installer: merge USB/SD installers into a single template

The USB and SD installers are U-Boot scripts that are practically
identical.
Merge them into a single template with a couple of machine variables that
determine the default device index in U-Boot for the USB or the microSD
card.

Do dynamic substitutions to create the two installers out of the template.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2025-06-05 16:10:53 +02:00
parent 5156fe26b3
commit ac69566ecd
30 changed files with 261 additions and 2464 deletions

View File

@ -25,6 +25,10 @@ MACHINE_FIRMWARE:append = " ${@oe.utils.conditional('HAVE_WIFI', '1', 'firmware-
UBOOT_CONFIG ??= "ccimx6qpsbc1GB ccimx6qpsbc2GB"
UBOOT_CONFIG[ccimx6qpsbc1GB] = "ccimx6qpsbc1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6qpsbc2GB] = "ccimx6qpsbc2GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
KERNEL_DEVICETREE ?= " \
imx6qp-ccimx6qpsbc.dtb \

View File

@ -23,6 +23,10 @@ UBOOT_CONFIG[ccimx6dlsbc] = "ccimx6dlsbc_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6qsbc2GB] = "ccimx6qsbc2GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6qsbc512MB] = "ccimx6qsbc512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6qsbc] = "ccimx6qsbc_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
KERNEL_DEVICETREE ?= " \
imx6dl-ccimx6sbc.dtb \

View File

@ -11,6 +11,10 @@ UBOOT_CONFIG ??= "ccimx6ulsbc1GB ccimx6ulsbc512MB ccimx6ulsbc"
UBOOT_CONFIG[ccimx6ulsbc1GB] = "ccimx6ulsbc1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulsbc512MB] = "ccimx6ulsbc512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulsbc] = "ccimx6ulsbc_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "0"
KERNEL_DEVICETREE ?= " \
digi/imx6ul-ccimx6ulsbc.dtb \

View File

@ -11,6 +11,10 @@ UBOOT_CONFIG ??= "ccimx6ulstarter1GB ccimx6ulstarter512MB ccimx6ulstarter"
UBOOT_CONFIG[ccimx6ulstarter1GB] = "ccimx6ulstarter1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulstarter512MB] = "ccimx6ulstarter512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "0"
KERNEL_DEVICETREE ?= " \
digi/imx6ul-ccimx6ulstarter.dtb \

View File

@ -22,6 +22,11 @@ SPL_BINARY = "spl/u-boot-spl.bin"
# Set u-boot DTB
UBOOT_DTB_NAME = "ccimx8mm-dvk.dtb"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
ATF_PLATFORM = "imx8mm"
IMX_BOOT_SOC_TARGET = "iMX8MM"

View File

@ -21,6 +21,11 @@ SPL_BINARY = "spl/u-boot-spl.bin"
# Set u-boot DTB
UBOOT_DTB_NAME = "ccimx8mn-dvk.dtb"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
ATF_PLATFORM = "imx8mn"
IMX_BOOT_SOC_TARGET = "iMX8MN"

View File

@ -9,6 +9,10 @@ include conf/machine/include/ccimx8x.inc
UBOOT_CONFIG ??= "ccimx8x_sbc_express"
UBOOT_CONFIG[ccimx8x_sbc_express] = "ccimx8x_sbc_express_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
SPL_BINARY = "spl/u-boot-spl.bin"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
KERNEL_DEVICETREE ?= " \
digi/ccimx8x_bt.dtbo \

View File

@ -10,6 +10,10 @@ include conf/machine/include/ccimx8x.inc
UBOOT_CONFIG ??= "ccimx8x_sbc_pro"
UBOOT_CONFIG[ccimx8x_sbc_pro] = "ccimx8x_sbc_pro_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
SPL_BINARY = "spl/u-boot-spl.bin"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
KERNEL_DEVICETREE ?= " \
digi/ccimx8x_bt.dtbo \

View File

