From 05d21a1310d1eed82f6235543bb7c576344ebbc5 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Thu, 9 Sep 2021 12:46:33 +0200 Subject: [PATCH] u-boot: boot.txt: move dualboot checks to the top When DualBoot mechanism is enabled and an update is pending, the boot script needs to change certain variables and save the environment. The regular boot script already changes a number of variables, such as 'extra_bootargs' and 'overlays' by appending strings to the already existing values. Saving the envionment may make these grow endlessly with each iteration of the boot script. For this reason, move the DualBoot check as the first thing in the script, save the environment if needed, and then continue with the normal flow, that changes variables before booting but doesn't save them. On certain scripts, this allows us to get rid of some instructions for resetting the overlays variable. Signed-off-by: Hector Palacios --- .../u-boot/u-boot-dey/ccimx6qpsbc/boot.txt | 51 ++++---- .../u-boot/u-boot-dey/ccimx6sbc/boot.txt | 107 +++++++++-------- .../u-boot/u-boot-dey/ccimx6ulsbc/boot.txt | 75 ++++++------ .../u-boot-dey/ccimx6ulstarter/boot.txt | 75 ++++++------ .../u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt | 75 ++++++------ .../u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt | 95 ++++++++------- .../u-boot-dey/ccimx8x-sbc-express/boot.txt | 99 ++++++++-------- .../u-boot-dey/ccimx8x-sbc-pro/boot.txt | 109 +++++++++--------- 8 files changed, 355 insertions(+), 331 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt index 5dedaa36d..fe794d0c6 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt @@ -2,28 +2,10 @@ # U-Boot bootscript for EMMC/SD images created by Yocto. # -# Back up environment variables -setenv ORIG_extra_bootargs ${extra_bootargs} - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file imx6qp-ccimx6qpsbc-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware variant - # - if test "${module_variant}" = "0x01"; then - setenv fdt_file imx6qp-ccimx6qpsbc-wb.dtb - elif test "${module_variant}" = "0x02"; then - setenv fdt_file imx6qp-ccimx6qpsbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file imx6qp-ccimx6qpsbc.dtb - else - setenv fdt_file imx6qp-ccimx6qpsbc-wb.dtb - fi -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -90,6 +72,31 @@ else setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi fi + + +# Back up environment variables +setenv ORIG_extra_bootargs ${extra_bootargs} + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file imx6qp-ccimx6qpsbc-id${board_id}.dtb +else + # + # Set device tree filename depending on the hardware variant + # + if test "${module_variant}" = "0x01"; then + setenv fdt_file imx6qp-ccimx6qpsbc-wb.dtb + elif test "${module_variant}" = "0x02"; then + setenv fdt_file imx6qp-ccimx6qpsbc-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file imx6qp-ccimx6qpsbc.dtb + else + setenv fdt_file imx6qp-ccimx6qpsbc-wb.dtb + fi +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt index 12b927abd..a88f10150 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt @@ -2,56 +2,10 @@ # U-Boot bootscript for EMMC/SD images created by Yocto. # -# Back up environment variables -setenv ORIG_extra_bootargs ${extra_bootargs} - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file ${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 imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x04"; then - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x05"; then - setenv fdt_file imx6q-ccimx6sbc-w.dtb - elif test "${module_variant}" = "0x06"; then - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x08"; then - setenv fdt_file imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x0a"; then - setenv fdt_file imx6dl-ccimx6sbc-w.dtb - elif test "${module_variant}" = "0x0b"; then - setenv fdt_file imx6dl-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x0c"; then - setenv fdt_file imx6dl-ccimx6sbc.dtb - elif test "${module_variant}" = "0x0e"; then - setenv fdt_file imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x0f"; then - setenv fdt_file imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x11"; then - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x12"; then - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x13"; then - setenv fdt_file imx6dl-ccimx6sbc-wb.dtb - elif test "${module_variant}" = "0x14"; then - setenv fdt_file imx6q-ccimx6sbc.dtb - elif test "${module_variant}" = "0x15"; then - setenv fdt_file imx6dl-ccimx6sbc.dtb - elif test "${module_variant}" = "0x16"; then - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - else - setenv fdt_file imx6q-ccimx6sbc-wb.dtb - fi -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -118,6 +72,59 @@ else setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi fi + + +# Back up environment variables +setenv ORIG_extra_bootargs ${extra_bootargs} + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file ${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 imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x04"; then + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x05"; then + setenv fdt_file imx6q-ccimx6sbc-w.dtb + elif test "${module_variant}" = "0x06"; then + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x08"; then + setenv fdt_file imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x0a"; then + setenv fdt_file imx6dl-ccimx6sbc-w.dtb + elif test "${module_variant}" = "0x0b"; then + setenv fdt_file imx6dl-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x0c"; then + setenv fdt_file imx6dl-ccimx6sbc.dtb + elif test "${module_variant}" = "0x0e"; then + setenv fdt_file imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x0f"; then + setenv fdt_file imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x11"; then + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x12"; then + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x13"; then + setenv fdt_file imx6dl-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x14"; then + setenv fdt_file imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x15"; then + setenv fdt_file imx6dl-ccimx6sbc.dtb + elif test "${module_variant}" = "0x16"; then + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + else + setenv fdt_file imx6q-ccimx6sbc-wb.dtb + fi +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt index 9d931bd24..9b45affa5 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt @@ -2,40 +2,10 @@ # U-Boot bootscript for NAND images created by Yocto. # -# Back up environment variables -setenv ORIG_extra_bootargs ${extra_bootargs} - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file 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 imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - elif test "${module_variant}" = "0x04"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x05"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - elif test "${module_variant}" = "0x06"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x07"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x08"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x09"; then - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - elif test "${module_variant}" = "0x0a"; then - setenv fdt_file imx6ul-ccimx6ulsbc.dtb - else - setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb - fi -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -81,6 +51,43 @@ else true fi fi + + +# Back up environment variables +setenv ORIG_extra_bootargs ${extra_bootargs} + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file 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 imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file imx6ul-ccimx6ulsbc.dtb + elif test "${module_variant}" = "0x04"; then + setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x05"; then + setenv fdt_file imx6ul-ccimx6ulsbc.dtb + elif test "${module_variant}" = "0x06"; then + setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x07"; then + setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x08"; then + setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x09"; then + setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x0a"; then + setenv fdt_file imx6ul-ccimx6ulsbc.dtb + else + setenv fdt_file imx6ul-ccimx6ulsbc-wb.dtb + fi +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt index fab05eb51..3fe58e274 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt @@ -2,40 +2,10 @@ # U-Boot bootscript for NAND images created by Yocto. # -# Back up environment variables -setenv ORIG_extra_bootargs ${extra_bootargs} - -# -# Set device tree filename depending on the board ID (if defined) -# -if test -n "${board_id}"; then - setenv fdt_file 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 imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x03"; then - setenv fdt_file imx6ul-ccimx6ulstarter.dtb - elif test "${module_variant}" = "0x04"; then - setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x05"; then - setenv fdt_file imx6ul-ccimx6ulstarter.dtb - elif test "${module_variant}" = "0x06"; then - setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x07"; then - setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x08"; then - setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x09"; then - setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb - elif test "${module_variant}" = "0x0a"; then - setenv fdt_file imx6ul-ccimx6ulstarter.dtb - else - setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb - fi -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -81,6 +51,43 @@ else true fi fi + + +# Back up environment variables +setenv ORIG_extra_bootargs ${extra_bootargs} + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file 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 imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file imx6ul-ccimx6ulstarter.dtb + elif test "${module_variant}" = "0x04"; then + setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x05"; then + setenv fdt_file imx6ul-ccimx6ulstarter.dtb + elif test "${module_variant}" = "0x06"; then + setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x07"; then + setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x08"; then + setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x09"; then + setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x0a"; then + setenv fdt_file imx6ul-ccimx6ulstarter.dtb + else + setenv fdt_file imx6ul-ccimx6ulstarter-wb.dtb + fi +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt index 1513df9e9..121b71e07 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt @@ -2,44 +2,10 @@ # U-Boot bootscript for EMMC/SD images created by Yocto. # -# Back up environment variables -setenv ORIG_overlays ${overlays} -setenv ORIG_extra_bootargs ${extra_bootargs} - -# Set SOC type to "imx8mm" if not already defined by U-Boot -if test ! -n "${soc_type}"; then - setenv soc_type "imx8mm" -fi - -# Reset overlays when using dualboot mode, because we need to -# save the environment in case of an installation fall back. -if test "${dual_boot}" = "yes"; then - if test -n "${overlays}"; then - setenv overlays - fi -fi - -# -# Determine overlays to apply depending on the hardware capabilities -# described by the HWID, SOM version, and carrier board version. -# -if test -n "${module_ram}"; then - setexpr som_hv ${hwid_2} \& 38 - setexpr som_hv ${som_hv} / 8 - - setexpr module_has_wifi ${hwid_2} \& 10000 - setexpr module_has_wifi ${module_has_wifi} / 10000 - setexpr module_has_bt ${hwid_2} \& 20000 - setexpr module_has_bt ${module_has_bt} / 20000 - - if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then - setenv overlays _ov_som_bt_ccimx8m.dtbo,${overlays} - fi - - if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then - setenv overlays _ov_som_wifi_ccimx8m.dtbo,${overlays} - fi -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -106,6 +72,39 @@ else setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi fi + + +# Back up environment variables +setenv ORIG_overlays ${overlays} +setenv ORIG_extra_bootargs ${extra_bootargs} + +# Set SOC type to "imx8mm" if not already defined by U-Boot +if test ! -n "${soc_type}"; then + setenv soc_type "imx8mm" +fi + +# +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. +# +if test -n "${module_ram}"; then + setexpr som_hv ${hwid_2} \& 38 + setexpr som_hv ${som_hv} / 8 + + setexpr module_has_wifi ${hwid_2} \& 10000 + setexpr module_has_wifi ${module_has_wifi} / 10000 + setexpr module_has_bt ${hwid_2} \& 20000 + setexpr module_has_bt ${module_has_bt} / 20000 + + if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then + setenv overlays _ov_som_bt_ccimx8m.dtbo,${overlays} + fi + + if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then + setenv overlays _ov_som_wifi_ccimx8m.dtbo,${overlays} + fi +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt index 7b7df5917..f39b8cfc5 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt @@ -2,53 +2,10 @@ # U-Boot bootscript for EMMC/SD images created by Yocto. # -# Back up environment variables -setenv ORIG_overlays ${overlays} -setenv ORIG_extra_bootargs ${extra_bootargs} - -# Set SOC type to "imx8mn" if not already defined by U-Boot -if test ! -n "${soc_type}"; then - setenv soc_type "imx8mn" -fi - -# Reset overlays when using dualboot mode, because we need to -# save the environment in case of an installation fall back. -if test "${dual_boot}" = "yes"; then - if test -n "${overlays}"; then - setenv overlays - fi -fi - -# -# Determine overlays to apply depending on the hardware capabilities -# described by the HWID, SOM version, and carrier board version. -# -if test -n "${module_ram}"; then - setexpr som_hv ${hwid_2} \& 38 - setexpr som_hv ${som_hv} / 8 - - setexpr module_has_wifi ${hwid_2} \& 10000 - setexpr module_has_wifi ${module_has_wifi} / 10000 - setexpr module_has_bt ${hwid_2} \& 20000 - setexpr module_has_bt ${module_has_bt} / 20000 - - if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then - setenv overlays _ov_som_bt_ccimx8m.dtbo,${overlays} - fi - - if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then - setenv overlays _ov_som_wifi_ccimx8m.dtbo,${overlays} - fi - - if test "${som_hv}" = "1"; then - setenv overlays _ov_som_v1_ccimx8mn.dtbo,${overlays} - fi -fi - -# Apply DVK v1-v2 overlay if the board version is < 3 -if test "${board_version}" -lt "3"; then - setenv overlays _ov_board_v1-v2_ccimx8mn-dvk.dtbo,${overlays} -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -68,7 +25,7 @@ if test "${dualboot}" = "yes"; then else part number mmc ${mmcbootdev} linux_a pi setenv mmcpart ${pi} - # Save the partition index on variable rootfs_b_index + # Save the partition index on variable rootfs_a_index part number mmc ${mmcbootdev} rootfs_a rootfs_a_index # Save the rootfs_a UUID into mmcroot_a part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a @@ -115,6 +72,48 @@ else setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi fi + + +# Back up environment variables +setenv ORIG_overlays ${overlays} +setenv ORIG_extra_bootargs ${extra_bootargs} + +# Set SOC type to "imx8mn" if not already defined by U-Boot +if test ! -n "${soc_type}"; then + setenv soc_type "imx8mn" +fi + +# +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. +# +if test -n "${module_ram}"; then + setexpr som_hv ${hwid_2} \& 38 + setexpr som_hv ${som_hv} / 8 + + setexpr module_has_wifi ${hwid_2} \& 10000 + setexpr module_has_wifi ${module_has_wifi} / 10000 + setexpr module_has_bt ${hwid_2} \& 20000 + setexpr module_has_bt ${module_has_bt} / 20000 + + if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then + setenv overlays _ov_som_bt_ccimx8m.dtbo,${overlays} + fi + + if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then + setenv overlays _ov_som_wifi_ccimx8m.dtbo,${overlays} + fi + + if test "${som_hv}" = "1"; then + setenv overlays _ov_som_v1_ccimx8mn.dtbo,${overlays} + fi +fi + +# Apply DVK v1-v2 overlay if the board version is < 3 +if test "${board_version}" -lt "3"; then + setenv overlays _ov_board_v1-v2_ccimx8mn-dvk.dtbo,${overlays} +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux mmc ${mmcbootdev}:${mmcpart} 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 index b99b3378b..836310230 100644 --- 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 @@ -2,56 +2,10 @@ # U-Boot bootscript for EMMC/SD images created by Yocto. # -# Back up environment variables -setenv ORIG_overlays ${overlays} -setenv ORIG_extra_bootargs ${extra_bootargs} - -# Set SOC type to "imx8qxp" if not already defined by U-Boot -if test ! -n "${soc_type}"; then - setenv soc_type "imx8qxp" -fi - -# Reset overlays when using dualboot mode, because we need to -# save the environment in case of an installation fall back. -if test "${dual_boot}" = "yes"; then - if test -n "${overlays}"; then - setenv overlays - fi -fi - -# -# Determine overlays to apply depending on the hardware capabilities -# described by the HWID, SOM version, and carrier board version. -# -if test -n "${module_ram}"; then - setexpr module_has_wifi ${hwid_3} \& 1 - setexpr module_has_bt ${hwid_3} \& 2 - setexpr module_has_bt ${module_has_bt} / 2 - - if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,${overlays} - fi - - if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then - setenv overlays _ov_som_wifi_ccimx8x.dtbo,${overlays} - fi -else - # - # Set overlays depending on the hardware variant - # - if test "${module_variant}" = "0x01"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} - elif test "${module_variant}" = "0x02"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} - elif test "${module_variant}" = "0x04"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} - fi -fi - -# Apply QXP overlay if the SOC type is "imx8qxp" -if test "${soc_type}" = "imx8qxp"; then - setenv overlays _ov_som_quad_ccimx8x.dtbo,${overlays} -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -118,6 +72,51 @@ else setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi fi + + +# Back up environment variables +setenv ORIG_overlays ${overlays} +setenv ORIG_extra_bootargs ${extra_bootargs} + +# Set SOC type to "imx8qxp" if not already defined by U-Boot +if test ! -n "${soc_type}"; then + setenv soc_type "imx8qxp" +fi + +# +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. +# +if test -n "${module_ram}"; then + setexpr module_has_wifi ${hwid_3} \& 1 + setexpr module_has_bt ${hwid_3} \& 2 + setexpr module_has_bt ${module_has_bt} / 2 + + if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,${overlays} + fi + + if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then + setenv overlays _ov_som_wifi_ccimx8x.dtbo,${overlays} + fi +else + # + # Set overlays depending on the hardware variant + # + if test "${module_variant}" = "0x01"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} + elif test "${module_variant}" = "0x02"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} + elif test "${module_variant}" = "0x04"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} + fi +fi + +# Apply QXP overlay if the SOC type is "imx8qxp" +if test "${soc_type}" = "imx8qxp"; then + setenv overlays _ov_som_quad_ccimx8x.dtbo,${overlays} +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt index 759308337..0a6968ea1 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt @@ -2,61 +2,10 @@ # U-Boot bootscript for EMMC/SD images created by Yocto. # -# Back up environment variables -setenv ORIG_overlays ${overlays} -setenv ORIG_extra_bootargs ${extra_bootargs} - -# Set SOC type to "imx8qxp" if not already defined by U-Boot -if test ! -n "${soc_type}"; then - setenv soc_type "imx8qxp" -fi - -# Reset overlays when using dualboot mode, because we need to -# save the environment in case of an installation fall back. -if test "${dual_boot}" = "yes"; then - if test -n "${overlays}"; then - setenv overlays - fi -fi - -# -# Determine overlays to apply depending on the hardware capabilities -# described by the HWID, SOM version, and carrier board version. -# -if test -n "${module_ram}"; then - setexpr module_has_wifi ${hwid_3} \& 1 - setexpr module_has_bt ${hwid_3} \& 2 - setexpr module_has_bt ${module_has_bt} / 2 - - if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,${overlays} - fi - - if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then - setenv overlays _ov_som_wifi_ccimx8x.dtbo,${overlays} - fi -else - # - # Set overlays depending on the hardware variant - # - if test "${module_variant}" = "0x01"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} - elif test "${module_variant}" = "0x02"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} - elif test "${module_variant}" = "0x04"; then - setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} - fi -fi - -# Apply QXP overlay if the SOC type is "imx8qxp" -if test "${soc_type}" = "imx8qxp"; then - setenv overlays _ov_som_quad_ccimx8x.dtbo,${overlays} -fi - -# Apply SBCv3 overlay if the board_version is 3 or lesser -if test "${board_version}" -le "3"; then - setenv overlays _ov_board_v1-v3_ccimx8x-sbc-pro.dtbo,${overlays} -fi +# As the first step in the boot script, check if we are using DualBoot and +# if an upgrade is available. This requires the script to change some variables +# and save them, while the rest of the script changes variables only temporarily +# without saving them. # Dual boot update verification if test "${dualboot}" = "yes"; then @@ -123,6 +72,56 @@ else setenv mmcroot /dev/mmcblk${mmcbootdev}p2 fi fi + + +# Back up environment variables +setenv ORIG_overlays ${overlays} +setenv ORIG_extra_bootargs ${extra_bootargs} + +# Set SOC type to "imx8qxp" if not already defined by U-Boot +if test ! -n "${soc_type}"; then + setenv soc_type "imx8qxp" +fi + +# +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. +# +if test -n "${module_ram}"; then + setexpr module_has_wifi ${hwid_3} \& 1 + setexpr module_has_bt ${hwid_3} \& 2 + setexpr module_has_bt ${module_has_bt} / 2 + + if test "${module_has_bt}" = "1" && test -z "${disable_bt}"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,${overlays} + fi + + if test "${module_has_wifi}" = "1" && test -z "${disable_wifi}"; then + setenv overlays _ov_som_wifi_ccimx8x.dtbo,${overlays} + fi +else + # + # Set overlays depending on the hardware variant + # + if test "${module_variant}" = "0x01"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} + elif test "${module_variant}" = "0x02"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} + elif test "${module_variant}" = "0x04"; then + setenv overlays _ov_som_bt_ccimx8x.dtbo,_ov_som_wifi_ccimx8x.dtbo,${overlays} + fi +fi + +# Apply QXP overlay if the SOC type is "imx8qxp" +if test "${soc_type}" = "imx8qxp"; then + setenv overlays _ov_som_quad_ccimx8x.dtbo,${overlays} +fi + +# Apply SBCv3 overlay if the board_version is 3 or lesser +if test "${board_version}" -le "3"; then + setenv overlays _ov_board_v1-v3_ccimx8x-sbc-pro.dtbo,${overlays} +fi + setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs} dboot linux mmc ${mmcbootdev}:${mmcpart}