Skip to contentSkip to conversation

pico-imx6ul: Move dfu_alt_info to CONFIG_DFU_ENV_SETTINGS variable

PATCH Superseded Otavio Salvador 2 participants 12 messages Nov 14, 2017 Arm i.MX and Layerscape

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---

 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 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 eMMM changes depending on the kernel versions.

---

 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 2/6 pico-imx6ul: Use PARTUUID to specify the rootfs location

Quoted 5 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 eMMM changes depending on the

s/eMMM/eMMC

With this fixed:

#3 lore raw

PATCH 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

---

 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
reviewer
#4 lore raw

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

Quoted 25 lines · 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.

Quoted 8 lines

Run on target:
ums 0 mmc 0

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

#5 lore raw

PATCH 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.

---

 include/configs/pico-imx6ul.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/pico-imx6ul.h +3 -0
index 6a19861da7..43ef3ef6d0 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
reviewer
#6 lore raw

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

Quoted 17 lines · Otavio Salvador

From: Fabio Berton <[email protected]>

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

---

 include/configs/pico-imx6ul.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/pico-imx6ul.h +0 -0
index 6a19861da7..43ef3ef6d0 100644

include/configs/pico-imx6ul.h line 73

Quoted 6 lines
include/configs/pico-imx6ul.h +3 -0
@@ -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" \

Please make this 16MiB instead.

#7 lore raw

PATCH 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.

---

 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 43ef3ef6d0..b7469f8031 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
#9 lore raw

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

In reply to Otavio Salvador

From: Fabio Berton <[email protected]>

---

 include/configs/pico-imx6ul.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/pico-imx6ul.h +2 -2
index b7469f8031..4a43515782 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