From 316634525039cd12380944f83f45468f41746d94 Mon Sep 17 00:00:00 2001 From: Isaac Hermida Date: Wed, 29 Dec 2021 14:59:32 +0100 Subject: [PATCH] u-boot: add boot script for ConnectCore 8M Plus https://onedigi.atlassian.net/browse/DEL-7784 Signed-off-by: Isaac Hermida Signed-off-by: Javier Viguera --- .../u-boot/u-boot-dey/ccimx8mp-dvk/boot.txt | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mp-dvk/boot.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mp-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mp-dvk/boot.txt new file mode 100644 index 000000000..3efee8a11 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mp-dvk/boot.txt @@ -0,0 +1,96 @@ +# +# U-Boot bootscript for EMMC/SD images created by Yocto. +# + +# 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 + if test "${upgrade_available}" = "1"; then + echo "Update detected; Booting new system in ${active_system} (try ${bootcount})" + else + if test "${active_system}" = "linux_a"; then + echo "Booting from system A" + part number mmc ${mmcbootdev} linux_a pi + setenv mmcpart ${pi} + # 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 + setenv mmcroot PARTUUID=${mmcroot_a} + else + echo "Booting from system B" + part number mmc ${mmcbootdev} linux_b pi + setenv mmcpart ${pi} + # Save the partition index on variable rootfs_b_index + part number mmc ${mmcbootdev} rootfs_b rootfs_b_index + # Save the rootfs_b UUID into mmcroot_b + part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b + setenv mmcroot PARTUUID=${mmcroot_b} + fi + fi +else + # 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 +fi + + +# Back up environment variables +setenv ORIG_overlays ${overlays} +setenv ORIG_extra_bootargs ${extra_bootargs} + +# Set SOC type to "imx8mp" if not already defined by U-Boot +if test ! -n "${soc_type}"; then + setenv soc_type "imx8mp" +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_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 + + ## + ## @TODO: THE OVERLAYS NEED TO BE ADJUSTED ONCE THE MURATA SUPPORT + ## IS IN PLACE. + ## + 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} + + + +# We only get here in case of an error on the dboot command. + +# Undo changes to environment variables +setenv overlays ${ORIG_overlays} +setenv ORIG_overlays +setenv extra_bootargs ${ORIG_extra_bootargs} +setenv ORIG_extra_bootargs