aboutsummaryrefslogtreecommitdiff
path: root/board/st
diff options
context:
space:
mode:
authorPatrick Delaunay2020-04-22 14:29:14 +0200
committerPatrick Delaunay2020-05-14 09:02:12 +0200
commit99f6743d6323c7cfa00a2517896aaf0af4f6a88e (patch)
treebb3d6aa456fb0723de1bee2bf204801b47db9b4e /board/st
parent055065a8acfb51b2aed415c62271ac3d5d34b641 (diff)
board: stm32mp1: set environment variable fdtfile
For booting Linux in the generic distro mechanism and support of FDTDIR in extlinux.conf , cmd/pxe.c retrieves the FDT file name from "fdtfile" environment variable. Dynamically build this variable with compatible of STMicroelectronics boards. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'board/st')
-rw-r--r--board/st/stm32mp1/stm32mp1.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 62b648f6e47..c64f20ab086 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -699,10 +699,19 @@ int board_late_init(void)
fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
&fdt_compat_len);
if (fdt_compat && fdt_compat_len) {
- if (strncmp(fdt_compat, "st,", 3) != 0)
+ if (strncmp(fdt_compat, "st,", 3) != 0) {
env_set("board_name", fdt_compat);
- else
+ } else {
+ char dtb_name[256];
+ int buf_len = sizeof(dtb_name);
+
env_set("board_name", fdt_compat + 3);
+
+ strncpy(dtb_name, fdt_compat + 3, buf_len);
+ buf_len -= strlen(fdt_compat + 3);
+ strncat(dtb_name, ".dtb", buf_len);
+ env_set("fdtfile", dtb_name);
+ }
}
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),