public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: pali@kernel.org, Tom Rini <trini@konsulko.com>,
	Heiko Schocher <hs@denx.de>
Subject: [PATCH v2] powerpc/mpc85xx: use board env file for socrates board
Date: Fri, 27 Jan 2023 06:50:52 +0100	[thread overview]
Message-ID: <20230127055052.356374-1-hs@denx.de> (raw)

as Tom suggested get rid of CFG_EXTRA_ENV_SETTINGS and
enable CONFIG_ENV_SOURCE_FILE and use text file

board/socrates/socrates.env

which contains the default environment. While at it,
cleanup the default Environment.

Signed-off-by: Heiko Schocher <hs@denx.de>
Suggested-by: Tom Rini <trini@konsulko.com>

---
This patch is a follow up as requested from Tom to socrates series
posted here:

https://lists.denx.de/pipermail/u-boot/2023-January/506030.html


Changes in v2:
add changes requested from Tom:
remove baudrate, bootcmd, bootdelay, mtdids and mtdpart setting in env file
remove CONFIG_ENV_SOURCE_FILE

 board/socrates/socrates.env | 46 +++++++++++++++++++++++++++
 configs/socrates_defconfig  |  2 +-
 include/configs/socrates.h  | 62 -------------------------------------
 3 files changed, 47 insertions(+), 63 deletions(-)
 create mode 100644 board/socrates/socrates.env

diff --git a/board/socrates/socrates.env b/board/socrates/socrates.env
new file mode 100644
index 0000000000..82e7ff8386
--- /dev/null
+++ b/board/socrates/socrates.env
@@ -0,0 +1,46 @@
+addcons=setenv bootargs $bootargs console=$consdev,$baudrate
+addip=setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off panic=1
+addmtd=setenv bootargs ${bootargs} ${mtdparts}
+boot_nor=run ramargs addcons addmtd;
+	if test -n ${RescueSystemJumper} ;then
+		run rescueargs;
+	else
+		if imi ${system1_addr};then
+			bootm ${system1_addr};
+		else
+			setenv RescueSystemJumper 1;run rescueargs;
+		fi;
+	fi;
+	if imi ${system2_addr}; then
+		bootm ${system2_addr};
+	fi;
+boot_usb=usb start;
+	ext2load usb 0 ${usb_boot_script_r} ${usb_boot_script};
+	if imi ${usb_boot_script_r};then
+		source ${usb_boot_script_r}#conf;
+	fi;
+clean_data=era FFA00000 FFFEFFFF
+clean_uboot_env=protect off FFF00000 FFF3FFFF;era FFF00000 FFF3FFFF
+consdev=ttyS0
+ethprime=eTSEC0
+initrd_high=0x03000000
+loadaddr=0x02000000
+loads_echo=1
+netdev=eth0
+nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath
+preboot=echo;echo Welcome on the Socrates Board;echo
+ramargs=setenv bootargs root=/dev/ram rw
+rescueargs=setenv bootargs $bootargs RescueSystemJumper=$RescueSystemJumper
+rootpath=/opt/poky/3.1.17
+system1_addr=FE000000
+system1_file=system1.itb
+system2_addr=FED00000
+system2_file=system2.itb
+uboot_addr=FFF40000
+uboot_file=u-boot.bin
+update_system1=tftp 110000 ${system1_file};era ${system1_addr} FECFFFFF;cp.b 110000 ${system1_addr} ${filesize};setenv filesize
+update_system2=tftp 110000 ${system2_file};era ${system2_addr} FF9FFFFF;cp.b 110000 ${system2_addr} ${filesize};setenv filesize
+update_uboot=tftp 110000 ${uboot_file};protect off ${uboot_addr} FFFFFFFF;era ${uboot_addr} FFFFFFFF;cp.b 110000 ${uboot_addr} ${filesize};setenv filesize
+usb_boot_script=/boot/socrates_boot.autoscr
+usb_boot_script_r=100000
+verify=1
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig
index e03c971b5e..312fda9ad0 100644
--- a/configs/socrates_defconfig
+++ b/configs/socrates_defconfig
@@ -31,7 +31,7 @@ CONFIG_BOOT_RETRY=y
 CONFIG_BOOT_RETRY_TIME=120
 CONFIG_RESET_TO_RETRY=y
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run boot_nor"
+CONFIG_BOOTCOMMAND="run boot_usb;run boot_nor"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="echo;echo Welcome on the ABB Socrates Board;echo"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
diff --git a/include/configs/socrates.h b/include/configs/socrates.h
index 305914de85..64cc17ca7c 100644
--- a/include/configs/socrates.h
+++ b/include/configs/socrates.h
@@ -109,68 +109,6 @@
  */
 #define CFG_SYS_BOOTMAPSZ	(8 << 20)	/* Initial Memory map for Linux	*/
 
