Skip to contentSkip to conversation

Update phyCORE-i.MX93 environment

PATCH Applied Primoz Fiser 2 participants 8 messages Apr 10, 2025 – Apr 11, 2025 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

cover Update phyCORE-i.MX93 environment

Update PHYTEC phyCORE-i.MX93 environment in mainline U-Boot with changes from the downstream fork to get back in sync.

Leonard Anderweit (1):
board: phycore-imx93: env: Move bootcmd from defconfig to env

Martin Schwan (1):
board: phycore-imx93: env: Add common RAUC boot logic

Primoz Fiser (4):
board: phycore-imx93: env: Move fdt and bootenv addresses
board: phycore-imx93: env: Add optargs to environment
board: phycore-imx93: env: Add prepare_mcore to environment
board: phycore-imx93: env: Add option to disable bootenv.txt import

 board/phytec/phycore_imx93/phycore_imx93.env | 36 +++++++++++++++-----
 configs/imx93-phycore_defconfig              |  1 -
 2 files changed, 27 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/6 board: phycore-imx93: env: Move fdt and bootenv addresses

Move the load addresses for FDTs and bootenv.txt to create space for loading OS image. Otherwise, parts of the image might get corrupted. and the following boot error will be present:

ERROR: FDT image overlaps OS image (OS=80400000..832a0000)

Moreover, this commit also syncs addresses with downstream PHYTEC u-boot for i.MX93 in preparation for FIT image support in the future.

---
 board/phytec/phycore_imx93/phycore_imx93.env | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
board/phytec/phycore_imx93/phycore_imx93.env +3 -3
index ab65cfce5fd1..9c70c40b2fca 100644
@@ -4,9 +4,9 @@
 
 image=Image
 console=ttyLP0
-fdt_addr_r=0x83000000
-fdtoverlay_addr_r=0x830c0000
-bootenv_addr_r=0x83500000
+fdt_addr_r=0x90000000
+fdtoverlay_addr_r=0x900c0000
+bootenv_addr_r=0x90500000
 fdtfile=CONFIG_DEFAULT_FDT_FILE
 ip_dyn=yes
 mmcdev=CONFIG_SYS_MMC_ENV_DEV
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/6 board: phycore-imx93: env: Add optargs to environment

In reply to Primoz Fiser

Add the optargs variable so we can set optional arguments while booting.

---
 board/phytec/phycore_imx93/phycore_imx93.env | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/phytec/phycore_imx93/phycore_imx93.env +2 -2
index 9c70c40b2fca..36bf3fefa0ba 100644
@@ -14,7 +14,7 @@ mmcpart=1
 mmcroot=2
 mmcautodetect=yes
 mmcargs=setenv bootargs console=${console},${baudrate} earlycon
-	root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw
+	root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw ${optargs}
 loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
 loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
 mmcboot=
@@ -31,7 +31,7 @@ mmcboot=
 	fi;
 nfsroot=/nfs
 netargs=setenv bootargs console=${console},${baudrate} earlycon
-	root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
+	root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp ${optargs}
 netboot=
 	echo Booting from net ...;
 	run netargs;
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/6 board: phycore-imx93: env: Add prepare_mcore to environment

In reply to Primoz Fiser

Add prepare_mcore script to environment to be able to notify Linux about the state of M33 core via the kernel cmdline by appending to ${optargs}.

---
 board/phytec/phycore_imx93/phycore_imx93.env | 1 +
 1 file changed, 1 insertion(+)
board/phytec/phycore_imx93/phycore_imx93.env +1 -0
index 36bf3fefa0ba..52c234a4206c 100644
@@ -9,6 +9,7 @@ fdtoverlay_addr_r=0x900c0000
 bootenv_addr_r=0x90500000
 fdtfile=CONFIG_DEFAULT_FDT_FILE
 ip_dyn=yes
+prepare_mcore=setenv optargs "${optargs} clk-imx93.mcore_booted"
 mmcdev=CONFIG_SYS_MMC_ENV_DEV
 mmcpart=1
 mmcroot=2
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/6 board: phycore-imx93: env: Add option to disable bootenv.txt import

In reply to Primoz Fiser

Add support for disabling external environment import (bootenv.txt) by setting the ${no_bootenv} environment variable.