@ -14,6 +14,11 @@ IMXBOOT_TARGETS = "flash_singleboot"
UBOOT_CONFIG ??= "ccimx91-dvk"
UBOOT_CONFIG[ccimx91-dvk] = "ccimx91-dvk_defconfig"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
# imx-boot configurations
ATF_PLATFORM = "imx91"
IMX_BOOT_SOC_TARGET = "iMX91"

View File

@ -12,6 +12,11 @@ include conf/machine/include/ccimx9.inc
UBOOT_CONFIG ??= "ccimx93-dvk"
UBOOT_CONFIG[ccimx93-dvk] = "ccimx93-dvk_defconfig"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
# imx-boot configurations
ATF_PLATFORM = "imx93"
IMX_BOOT_SOC_TARGET = "iMX93"

View File

@ -31,6 +31,10 @@ UBOOT_CONFIG[ccmp13-dvk] = "ccmp13-dvk_defconfig,,u-boot.dtb"
UBOOT_CONFIG:remove:stm32mp13common = "default_stm32mp13"
# List of U-Boot device tree to use
UBOOT_DEVICETREE = "${STM32MP_DEVICETREE}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
# =========================================================================
# Machine settings

View File

@ -31,6 +31,10 @@ UBOOT_CONFIG[ccmp15-dvk] = "ccmp15-dvk_defconfig,,u-boot.dtb"
UBOOT_CONFIG:remove:stm32mp15common = "default_stm32mp15"
# List of U-Boot device tree to use
UBOOT_DEVICETREE = "${STM32MP_DEVICETREE}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "1"
# =========================================================================
# Machine settings

View File

@ -33,6 +33,10 @@ UBOOT_CONFIG = "ccmp25-dvk"
UBOOT_CONFIG[ccmp25-dvk] = "ccmp25-dvk_defconfig,,u-boot.dtb"
# List of U-Boot device tree to use
UBOOT_DEVICETREE = "${STM32MP_DEVICETREE}"
# Index of USB device for installer
UBOOT_INSTALL_USB_INDEX = "0"
# Index of microSD device for installer
UBOOT_INSTALL_SD_INDEX = "2"
# =========================================================================
# Machine settings

View File

