boot-script: merge 'recovery' and 'boot' scripts into 'boot'
- Instead of using a different boot script when booting from linux and from recovery, merge them into one script that checks the boot source. https://jira.digi.com/browse/DEL-3836 Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
parent
c4bd0534e2
commit
42856f87aa
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
@ -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}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue