Skip to contentSkip to conversation

ARM: stm32: Add update_sf script to install U-Boot into SF on DHSOM

PATCH In review Marek Vasut 3 participants 5 messages Nov 13, 2021 – Nov 30, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: stm32: Add update_sf script to install U-Boot into SF on DHSOM

Add script to read U-Boot from SD card and write it to matching locations in the SPI NOR, thus making the SPI NOR bootable. The script erases the entire SPI NOR, including U-Boot environment, to make sure the installation is clean. To retain environment from current running U-Boot, run 'saveenv' after running the 'update_sf' script.

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
---
 include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/stm32mp15_dh_dhsom.h +11 -1
index bac9e8388a7..b68e153f10b 100644
@@ -9,7 +9,17 @@
 #define __CONFIG_STM32MP15_DH_DHSOM_H__
 
 #define STM32MP_BOARD_EXTRA_ENV \
-	"usb_pgood_delay=1000\0"
+	"usb_pgood_delay=1000\0" \
+	"update_sf=" /* Erase SPI NOR and install U-Boot from SD */	\
+		"setexpr loadaddr1 ${loadaddr} + 0x1000000 && "		\
+		"load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "	\
+		"env set filesize1 ${filesize} && "			\
+		"load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "		\
+		"sf probe && sf erase 0 0x200000 && "			\
+		"sf update ${loadaddr1} 0 ${filesize1} && "		\
+		"sf update ${loadaddr1} 0x40000 ${filesize1} && "	\
+		"sf update ${loadaddr} 0x80000 ${filesize} && "		\
+		"env set filesize1 && env set loadaddr1\0"
 
 #include <configs/stm32mp15_common.h>
 
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Marek

Quoted 28 lines · Marek Vasut

Add script to read U-Boot from SD card and write it to matching locations in the SPI NOR, thus making the SPI NOR bootable. The script erases the entire SPI NOR, including U-Boot environment, to make sure the installation is clean. To retain environment from current running U-Boot, run 'saveenv' after running the 'update_sf' script.

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
---
 include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/stm32mp15_dh_dhsom.h +4 -1
index bac9e8388a7..b68e153f10b 100644
@@ -9,7 +9,17 @@
 #define __CONFIG_STM32MP15_DH_DHSOM_H__
 
 #define STM32MP_BOARD_EXTRA_ENV \
-	"usb_pgood_delay=1000\0"
+	"usb_pgood_delay=1000\0" \
+	"update_sf=" /* Erase SPI NOR and install U-Boot from SD */	\
+		"setexpr loadaddr1 ${loadaddr} + 0x1000000 && "		\
+		"load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "	\

include/configs/stm32mp15_dh_dhsom.h line 25

Quoted 10 lines
include/configs/stm32mp15_dh_dhsom.h +7 -0
+		"env set filesize1 ${filesize} && "			\
+		"load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "		\
+		"sf probe && sf erase 0 0x200000 && "			\
+		"sf update ${loadaddr1} 0 ${filesize1} && "		\
+		"sf update ${loadaddr1} 0x40000 ${filesize1} && "	\
+		"sf update ${loadaddr} 0x80000 ${filesize} && "		\
+		"env set filesize1 && env set loadaddr1\0"
 
 #include <configs/stm32mp15_common.h>
 

Thanks
Patrice

Reviewed-by on v1 1/1
#2 lore raw
In reply to Marek Vasut

Hi Marek,

Quoted 27 lines · Marek Vasut

Add script to read U-Boot from SD card and write it to matching locations in the SPI NOR, thus making the SPI NOR bootable. The script erases the entire SPI NOR, including U-Boot environment, to make sure the installation is clean. To retain environment from current running U-Boot, run 'saveenv' after running the 'update_sf' script.

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
---
  include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/stm32mp15_dh_dhsom.h +4 -1
index bac9e8388a7..b68e153f10b 100644
@@ -9,7 +9,17 @@
  #define __CONFIG_STM32MP15_DH_DHSOM_H__
 
  #define STM32MP_BOARD_EXTRA_ENV \
-	"usb_pgood_delay=1000\0"
+	"usb_pgood_delay=1000\0" \
+	"update_sf=" /* Erase SPI NOR and install U-Boot from SD */	\
+		"setexpr loadaddr1 ${loadaddr} + 0x1000000 && "		\
+		"load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "	\

