Skip to contentSkip to conversation

phycore_imx8mm: Switch to using env text files

PATCH Superseded Yunus Bas 2 participants 7 messages Nov 22, 2024 – Dec 3, 2024 Arm i.MX and Layerscape

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yunus Bas

author
#0 lore raw

PATCH 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  | 52 +++++++++++++++++++
 include/configs/phycore_imx8mm.h              | 46 ----------------
 2 files changed, 52 insertions(+), 46 deletions(-)
 create mode 100644 board/phytec/phycore_imx8mm/phycore_imx8mm.env
board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +52 -0
new file mode 100644
index 00000000000..b2f61843995
@@ -0,0 +1,52 @@
+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
+sd_dev=1
+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
#3 lore raw

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

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 2058bf59235..1073e1327e6 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
author
#1 lore raw

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

In reply to Yunus Bas

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 b2f61843995..2058bf59235 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 5e59efe5649..c8fbcc910d8 100644
@@ -30,8 +30,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
#5 lore raw
In reply to Yunus Bas

Hi Yunus,

please use get_maintainer script to get a list of people to send (a copy of) the patches to. Usually Maintainers are put in To: field and reviewers Cc:

Additionally, I suggest using a cover letter to summarize the changes made in this patch series.

Quoted 59 lines · Yunus Bas

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  | 52 +++++++++++++++++++ include/configs/phycore_imx8mm.h              | 46 ----------------

 2 files changed, 52 insertions(+), 46 deletions(-)

 create mode 100644 board/phytec/phycore_imx8mm/phycore_imx8mm.env

board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +34 -0
new file mode 100644
index 00000000000..b2f61843995
@@ -0,0 +1,52 @@
+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;

board/phytec/phycore_imx8mm/phycore_imx8mm.env line 44

Quoted 10 lines
board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +10 -0
+	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
+sd_dev=1

This unexplained change snuck in; at least I don't see sd_dev defined before. Please update commit description or remove it.

Yannic

Quoted 65 lines
board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +8 -0
+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 -0
index e74a3f184c6..20e2ab832ee 100644
@@ -20,52 +20,6 @@
  /* For RAW image gives a error info not panic */
  #endif

include/configs/phycore_imx8mm.h +0 -46
-#define CFG_EXTRA_ENV_SETTINGS \
-	"image=Image\0" \
-	"console=ttymxc2,115200\0" \
-	"fdt_addr=0x48000000\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
-	"ip_dyn=yes\0" \
-	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
-	"mmcpart=1\0" \
-	"mmcroot=2\0" \
-	"update_offset=0x42\0" \
-	"update_filename=flash.bin\0" \
-	"update_bootimg="						\
-		"mmc dev ${mmcdev} ; "		\
-		"if dhcp ${loadaddr} ${update_filepath}/${update_filename} ; then "	\
-		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
-		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ; "	\
-		"fi\0" \
-	"mmcautodetect=yes\0" \
-	"mmcargs=setenv bootargs console=${console} " \
-		"root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw\0" \
-	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
-	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
-	"mmcboot=echo Booting from mmc ...; " \
-		"run mmcargs; " \
-		"if run loadfdt; then " \
-			"booti ${loadaddr} - ${fdt_addr}; " \
-		"else " \
-			"echo WARN: Cannot load the DT; " \
-		"fi;\0 " \
-	"nfsroot=/nfs\0" \
-	"netargs=setenv bootargs console=${console} root=/dev/nfs ip=dhcp " \
-		"nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-	"netboot=echo Booting from net ...; " \
-		"run netargs; " \
-		"if test ${ip_dyn} = yes; then " \
-			"setenv get_cmd dhcp; " \
-		"else " \
-			"setenv get_cmd tftp; " \
-		"fi; " \
-		"${get_cmd} ${loadaddr} ${image}; " \
-		"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
-			"booti ${loadaddr} - ${fdt_addr}; " \
-		"else " \
-			"echo WARN: Cannot load the DT; " \
-		"fi;\0" \
-

 /* Link Definitions */

 #define CFG_SYS_INIT_RAM_ADDR 0x40000000

Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] phycore_imx8mm: Move default bootcmd to board env

In reply to Yunus Bas
Quoted 3 lines · Yunus Bas

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

Quoted 37 lines

---
 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 b2f61843995..2058bf59235 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 -0
index 5e59efe5649..c8fbcc910d8 100644
@@ -30,8 +30,6 @@ CONFIG_FIT=y

 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_SYSTEM_SETUP=y

configs/phycore-imx8mm_defconfig +0 -2
-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

Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] board: phytec: phycore_imx8mm: Add RAUC boot logic to environment

In reply to Yunus Bas
Quoted 3 lines · Yunus Bas

Add RAUC boot logic to the environment.

Quoted 30 lines

---
 board/phytec/phycore_imx8mm/phycore_imx8mm.env | 7 ++++++-

 1 file changed, 6 insertions(+), 1 deletion(-)
board/phytec/phycore_imx8mm/phycore_imx8mm.env +2 -0
index 2058bf59235..1073e1327e6 100644
@@ -1,6 +1,11 @@
+#include <env/phytec/rauc.env>
+

 bootcmd=
  mmc dev ${mmcdev};
  if mmc rescan; then