---
 board/phytec/phycore_imx93/phycore_imx93.env | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
board/phytec/phycore_imx93/phycore_imx93.env +8 -4
index 52c234a4206c..d0694f23269a 100644
@@ -20,8 +20,10 @@ loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
 loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
 mmcboot=
 	echo Booting from mmc ...;
-	if run mmc_load_bootenv; then
-		env import -t ${bootenv_addr_r} ${filesize};
+	if test ${no_bootenv} = 0; then
+		if run mmc_load_bootenv; then
+			env import -t ${bootenv_addr_r} ${filesize};
+		fi;
 	fi;
 	run mmcargs;
 	if run loadfdt; then
@@ -41,8 +43,10 @@ netboot=
 	else
 		setenv get_cmd tftp;
 	fi;
-	if run net_load_bootenv; then
-		env import -t ${bootenv_addr_r} ${filesize};
+	if test ${no_bootenv} = 0; then
+		if run net_load_bootenv; then
+			env import -t ${bootenv_addr_r} ${filesize};
+		fi;
 	fi;
 	${get_cmd} ${loadaddr} ${image};
 	if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/6 board: phycore-imx93: env: Move bootcmd from defconfig to env

In reply to Primoz Fiser

From: Leonard Anderweit <[email protected]>

Move the default bootcmd from the defconfig to the board environment in preparation for RAUC support. No change in functionality.

---
 board/phytec/phycore_imx93/phycore_imx93.env | 9 +++++++++
 configs/imx93-phycore_defconfig              | 1 -
 2 files changed, 9 insertions(+), 1 deletion(-)
board/phytec/phycore_imx93/phycore_imx93.env +9 -0
index d0694f23269a..3a36597cae84 100644
@@ -2,6 +2,15 @@
 
 #include <env/phytec/overlays.env>
 
+bootcmd=
+	mmc dev ${mmcdev};
+	if mmc rescan; then
+		if run loadimage; then
+			run mmcboot;
+		else
+			run netboot;
+		fi;
+	fi;
 image=Image
 console=ttyLP0
 fdt_addr_r=0x90000000
configs/imx93-phycore_defconfig +0 -1
index cf9800118ac1..e99676d4f62b 100644
@@ -35,7 +35,6 @@ CONFIG_REMAKE_ELF=y
 # CONFIG_ANDROID_BOOT_IMAGE is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_SYSTEM_SETUP=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.34.1
#6 lore raw

PATCH 6/6 board: phycore-imx93: env: Add common RAUC boot logic

In reply to Primoz Fiser

From: Martin Schwan <[email protected]>

Add a common RAUC boot logic environment and make use of it in the i.MX93 environment. The RAUC boot logic is deactivated by default and can be activated by setting "doraucboot" to "1".

---
 board/phytec/phycore_imx93/phycore_imx93.env | 4 ++++
 1 file changed, 4 insertions(+)
board/phytec/phycore_imx93/phycore_imx93.env +4 -0
index 3a36597cae84..3b2f30118e76 100644
@@ -1,10 +1,14 @@
 /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
 
+#include <env/phytec/rauc.env>
 #include <env/phytec/overlays.env>
 
 bootcmd=
 	mmc dev ${mmcdev};
 	if mmc rescan; then
+		if test ${doraucboot} = 1; then
+			run raucinit;
+		fi;
 		if run loadimage; then
 			run mmcboot;
 		else
Signature · 1 line
2.34.1
reviewer Applied
#7 lore raw
In reply to Primoz Fiser
Quoted 7 lines · Primoz Fiser

Update PHYTEC phyCORE-i.MX93 environment in mainline U-Boot with changes from the downstream fork to get back in sync.

Leonard Anderweit (1):
board: phycore-imx93: env: Move bootcmd from defconfig to env

Quoted 8 lines

Martin Schwan (1):
board: phycore-imx93: env: Add common RAUC boot logic

Primoz Fiser (4):
board: phycore-imx93: env: Move fdt and bootenv addresses
board: phycore-imx93: env: Add optargs to environment
board: phycore-imx93: env: Add prepare_mcore to environment
board: phycore-imx93: env: Add option to disable bootenv.txt import

Applied the series, thanks.