[PATCH 5/8] opos6uldev: Migrate to using CONFIG_EXTRA_ENV_TEXT

Tom Rini trini at konsulko.com
Tue Jun 14 04:57:34 CEST 2022


Move the environment text over from being set via
CONFIG_EXTRA_ENV_SETTINGS in include/configs/opos6uldev.h and over to
plain text in board/armadeus/opos6uldev/opos6uldev.env.  This lets us
manage env_version without a CONFIG variable.

Cc: Sébastien Szymanski <sebastien.szymanski at armadeus.com>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 board/armadeus/opos6uldev/opos6uldev.env | 133 +++++++++++++++++++++++
 include/configs/opos6uldev.h             | 131 ----------------------
 2 files changed, 133 insertions(+), 131 deletions(-)
 create mode 100644 board/armadeus/opos6uldev/opos6uldev.env

diff --git a/board/armadeus/opos6uldev/opos6uldev.env b/board/armadeus/opos6uldev/opos6uldev.env
new file mode 100644
index 000000000000..585f28ca8587
--- /dev/null
+++ b/board/armadeus/opos6uldev/opos6uldev.env
@@ -0,0 +1,133 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+/*
+ * Copyright (C) 2017 Armadeus Systems
+ */
+
+/* Environment is stored in the eMMC boot partition */
+
+env_version=100
+consoledev=ttymxc0
+board_name=opos6ul
+fdt_addr=0x88000000
+fdt_high=0xffffffff
+fdt_name=opos6uldev
+initrd_high=0xffffffff
+ip_dyn=yes
+stdin=serial
+stdout=serial
+stderr=serial
+mmcdev=0
+mmcpart=2
+mmcroot=/dev/mmcblk0p2 ro
+mmcrootfstype=ext4 rootwait
+kernelimg=opos6ul-linux.bin
+splashpos=0,0
+splashimage=CONFIG_SYS_LOAD_ADDR
+videomode=video=ctfb:x:800,y:480,depth:18,pclk:33033,le:96,ri:96,up:20,lo:21,hs:64,vs:4,sync:0,vmode:0
+check_env=if test -n ${flash_env_version};
+	then env default env_version;
+	else env set flash_env_version ${env_version}; env save;
+	fi;
+	if itest ${flash_env_version} != ${env_version}; then
+		echo "*** Warning - Environment version
+		 change suggests: run flash_reset_env; reset";
+		env default flash_reset_env;
+	else exit; fi; 
+flash_reset_env=env default -f -a && saveenv &&
+	echo Environment variables erased!
+download_uboot_spl=tftpboot ${loadaddr} ${board_name}-u-boot.spl
+flash_uboot_spl=
+	if mmc dev 0 1; then
+		setexpr sz ${filesize} / 0x200;
+		setexpr sz ${sz} + 1;
+		if mmc write ${loadaddr} 0x2 ${sz}; then
+			echo Flashing of U-boot SPL succeed;
+		else echo Flashing of U-boot SPL failed;
+		fi;
+	fi;
+download_uboot_img=tftpboot ${loadaddr} ${board_name}-u-boot.img
+flash_uboot_img=
+	if mmc dev 0 1; then
+		setexpr sz ${filesize} / 0x200;
+		setexpr sz ${sz} + 1;
+		if mmc write ${loadaddr} 0x8a ${sz}; then
+			echo Flashing of U-boot image succeed;
+		else echo Flashing of U-boot image failed;
+		fi;
+	fi;
+update_uboot=run download_uboot_spl flash_uboot_spl
+	download_uboot_img flash_uboot_img
+download_kernel=tftpboot ${loadaddr} ${kernelimg}
+flash_kernel=
+	if ext4write mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} ${filesize}; then
+		echo kernel update succeed;
+		else echo kernel update failed;
+	fi;
+update_kernel=run download_kernel flash_kernel
+download_dtb=tftpboot ${fdt_addr} imx6ul-${fdt_name}.dtb
+flash_dtb=
+	if ext4write mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb ${filesize}; then
+		echo dtb update succeed;
+		else echo dtb update in failed;
+	fi;
+update_dtb=run download_dtb flash_dtb
+download_rootfs=tftpboot ${loadaddr} ${board_name}-rootfs.ext4
+flash_rootfs=
+	if mmc dev 0 0; then
+		setexpr nbblocks ${filesize} / 0x200;
+		setexpr nbblocks ${nbblocks} + 1;
+		if mmc write ${loadaddr} 0x40800 ${nbblocks}; then
+			echo Flashing of rootfs image succeed;
+		else echo Flashing of rootfs image failed;
+		fi;
+	fi;
+update_rootfs=run download_rootfs flash_rootfs
+flash_failsafe=
+	if mmc dev 0 0; then
+		setexpr nbblocks ${filesize} / 0x200;
+		setexpr nbblocks ${nbblocks} + 1;
+		if mmc write ${loadaddr} 0x800 ${nbblocks}; then
+			echo Flashing of rootfs image in failsafe partition succeed;
+		else echo Flashing of rootfs image in failsafe partition failed;
+		fi;
+	fi;
+update_failsafe=run download_rootfs flash_failsafe
+download_userdata=tftpboot ${loadaddr} ${board_name}-user_data.ext4
+flash_userdata=
+	if mmc dev 0 0; then
+		setexpr nbblocks ${filesize} / 0x200;
+		setexpr nbblocks ${nbblocks} + 1;
+		if mmc write ${loadaddr} 0 ${nbblocks}; then
+			echo Flashing of user_data image succeed;
+		else echo Flashing of user_data image failed;
+		fi;
+	fi;
+update_userdata=run download_userdata flash_userdata; mmc rescan
+erase_userdata=
+	if mmc dev 0 0; then
+		echo Erasing eMMC User Data partition, no way out...;
+		mw ${loadaddr} 0 0x200000;
+		mmc write ${loadaddr} 0 0x1000;
+		mmc write ${loadaddr} 0x800 0x1000;
+		mmc write ${loadaddr} 0x40800 0x1000;
+		mmc write ${loadaddr} 0x440800 0x1000;
+	fi;
+	mmc rescan
+update_all=run update_rootfs update_uboot
+initargs=setenv bootargs console=${consoledev},${baudrate} ${extrabootargs}
+addipargs=setenv bootargs ${bootargs}
+	ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
+addmmcargs=setenv bootargs ${bootargs} root=${mmcroot}
+	rootfstype=${mmcrootfstype}
+emmcboot=run initargs; run addmmcargs;
+	load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} &&
+	load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb &&
+	bootz ${loadaddr} - ${fdt_addr};
+emmcsafeboot=setenv mmcpart 1; setenv mmcroot /dev/mmcblk0p1 ro; run emmcboot;
+addnfsargs=setenv bootargs ${bootargs} root=/dev/nfs rw
+	nfsroot=${serverip}:${rootpath}
+nfsboot=run initargs; run addnfsargs addipargs;
+	nfs ${loadaddr} ${serverip}:${rootpath}/boot/${kernelimg} &&
+	nfs ${fdt_addr} ${serverip}:${rootpath}/boot/imx6ul-${fdt_name}.dtb &&
+	bootz ${loadaddr} - ${fdt_addr};
diff --git a/include/configs/opos6uldev.h b/include/configs/opos6uldev.h
index 9b89d9e524fd..73fe86f9bab8 100644
--- a/include/configs/opos6uldev.h
+++ b/include/configs/opos6uldev.h
@@ -31,138 +31,7 @@
 /* LCD */
 #define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR
 
