All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/5] toradex: imx: add update_uboot wrapper
@ 2019-12-04 14:31 Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 1/5] colibri_imx7: " Igor Opaniuk
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-04 14:31 UTC (permalink / raw)
  To: u-boot

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

Example of usage:
> tftpboot ${loadaddr} ${board_name}/u-boot.img
> run update_uboot
> tftpboot ${loadaddr} ${board_name}/SPL
> run update_spl


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 |  8 ++++++++
 include/configs/colibri_imx6.h    | 12 ++++++++++++
 include/configs/colibri_imx7.h    | 18 ++++++++++++++++++
 include/configs/colibri_vf.h      |  6 ++++++
 5 files changed, 56 insertions(+)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/5] colibri_imx7: add update_uboot wrapper
  2019-12-04 14:31 [PATCH v1 0/5] toradex: imx: add update_uboot wrapper Igor Opaniuk
@ 2019-12-04 14:31 ` Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 2/5] apalis_imx6: " Igor Opaniuk
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-04 14:31 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

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

Usage example:
> tftpboot ${loadaddr} ${board_name}/u-boot-dtb.imx
> run update_uboot

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 include/configs/colibri_imx7.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index d92db7192e..2e212bf8ec 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -43,6 +43,23 @@
 #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 \
+	"uboot_hwpart=1\0" \
+	"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 +180,7 @@
 	MEM_LAYOUT_ENV_SETTINGS \
 	NFS_BOOTCMD \
 	MODULE_EXTRA_ENV_SETTINGS \
+	UBOOT_UPDATE \
 	"boot_file=zImage\0" \
 	"console=ttymxc0\0" \
 	"defargs=\0" \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/5] apalis_imx6: add update_uboot wrapper
  2019-12-04 14:31 [PATCH v1 0/5] toradex: imx: add update_uboot wrapper Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 1/5] colibri_imx7: " Igor Opaniuk
@ 2019-12-04 14:31 ` Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 3/5] colibri_imx6: " Igor Opaniuk
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-04 14:31 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

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

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

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 include/configs/apalis_imx6.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 50a4391cd4..800f27ccbb 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -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" \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 3/5] colibri_imx6: add update_uboot wrapper
  2019-12-04 14:31 [PATCH v1 0/5] toradex: imx: add update_uboot wrapper Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 1/5] colibri_imx7: " Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 2/5] apalis_imx6: " Igor Opaniuk
@ 2019-12-04 14:31 ` Igor Opaniuk
  2019-12-04 22:46   ` Lukasz Majewski
  2019-12-04 14:31 ` [PATCH v1 4/5] colibri-imx6ull: " Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 5/5] colibri_vf: " Igor Opaniuk
  4 siblings, 1 reply; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-04 14:31 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

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

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

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 include/configs/colibri_imx6.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 95b5a14b59..750463ef47 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -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" \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 4/5] colibri-imx6ull: add update_uboot wrapper
  2019-12-04 14:31 [PATCH v1 0/5] toradex: imx: add update_uboot wrapper Igor Opaniuk
                   ` (2 preceding siblings ...)
  2019-12-04 14:31 ` [PATCH v1 3/5] colibri_imx6: " Igor Opaniuk
@ 2019-12-04 14:31 ` Igor Opaniuk
  2019-12-04 14:31 ` [PATCH v1 5/5] colibri_vf: " Igor Opaniuk
  4 siblings, 0 replies; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-04 14:31 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

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

Usage example:
> tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx
> run update_uboot

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 include/configs/colibri-imx6ull.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h
index 0c36a57a0e..ac65ffdfd2 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -47,6 +47,13 @@
 	"ramdisk_addr_r=0x82200000\0" \
 	"scriptaddr=0x87000000\0"
 
+#define UBOOT_UPDATE \
+	"uboot_hwpart=1\0" \
+	"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 +90,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" \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 5/5] colibri_vf: add update_uboot wrapper
  2019-12-04 14:31 [PATCH v1 0/5] toradex: imx: add update_uboot wrapper Igor Opaniuk
                   ` (3 preceding siblings ...)
  2019-12-04 14:31 ` [PATCH v1 4/5] colibri-imx6ull: " Igor Opaniuk
@ 2019-12-04 14:31 ` Igor Opaniuk
  4 siblings, 0 replies; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-04 14:31 UTC (permalink / raw)
  To: u-boot

From: Igor Opaniuk <igor.opaniuk@toradex.com>

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

