Skip to contentSkip to conversation

toradex: imx: add update_uboot wrapper

PATCH Superseded Igor Opaniuk 2 participants 11 messages Dec 9, 2019 – Dec 29, 2019 Arm i.MX and Layerscape

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover toradex: imx: add update_uboot wrapper

This patch series introduces universtal update_uboot wrapper that helps to update U-Boot image on internal storage.

Example of usage:

Quoted 4 lines

tftpboot ${loadaddr} ${board_name}/u-boot.img
run update_uboot
tftpboot ${loadaddr} ${board_name}/SPL
run update_spl

v2:
- remove uboot_hwpart defition for NAND setups

Igor Opaniuk (5):
colibri_imx7: add update_uboot wrapper
apalis_imx6: add update_uboot wrapper
colibri_imx6: add update_uboot wrapper
colibri-imx6ull: add update_uboot wrapper
colibri_vf: add update_uboot wrapper

 include/configs/apalis_imx6.h     | 12 ++++++++++++
 include/configs/colibri-imx6ull.h |  7 +++++++
 include/configs/colibri_imx6.h    | 12 ++++++++++++
 include/configs/colibri_imx7.h    | 17 +++++++++++++++++
 include/configs/colibri_vf.h      |  5 +++++
 5 files changed, 53 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/5 colibri_imx7: add update_uboot wrapper

From: Igor Opaniuk <[email protected]>

Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.

Usage example:

Quoted 2 lines

tftpboot ${loadaddr} ${board_name}/u-boot-dtb.imx
run update_uboot

---

 include/configs/colibri_imx7.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
include/configs/colibri_imx7.h +17 -0
index d92db7192e..88e1be1ef5 100644
@@ -43,6 +43,22 @@
 #define CONFIG_NETMASK			255.255.255.0
 #define CONFIG_SERVERIP			192.168.10.1
 
+#if defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
+#define UBOOT_UPDATE \
+	"uboot_hwpart=1\0" \
+	"uboot_blk=2\0" \
+	"set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && " \
+		"setexpr blkcnt ${blkcnt} / 0x200\0" \
+	"update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
+		"mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0"
+#elif defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
+#define UBOOT_UPDATE \
+	"update_uboot=nand erase.part u-boot1 && " \
+		"nand write ${loadaddr} u-boot1 ${filesize} && " \
+		"nand erase.part u-boot2 && " \
+		"nand write ${loadaddr} u-boot2 ${filesize}\0"
+#endif
+
 #ifndef PARTS_DEFAULT
 /* Define the default GPT table for eMMC */
 #define PARTS_DEFAULT \
@@ -163,6 +179,7 @@
 	MEM_LAYOUT_ENV_SETTINGS \
 	NFS_BOOTCMD \
 	MODULE_EXTRA_ENV_SETTINGS \
+	UBOOT_UPDATE \
 	"boot_file=zImage\0" \
 	"console=ttymxc0\0" \
 	"defargs=\0" \
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 2/5 apalis_imx6: add update_uboot wrapper

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.

Usage example:

Quoted 4 lines

tftpboot ${loadaddr} ${board_name}/u-boot.img
run update_uboot
tftpboot ${loadaddr} ${board_name}/SPL
run update_spl

---

 include/configs/apalis_imx6.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/configs/apalis_imx6.h +12 -0
index 50a4391cd4..800f27ccbb 100644
@@ -121,6 +121,17 @@
 	"imx6q-apalis-eval.dtb fat 0 1;" \
 	"imx6q-apalis-cam-eval.dtb fat 0 1"
 
+#define UBOOT_UPDATE \
+	"uboot_hwpart=1\0" \
+	"uboot_blk=8a\0" \
+	"uboot_spl_blk=2\0" \
+	"set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && " \
+		"setexpr blkcnt ${blkcnt} / 0x200\0" \
+	"update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
+		"mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0" \
+	"update_spl=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
+		"mmc write ${loadaddr} ${uboot_spl_blk} ${blkcnt}\0"
+
 #define EMMC_BOOTCMD \
 	"set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} " \
 		"ro,noatime rootfstype=ext4 rootwait\0" \
@@ -178,6 +189,7 @@
 	"fdt_fixup=;\0" \
 	MEM_LAYOUT_ENV_SETTINGS \
 	NFS_BOOTCMD \
+	UBOOT_UPDATE \
 	"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
 		"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
 		"flash_eth.img && source ${loadaddr}\0" \
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 3/5 colibri_imx6: add update_uboot wrapper

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.

Quoted 4 lines

tftpboot ${loadaddr} ${board_name}/u-boot.img
run update_uboot
tftpboot ${loadaddr} ${board_name}/SPL
run update_spl

---

 include/configs/colibri_imx6.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/configs/colibri_imx6.h +12 -0
index 95b5a14b59..750463ef47 100644
@@ -110,6 +110,17 @@
 	"imx6dl-colibri-eval-v3.dtb fat 0 1;" \
 	"imx6dl-colibri-cam-eval-v3.dtb fat 0 1"
 
