From f724e2f9e76545842eee0a10f0d54111f3c63938 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 18 Jun 2021 17:07:46 +0200 Subject: [PATCH] UBOOT-STM32MP-EXTLINUX: fix boot.cmd for overlay By default U-Boot reserve overlay sizee with 4KB padding, sometime it is not enought and it is normal. The caller NEED to reserved enought memory before to apply overlay by usisng the parameter. fdt resize [] - Resize fdt to size + padding to 4k addr + some optional if needed A correct value cannot be proposed (it is depending of the overlay size) but at least you must reserved the size of the loaded overlay dtbo file => ${filesize} (this variable automatically updated after a load command) Change-Id: Ib37f2778bd843436b0baddb67a7a4fd5c799b749 Signed-off-by: Patrick Delaunay --- recipes-bsp/u-boot/u-boot-stm32mp-extlinux.bb | 2 +- recipes-bsp/u-boot/u-boot-stm32mp-extlinux/boot.scr.cmd | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes-bsp/u-boot/u-boot-stm32mp-extlinux.bb b/recipes-bsp/u-boot/u-boot-stm32mp-extlinux.bb index 6d034b9..8513d64 100644 --- a/recipes-bsp/u-boot/u-boot-stm32mp-extlinux.bb +++ b/recipes-bsp/u-boot/u-boot-stm32mp-extlinux.bb @@ -8,7 +8,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" SRC_URI = "file://boot.scr.cmd" -PV = "3.1" +PV = "3.1.1" inherit kernel-arch extlinuxconf-stm32mp diff --git a/recipes-bsp/u-boot/u-boot-stm32mp-extlinux/boot.scr.cmd b/recipes-bsp/u-boot/u-boot-stm32mp-extlinux/boot.scr.cmd index eeedb2e..f6328eb 100644 --- a/recipes-bsp/u-boot/u-boot-stm32mp-extlinux/boot.scr.cmd +++ b/recipes-bsp/u-boot/u-boot-stm32mp-extlinux/boot.scr.cmd @@ -23,7 +23,9 @@ env set boot_m4fw 'rproc init; rproc load 0 ${m4fw_addr} ${filesize}; rproc star env set scan_m4fw 'if test -e ${devtype} ${devnum}:${distro_bootpart} ${m4fw_name};then echo Found M4 FW $m4fw_name; if load ${devtype} ${devnum}:${distro_bootpart} ${m4fw_addr} ${m4fw_name}; then run boot_m4fw; fi; fi;' # management of overlay -env set scan_overlays 'if test -e ${devtype} ${devnum}:${distro_bootpart} /overlays/overlays.txt; then env set fdt_addr ${fdt_addr_r}; if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr} ${fdtfile}; then fdt addr ${fdt_addr}; fdt resize; setexpr fdtovaddr ${fdt_addr} + C0000; if load ${devtype} ${devnum}:${distro_bootpart} ${fdtovaddr} /overlays/overlays.txt && env import -t ${fdtovaddr} ${filesize} && test -n ${overlay}; then echo loaded overlay.txt: ${overlay}; for ov in ${overlay}; do echo overlaying ${ov}...; load ${devtype} ${devnum}:${distro_bootpart} ${fdtovaddr} /overlays/${ov}.dtbo && fdt apply ${fdtovaddr}; done; fi; fi; fi;' +env set ov_init 'load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${fdtfile} && env set fdt_addr ${fdt_addr_r} && fdt addr ${fdt_addr} && setexpr fdtovaddr ${fdt_addr} + C0000' +env set ov_apply 'test -n ${fdtovaddr} && test -n ${overlay} && for ov in ${overlay}; do echo overlaying ${ov}...; load ${devtype} ${devnum}:${distro_bootpart} ${fdtovaddr} /overlays/${ov}.dtbo && fdt resize ${filesize} && fdt apply ${fdtovaddr}; done' +env set scan_overlays 'if test -e ${devtype} ${devnum}:${distro_bootpart} /overlays/overlays.txt && load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /overlays/overlays.txt && env import -t ${loadaddr} ${filesize}; then echo loaded overlay.txt: ${overlay}; run ov_init; run ov_apply; fi' # Update the DISTRO command to search in sub-directory and load M4 firmware env set boot_prefixes "/${boot_device}${boot_instance}_"