[PATCH 5/5] brppt1: Update environment to support new boot concept

Bernhard Messerklinger bernhard.messerklinger at br-automation.com
Thu Aug 25 08:54:04 CEST 2022


* Drop legacy /boot/PPTImage.md5 check
* Update device tree naming
* Update t30args#0 root cmd line property to support latest kernel
  versions (root=/dev/mmcblk0p2 for linux < 4 and
  root=/dev/mmcblk1p2 for linux >= 4)
* Add custom bootloader version string
* Destroy invalid dtb at ${dtbaddr} and configuration script at
  ${cfgaddr} to ensure proper boot in warm restart case.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger at br-automation.com>
---

 configs/brppt1_mmc_defconfig |  4 +++-
 include/configs/brppt1.h     | 18 ++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index 6da6d58bfd..a45604de16 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -17,6 +17,8 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x50000
 CONFIG_SYS_LOAD_ADDR=0x80000000
+CONFIG_LOCALVERSION="-2.0.0"
+# CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4030ff00
 # CONFIG_EXPERT is not set
@@ -26,7 +28,7 @@ CONFIG_BOOTDELAY=0
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run b_default"
 CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="mw ${dtbaddr} 0; run cfgscr; run brdefaultip"
+CONFIG_PREBOOT="mw ${cfgaddr} 0; mw ${dtbaddr} 0; run cfgscr; run brdefaultip"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h
index aaf3f8b4a5..2c5236aa58 100644
--- a/include/configs/brppt1.h
+++ b/include/configs/brppt1.h
@@ -29,18 +29,16 @@
 
 #define MMC_TGTS \
 "t30args#0=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
-	"b_mode=${b_mode} root=/dev/mmcblk0p2 rootfstype=ext4\0" \
+	"b_mode=${b_mode} root=${root_dev} rootfstype=ext4 rootwait\0" \
 "b_t30lgcy#0=" \
-	"load ${loaddev}:2 ${loadaddr} /boot/PPTImage.md5 && " \
 	"load ${loaddev}:2 ${loadaddr} /boot/zImage && " \
-	"load ${loaddev}:2 ${dtbaddr} /boot/am335x-ppt30.dtb || " \
-	"load ${loaddev}:1 ${dtbaddr} am335x-ppt30-legacy.dtb; "\
+	"run load_dtb && " \
 	"run t30args#0; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
 "t30args#1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
 	"b_mode=${b_mode}\0" \
 "b_t30lgcy#1=" \
 	"load ${loaddev}:1 ${loadaddr} zImage && " \
-	"load ${loaddev}:1 ${dtbaddr} am335x-ppt30.dtb && " \
+	"load ${loaddev}:1 ${dtbaddr} am335x-brppt30.dtb && " \
 	"load ${loaddev}:1 ${ramaddr} rootfsPPT30.uboot && " \
 	"run t30args#1; run cfgscr; bootz ${loadaddr} ${ramaddr} ${dtbaddr}\0" \
 "b_mmc0=load ${loaddev}:1 ${scraddr} bootscr.img && source ${scraddr}\0" \
@@ -48,11 +46,19 @@
 "b_tgts_std=mmc0 mmc1 t30lgcy#0 t30lgcy#1 usb0 net\0" \
 "b_tgts_rcy=t30lgcy#1 usb0 net\0" \
 "b_tgts_pme=net usb0 mmc0 mmc1\0" \
-"loaddev=mmc 1\0"
+"loaddev=mmc 1\0" \
+"root_dev=/dev/mmcblk0p2\0" \
+"load_dtb=load ${loaddev}:2 ${dtbaddr} /boot/am335x-brppt30.dtb; " \
+	 "if test $? -eq 0; then " \
+	     "setenv root_dev /dev/mmcblk1p2; " \
+	 "else; " \
+	     "load ${loaddev}:1 ${dtbaddr} am335x-brppt30-legacy.dtb; " \
+	 "fi;\0"
 
 #ifdef CONFIG_ENV_IS_IN_MMC
 #define MMCTGTS \
 MMC_TGTS \
+"cfgscr=mw ${cfgaddr} 0;" \
 " mmc dev 1; mmc read ${cfgaddr} 200 80; source ${cfgaddr};" \
 " fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0"
 #else
-- 
2.37.2




More information about the U-Boot mailing list