-#define SOCRATES_ENV_MTD \
-	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
-	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
-	"addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"
-
-#define	CFG_EXTRA_ENV_SETTINGS					\
-	"netdev=eth0\0"							\
-	"consdev=ttyS0\0"						\
-	"initrd_high=0x03000000\0"					\
-	"uboot_file=/home/tftp/syscon3/u-boot.bin\0"			\
-	"bootfile=/home/tftp/syscon3/uImage\0"				\
-	"fdt_file=/home/tftp/syscon3/socrates.dtb\0"			\
-	"initrd_file=/home/tftp/syscon3/uinitrd.gz\0"			\
-	"uboot_addr=FFF40000\0"						\
-	"kernel_addr=FE000000\0"					\
-	"fdt_addr=FE1E0000\0"						\
-	"ramdisk_addr=FE200000\0"					\
-	"fdt_addr_r=B00000\0"						\
-	"kernel_addr_r=200000\0"					\
-	"ramdisk_addr_r=400000\0"					\
-	"rootpath=/opt/eldk/ppc_85xxDP\0"				\
-	"ramargs=setenv bootargs root=/dev/ram rw\0"			\
-	"nfsargs=setenv bootargs root=/dev/nfs rw "			\
-		"nfsroot=$serverip:$rootpath\0"				\
-	"addcons=setenv bootargs $bootargs "				\
-		"console=$consdev,$baudrate\0"				\
-	"addip=setenv bootargs $bootargs "				\
-		"ip=$ipaddr:$serverip:$gatewayip:$netmask"		\
-		":$hostname:$netdev:off panic=1\0"			\
-	"boot_nor=run ramargs addcons addmtd;"				\
-		"bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"	\
-	"net_nfs=tftp ${kernel_addr_r} ${bootfile}; "			\
-		"tftp ${fdt_addr_r} ${fdt_file}; "			\
-		"run nfsargs addip addcons addmtd;"			\
-		"bootm ${kernel_addr_r} - ${fdt_addr_r}\0"		\
-	"update_uboot=tftp 100000 ${uboot_file};"			\
-		"protect off ${uboot_addr} ffffffff;"			\
-		"era ${uboot_addr}  ffffffff;"				\
-		"cp.b 100000 ${uboot_addr}  ${filesize};"		\
-		"setenv filesize;saveenv\0"				\
-	"update_kernel=tftp 100000 ${bootfile};"			\
-		"era fe000000 fe1dffff;"				\
-		"cp.b 100000 fe000000 ${filesize};"			\
-		"setenv filesize;saveenv\0"				\
-	"update_fdt=tftp 100000 ${fdt_file};"				\
-		"era fe1e0000 fe1fffff;"				\
-		"cp.b 100000 fe1e0000 ${filesize};"			\
-		"setenv filesize;saveenv\0"				\
-	"update_initrd=tftp 100000 ${initrd_file};"			\
-		"era fe200000 fe9fffff;"				\
-		"cp.b 100000 fe200000 ${filesize};"			\
-		"setenv filesize;saveenv\0"				\
-	"clean_data=era fea00000 fff5ffff\0"				\
-	"usbargs=setenv bootargs root=/dev/sda1 rw\0"			\
-	"load_usb=usb start;"						\
-		"ext2load usb 0:1 ${kernel_addr_r} /boot/uImage\0"	\
-	"boot_usb=run load_usb usbargs addcons;"			\
-		"bootm ${kernel_addr_r} - ${fdt_addr};"			\
-		"bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"	\
-	SOCRATES_ENV_MTD \
-	""
-
 #define CFG_ENV_FLAGS_LIST_STATIC "ethaddr:mw,eth1addr:mw,system1_addr:xw,serial#:sw,ethact:sw,ethprime:sw"
 
 /* pass open firmware flat tree */
-- 
2.37.3


             reply	other threads:[~2023-01-27  5:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  5:50 Heiko Schocher [this message]
2023-01-27 13:22 ` [PATCH v2] powerpc/mpc85xx: use board env file for socrates board Tom Rini
2023-02-09 21:33 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127055052.356374-1-hs@denx.de \
    --to=hs@denx.de \
    --cc=pali@kernel.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox