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 <h...@denx.de>
Suggested-by: Tom Rini <tr...@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


 board/socrates/socrates.env | 51 ++++++++++++++++++++++++++++++
 configs/socrates_defconfig  |  5 +--
 include/configs/socrates.h  | 62 -------------------------------------
 3 files changed, 54 insertions(+), 64 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..14c6ada34d
--- /dev/null
+++ b/board/socrates/socrates.env
@@ -0,0 +1,51 @@
+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}
+baudrate=CONFIG_BAUDRATE
+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;
+bootcmd=CONFIG_BOOTCOMMAND
+bootdelay=CONFIG_BOOTDELAY
+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
+mtdids=CONFIG_MTDIDS_DEFAULT
+mtdparts=CONFIG_MTDPARTS_DEFAULT
+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..0f4786958b 100644
--- a/configs/socrates_defconfig
+++ b/configs/socrates_defconfig
@@ -31,9 +31,9 @@ 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_PREBOOT="echo;echo Welcome on the Socrates Board;echo"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_BOARD_EARLY_INIT_R=y
 # CONFIG_HWCONFIG is not set
@@ -70,6 +70,7 @@ 
CONFIG_MTDIDS_DEFAULT="nor0=fe000000.nor_flash,nand0=socrates_nand"
 
CONFIG_MTDPARTS_DEFAULT="mtdparts=fe000000.nor_flash:13312k(system1),13312k(system2),5120k(data),128k(env),128k(env-red),768k(u-boot);socrates_nand:256M(ubi-data1),-(ubi-data2)"
 # CONFIG_CMD_IRQ is not set
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_SOURCE_FILE="socrates"
 CONFIG_ENV_IS_NOWHERE=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=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 via email to