Usage example:
> tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx
> run update_uboot

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---

 include/configs/colibri_vf.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
index 40c050a27e..53e4ae2702 100644
--- a/include/configs/colibri_vf.h
+++ b/include/configs/colibri_vf.h
@@ -58,6 +58,11 @@
 	"ramdisk_addr_r=0x82100000\0" \
 	"scriptaddr=0x87000000\0"
 
+#define UBOOT_UPDATE \
+	"uboot_hwpart=1\0" \
+	"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 +117,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" \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 3/5] colibri_imx6: add update_uboot wrapper
  2019-12-04 14:31 ` [PATCH v1 3/5] colibri_imx6: " Igor Opaniuk
@ 2019-12-04 22:46   ` Lukasz Majewski
  2019-12-05 11:51     ` Igor Opaniuk
  0 siblings, 1 reply; 8+ messages in thread
From: Lukasz Majewski @ 2019-12-04 22:46 UTC (permalink / raw)
  To: u-boot

Hi Igor,

> From: Igor Opaniuk <igor.opaniuk@toradex.com>
> 
> Add universal update_uboot wrapper that helps to update
> U-Boot image on internal storage.
> 
> > tftpboot ${loadaddr} ${board_name}/u-boot.img
> > run update_uboot
> > tftpboot ${loadaddr} ${board_name}/SPL
> > run update_spl  
> 
> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
> ---
> 
>  include/configs/colibri_imx6.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/configs/colibri_imx6.h
> b/include/configs/colibri_imx6.h index 95b5a14b59..750463ef47 100644
> --- a/include/configs/colibri_imx6.h
> +++ b/include/configs/colibri_imx6.h
> @@ -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"
> +

Do you see any chance to make this code common and being re-usable by
other imx6 devices?

>  #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" \




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191204/7cd9cffc/attachment.sig>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 3/5] colibri_imx6: add update_uboot wrapper
  2019-12-04 22:46   ` Lukasz Majewski
@ 2019-12-05 11:51     ` Igor Opaniuk
  0 siblings, 0 replies; 8+ messages in thread
From: Igor Opaniuk @ 2019-12-05 11:51 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

On Thu, Dec 5, 2019 at 12:46 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> Hi Igor,
>
> > From: Igor Opaniuk <igor.opaniuk@toradex.com>
> >
> > Add universal update_uboot wrapper that helps to update
> > U-Boot image on internal storage.
> >
> > > tftpboot ${loadaddr} ${board_name}/u-boot.img
> > > run update_uboot
> > > tftpboot ${loadaddr} ${board_name}/SPL
> > > run update_spl
> >
> > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
> > ---
> >
> >  include/configs/colibri_imx6.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/include/configs/colibri_imx6.h
> > b/include/configs/colibri_imx6.h index 95b5a14b59..750463ef47 100644
> > --- a/include/configs/colibri_imx6.h
> > +++ b/include/configs/colibri_imx6.h
> > @@ -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"
> > +
>
> Do you see any chance to make this code common and being re-usable by
> other imx6 devices?

Not sure, because:
1. Some platforms use "user" hw partition instead of boot0 for
storing SPL/U-boot proper (AFAIK this is actual for i.MX6Q Sabre)
IMHO, for this case it's much more convenient to use DFU/UMS/Fastboot
(which is not possible for boot0/boot1) for flashing instead of some
wrapper like this.
2. I don't have any mx6-based boards other than from Toradex, so at
least I won't be
able to test it.

If you insist, I can add "update_uboot" to the common include, but to be honest
I really doubt that someone will use it :)

>
> >  #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" \
>
>
>
>
> Best regards,
>
> Lukasz Majewski
>
> --
>
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de

Thanks
--
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-05 11:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 14:31 [PATCH v1 0/5] toradex: imx: add update_uboot wrapper Igor Opaniuk
2019-12-04 14:31 ` [PATCH v1 1/5] colibri_imx7: " Igor Opaniuk
2019-12-04 14:31 ` [PATCH v1 2/5] apalis_imx6: " Igor Opaniuk
2019-12-04 14:31 ` [PATCH v1 3/5] colibri_imx6: " Igor Opaniuk
2019-12-04 22:46   ` Lukasz Majewski
2019-12-05 11:51     ` Igor Opaniuk
2019-12-04 14:31 ` [PATCH v1 4/5] colibri-imx6ull: " Igor Opaniuk
2019-12-04 14:31 ` [PATCH v1 5/5] colibri_vf: " Igor Opaniuk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.