@ -29,7 +29,8 @@ INSTALL_FW_UBOOT_SCRIPTS = " \
SRC_URI = " \
${UBOOT_GIT_URI};branch=${SRCBRANCH} \
file://boot.txt \
${INSTALL_FW_UBOOT_SCRIPTS} \
file://install_linux_fw_media.txt \
file://install_linux_fw_uuu.sh \
"
BUILD_UBOOT_SCRIPTS ?= "true"
@ -77,6 +78,15 @@ do_deploy[postfuncs] += " \
"
build_uboot_scripts() {
# Generate USB installer from media template
sed -e 's,##INSTALL_MEDIA##,usb,g' \
-e 's,##INSTALL_MEDIA_INDEX##,${UBOOT_INSTALL_USB_INDEX},g' \
${WORKDIR}/install_linux_fw_media.txt > ${WORKDIR}/install_linux_fw_usb.txt
# Generate microSD installer from media template
sed -e 's,##INSTALL_MEDIA##,mmc,g' \
-e 's,##INSTALL_MEDIA_INDEX##,${UBOOT_INSTALL_SD_INDEX},g' \
${WORKDIR}/install_linux_fw_media.txt > ${WORKDIR}/install_linux_fw_sd.txt
for f in $(echo ${INSTALL_FW_UBOOT_SCRIPTS} | sed -e 's,file\:\/\/,,g'); do
f_ext="${f##*.}"
TMP_INSTALL_SCR="$(mktemp ${WORKDIR}/${f}.XXXXXX)"

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the eMMC
#
@ -37,7 +37,8 @@ else
exit;
fi;
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -54,13 +55,13 @@ fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the USB
# Check for presence of firmware files on the media
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -68,9 +69,9 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
@ -84,7 +85,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
@ -133,7 +134,7 @@ echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -172,14 +173,16 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -192,7 +195,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -200,13 +203,15 @@ setenv bootcmd "
exit;
fi;
fi;
usb reset;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -219,7 +224,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -234,7 +239,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -246,7 +251,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -258,7 +263,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,285 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the SD
# card into the eMMC
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
# Determine U-Boot file to program basing on module variant
# If module_variant is unknown or not set, return error asking the user
if test "${module_variant}" = "0x01" || test "${module_variant}" = "0x02"; then
setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##2GB.imx;
elif test "${module_variant}" = "0x03"; then
setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx;
fi
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
# u-boot when the checked value is empty.
if test -n "${INSTALL_UBOOT_FILENAME}"; then
true;
else
echo "";
echo "[ERROR] Cannot determine U-Boot file for this module!";
echo "";
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 QuadPlus variant:";
echo " - For a QuadPlus CPU with 2GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##2GB.imx";
echo " - For a DualPlus CPU with 1GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx";
echo "";
echo "";
echo "2. Run the install script again.";
echo "";
echo "Aborted";
echo "";
exit;
fi;
setenv INSTALL_MMCDEV 1
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the SD card
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Partition the eMMC user data area for Linux
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv install_dualboot ${install_dualboot};
saveenv;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
setenv bootcount 0;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
reset;
"
setenv bootcount 0
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the eMMC
#
@ -44,7 +44,8 @@ else
exit;
fi;
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -61,13 +62,13 @@ fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the USB
# Check for presence of firmware files on the media
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -75,9 +76,9 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
@ -91,7 +92,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
@ -140,7 +141,7 @@ echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -179,14 +180,16 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -199,7 +202,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -207,13 +210,15 @@ setenv bootcmd "
exit;
fi;
fi;
usb reset;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -226,7 +231,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -241,7 +246,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -253,7 +258,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -265,7 +270,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,292 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the SD
# card into the eMMC
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
# Determine U-Boot file to program basing on module variant
# If module_variant is unknown or not set, return error asking the user
if test "${module_variant}" = "0x12"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx;
elif test "${module_variant}" = "0x02" || test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x0b" || test "${module_variant}" = "0x11" || test "${module_variant}" = "0x14" || test "${module_variant}" = "0x15" || test "${module_variant}" = "0x16"; then
setenv INSTALL_UBOOT_FILENAME u-boot-cc${soc_family}sbc.imx;
elif test "${module_variant}" = "0x03" || test "${module_variant}" = "0x0c" || test "${module_variant}" = "0x0e" || test "${module_variant}" = "0x0f" || test "${module_variant}" = "0x13"; then
setenv INSTALL_UBOOT_FILENAME u-boot-cc${soc_family}sbc512MB.imx;
fi
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
# u-boot when the checked value is empty.
if test -n "${INSTALL_UBOOT_FILENAME}"; then
true;
else
echo "";
echo "[ERROR] Cannot determine U-Boot file for this module!";
echo "";
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 variant:";
echo " - For a Quad/Dual CPU with 2GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx";
echo " - For a Quad/Dual CPU with 1GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx";
echo " - For a Quad/Dual CPU with 512MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx";
echo " - For a DualLite/Solo CPU with 1GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx";
echo " - For a DualLite/Solo CPU with 512MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx";
echo "";
echo "2. Run the install script again.";
echo "";
echo "Aborted";
echo "";
exit;
fi;
setenv INSTALL_MMCDEV 1
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the SD card
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Partition the eMMC user data area for Linux
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv install_dualboot ${install_dualboot};
saveenv;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
setenv bootcount 0;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
reset;
"
setenv bootcount 0
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the NAND
#
@ -17,6 +17,9 @@ elif test "${module_variant}" = "0x08" || test "${module_variant}" = "0x0a"; the
setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx
fi
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
# u-boot when the checked value is empty.
if test -n "${INSTALL_UBOOT_FILENAME}"; then
@ -40,8 +43,6 @@ else
exit;
fi;
setenv INSTALL_USBDEV 0
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
@ -63,7 +64,7 @@ if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -71,10 +72,10 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ubifs"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
setenv rootfstype;
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
setenv rootfstype squashfs;
else
@ -89,7 +90,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install the following files"
@ -135,10 +136,10 @@ echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -173,14 +174,16 @@ setenv bootcmd "
else
force_erase=\"-e\";
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} \$\{force_erase\};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -193,7 +196,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} \$\{force_erase\};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -201,12 +204,15 @@ setenv bootcmd "
exit;
fi;
fi;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} \$\{force_erase\};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -219,7 +225,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} \$\{force_erase\};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -234,7 +240,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} \$\{force_erase\};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -246,7 +252,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME} \$\{force_erase\};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -258,7 +264,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} \$\{force_erase\};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,290 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the micro SD
# card into the NAND
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
# Determine U-Boot file to program basing on module variant
# If module_variant is unknown or not set, return error asking the user
if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06" || test "${module_variant}" = "0x09"; then
setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##.imx;
elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x07"; then
setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx;
elif test "${module_variant}" = "0x08" || test "${module_variant}" = "0x0a"; then
setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx
fi
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
# u-boot when the checked value is empty.
if test -n "${INSTALL_UBOOT_FILENAME}"; then
true;
else
echo "";
echo "[ERROR] Cannot determine U-Boot file for this module!";
echo "";
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6UL variant:";
echo " - For a SOM with 1GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx";
echo " - For a SOM with 512MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx";
echo " - For a SOM with 256MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##.imx";
echo "";
echo "2. Run the install script again.";
echo "";
echo "Aborted";
echo "";
exit;
fi;
setenv INSTALL_MMCDEV 0
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.ubifs
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.ubifs
# Check for presence of firmware files on the SD card
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ubifs"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
setenv rootfstype;
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
setenv rootfstype squashfs;
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install the following files"
echo " on the partitions of the NAND."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'singlemtdsys' and 'dualboot' if previously set
# - Run 'partition_nand_linux' script to re-partition the NAND if needed
# - Save the environment
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv singlemtdsys ${singlemtdsys};
setenv dualboot ${dualboot};
setenv rootfstype ${rootfstype};
setenv install_dualboot ${install_dualboot};
run partition_nand_linux;
saveenv;
if test \"\$\{singlemtdsys\}\" = yes; then
run ubivolscript;
else
force_erase=\"-e\";
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} \$\{force_erase\};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
if test \"\$\{singlemtdsys\}\" != yes; then
nand erase.part update;
fi;
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
bootcount reset;
reset;
"
bootcount reset
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the eMMC
#
@ -7,8 +7,8 @@
install_abort=0
BASEFILENAME=0
setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##.bin;
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -25,13 +25,13 @@ fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the USB
# Check for presence of firmware files on the media
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -39,9 +39,9 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
@ -55,7 +55,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
@ -104,10 +104,10 @@ echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -130,6 +130,7 @@ fi
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# NOTE: insert some 'usb reset' commands to avoid EHCI timeouts
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
@ -148,14 +149,16 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -168,7 +171,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -176,12 +179,15 @@ setenv bootcmd "
exit;
fi;
fi;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -194,7 +200,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -209,7 +215,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -221,7 +227,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -233,7 +239,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,263 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the SD
# card into the eMMC
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##.bin;
setenv INSTALL_MMCDEV 1
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the SD card
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv install_dualboot ${install_dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
bootcount reset;
reset;
"
bootcount reset
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the eMMC
#
@ -18,9 +18,8 @@ fi
# the necessary logic to choose the correct imx-boot file for the target's SOC.
setenv skip-uboot-check "yes"
setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##-${soc_rev}.bin;
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -37,13 +36,13 @@ fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the USB
# Check for presence of firmware files on the media
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -51,9 +50,9 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
@ -67,7 +66,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
@ -116,10 +115,10 @@ echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -161,14 +160,16 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -181,7 +182,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -189,13 +190,15 @@ setenv bootcmd "
exit;
fi;
fi;
usb reset;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -208,7 +211,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -223,7 +226,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -235,7 +238,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -247,7 +250,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,275 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the SD
# card into the eMMC
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
# Since SOMs with the B0 SOC might have an older U-Boot that doesn't export the
# SOC revision to the environment, use B0 by default
if test -z "${soc_rev}"; then
setenv soc_rev B0
fi
# In case this script is used to update to a newer release whose imx-boot file
# is not recognized by the SECO fw check, bypass it by default. The script has
# the necessary logic to choose the correct imx-boot file for the target's SOC.
setenv skip-uboot-check "yes"
setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##-${soc_rev}.bin;
setenv INSTALL_MMCDEV 1
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the SD card
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv install_dualboot ${install_dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
bootcount reset;
reset;
"
bootcount reset
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the eMMC
#
@ -22,8 +22,9 @@ if test "${soc_type}" = "imx93"; then
fi
fi
fi
setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##${SOCREV}.bin
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -40,13 +41,13 @@ fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the USB
# Check for presence of firmware files on the media
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -54,9 +55,9 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
@ -70,7 +71,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
@ -122,10 +123,10 @@ echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -163,6 +164,7 @@ fi;
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# NOTE: insert some 'usb reset' commands to avoid EHCI timeouts
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
@ -181,14 +183,16 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -201,7 +205,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -209,12 +213,15 @@ setenv bootcmd "
exit;
fi;
fi;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -227,7 +234,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -242,7 +249,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -254,7 +261,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -266,7 +273,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,296 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the SD
# card into the eMMC
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
# Determine U-Boot file to program basing on SOM's SOC revision
if test "${soc_type}" = "imx93"; then
if test -z "${soc_rev}"; then
# Fallback to hardware version if soc_rev is empty
setexpr som_hv ${hwid_2} \& 78
setexpr som_hv ${som_hv} / 8
if test "${som_hv}" -lt "2"; then
SOCREV="-A0"
fi
else
if test "${soc_rev}" = "0x10"; then
SOCREV="-A0"
fi
fi
fi
setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##${SOCREV}.bin
setenv INSTALL_MMCDEV 1
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the SD card
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader1 ${INSTALL_UBOOT_FILENAME}"
if test "${install_redundant_bootloader}" = "yes"; then
echo " bootloader2 ${INSTALL_UBOOT_FILENAME}"
fi
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
if test "${install_redundant_bootloader}" = yes; then
echo "";
echo "";
echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} on redundant partition";
echo "";
echo "";
update uboot-redundant mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME};
if test $? -eq 1; then
echo "[ERROR] Failed to update redundant U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi;
fi;
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv install_dualboot ${install_dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
bootcount reset;
reset;
"
bootcount reset
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the NAND
#
@ -10,7 +10,9 @@ BASEFILENAME=0
setenv INSTALL_ATF_FILENAME tf-a-##MACHINE##-${module_ram}-##BOOTSCHEME_DEFAULT##-nand.stm32
setenv INSTALL_METADATA_FILENAME metadata-##MACHINE##.bin
setenv INSTALL_FIP_FILENAME fip-##MACHINE##-${module_ram}-##BOOTSCHEME_DEFAULT##-nand.bin
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -33,7 +35,7 @@ if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -41,10 +43,10 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ubifs"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
setenv rootfstype;
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
setenv rootfstype squashfs;
else
@ -59,7 +61,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install the following files"
@ -110,14 +112,14 @@ echo ""
echo ">> Installing ATF boot loader image ${INSTALL_ATF_FILENAME}"
echo ""
echo ""
update fsbl1 usb ${INSTALL_USBDEV} ${INSTALL_ATF_FILENAME}
update fsbl1 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fsbl1!";
echo "";
echo "Aborted.";
exit;
fi
update fsbl2 usb ${INSTALL_USBDEV} ${INSTALL_ATF_FILENAME}
update fsbl2 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fsbl2!";
echo "";
@ -129,14 +131,14 @@ echo ""
echo ">> Installing METADATA boot loader image ${INSTALL_METADATA_FILENAME}"
echo ""
echo ""
update metadata1 usb ${INSTALL_USBDEV} ${INSTALL_METADATA_FILENAME}
update metadata1 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata1!";
echo "";
echo "Aborted.";
exit;
fi
update metadata2 usb ${INSTALL_USBDEV} ${INSTALL_METADATA_FILENAME}
update metadata2 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata2!";
echo "";
@ -148,14 +150,14 @@ echo ""
echo ">> Installing FIP boot loader image ${INSTALL_FIP_FILENAME} (target will reset)"
echo ""
echo ""
update fip-a usb ${INSTALL_USBDEV} ${INSTALL_FIP_FILENAME}
update fip-a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-a!";
echo "";
echo "Aborted.";
exit;
fi
update fip-b usb ${INSTALL_USBDEV} ${INSTALL_FIP_FILENAME}
update fip-b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-b!";
echo "";
@ -189,14 +191,16 @@ setenv bootcmd "
setenv rootfstype ${rootfstype};
setenv install_dualboot ${install_dualboot};
run ubivolscript;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -209,7 +213,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -217,12 +221,15 @@ setenv bootcmd "
exit;
fi;
fi;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -235,7 +242,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -250,7 +257,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -262,7 +269,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -274,7 +281,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,303 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the micro SD
# card into the NAND
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
setenv INSTALL_ATF_FILENAME tf-a-##MACHINE##-${module_ram}-##BOOTSCHEME_DEFAULT##-nand.stm32
setenv INSTALL_METADATA_FILENAME metadata-##MACHINE##.bin
setenv INSTALL_FIP_FILENAME fip-##MACHINE##-${module_ram}-##BOOTSCHEME_DEFAULT##-nand.bin
setenv INSTALL_MMCDEV 1
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.ubifs
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.ubifs
# Check for presence of firmware files on the SD card
FILES="${INSTALL_ATF_FILENAME} ${INSTALL_METADATA_FILENAME} ${INSTALL_FIP_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ubifs"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
setenv rootfstype;
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
setenv rootfstype squashfs;
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install the following files"
echo " on the partitions of the NAND."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " fsbl1 ${INSTALL_ATF_FILENAME}"
echo " fsbl2 ${INSTALL_ATF_FILENAME}"
echo " metadata1 ${INSTALL_METADATA_FILENAME}"
echo " metadata2 ${INSTALL_METADATA_FILENAME}"
echo " fip-a ${INSTALL_FIP_FILENAME}"
echo " fip-b ${INSTALL_FIP_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Update ATF, METADATA and FIP images
echo ""
echo ""
echo ">> Installing ATF boot loader image ${INSTALL_ATF_FILENAME}"
echo ""
echo ""
update fsbl1 mmc ${INSTALL_MMCDEV} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fsbl1!";
echo "";
echo "Aborted.";
exit;
fi
update fsbl2 mmc ${INSTALL_MMCDEV} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fsbl2!";
echo "";
echo "Aborted.";
exit;
fi
echo ""
echo ""
echo ">> Installing METADATA boot loader image ${INSTALL_METADATA_FILENAME}"
echo ""
echo ""
update metadata1 mmc ${INSTALL_MMCDEV} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata1!";
echo "";
echo "Aborted.";
exit;
fi
update metadata2 mmc ${INSTALL_MMCDEV} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata2!";
echo "";
echo "Aborted.";
exit;
fi
echo ""
echo ""
echo ">> Installing FIP boot loader image ${INSTALL_FIP_FILENAME} (target will reset)"
echo ""
echo ""
update fip-a mmc ${INSTALL_MMCDEV} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-a!";
echo "";
echo "Aborted.";
exit;
fi
update fip-b mmc ${INSTALL_MMCDEV} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-b!";
echo "";
echo "Aborted.";
exit;
fi
# Check if uboot_config volume exists (U-Boot env)
ubi part UBI
ubi check uboot_config
if test $? -eq 1; then
# Create volumes layout (including U-Boot env)
run ubivolscript;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Run 'ubivolscript' script to re-partition the UBI partition and save the
# environment
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv rootfstype ${rootfstype};
setenv install_dualboot ${install_dualboot};
run ubivolscript;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
bootcount reset;
reset;
"
bootcount reset
saveenv
reset

View File

@ -1,5 +1,5 @@
#
# U-Boot script for installing Linux images created by Yocto from a USB stick
# U-Boot script for installing Linux images created by Yocto from external media
# into the eMMC
#
@ -10,7 +10,8 @@ BASEFILENAME=0
setenv INSTALL_ATF_FILENAME tf-a-##MACHINE##-optee-emmc.stm32
setenv INSTALL_METADATA_FILENAME metadata-##MACHINE##.bin
setenv INSTALL_FIP_FILENAME fip-##MACHINE##-optee-emmc.bin
setenv INSTALL_USBDEV 0
setenv INSTALL_MEDIA_INDEX ##INSTALL_MEDIA_INDEX##
setenv INSTALL_MEDIA ##INSTALL_MEDIA##
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
@ -27,13 +28,13 @@ fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the USB
# Check for presence of firmware files on the media
FILES="${INSTALL_ATF_FILENAME} ${INSTALL_METADATA_FILENAME} ${INSTALL_FIP_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then
if test ! -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
@ -41,9 +42,9 @@ done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME}; then
if test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e usb ${INSTALL_USBDEV} ${ROOTFS_FILENAME_SQFS}; then
elif test -e ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
@ -57,7 +58,7 @@ if test "${install_abort}" = "1"; then
fi
echo "############################################################"
echo "# Linux firmware install from USB #"
echo "# Linux firmware install from media #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
@ -111,14 +112,14 @@ echo ""
echo ">> Installing ATF boot loader image ${INSTALL_ATF_FILENAME}"
echo ""
echo ""
update boot1 usb ${INSTALL_USBDEV} ${INSTALL_ATF_FILENAME}
update boot1 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update boot1!";
echo "";
echo "Aborted.";
exit;
fi
update boot2 usb ${INSTALL_USBDEV} ${INSTALL_ATF_FILENAME}
update boot2 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update boot2!";
echo "";
@ -130,14 +131,14 @@ echo ""
echo ">> Installing METADATA boot loader image ${INSTALL_METADATA_FILENAME}"
echo ""
echo ""
update metadata1 usb ${INSTALL_USBDEV} ${INSTALL_METADATA_FILENAME}
update metadata1 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata1!";
echo "";
echo "Aborted.";
exit;
fi
update metadata2 usb ${INSTALL_USBDEV} ${INSTALL_METADATA_FILENAME}
update metadata2 ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata2!";
echo "";
@ -149,14 +150,14 @@ echo ""
echo ">> Installing FIP boot loader image ${INSTALL_FIP_FILENAME} (target will reset)"
echo ""
echo ""
update fip-a usb ${INSTALL_USBDEV} ${INSTALL_FIP_FILENAME}
update fip-a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-a!";
echo "";
echo "Aborted.";
exit;
fi
update fip-b usb ${INSTALL_USBDEV} ${INSTALL_FIP_FILENAME}
update fip-b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-b!";
echo "";
@ -178,6 +179,7 @@ fi
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# NOTE: insert some 'usb reset' commands to avoid EHCI timeouts
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
@ -196,14 +198,16 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
usb start;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb start;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
@ -216,7 +220,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
@ -224,12 +228,15 @@ setenv bootcmd "
exit;
fi;
fi;
if test \"\$\{INSTALL_MEDIA\}\" = "usb"; then
usb reset;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_a ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
@ -242,7 +249,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs_b ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
@ -257,7 +264,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
update linux ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
@ -269,7 +276,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
update recovery ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
@ -281,7 +288,7 @@ setenv bootcmd "
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
update rootfs ${INSTALL_MEDIA} ${INSTALL_MEDIA_INDEX} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";

