From 8af88177967269c4b4c0fb1d85c765d7911058d0 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Tue, 29 May 2018 18:32:11 +0200 Subject: [PATCH] u-boot: add support for U-Boot v2017.03 This adds support for U-Boot v2017.03 for all platforms (including CC8X). For legacy v2015.04: - Renames u-boot.inc as a versioned file only for v2015.04. - Moves boot/install scripts from versioned folder into non-versioned folder (since the scripts remain the same between versions). For new v2017.03: - Re-uses poky's u-boot.inc in rocko for v2017.03 - DEY recipe re-writes the do_compile for special U-Boot configuration required for TrustFence. - DEY recipe appends the do_deploy, for U-Boot scripts and deploy of special TrustFence artifacts. - Adds u-boot-dtb.xxx to UBOOT_CONFIG, required for new U-Boots. - Adds CC8X scripts. Signed-off-by: Hector Palacios https://jira.digi.com/browse/DEL-5936 --- meta-digi-arm/conf/machine/ccimx6qpsbc.conf | 2 +- meta-digi-arm/conf/machine/ccimx6sbc.conf | 10 +- meta-digi-arm/conf/machine/ccimx6ulsbc.conf | 4 +- .../conf/machine/ccimx6ulstarter.conf | 4 +- .../conf/machine/ccimx8x-sbc-express.conf | 2 +- .../conf/machine/include/digi-defaults.inc | 6 +- .../u-boot/{u-boot.inc => u-boot-2015.04.inc} | 0 .../ccimx6qpsbc/boot.txt | 0 .../ccimx6qpsbc/install_linux_fw_sd.txt | 0 .../ccimx6sbc/boot.txt | 0 .../ccimx6sbc/install_linux_fw_sd.txt | 0 .../ccimx6ulsbc/boot.txt | 0 .../ccimx6ulsbc/install_linux_fw_sd.txt | 0 .../ccimx6ulstarter/boot.txt | 0 .../ccimx6ulstarter/install_linux_fw_sd.txt | 0 .../u-boot-dey/ccimx8x-sbc-express/boot.txt | 35 ++++ .../install_linux_fw_sd.txt | 162 +++++++++++++++++ .../recipes-bsp/u-boot/u-boot-dey_2015.04.bb | 2 +- .../recipes-bsp/u-boot/u-boot-dey_2017.03.bb | 172 ++++++++++++++++++ 19 files changed, 384 insertions(+), 15 deletions(-) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot.inc => u-boot-2015.04.inc} (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6qpsbc/boot.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6qpsbc/install_linux_fw_sd.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6sbc/boot.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6sbc/install_linux_fw_sd.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6ulsbc/boot.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6ulsbc/install_linux_fw_sd.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6ulstarter/boot.txt (100%) rename meta-digi-arm/recipes-bsp/u-boot/{u-boot-dey-2015.04 => u-boot-dey}/ccimx6ulstarter/install_linux_fw_sd.txt (100%) create mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt create mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/install_linux_fw_sd.txt create mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2017.03.bb diff --git a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf index 4d542a75c..07d1789e5 100644 --- a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf @@ -25,7 +25,7 @@ PREFERRED_PROVIDER_virtual/libg2d_mx6 = "imx-gpu-g2d" # U-Boot configurations # Last one is the default (the one the symlinks point at) UBOOT_CONFIG ??= "ccimx6qpsbc2GB" -UBOOT_CONFIG[ccimx6qpsbc2GB] = "ccimx6qpsbc2GB_defconfig" +UBOOT_CONFIG[ccimx6qpsbc2GB] = "ccimx6qpsbc2GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" KERNEL_DEVICETREE ?= " \ imx6qp-ccimx6qpsbc.dtb \ diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index d10f8ea99..fdce4057d 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -14,11 +14,11 @@ PREFERRED_PROVIDER_virtual/libg2d_mx6 = "imx-gpu-g2d" # U-Boot configurations # Last one is the default (the one the symlinks point at) UBOOT_CONFIG ??= "ccimx6dlsbc512MB ccimx6dlsbc ccimx6qsbc2GB ccimx6qsbc512MB ccimx6qsbc" -UBOOT_CONFIG[ccimx6dlsbc512MB] = "ccimx6dlsbc512MB_defconfig" -UBOOT_CONFIG[ccimx6dlsbc] = "ccimx6dlsbc_defconfig" -UBOOT_CONFIG[ccimx6qsbc2GB] = "ccimx6qsbc2GB_defconfig" -UBOOT_CONFIG[ccimx6qsbc512MB] = "ccimx6qsbc512MB_defconfig" -UBOOT_CONFIG[ccimx6qsbc] = "ccimx6qsbc_defconfig" +UBOOT_CONFIG[ccimx6dlsbc512MB] = "ccimx6dlsbc512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" +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}" KERNEL_DEVICETREE ?= " \ imx6dl-ccimx6sbc.dtb \ diff --git a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf index db3ce2345..b52f6d5bc 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf @@ -8,8 +8,8 @@ include conf/machine/include/ccimx6ul.inc # U-Boot configurations # Last one is the default (the one the symlinks point at) UBOOT_CONFIG ??= "ccimx6ulsbc1GB ccimx6ulsbc" -UBOOT_CONFIG[ccimx6ulsbc1GB] = "ccimx6ulsbc1GB_defconfig" -UBOOT_CONFIG[ccimx6ulsbc] = "ccimx6ulsbc_defconfig" +UBOOT_CONFIG[ccimx6ulsbc1GB] = "ccimx6ulsbc1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" +UBOOT_CONFIG[ccimx6ulsbc] = "ccimx6ulsbc_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" # U-Boot environment offset (within partition) UBOOT_ENV_OFFSET ?= "0x0" diff --git a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf index f7b95048b..91b8f696f 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf @@ -8,8 +8,8 @@ include conf/machine/include/ccimx6ul.inc # U-Boot configurations # Last one is the default (the one the symlinks point at) UBOOT_CONFIG ??= "ccimx6ulstarter1GB ccimx6ulstarter" -UBOOT_CONFIG[ccimx6ulstarter1GB] = "ccimx6ulstarter1GB_defconfig" -UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig" +UBOOT_CONFIG[ccimx6ulstarter1GB] = "ccimx6ulstarter1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" +UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" # U-Boot environment offset (within partition) UBOOT_ENV_OFFSET ?= "0x0" diff --git a/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf b/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf index 594de5c55..bef141f5f 100644 --- a/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf +++ b/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf @@ -23,7 +23,7 @@ MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1', 'firmware-qual # U-Boot configurations # Last one is the default (the one the symlinks point at) UBOOT_CONFIG ??= "ccimx8x_sbc_express" -UBOOT_CONFIG[ccimx8x_sbc_express] = "ccimx8x_sbc_express_defconfig" +UBOOT_CONFIG[ccimx8x_sbc_express] = "ccimx8x_sbc_express_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}" KERNEL_DEVICETREE ?= " \ ccimx8x-sbc-express.dtb \ diff --git a/meta-digi-arm/conf/machine/include/digi-defaults.inc b/meta-digi-arm/conf/machine/include/digi-defaults.inc index 5ebb8a226..e85e5b015 100644 --- a/meta-digi-arm/conf/machine/include/digi-defaults.inc +++ b/meta-digi-arm/conf/machine/include/digi-defaults.inc @@ -10,9 +10,9 @@ PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg" # # Platform Linux U-Boot # ------------------------------------------------- -# ccimx6 4.1, 3.14 2015.04 -# ccimx6qp 4.9 2015.04 -# ccimx6ul 4.9, 4.1 2015.04 +# ccimx6 4.9 2017.03, 2015.04 +# ccimx6qp 4.9 2017.03, 2015.04 +# ccimx6ul 4.9 2017.03, 2015.04 # ccimx8x 4.9 2017.03 # diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot.inc b/meta-digi-arm/recipes-bsp/u-boot/u-boot-2015.04.inc similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot.inc rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-2015.04.inc diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/boot.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_sd.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/install_linux_fw_sd.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_sd.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/boot.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_sd.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/install_linux_fw_sd.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_sd.txt 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/ccimx6ulsbc/boot.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/boot.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/install_linux_fw_sd.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/install_linux_fw_sd.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/install_linux_fw_sd.txt 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/ccimx6ulstarter/boot.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/install_linux_fw_sd.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/install_linux_fw_sd.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt new file mode 100644 index 000000000..9dab463bb --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt @@ -0,0 +1,35 @@ +# +# 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 zImage-ccimx8x-sbc-express-id${board_id}.dtb +else + # + # Set device tree filename depending on the hardware variant + # + if test "${module_variant}" = "0x01"; then + setenv fdt_file zImage-ccimx8x-sbc-express-wb.dtb + else + echo "------ Using default fdt_file" + fi +fi + +# Get the UUID of the configured boot partition. +part uuid mmc ${mmcbootdev}:${mmcpart} bootpart +# 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/ccimx8x-sbc-express/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/install_linux_fw_sd.txt new file mode 100644 index 000000000..36c709a0b --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/install_linux_fw_sd.txt @@ -0,0 +1,162 @@ +# +# U-Boot script for installing Linux images created by Yocto from the SD +# card into the eMMC +# + +echo "############################################################" +echo "# Linux firmware install from micro SD #" +echo "############################################################" +echo "" +echo " This process will erase your eMMC and will install a new" +echo " U-Boot and Linux firmware images on the eMMC." +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 + +# Determine U-Boot file to program basing on module variant +if test -n "${module_variant}"; then + if test "${module_variant}" = "0x01"; then + setenv INSTALL_UBOOT_FILENAME u-boot-ccimx8x-sbc-express.bin; + fi +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 8X variant:"; + echo " - For a QuadXPlus CPU with 1GB DDR3, run:"; + echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx8x-sbc-express.bin"; + echo ""; + echo "2. Run the install script again."; + echo ""; + echo "Aborted"; + echo ""; + exit; +fi; + +setenv INSTALL_MMCDEV 1 +setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8x-sbc-express.boot.vfat +setenv INSTALL_RECOVERY_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8x-sbc-express.recovery.vfat +setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8x-sbc-express.ext4 + +# Check for presence of firmware files on the SD card +for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do + if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then + echo "ERROR: Could not find file ${install_f}"; + install_abort=1; + fi; +done +if test -n "${install_abort}"; then + echo "Aborted."; + 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 (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 +# - Save the environment +# - Partition the eMMC user data area for Linux +# - Update the 'linux' partition +# - Update the 'recovery' partition +# - Update the 'rootfs' partition +# - Configure recovery to wipe 'update' partition +# - Run 'recovery' and let the system boot after +setenv bootcmd " + env default -a; + 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; + echo \"\"; + echo \"\"; + echo \">> Installing Linux kernel and device tree files\"; + echo \"\"; + echo \"\"; + update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; + echo \">> Installing recovery\"; + echo \"\"; + echo \"\"; + update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update recovery partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; + echo \">> Installing Linux root file system\"; + echo \"\"; + echo \"\"; + update rootfs mmc ${INSTALL_MMCDEV} fat ${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; + saveenv; + echo \"\"; + echo \"\"; + echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\"; + echo \"\"; + echo \"\"; + sleep 1; + reset; +" + +saveenv +reset 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 904ef6aac..d01bc481f 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 @@ -1,6 +1,6 @@ # Copyright (C) 2012-2018 Digi International -require u-boot.inc +require u-boot-2015.04.inc DESCRIPTION = "Bootloader for Digi platforms" LICENSE = "GPLv2+" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2017.03.bb b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2017.03.bb new file mode 100644 index 000000000..54f0b1958 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2017.03.bb @@ -0,0 +1,172 @@ +# Copyright (C) 2018 Digi International + +require recipes-bsp/u-boot/u-boot.inc + +DESCRIPTION = "Bootloader for Digi platforms" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6" +SECTION = "bootloaders" + +DEPENDS += "bc-native dtc-native u-boot-mkimage-native" +DEPENDS += "${@base_conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native', '', d)}" + +PROVIDES += "u-boot" + +SRCBRANCH = "v2017.03/master" +SRCREV = "${AUTOREV}" + +S = "${WORKDIR}/git" + +# Select internal or Github U-Boot repo +UBOOT_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-boot-denx.git', '${DIGI_GITHUB_GIT}/u-boot.git', d)}" + +SRC_URI = " \ + ${UBOOT_GIT_URI};branch=${SRCBRANCH} \ +" + +SRC_URI_append = " \ + file://boot.txt \ + file://install_linux_fw_sd.txt \ +" + +LOCALVERSION ?= "" +inherit fsl-u-boot-localversion + +EXTRA_OEMAKE_append = " KCFLAGS=-fgnu89-inline" + +UBOOT_EXTRA_CONF ?= "" + +python __anonymous() { + if (d.getVar("TRUSTFENCE_DEK_PATH", True) not in ["0", None]) and (d.getVar("TRUSTFENCE_SIGN", True) != "1"): + bb.fatal("Only signed U-Boot images can be encrypted. Generate signed images (TRUSTFENCE_SIGN = \"1\") or remove encryption (TRUSTFENCE_DEK_PATH = \"0\")") +} + +do_compile () { + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + if [ -n "${UBOOT_CONFIG}" ] + then + unset i j k + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + oe_runmake -C ${S} O=${B}/${config} ${config} + + # Reconfigure U-Boot with Digi UBOOT_EXTRA_CONF + for var in ${UBOOT_EXTRA_CONF}; do + echo "${var}" >> ${B}/${config}/.config + done + oe_runmake -C ${S} O=${B}/${config} oldconfig + + oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET} + for binary in ${UBOOT_BINARIES}; do + k=$(expr $k + 1); + if [ $k -eq $i ]; then + cp ${B}/${config}/${binary} ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} + fi + done + unset k + + # Secure boot artifacts + if [ "${TRUSTFENCE_SIGN}" = "1" ] + then + cp ${B}/${config}/u-boot-dtb-signed.imx ${B}/${config}/u-boot-dtb-signed-${type}.${UBOOT_SUFFIX} + cp ${B}/${config}/u-boot-dtb-usb-signed.imx ${B}/${config}/u-boot-dtb-usb-signed-${type}.${UBOOT_SUFFIX} + if [ "${TRUSTFENCE_DEK_PATH}" != "0" ] + then + cp ${B}/${config}/u-boot-dtb-encrypted.imx ${B}/${config}/u-boot-dtb-encrypted-${type}.${UBOOT_SUFFIX} + fi + fi + fi + done + unset j + done + unset i + else + oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} + oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET} + fi +} + +TF_BOOTSCRIPT_SEDFILTER = "" +TF_BOOTSCRIPT_SEDFILTER_ccimx6 = "${@tf_bootscript_sedfilter(d)}" +TF_BOOTSCRIPT_SEDFILTER_ccimx6ul = "${@tf_bootscript_sedfilter(d)}" + +def tf_bootscript_sedfilter(d): + tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE',True) or "" + 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: + # u-boot-.- + # u-boot- + # and add a more suitable symlink in the form: + # u-boot--. + if [ -n "${UBOOT_CONFIG}" ] && [ "${TRUSTFENCE_SIGN}" = "1" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install ${B}/${config}/SRK_efuses.bin SRK_efuses-${PV}-${PR}.bin + ln -sf SRK_efuses-${PV}-${PR}.bin SRK_efuses.bin + + install ${B}/${config}/u-boot-dtb-signed-${type}.${UBOOT_SUFFIX} u-boot-dtb-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-dtb-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-dtb-signed-${type}.${UBOOT_SUFFIX} + + install ${B}/${config}/u-boot-dtb-usb-signed-${type}.${UBOOT_SUFFIX} u-boot-dtb-usb-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-dtb-usb-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-dtb-usb-signed-${type}.${UBOOT_SUFFIX} + + if [ "${TRUSTFENCE_DEK_PATH}" != "0" ] + then + install ${B}/${config}/u-boot-dtb-encrypted-${type}.${UBOOT_SUFFIX} u-boot-dtb-encrypted-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-dtb-encrypted-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-dtb-encrypted-${type}.${UBOOT_SUFFIX} + fi + fi + done + unset j + done + unset i + fi + + # DEY firmware install script + sed -i -e 's,##GRAPHICAL_BACKEND##,${GRAPHICAL_BACKEND},g' ${WORKDIR}/install_linux_fw_sd.txt + mkimage -T script -n "DEY firmware install script" -C none -d ${WORKDIR}/install_linux_fw_sd.txt ${DEPLOYDIR}/install_linux_fw_sd.scr + + # Boot script for DEY images (reconfigure on-the-fly if TRUSTFENCE is enabled) + TMP_BOOTSCR="$(mktemp ${WORKDIR}/bootscr.XXXXXX)" + sed -e "${TF_BOOTSCRIPT_SEDFILTER}" ${WORKDIR}/boot.txt > ${TMP_BOOTSCR} + mkimage -T script -n bootscript -C none -d ${TMP_BOOTSCR} ${DEPLOYDIR}/boot.scr + + # Sign the scripts + if [ "${TRUSTFENCE_SIGN}" = "1" ]; then + export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" + [ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" + [ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}" + + # Sign boot script + 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" + fi + rm -f ${TMP_BOOTSCR} +} + +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x)"