+#define UBOOT_UPDATE \
+	"uboot_hwpart=1\0" \
+	"uboot_blk=8a\0" \
+	"uboot_spl_blk=2\0" \
+	"set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && " \
+		"setexpr blkcnt ${blkcnt} / 0x200\0" \
+	"update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
+		"mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0" \
+	"update_spl=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
+		"mmc write ${loadaddr} ${uboot_spl_blk} ${blkcnt}\0"
+
 #define EMMC_BOOTCMD \
 	"set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} "\
 		"rw,noatime rootfstype=ext4 " \
@@ -163,6 +174,7 @@
 	"fdt_fixup=;\0" \
 	MEM_LAYOUT_ENV_SETTINGS \
 	NFS_BOOTCMD \
+	UBOOT_UPDATE \
 	"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
 		"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
 		"flash_eth.img && source ${loadaddr}\0" \
Signature · 1 line
2.17.1
#7 lore raw

PATCH v2 4/5 colibri-imx6ull: add update_uboot wrapper

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.

Usage example:

Quoted 2 lines

tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx run update_uboot

---

 include/configs/colibri-imx6ull.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/configs/colibri-imx6ull.h +7 -0
index 0c36a57a0e..ea5ba6bfce 100644
@@ -47,6 +47,12 @@
 	"ramdisk_addr_r=0x82200000\0" \
 	"scriptaddr=0x87000000\0"
 
+#define UBOOT_UPDATE \
+	"update_uboot=nand erase.part u-boot1 && " \
+		"nand write ${loadaddr} u-boot1 ${filesize} && " \
+		"nand erase.part u-boot2 && " \
+		"nand write ${loadaddr} u-boot2 ${filesize}\0"
+
 #define NFS_BOOTCMD \
 	"nfsargs=ip=:::::eth0: root=/dev/nfs\0" \
 	"nfsboot=run setup; " \
@@ -83,6 +89,7 @@
 	MEM_LAYOUT_ENV_SETTINGS \
 	NFS_BOOTCMD \
 	UBI_BOOTCMD \
+	UBOOT_UPDATE \
 	"console=ttymxc0\0" \
 	"defargs=user_debug=30\0" \
 	"dfu_alt_info=" DFU_ALT_NAND_INFO "\0" \
Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 5/5 colibri_vf: add update_uboot wrapper

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.

Usage example:

Quoted 2 lines

tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx run update_uboot

---

 include/configs/colibri_vf.h | 5 +++++
 1 file changed, 5 insertions(+)
include/configs/colibri_vf.h +5 -0
index 40c050a27e..1478ea844e 100644
@@ -58,6 +58,10 @@
 	"ramdisk_addr_r=0x82100000\0" \
 	"scriptaddr=0x87000000\0"
 
+#define UBOOT_UPDATE \
+	"update_uboot=nand erase.part u-boot && " \
+		"nand write ${loadaddr} u-boot ${filesize}\0" \
+
 #define NFS_BOOTCMD \
 	"nfsargs=ip=:::::eth0: root=/dev/nfs\0"	\
 	"nfsboot=run setup; " \
@@ -112,6 +116,7 @@
 	NFS_BOOTCMD \
 	SD_BOOTCMD \
 	UBI_BOOTCMD \
+	UBOOT_UPDATE \
 	"console=ttyLP0\0" \
 	"defargs=user_debug=30\0" \
 	"dfu_alt_info=" DFU_ALT_NAND_INFO "\0" \
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 3/5 colibri_imx6: add update_uboot wrapper

In reply to Igor Opaniuk
Quoted 8 lines

From: Igor Opaniuk <[email protected]> Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.

Quoted 4 lines

tftpboot ${loadaddr} ${board_name}/u-boot.img
run update_uboot
tftpboot ${loadaddr} ${board_name}/SPL
run update_spl

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#10 lore raw

PATCH v2 5/5 colibri_vf: add update_uboot wrapper

In reply to Igor Opaniuk
Quoted 7 lines

From: Igor Opaniuk <[email protected]> Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.
Usage example:

Quoted 2 lines

tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx run update_uboot

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH v2 2/5 apalis_imx6: add update_uboot wrapper

In reply to Igor Opaniuk
Quoted 9 lines

From: Igor Opaniuk <[email protected]> Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.
Usage example:

Quoted 4 lines

tftpboot ${loadaddr} ${board_name}/u-boot.img
run update_uboot
tftpboot ${loadaddr} ${board_name}/SPL
run update_spl

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#8 lore raw

PATCH v2 4/5 colibri-imx6ull: add update_uboot wrapper

In reply to Igor Opaniuk
Quoted 7 lines

From: Igor Opaniuk <[email protected]> Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.
Usage example:

Quoted 2 lines

tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx run update_uboot

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH v2 1/5 colibri_imx7: add update_uboot wrapper

In reply to Igor Opaniuk
Quoted 7 lines

From: Igor Opaniuk <[email protected]> Add universal update_uboot wrapper that helps to update U-Boot image on internal storage.
Usage example:

Quoted 2 lines

tftpboot ${loadaddr} ${board_name}/u-boot-dtb.imx
run update_uboot

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================