[U-Boot] [PATCH 1/6] pico-imx6ul: Move dfu_alt_info to CONFIG_DFU_ENV_SETTINGS variable

From: Fabio Berton fabio.berton@ossystems.com.br
Create CONFIG_DFU_ENV_SETTINGS to set dfu environment settings to improve human readable code.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br ---
include/configs/pico-imx6ul.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 75658fd489..d4b29e3950 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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" \

From: Fabio Berton fabio.berton@ossystems.com.br
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.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br ---
configs/pico-imx6ul_defconfig | 1 + include/configs/pico-imx6ul.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 09b36ccb09..e00f9f34a3 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -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 diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index d4b29e3950..c775c32690 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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 */

On Tue, Nov 14, 2017 at 4:07 PM, Otavio Salvador otavio@ossystems.com.br wrote:
From: Fabio Berton fabio.berton@ossystems.com.br
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:
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com

From: Fabio Berton fabio.berton@ossystems.com.br
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
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br ---
include/configs/pico-imx6ul.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index c775c32690..6a19861da7 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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

On Tue, Nov 14, 2017 at 4:07 PM, Otavio Salvador otavio@ossystems.com.br wrote:
From: Fabio Berton fabio.berton@ossystems.com.br
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
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com

From: Fabio Berton fabio.berton@ossystems.com.br
Create layout with a boot 16MiB partition and rootfs with remain space.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br ---
include/configs/pico-imx6ul.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 6a19861da7..43ef3ef6d0 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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" \

On Tue, Nov 14, 2017 at 4:07 PM, Otavio Salvador otavio@ossystems.com.br wrote:
From: Fabio Berton fabio.berton@ossystems.com.br
Create layout with a boot 16MiB partition and rootfs with remain space.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br
include/configs/pico-imx6ul.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 6a19861da7..43ef3ef6d0 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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.

From: Fabio Berton fabio.berton@ossystems.com.br
Command run setup_emmc will create gpt partitions for mmc 0 device based on patitions variable.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br ---
configs/pico-imx6ul_defconfig | 1 + include/configs/pico-imx6ul.h | 1 + 2 files changed, 2 insertions(+)
diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index e00f9f34a3..f28f9b7a4e 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -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 diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 43ef3ef6d0..b7469f8031 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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" \

On Tue, Nov 14, 2017 at 4:07 PM, Otavio Salvador otavio@ossystems.com.br wrote:
From: Fabio Berton fabio.berton@ossystems.com.br
Command run setup_emmc will create gpt partitions for mmc 0 device based on patitions variable.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com

From: Fabio Berton fabio.berton@ossystems.com.br
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br ---
include/configs/pico-imx6ul.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index b7469f8031..4a43515782 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -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; " \

On Tue, Nov 14, 2017 at 4:07 PM, Otavio Salvador otavio@ossystems.com.br wrote:
From: Fabio Berton fabio.berton@ossystems.com.br
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com

On Tue, Nov 14, 2017 at 4:07 PM, Otavio Salvador otavio@ossystems.com.br wrote:
From: Fabio Berton fabio.berton@ossystems.com.br
Create CONFIG_DFU_ENV_SETTINGS to set dfu environment settings to improve human readable code.
Signed-off-by: Fabio Berton fabio.berton@ossystems.com.br Signed-off-by: Otavio Salvador otavio@ossystems.com.br
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com
participants (2)
-
Fabio Estevam
-
Otavio Salvador