Skip to contentSkip to conversation

phycore_imx8mm: Switch to using env text files

PATCH Superseded Yunus Bas 1 participant 3 messages Dec 3, 2024 Arm i.MX and Layerscape

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yunus Bas

author
#0 lore raw

PATCH v2 1/3 phycore_imx8mm: Switch to using env text files

Move the environment into the board directory and convert header to a txt file. In addition, this patch also applies following changes:

- Change default nfsroot path to /srv/nfs due to compliance with Linux FHS 3.0.

- Rename specific variables as stated in the bootstd documentation. Renamed variables:
fdt_addr => fdt_addr_r
fdt_file => fdtfile

---
 .../phytec/phycore_imx8mm/phycore_imx8mm.env  | 51 +++++++++++++++++++
 include/configs/phycore_imx8mm.h              | 46 -----------------
 2 files changed, 51 insertions(+), 46 deletions(-)
 create mode 100644 board/phytec/phycore_imx8mm/phycore_imx8mm.env
board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +51 -0
new file mode 100644
index 00000000000..33a2595fa16
@@ -0,0 +1,51 @@
+console=ttymxc2,115200
+emmc_dev=2
+fdt_addr_r=0x48000000
+fdtfile=CONFIG_DEFAULT_FDT_FILE
+image=Image
+ip_dyn=yes
+loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+mmcargs=
+	setenv bootargs console=${console}
+	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
+mmcautodetect=yes
+mmcboot=
+	echo Booting from mmc ...;
+	run mmcargs;
+	if run loadfdt; then
+		if test ${dofitboot} = 1; then
+			booti ${loadaddr} - ${fdt_addr_r}
+		else
+			echo WARN: Cannot load the DT;
+		fi;
+	fi;
+mmcdev=CONFIG_SYS_MMC_ENV_DEV
+mmcpart=1
+mmcroot=2
+netargs=
+	setenv bootargs console=${console} root=/dev/nfs ip=dhcp
+	nfsroot=${serverip}:${nfsroot},v3,tcp
+netboot=
+	echo Booting from net ...;
+	if test ${ip_dyn} = yes; then
+		setenv get_cmd dhcp;
+	else
+		setenv get_cmd tftp;
+	fi;
+	${get_cmd} ${loadaddr} ${image};
+	run netargs;
+	if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then
+		booti ${loadaddr} - ${fdt_addr_r};
+	else
+		echo WARN: Cannot load the DT;
+	fi;
+nfsroot=/srv/nfs
+update_bootimg=
+	mmc dev ${mmcdev};
+	if dhcp ${loadaddr} ${update_filepath}/${update_filename}; then
+		setexpr fw_sz ${filesize} / 0x200;
+		mmc write ${loadaddr} ${update_offset} ${fw_sz};
+	fi;
+update_filename=flash.bin
+update_offset=0x42
include/configs/phycore_imx8mm.h +0 -46

52 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 2/3 phycore_imx8mm: Move default bootcmd to board env

Move the default bootcmd from the defconfig to the board environment.

---
 board/phytec/phycore_imx8mm/phycore_imx8mm.env | 9 +++++++++
 configs/phycore-imx8mm_defconfig               | 2 --
 2 files changed, 9 insertions(+), 2 deletions(-)
board/phytec/phycore_imx8mm/phycore_imx8mm.env +9 -0
index 33a2595fa16..44fa3731b8a 100644
@@ -1,3 +1,12 @@
+bootcmd=
+	mmc dev ${mmcdev};
+	if mmc rescan; then
+		if run loadimage; then
+			run mmcboot;
+		else
+			run netboot;
+		fi;
+	fi;
 console=ttymxc2,115200
 emmc_dev=2
 fdt_addr_r=0x48000000
configs/phycore-imx8mm_defconfig +0 -2
index c24580430f2..3f4336837e9 100644
@@ -31,8 +31,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadimage; then run mmcboot; else run netboot; fi; fi;"
 CONFIG_DEFAULT_FDT_FILE="oftree"
 CONFIG_SYS_CBSIZE=2048
 CONFIG_SYS_PBSIZE=2074
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v2 3/3 board: phytec: phycore_imx8mm: Add RAUC boot logic to environment

In reply to Yunus Bas

Add RAUC boot logic to the environment.

---
 board/phytec/phycore_imx8mm/phycore_imx8mm.env | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
board/phytec/phycore_imx8mm/phycore_imx8mm.env +6 -1
index 44fa3731b8a..a7d14e774a0 100644
@@ -1,6 +1,11 @@
+#include <env/phytec/rauc.env>
+
 bootcmd=
 	mmc dev ${mmcdev};
 	if mmc rescan; then
+		if test ${doraucboot} = 1; then
+			run raucinit;
+		fi;
 		if run loadimage; then
 			run mmcboot;
 		else
@@ -17,7 +22,7 @@ loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
 loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
 mmcargs=
 	setenv bootargs console=${console}
-	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
+	root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw
 mmcautodetect=yes
 mmcboot=
 	echo Booting from mmc ...;
Signature · 1 line
2.25.1