Skip to contentSkip to conversation

pico-imx6ul: Move dfu_alt_info to CONFIG_DFU_ENV_SETTINGS variable

PATCH New Otavio Salvador 4 participants 10 messages Nov 16, 2017 – Nov 20, 2017 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/6 pico-imx6ul: Move dfu_alt_info to CONFIG_DFU_ENV_SETTINGS variable

From: Fabio Berton <[email protected]>

Create CONFIG_DFU_ENV_SETTINGS to set dfu environment settings to improve human readable code.

---

Changes in v2: None

 include/configs/pico-imx6ul.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/pico-imx6ul.h +4 -1
index 75658fd489..d4b29e3950 100644
@@ -47,6 +47,9 @@
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_16M
 #define DFU_DEFAULT_POLL_TIMEOUT 300
 
+#define CONFIG_DFU_ENV_SETTINGS \
+	"dfu_alt_info=boot raw 0x2 0x400 mmcpart 1\0" \
+
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -60,7 +63,7 @@
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
 	"mmcautodetect=yes\0" \
-	"dfu_alt_info=boot raw 0x2 0x400 mmcpart 1\0" \
+	CONFIG_DFU_ENV_SETTINGS \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=${mmcroot}\0" \
 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
Signature · 1 line
2.15.0
#1 lore raw

PATCH v2 2/6 pico-imx6ul: Use PARTUUID to specify the rootfs location

From: Fabio Berton <[email protected]>

Currently the rootfs location is passed via mmcblk number and using the UUID method to specify the rootfs location is a better approach working even if mmcblk number for the eMMC changes depending on the kernel versions.

---

Changes in v2:
- fix typo (s/eMMM/eMMC/) - Fabio Estevam

 configs/pico-imx6ul_defconfig | 1 +
 include/configs/pico-imx6ul.h | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
configs/pico-imx6ul_defconfig +1 -0
index 09b36ccb09..e00f9f34a3 100644
@@ -13,6 +13,7 @@ CONFIG_CMD_DFU=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_DHCP=y
include/configs/pico-imx6ul.h +3 -3
index d4b29e3950..c775c32690 100644
@@ -61,14 +61,15 @@
 	"fdt_addr=0x83000000\0" \
 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
-	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
 	"mmcautodetect=yes\0" \
 	CONFIG_DFU_ENV_SETTINGS \
+	"finduuid=part uuid mmc 0:2 uuid\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
-		"root=${mmcroot}\0" \
+		"root=PARTUUID=${uuid} rootwait rw\0" \
 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
 	"mmcboot=echo Booting from mmc ...; " \
+		"run finduuid; " \
 		"run mmcargs; " \
 		"if run loadfdt; then " \
 			"bootz ${loadaddr} - ${fdt_addr}; " \
@@ -147,6 +148,5 @@
 
 #define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_SYS_MMC_ENV_PART		0
-#define CONFIG_MMCROOT			"/dev/mmcblk0p2"
 
 #endif /* __PICO_IMX6UL_CONFIG_H */
Signature · 1 line
2.15.0
reviewer
#2 lore raw

PATCH v2 2/6 pico-imx6ul: Use PARTUUID to specify the rootfs location

Quoted 9 lines · Otavio Salvador

From: Fabio Berton <[email protected]>

Currently the rootfs location is passed via mmcblk number and using the UUID method to specify the rootfs location is a better approach working even if mmcblk number for the eMMC changes depending on the kernel versions.

(You should have kept my Reviewed-by tag on the other patches that you resent without changes)

#3 lore raw

PATCH v2 3/6 pico-imx6ul: Add boot and rootfs dfu_alt_info

In reply to Otavio Salvador

From: Fabio Berton <[email protected]>

Change dfu_alt_info variable to use the following altsetting:

  uboot:                     To flash raw U-Boot
  /zImage: boot:             To copy kernel image
  /imx6ul-pico-hobbit.dtb:   To copy dtb file
  rootfs:                    To copy rootfs

List the currently attached DFU capable USB devices running:
sudo dfu-util -l

Flash U-Boot:
sudo dfu-util -D u-boot.imx -a uboot

Copy boot files:
sudo dfu-util -D zImage -a /zImage
sudo dfu-util -D imx6ul-pico-hobbit.dtb -a /imx6ul-pico-hobbit.dtb

Flash rootfs:
sudo dfu-util -D rootfs.ext4 -a rootfs

To copy boot files you need to have a formated mmc 0:1 partition. To format with ext4 filesystem you can use ums.

Run on target:
ums 0 mmc 0

and on host:
sudo mkfs.ext4 /dev/sdx1

---

Changes in v2: None

 include/configs/pico-imx6ul.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/configs/pico-imx6ul.h +5 -1
index c775c32690..6a19861da7 100644
@@ -48,7 +48,11 @@
 #define DFU_DEFAULT_POLL_TIMEOUT 300
 
 #define CONFIG_DFU_ENV_SETTINGS \