board/phytec/phycore_imx8mm/phycore_imx8mm.env +3 -0
+		if test ${doraucboot} = 1; then
+			run raucinit;
+		fi;

  if run loadimage; then
  run mmcboot;
  else

board/phytec/phycore_imx8mm/phycore_imx8mm.env +0 -0
@@ -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}

board/phytec/phycore_imx8mm/phycore_imx8mm.env +1 -1
-	root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
+	root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw

 mmcautodetect=yes
 mmcboot=
  echo Booting from mmc ...;

author
#6 lore raw
In reply to Yannic Moog

Hi Yannic,

Am Montag, dem 25.11.2024 um 09:15 +0000 schrieb Yannic Moog:

Quoted 5 lines

Hi Yunus,

please use get_maintainer script to get a list of people to send (a copy of) the patches to.
Usually Maintainers are put in To: field and reviewers Cc:

Will do, thank you for the note.

Quoted 3 lines

Additionally, I suggest using a cover letter to summarize the changes made in this patch series.

I don't think a cover letter is needed here, since the changes are trivial and also mentioned in the commit description.

Quoted 71 lines · Yunus Bas
Quoted 69 lines

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  | 52
+++++++++++++++++++
 include/configs/phycore_imx8mm.h              | 46 --------------- -

 2 files changed, 52 insertions(+), 46 deletions(-)

 create mode 100644 board/phytec/phycore_imx8mm/phycore_imx8mm.env

board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +40 -0
new file mode 100644
index 00000000000..b2f61843995
@@ -0,0 +1,52 @@
+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
Quoted 8 lines

board/phytec/phycore_imx8mm/phycore_imx8mm.env line 44

Quoted 4 lines
board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +4 -0
+		echo WARN: Cannot load the DT;
+	fi;
+nfsroot=/srv/nfs
+sd_dev=1

This unexplained change snuck in; at least I don't see sd_dev defined before. Please update commit
description or remove it.

Again, thank you for your attention. This one slipped in. I'll update the patch and send a v2.

Regards
Yunus

Quoted 79 lines

Yannic

Quoted 75 lines
board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +3 -0
+update_bootimg=
+	mmc dev ${mmcdev};
+	if dhcp ${loadaddr} ${update_filepath}/${update_filename};

then

board/phytec/phycore_imx8mm/phycore_imx8mm.env new file +5 -0
+		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 -0
index e74a3f184c6..20e2ab832ee 100644
@@ -20,52 +20,6 @@
  /* For RAW image gives a error info not panic */
  #endif

include/configs/phycore_imx8mm.h +0 -12
-#define CFG_EXTRA_ENV_SETTINGS \
-	"image=Image\0" \
-	"console=ttymxc2,115200\0" \
-	"fdt_addr=0x48000000\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
-	"ip_dyn=yes\0" \
-	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
-	"mmcpart=1\0" \
-	"mmcroot=2\0" \
-	"update_offset=0x42\0" \
-	"update_filename=flash.bin\0" \
-
	"update_bootimg="						\
include/configs/phycore_imx8mm.h +0 -2
-		"mmc dev ${mmcdev} ; "		\
-		"if dhcp ${loadaddr}

${update_filepath}/${update_filename} ; then " \

include/configs/phycore_imx8mm.h +0 -1
-		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD

block size */ \

include/configs/phycore_imx8mm.h +0 -1
-		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ;

" \

include/configs/phycore_imx8mm.h +0 -4
-		"fi\0" \
-	"mmcautodetect=yes\0" \
-	"mmcargs=setenv bootargs console=${console} " \
-		"root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait

rw\0" \

include/configs/phycore_imx8mm.h +0 -1
-	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr}

${image}\0" \

include/configs/phycore_imx8mm.h +0 -1
-	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr}

${fdt_file}\0" \

include/configs/phycore_imx8mm.h +0 -9
-	"mmcboot=echo Booting from mmc ...; " \
-		"run mmcargs; " \
-		"if run loadfdt; then " \
-			"booti ${loadaddr} - ${fdt_addr}; " \
-		"else " \
-			"echo WARN: Cannot load the DT; " \
-		"fi;\0 " \
-	"nfsroot=/nfs\0" \
-	"netargs=setenv bootargs console=${console} root=/dev/nfs

ip=dhcp " \

include/configs/phycore_imx8mm.h +0 -15
-		"nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-	"netboot=echo Booting from net ...; " \
-		"run netargs; " \
-		"if test ${ip_dyn} = yes; then " \
-			"setenv get_cmd dhcp; " \
-		"else " \
-			"setenv get_cmd tftp; " \
-		"fi; " \
-		"${get_cmd} ${loadaddr} ${image}; " \
-		"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
-			"booti ${loadaddr} - ${fdt_addr}; " \
-		"else " \
-			"echo WARN: Cannot load the DT; " \
-		"fi;\0" \
-

 /* Link Definitions */

 #define CFG_SYS_INIT_RAM_ADDR 0x40000000

Signature · 5 lines
PHYTEC Messtechnik GmbH | Barcelona-Allee 1 | 55129 Mainz, Germany

Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber,
Dipl.-Ing. (FH) Marcus Lickes | Handelsregister Mainz HRB 4656 |
Finanzamt Mainz | St.Nr.: 26/665/00608, USt-ID: DE 149059855