-/* Environment is stored in the eMMC boot partition */
-
-#define CONFIG_ENV_VERSION	100
-#define ACFG_CONSOLE_DEV        ttymxc0
 #define CONFIG_SYS_AUTOLOAD     "no"
 #define CONFIG_ROOTPATH         "/tftpboot/opos6ul-root"
 
-#define CONFIG_EXTRA_ENV_SETTINGS \
-	"env_version="          __stringify(CONFIG_ENV_VERSION)         "\0"                    \
-	"consoledev="           __stringify(ACFG_CONSOLE_DEV)           "\0"                    \
-	"board_name=opos6ul\0"                                                                  \
-	"fdt_addr=0x88000000\0"                                                                 \
-	"fdt_high=0xffffffff\0"                                                                 \
-	"fdt_name=opos6uldev\0"                                                                 \
-	"initrd_high=0xffffffff\0"                                                              \
-	"ip_dyn=yes\0"                                                                          \
-	"stdin=serial\0"                                                                        \
-	"stdout=serial\0"                                                                       \
-	"stderr=serial\0"                                                                       \
-	"mmcdev=0\0"                                                                            \
-	"mmcpart=2\0"                                                                           \
-	"mmcroot=/dev/mmcblk0p2 ro\0"                                                           \
-	"mmcrootfstype=ext4 rootwait\0"                                                         \
-	"kernelimg=opos6ul-linux.bin\0"                                                         \
-	"splashpos=0,0\0"									\
-	"splashimage="		__stringify(CONFIG_SYS_LOAD_ADDR)	"\0"			\
-	"videomode=video=ctfb:x:800,y:480,depth:18,pclk:33033,le:96,ri:96,up:20,lo:21,hs:64,vs:4,sync:0,vmode:0\0" \
-	"check_env=if test -n ${flash_env_version}; "                                           \
-		"then env default env_version; "                                                \
-		"else env set flash_env_version ${env_version}; env save; "                     \
-		"fi; "                                                                          \
-		"if itest ${flash_env_version} != ${env_version}; then "                        \
-			"echo \"*** Warning - Environment version"                              \
-			" change suggests: run flash_reset_env; reset\"; "                      \
-			"env default flash_reset_env; "                                         \
-		"else exit; fi; \0"                                                             \
-	"flash_reset_env=env default -f -a && saveenv && "                                      \
-		"echo Environment variables erased!\0"                                          \
-	"download_uboot_spl=tftpboot ${loadaddr} ${board_name}-u-boot.spl\0"                    \
-	"flash_uboot_spl="                                                                      \
-		"if mmc dev 0 1; then "                                                         \
-			"setexpr sz ${filesize} / 0x200; "                                      \
-			"setexpr sz ${sz} + 1; "                                                \
-			"if mmc write ${loadaddr} 0x2 ${sz}; then "                             \
-				"echo Flashing of U-boot SPL succeed; "                         \
-			"else echo Flashing of U-boot SPL failed; "                             \
-			"fi; "                                                                  \
-		"fi;\0"                                                                         \
-	"download_uboot_img=tftpboot ${loadaddr} ${board_name}-u-boot.img\0"                    \
-	"flash_uboot_img="                                                                      \
-		"if mmc dev 0 1; then "                                                         \
-			"setexpr sz ${filesize} / 0x200; "                                      \
-			"setexpr sz ${sz} + 1; "                                                \
-			"if mmc write ${loadaddr} 0x8a ${sz}; then "                            \
-				"echo Flashing of U-boot image succeed; "                       \
-			"else echo Flashing of U-boot image failed; "                           \
-			"fi; "                                                                  \
-		"fi;\0"                                                                         \
-	"update_uboot=run download_uboot_spl flash_uboot_spl "                                  \
-		"download_uboot_img flash_uboot_img\0"                                          \
-	"download_kernel=tftpboot ${loadaddr} ${kernelimg}\0"                                   \
-	"flash_kernel="                                                                         \
-		"if ext4write mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} ${filesize}; then "    \
-			"echo kernel update succeed; "                                          \
-			"else echo kernel update failed; "                                      \
-		"fi;\0"                                                                         \
-	"update_kernel=run download_kernel flash_kernel\0"                                      \
-	"download_dtb=tftpboot ${fdt_addr} imx6ul-${fdt_name}.dtb\0"                            \
-	"flash_dtb="                                                                            \
-		"if ext4write mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb ${filesize}; then " \
-			"echo dtb update succeed; "                                             \
-			"else echo dtb update in failed; "                                      \
-		"fi;\0"                                                                         \
-	"update_dtb=run download_dtb flash_dtb\0"                                               \
-	"download_rootfs=tftpboot ${loadaddr} ${board_name}-rootfs.ext4\0"                      \
-	"flash_rootfs="                                                                         \
-		"if mmc dev 0 0; then "                                                         \
-			"setexpr nbblocks ${filesize} / 0x200; "                                \
-			"setexpr nbblocks ${nbblocks} + 1; "                                    \
-			"if mmc write ${loadaddr} 0x40800 ${nbblocks}; then "                   \
-				"echo Flashing of rootfs image succeed; "                       \
-			"else echo Flashing of rootfs image failed; "                           \
-			"fi; "                                                                  \
-		"fi;\0"                                                                         \
-	"update_rootfs=run download_rootfs flash_rootfs\0"                                      \
-	"flash_failsafe="                                                                       \
-		"if mmc dev 0 0; then "                                                         \
-			"setexpr nbblocks ${filesize} / 0x200; "                                \
-			"setexpr nbblocks ${nbblocks} + 1; "                                    \
-			"if mmc write ${loadaddr} 0x800 ${nbblocks}; then "                     \
-				"echo Flashing of rootfs image in failsafe partition succeed; " \
-			"else echo Flashing of rootfs image in failsafe partition failed; "     \
-			"fi; "                                                                  \
-		"fi;\0"                                                                         \
-	"update_failsafe=run download_rootfs flash_failsafe\0"                                  \
-	"download_userdata=tftpboot ${loadaddr} ${board_name}-user_data.ext4\0"                 \
-	"flash_userdata="                                                                       \
-		"if mmc dev 0 0; then "                                                         \
-			"setexpr nbblocks ${filesize} / 0x200; "                                \
-			"setexpr nbblocks ${nbblocks} + 1; "                                    \
-			"if mmc write ${loadaddr} 0 ${nbblocks}; then "                         \
-				"echo Flashing of user_data image succeed; "                    \
-			"else echo Flashing of user_data image failed; "                        \
-			"fi; "                                                                  \
-		"fi;\0"                                                                         \
-	"update_userdata=run download_userdata flash_userdata; mmc rescan\0"                    \
-	"erase_userdata="                                                                       \
-		"if mmc dev 0 0; then "                                                         \
-			"echo Erasing eMMC User Data partition, no way out...; "                \
-			"mw ${loadaddr} 0 0x200000; "                                           \
-			"mmc write ${loadaddr} 0 0x1000; "                                      \
-			"mmc write ${loadaddr} 0x800 0x1000; "                                  \
-			"mmc write ${loadaddr} 0x40800 0x1000; "                                \
-			"mmc write ${loadaddr} 0x440800 0x1000; "                               \
-		"fi;"                                                                           \
-		"mmc rescan\0"                                                                  \
-	"update_all=run update_rootfs update_uboot\0"						\
-	"initargs=setenv bootargs console=${consoledev},${baudrate} ${extrabootargs}\0"         \
-	"addipargs=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:"                       \
-		"${gatewayip}:${netmask}:${hostname}:eth0:off\0"                                \
-	"addmmcargs=setenv bootargs ${bootargs} root=${mmcroot} "                               \
-		"rootfstype=${mmcrootfstype}\0"                                                 \
-	"emmcboot=run initargs; run addmmcargs; "                                               \
-		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} && "              \
-		"load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb && "    \
-		"bootz ${loadaddr} - ${fdt_addr};\0"                                            \
-	"emmcsafeboot=setenv mmcpart 1; setenv mmcroot /dev/mmcblk0p1 ro; run emmcboot;\0"      \
-	"addnfsargs=setenv bootargs ${bootargs} root=/dev/nfs rw "                              \
-		"nfsroot=${serverip}:${rootpath}\0"                                             \
-	"nfsboot=run initargs; run addnfsargs addipargs; "                                      \
-		"nfs ${loadaddr} ${serverip}:${rootpath}/boot/${kernelimg} && "                 \
-		"nfs ${fdt_addr} ${serverip}:${rootpath}/boot/imx6ul-${fdt_name}.dtb && "       \
-		"bootz ${loadaddr} - ${fdt_addr};\0"
-
 #endif /* __OPOS6ULDEV_CONFIG_H */
-- 
2.25.1



More information about the U-Boot mailing list