-	"dfu_alt_info=boot raw 0x2 0x400 mmcpart 1\0" \
+	"dfu_alt_info=uboot raw 0x2 0x400 mmcpart 1;" \
+		"boot part 0 1;" \
+		"/zImage ext4 0 1;" \
+		"/imx6ul-pico-hobbit.dtb ext4 0 1;" \
+		"rootfs part 0 2\0" \
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
Signature · 1 line
2.15.0
#4 lore raw

PATCH v2 4/6 pico-imx6ul: Define partition layout in the environment

In reply to Otavio Salvador

From: Fabio Berton <[email protected]>

Create layout with a boot 16MiB partition and rootfs with remain space.

---

Changes in v2:
- fix typo (s/Mib/MiB/) - Fabio Estevam

 include/configs/pico-imx6ul.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/pico-imx6ul.h +3 -0
index 6a19861da7..1ea79b9c18 100644
@@ -68,6 +68,9 @@
 	"mmcautodetect=yes\0" \
 	CONFIG_DFU_ENV_SETTINGS \
 	"finduuid=part uuid mmc 0:2 uuid\0" \
+	"partitions=" \
+		"uuid_disk=${uuid_gpt_disk};" \
+		"name=boot,size=16MiB;name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=PARTUUID=${uuid} rootwait rw\0" \
 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
Signature · 1 line
2.15.0
#6 lore raw

PATCH v2 5/6 pico-imx6ul: Add function to create gpt partitions

In reply to Otavio Salvador

From: Fabio Berton <[email protected]>

Command run setup_emmc will create gpt partitions for mmc 0 device based on patitions variable.

---

Changes in v2: None

 configs/pico-imx6ul_defconfig | 1 +
 include/configs/pico-imx6ul.h | 1 +
 2 files changed, 2 insertions(+)
configs/pico-imx6ul_defconfig +1 -0
index e00f9f34a3..f28f9b7a4e 100644
@@ -12,6 +12,7 @@ CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_DFU=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_USB=y
include/configs/pico-imx6ul.h +1 -0
index 1ea79b9c18..310fceb14b 100644
@@ -71,6 +71,7 @@
 	"partitions=" \
 		"uuid_disk=${uuid_gpt_disk};" \
 		"name=boot,size=16MiB;name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \
+	"setup_emmc=gpt write mmc 0 $partitions; reset;\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=PARTUUID=${uuid} rootwait rw\0" \
 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
Signature · 1 line
2.15.0
#7 lore raw

PATCH v2 6/6 pico-imx6ul: Use FS_GENERIC load command

In reply to Otavio Salvador

From: Fabio Berton <[email protected]>

---

Changes in v2: None

 include/configs/pico-imx6ul.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/pico-imx6ul.h +2 -2
index 310fceb14b..f821b67c72 100644
@@ -74,8 +74,8 @@
 	"setup_emmc=gpt write mmc 0 $partitions; reset;\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=PARTUUID=${uuid} rootwait rw\0" \
-	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
-	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
+	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
 	"mmcboot=echo Booting from mmc ...; " \
 		"run finduuid; " \
 		"run mmcargs; " \
Signature · 1 line
2.15.0
#8 lore raw

PATCH v2 1/6 pico-imx6ul: Move dfu_alt_info to CONFIG_DFU_ENV_SETTINGS variable

In reply to Otavio Salvador
Quoted 37 lines · On Thu, 16 Nov 2017 09:59:44 -0200 Otavio Salvador <[email protected]>…

From: Fabio Berton <[email protected]>

Create CONFIG_DFU_ENV_SETTINGS to set dfu environment settings to improve human readable code.

---

Changes in v2: None

 include/configs/pico-imx6ul.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/configs/pico-imx6ul.h index 75658fd489..d4b29e3950 100644

include/configs/pico-imx6ul.h +4 -1
@@ -47,6 +47,9 @@
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_16M
 #define DFU_DEFAULT_POLL_TIMEOUT 300
 
+#define CONFIG_DFU_ENV_SETTINGS \
+	"dfu_alt_info=boot raw 0x2 0x400 mmcpart 1\0" \
+
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -60,7 +63,7 @@
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
 	"mmcautodetect=yes\0" \
-	"dfu_alt_info=boot raw 0x2 0x400 mmcpart 1\0" \
+	CONFIG_DFU_ENV_SETTINGS \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=${mmcroot}\0" \
 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr}
Quoted 1 line

${image}\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-10 Fax: (+49)-8142-66989-80 Email: wd 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: <http://lists.denx.de/pipermail/u-boot/attachments/20171117/697484aa/attachment.sig>

#9 lore raw

PATCH v2 1/6 pico-imx6ul: Move dfu_alt_info to CONFIG_DFU_ENV_SETTINGS variable

In reply to Otavio Salvador

Hi Otavio,

Quoted 9 lines · Otavio Salvador

From: Fabio Berton <[email protected]>

Create CONFIG_DFU_ENV_SETTINGS to set dfu environment settings to improve human readable code.

---

Whole series applied to u-boot-imx, 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
=====================================================================