include/configs/stm32mp15_dh_dhsom.h line 25

Quoted 10 lines
include/configs/stm32mp15_dh_dhsom.h +7 -0
+		"env set filesize1 ${filesize} && "			\
+		"load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "		\
+		"sf probe && sf erase 0 0x200000 && "			\
+		"sf update ${loadaddr1} 0 ${filesize1} && "		\
+		"sf update ${loadaddr1} 0x40000 ${filesize1} && "	\
+		"sf update ${loadaddr} 0x80000 ${filesize} && "		\
+		"env set filesize1 && env set loadaddr1\0"
 
  #include <configs/stm32mp15_common.h>
 

Thanks
Patrick

#3 lore raw

HI Marek

Quoted 43 lines · Patrick DELAUNAY

Hi Marek,

Quoted 34 lines · Marek Vasut

Add script to read U-Boot from SD card and write it to matching locations in the SPI NOR, thus making the SPI NOR bootable. The script erases the entire SPI NOR, including U-Boot environment, to make sure the installation is clean. To retain environment from current running U-Boot, run 'saveenv' after running the 'update_sf' script.

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

---
  include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-

  1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/stm32mp15_dh_dhsom.h +11 -1
index bac9e8388a7..b68e153f10b 100644
@@ -9,7 +9,17 @@
   #define __CONFIG_STM32MP15_DH_DHSOM_H__
     #define STM32MP_BOARD_EXTRA_ENV \
-    "usb_pgood_delay=1000\0"
+    "usb_pgood_delay=1000\0" \
+    "update_sf=" /* Erase SPI NOR and install U-Boot from SD */    \
+        "setexpr loadaddr1 ${loadaddr} + 0x1000000 && "        \
+        "load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "    \
+        "env set filesize1 ${filesize} && "            \
+        "load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "        \
+        "sf probe && sf erase 0 0x200000 && "            \
+        "sf update ${loadaddr1} 0 ${filesize1} && "        \
+        "sf update ${loadaddr1} 0x40000 ${filesize1} && "    \
+        "sf update ${loadaddr} 0x80000 ${filesize} && "        \
+        "env set filesize1 && env set loadaddr1\0"
     #include <configs/stm32mp15_common.h>
Quoted 1 line

Quoted 5 lines

Thanks
Patrick

Applied to u-boot-stm32/next

Thanks
Patrice

#4 lore raw
Quoted 46 lines · Patrice CHOTARD

HI Marek

Quoted 43 lines · Patrick DELAUNAY

Hi Marek,

Quoted 25 lines · Marek Vasut

Add script to read U-Boot from SD card and write it to matching locations in the SPI NOR, thus making the SPI NOR bootable. The script erases the entire SPI NOR, including U-Boot environment, to make sure the installation is clean. To retain environment from current running U-Boot, run 'saveenv' after running the 'update_sf' script.

Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>
---
   include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
   1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/stm32mp15_dh_dhsom.h +3 -1
index bac9e8388a7..b68e153f10b 100644
@@ -9,7 +9,17 @@
   #define __CONFIG_STM32MP15_DH_DHSOM_H__
     #define STM32MP_BOARD_EXTRA_ENV \
-    "usb_pgood_delay=1000\0"
+    "usb_pgood_delay=1000\0" \
+    "update_sf=" /* Erase SPI NOR and install U-Boot from SD */    \
+        "setexpr loadaddr1 ${loadaddr} + 0x1000000 && "        \

include/configs/stm32mp15_dh_dhsom.h line 23

Quoted 10 lines
include/configs/stm32mp15_dh_dhsom.h +8 -0
+        "load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "    \
+        "env set filesize1 ${filesize} && "            \
+        "load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "        \
+        "sf probe && sf erase 0 0x200000 && "            \
+        "sf update ${loadaddr1} 0 ${filesize1} && "        \
+        "sf update ${loadaddr1} 0x40000 ${filesize1} && "    \
+        "sf update ${loadaddr} 0x80000 ${filesize} && "        \
+        "env set filesize1 && env set loadaddr1\0"
     #include <configs/stm32mp15_common.h>
 
Quoted 6 lines
Quoted 5 lines

Thanks
Patrick

Applied to u-boot-stm32/next

I would prefer if all this stuff went into 2022.01 , it is isolated to the DH boards after all and it was posted before rc2.