diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index f2500a24d..1bcb23d25 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -138,8 +138,7 @@ IMAGE_CMD_recovery.vfat() { # Use 'boot.vfat' image as base cp --remove-destination ${IMGDEPLOYDIR}/${IMAGE_NAME}.boot.vfat ${IMGDEPLOYDIR}/${IMAGE_NAME}.recovery.vfat - # Copy the recovery U-Boot script and recovery initramfs into the VFAT image - mcopy -o -i ${IMGDEPLOYDIR}/${IMAGE_NAME}.recovery.vfat -s ${DEPLOY_DIR_IMAGE}/recovery.scr ::/boot.scr + # Copy the recovery initramfs into the VFAT image mcopy -i ${IMGDEPLOYDIR}/${IMAGE_NAME}.recovery.vfat -s ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ::/uramdisk-recovery.img } @@ -174,8 +173,14 @@ IMAGE_CMD_recovery.ubifs() { ln ${orig} ${TMP_RECOVERYDIR}/$(basename ${item}) done - # Copy the recovery U-Boot script and recovery initramfs into the temporary folder - cp ${DEPLOY_DIR_IMAGE}/recovery.scr ${TMP_RECOVERYDIR}/boot.scr + # Hard-link boot scripts into the temporary folder + for item in ${BOOT_SCRIPTS}; do + src="$(echo ${item} | awk -F':' '{ print $1 }')" + dst="$(echo ${item} | awk -F':' '{ print $2 }')" + ln ${DEPLOY_DIR_IMAGE}/${src} ${TMP_RECOVERYDIR}/${dst} + done + + # Copy the recovery initramfs into the temporary folder cp ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ${TMP_RECOVERYDIR}/uramdisk-recovery.img # Build UBIFS recovery image out of temp folder diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt index f3d9e9514..f86ceb43e 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt @@ -44,10 +44,18 @@ else fi fi -# To detect if we are booting from SD card we get the UUID of the -# boot partition and compare with the default one for the EMMC +# Get the UUID of the configured boot partition. part uuid mmc ${mmcbootdev}:${mmcpart} bootpart -if test "${bootpart}" != "${part1_uuid}"; then +# Check the boot source. +if test "${bootpart}" = "${part1_uuid}"; then + # We are booting from the eMMC using 'linux'. + true +elif test "${bootpart}" = "${part2_uuid}"; then + # We are booting from the eMMC using 'recovery'. + setenv boot_initrd true + setenv initrd_file uramdisk-recovery.img +else + # We are booting from the SD card. setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/recovery.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/recovery.txt deleted file mode 100644 index 7df232111..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/recovery.txt +++ /dev/null @@ -1,49 +0,0 @@ -# -# U-Boot bootscript for EMMC/SD images created by Yocto. -# - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file uImage-${soc_family}-ccimx6sbc-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware variant - # - if test "${module_variant}" = "0x02"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x04"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x05"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-w.dtb - elif test "${module_variant}" = "0x06"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x08"; then - setenv fdt_file uImage-imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x0a"; then - setenv fdt_file uImage-imx6dl-ccimx6sbc-w.dtb - elif test "${module_variant}" = "0x0b"; then - setenv fdt_file uImage-imx6dl-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x0c"; then - setenv fdt_file uImage-imx6dl-ccimx6sbc.dtb - elif test "${module_variant}" = "0x0e"; then - setenv fdt_file uImage-imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x0f"; then - setenv fdt_file uImage-imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x11"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x12"; then - setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x13"; then - setenv fdt_file uImage-imx6dl-ccimx6sbc-wb.dtb - else - echo "------ Using default fdt_file" - fi -fi - -setenv boot_initrd true -setenv initrd_file uramdisk-recovery.img -dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/boot.txt index a69bc6c18..ae259dac9 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/boot.txt @@ -20,4 +20,10 @@ else fi fi -dboot linux nand +if test "${mtdbootpart}" = "recovery"; then + setenv boot_initrd true + setenv initrd_file uramdisk-recovery.img +else + true +fi +dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/recovery.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/recovery.txt deleted file mode 100644 index 877abe457..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/recovery.txt +++ /dev/null @@ -1,25 +0,0 @@ -# -# U-Boot bootscript for NAND images created by Yocto. -# - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file zImage-imx6ul-ccimx6ulsbc-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware variant - # - if test "${module_variant}" = "0x02"; then - setenv fdt_file zImage-imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file zImage-imx6ul-ccimx6ulsbc.dtb - else - echo "------ Using default fdt_file: $fdt_file" - fi -fi - -setenv boot_initrd true -setenv initrd_file uramdisk-recovery.img -dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt index 86f18aadb..728e6e4c7 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt @@ -20,4 +20,10 @@ else fi fi -dboot linux nand +if test "${mtdbootpart}" = "recovery"; then + setenv boot_initrd true + setenv initrd_file uramdisk-recovery.img +else + true +fi +dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/recovery.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/recovery.txt deleted file mode 100644 index 2c75edf7a..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/recovery.txt +++ /dev/null @@ -1,25 +0,0 @@ -# -# U-Boot bootscript for NAND images created by Yocto. -# - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file zImage-imx6ul-ccimx6ulstarter-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware variant - # - if test "${module_variant}" = "0x02"; then - setenv fdt_file zImage-imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file zImage-imx6ul-ccimx6ulstarter.dtb - else - echo "------ Using default fdt_file: $fdt_file" - fi -fi - -setenv boot_initrd true -setenv initrd_file uramdisk-recovery.img -dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb index f5fd1534f..c652af018 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb @@ -24,7 +24,6 @@ SRC_URI = " \ SRC_URI_append = " \ file://boot.txt \ file://install_linux_fw_sd.txt \ - file://recovery.txt \ " LOCALVERSION ?= "" @@ -102,7 +101,7 @@ TF_BOOTSCRIPT_SEDFILTER_ccimx6ul = "${@tf_bootscript_sedfilter(d)}" def tf_bootscript_sedfilter(d): tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE',True) or "" - return "/^dboot linux/i\setenv boot_initrd true\\nsetenv initrd_file %s-${MACHINE}.cpio.gz.u-boot.tf" % tf_initramfs if tf_initramfs else "" + return "s,\(^[[:blank:]]*\)true.*,\\1setenv boot_initrd true\\n\\1setenv initrd_file %s-${MACHINE}.cpio.gz.u-boot.tf,g" % tf_initramfs if tf_initramfs else "" do_deploy_append() { # Remove canonical U-Boot symlinks for ${UBOOT_CONFIG} currently in the form: @@ -152,9 +151,6 @@ do_deploy_append() { sed -e "${TF_BOOTSCRIPT_SEDFILTER}" ${WORKDIR}/boot.txt > ${TMP_BOOTSCR} mkimage -T script -n bootscript -C none -d ${TMP_BOOTSCR} ${DEPLOYDIR}/boot.scr - # Recovery boot script for DEY images - mkimage -T script -n bootscript -C none -d ${WORKDIR}/recovery.txt ${DEPLOYDIR}/recovery.scr - # Sign the scripts if [ "${TRUSTFENCE_SIGN}" = "1" ]; then export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" @@ -165,10 +161,6 @@ do_deploy_append() { TMP_SIGNED_BOOTSCR="$(mktemp ${WORKDIR}/bootscr-signed.XXXXXX)" trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/boot.scr" "${TMP_SIGNED_BOOTSCR}" mv "${TMP_SIGNED_BOOTSCR}" "${DEPLOYDIR}/boot.scr" - - # Sign recovery script - trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/recovery.scr" "${TMP_SIGNED_BOOTSCR}" - mv "${TMP_SIGNED_BOOTSCR}" "${DEPLOYDIR}/recovery.scr" fi rm -f ${TMP_BOOTSCR} }