From f58ccb74630af52b31fde8d8c86dc22c7b51003e Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Tue, 26 May 2020 17:25:11 +0200 Subject: [PATCH] boot: don't set fdt_file on bootscript; just the overlays With the device tree overlays mechanism in place, the bootscript doesn't need to set the fdt_file variable. Instead, it will use the value it has (which can be changed by the user) and it will simply update the 'overlays' variable with the device tree overlays that apply basing on the hardware capabilities found on the HWID, SOM version, and carrier board version. This allows a user to override the default fdt_file to point to his custom device tree, but still make use of the boot script for hardware-detected overlays. Without the need to set the base filename, the boot script is the same for any carrier board of the ccimx8x SOM, so this commit moves it to a common folder. Signed-off-by: Hector Palacios --- .../u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt | 42 +++++------- .../u-boot-dey/ccimx8x-sbc-express/boot.txt | 67 ------------------- .../{ccimx8x-sbc-pro => ccimx8x}/boot.txt | 47 +++++-------- 3 files changed, 35 insertions(+), 121 deletions(-) delete mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt rename meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/{ccimx8x-sbc-pro => ccimx8x}/boot.txt (50%) 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 c64aedd76..6815fc994 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 @@ -8,36 +8,28 @@ if test ! -n "${soc_type}"; then fi # -# Set device tree filename depending on the board ID (if defined) +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. # -if test -n "${board_id}"; then - setenv fdt_file cc${soc_type}-dvk-id${board_id}.dtb -else - # - # Set device tree filename depending on the hardware capabilities - # - if test -n "${module_ram}"; then - setexpr som_hv ${hwid_2} \& 38 - setexpr som_hv ${som_hv} / 8 +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 + 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 - setenv fdt_file cc${soc_type}-dvk.dtb + if test "${module_has_bt}" = "1"; then + setenv overlays cc${soc_type}_ov_bt.dtbo,${overlays} + fi - if test "${module_has_bt}" = "1"; then - setenv overlays cc${soc_type}_ov_bt.dtbo,${overlays} - fi + if test "${module_has_wifi}" = "1"; then + setenv overlays cc${soc_type}_ov_wifi.dtbo,${overlays} + fi - if test "${module_has_wifi}" = "1"; then - setenv overlays cc${soc_type}_ov_wifi.dtbo,${overlays} - fi - - if test "${som_hv}" = "1"; then - setenv overlays cc${soc_type}_ov_v1.dtbo,${overlays} - fi + if test "${som_hv}" = "1"; then + setenv overlays cc${soc_type}_ov_v1.dtbo,${overlays} fi fi 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 deleted file mode 100644 index 7aafcb8e9..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt +++ /dev/null @@ -1,67 +0,0 @@ -# -# U-Boot bootscript for EMMC/SD images created by Yocto. -# - -# Set SOC type to "imx8qxp" if not already defined by U-Boot -if test ! -n "${soc_type}"; then - setenv soc_type "imx8qxp" -fi - -# -# Set the base device tree filename -# -setenv fdt_file ccimx8x-sbc-express.dtb - -# -# Set predetermined overlays for specific board IDs -# -if test "${board_id}" = "129"; then - setenv overlays ccimx8x_ov_bt.dtbo,ccimx8x_ov_wifi.dtbo,${overlays} -else - # - # Set overlays depending on the hardware capabilities - # - 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"; then - setenv overlays ccimx8x_ov_bt.dtbo,${overlays} - fi - - if test "${module_has_wifi}" = "1"; then - setenv overlays ccimx8x_ov_wifi.dtbo,${overlays} - fi - else - # - # Set overlays depending on the hardware variant - # - if test "${module_variant}" = "0x01" || - test "${module_variant}" = "0x02" || - test "${module_variant}" = "0x04"; then - setenv overlays ccimx8x_ov_bt.dtbo,ccimx8x_ov_wifi.dtbo,${overlays} - fi - fi -fi - -# Apply QXP overlay if the SOC type is "imx8qxp" -if test "${soc_type}" = "imx8qxp""; then - setenv overlays ccimx8x_ov_qxp.dtbo,${overlays} -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-pro/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/boot.txt similarity index 50% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/boot.txt index 5dbfe4534..dc4519a61 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/boot.txt @@ -8,40 +8,29 @@ if test ! -n "${soc_type}"; then fi # -# Set the base device tree filename +# Determine overlays to apply depending on the hardware capabilities +# described by the HWID, SOM version, and carrier board version. # -setenv fdt_file ccimx8x-sbc-pro.dtb +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 -# -# Set predetermined overlays for specific board IDs -# -if test "${board_id}" = "135"; then - setenv overlays ccimx8x_ov_bt.dtbo,ccimx8x_ov_wifi.dtbo,${overlays} + if test "${module_has_bt}" = "1"; then + setenv overlays ccimx8x_ov_bt.dtbo,${overlays} + fi + + if test "${module_has_wifi}" = "1"; then + setenv overlays ccimx8x_ov_wifi.dtbo,${overlays} + fi else # - # Set overlays depending on the hardware capabilities + # Set overlays depending on the hardware variant # - 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"; then - setenv overlays ccimx8x_ov_bt.dtbo,${overlays} - fi - - if test "${module_has_wifi}" = "1"; then - setenv overlays ccimx8x_ov_wifi.dtbo,${overlays} - fi - else - # - # Set overlays depending on the hardware variant - # - if test "${module_variant}" = "0x01" || - test "${module_variant}" = "0x02" || - test "${module_variant}" = "0x04"; then - setenv overlays ccimx8x_ov_bt.dtbo,ccimx8x_ov_wifi.dtbo,${overlays} - fi + if test "${module_variant}" = "0x01" || + test "${module_variant}" = "0x02" || + test "${module_variant}" = "0x04"; then + setenv overlays ccimx8x_ov_bt.dtbo,ccimx8x_ov_wifi.dtbo,${overlays} fi fi