[PATCH] cpu: imx8_cpu: Avoid revision to corrupt device tree

Peng Fan (OSS) peng.fan at oss.nxp.com
Fri Oct 11 12:58:27 CEST 2024


From: Peng Fan <peng.fan at nxp.com>

U-Boot device tree is padded just after U-Boot proper. After the whole
stuff loaded to DRAM space, the device tree area is conflict with BSS
region before U-Boot relocation. So any write to BSS area before
reloc_fdt will corrupt the device tree. Without the fix, there is
issue that “binman_init failed:-2” on i.MX8MP-EVK board.

Move the variable to data section to fix the issue

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/cpu/imx8_cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c
index 6c0a8c0cbe4..19c65c7ce47 100644
--- a/drivers/cpu/imx8_cpu.c
+++ b/drivers/cpu/imx8_cpu.c
@@ -71,7 +71,7 @@ static const char *get_imx_type_str(u32 imxtype)
 
 static const char *get_imx_rev_str(u32 rev)
 {
-	static char revision[4];
+	static char revision[4] __section(".data");
 
 	if (IS_ENABLED(CONFIG_IMX8)) {
 		switch (rev) {
-- 
2.35.3



More information about the U-Boot mailing list