View File

@ -1,311 +0,0 @@
#
# U-Boot script for installing Linux images created by Yocto from the micro SD
# card into the eMMC
#
# Reset temp variables
install_abort=0
BASEFILENAME=0
setenv INSTALL_ATF_FILENAME tf-a-##MACHINE##-optee-emmc.stm32
setenv INSTALL_METADATA_FILENAME metadata-##MACHINE##.bin
setenv INSTALL_FIP_FILENAME fip-##MACHINE##-optee-emmc.bin
setenv INSTALL_MMCDEV 2
if test -z "${image-name}"; then
setenv image-name ##DEFAULT_IMAGE_NAME##
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if test "${image-name}" = "${g}"; then
BASEFILENAME="${image-name}-##GRAPHICAL_BACKEND##"
fi
done
if test "${BASEFILENAME}" = "0"; then
BASEFILENAME="${image-name}"
fi
setenv INSTALL_LINUX_FILENAME ${BASEFILENAME}-##MACHINE##.boot.vfat
setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.vfat
# Check for presence of firmware files on the SD card
FILES="${INSTALL_ATF_FILENAME} ${INSTALL_METADATA_FILENAME} ${INSTALL_FIP_FILENAME} ${INSTALL_LINUX_FILENAME}"
if test "${dualboot}" != "yes"; then
FILES="${FILES} ${INSTALL_RECOVERY_FILENAME}"
fi
for install_f in ${FILES}; do
if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
# Verify what kind of rootfs is going to be programmed
ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
ROOTFS_FILENAME_SQFS="${BASEFILENAME}-##MACHINE##.squashfs"
if test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME};
elif test -e mmc ${INSTALL_MMCDEV} ${ROOTFS_FILENAME_SQFS}; then
setenv INSTALL_ROOTFS_FILENAME ${ROOTFS_FILENAME_SQFS};
else
echo "ERROR: Could not find any rootfs image";
install_abort=1;
fi
if test "${install_abort}" = "1"; then
echo "To install a different image, set variable 'image-name', e.g.:"
echo " => setenv image-name core-image-base"
echo "Aborted.";
exit;
fi
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " boot1 ${INSTALL_ATF_FILENAME}"
echo " boot2 ${INSTALL_ATF_FILENAME}"
echo " metadata1 ${INSTALL_METADATA_FILENAME}"
echo " metadata2 ${INSTALL_METADATA_FILENAME}"
echo " fip-a ${INSTALL_FIP_FILENAME}"
echo " fip-b ${INSTALL_FIP_FILENAME}"
if test "${dualboot}" = "yes"; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " linux_b ${INSTALL_LINUX_FILENAME}"
fi
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
if test "${install_dualboot}" = "yes"; then
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
fi
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Set target MMC device index to eMMC
setenv mmcdev 0
# Update ATF, METADATA and FIP images
echo ""
echo ""
echo ">> Installing ATF boot loader image ${INSTALL_ATF_FILENAME}"
echo ""
echo ""
update boot1 mmc ${INSTALL_MMCDEV} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update boot1!";
echo "";
echo "Aborted.";
exit;
fi
update boot2 mmc ${INSTALL_MMCDEV} ${INSTALL_ATF_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update boot2!";
echo "";
echo "Aborted.";
exit;
fi
echo ""
echo ""
echo ">> Installing METADATA boot loader image ${INSTALL_METADATA_FILENAME}"
echo ""
echo ""
update metadata1 mmc ${INSTALL_MMCDEV} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata1!";
echo "";
echo "Aborted.";
exit;
fi
update metadata2 mmc ${INSTALL_MMCDEV} ${INSTALL_METADATA_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update metadata2!";
echo "";
echo "Aborted.";
exit;
fi
echo ""
echo ""
echo ">> Installing FIP boot loader image ${INSTALL_FIP_FILENAME} (target will reset)"
echo ""
echo ""
update fip-a mmc ${INSTALL_MMCDEV} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-a!";
echo "";
echo "Aborted.";
exit;
fi
update fip-b mmc ${INSTALL_MMCDEV} ${INSTALL_FIP_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update fip-b!";
echo "";
echo "Aborted.";
exit;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
setenv install_dualboot ${install_dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
if test \"\$\{install_dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
fi;
setenv bootlimit 3;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;
bootcount reset;
reset;
"
bootcount reset
saveenv
reset