[U-Boot] [PATCH 5/5] apalis-tk1: use UUID for rootfs

Marcel Ziswiler marcel.ziswiler at toradex.com
Fri May 24 08:01:46 UTC 2019


On Mon, 2019-05-13 at 12:15 +0300, Igor Opaniuk wrote:
> 1. Replace usage of "/dev/mmcblk*p*" with a proper UUID of rootfs
> partition. This fixes the issue, when MMC controllers are probed in
> a different order in U-boot and Linux kernel.
> 2. Fix legacy USB command (both sdboot and usbboot can be used now).
> 
> Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
> ---
>  include/configs/apalis-tk1.h | 62 ++++++++++++++++++++++++--------
> ----
>  1 file changed, 41 insertions(+), 21 deletions(-)
> 
> diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-
> tk1.h
> index 1d296ba51a..ff6c5e425d 100644
> --- a/include/configs/apalis-tk1.h
> +++ b/include/configs/apalis-tk1.h
> @@ -51,15 +51,22 @@
>  				"tegra124-apalis-eval.dtb fat 0 1
> mmcpart 0"
>  
>  #define EMMC_BOOTCMD \
> -	"emmcargs=ip=off root=/dev/mmcblk0p2 rw rootfstype=ext3
>  rootwait\0" \
> -	"emmcboot=run setup; setenv bootargs ${defargs} ${emmcargs} " \
> -		"${setupargs} ${vidargs}; echo Booting from internal
> eMMC " \
> -		"chip...; run emmcdtbload; load mmc 0:1
> ${kernel_addr_r} " \
> +	"set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} " \
> +		"rw

Same using of ro recommended instead as pointed out in previous patch.

>  rootfstype=ext3

Here we should also transition to using ext4 as we already did anywhere
else and in downstream.

>  rootwait\0" \
> +	"emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \
> +		"setenv bootargs ${defargs} ${emmcargs} " \
> +		"${setupargs} ${vidargs}; echo Booting from internal
> eMMC; " \
> +		"run emmcdtbload; " \
> +		"load mmc ${emmcdev}:${emmcbootpart} ${kernel_addr_r} "
> \
>  		"${boot_file} && run fdt_fixup && " \
>  		"bootm ${kernel_addr_r} - ${dtbparam}\0" \
> -	"emmcdtbload=setenv dtbparam; load mmc 0:1 ${fdt_addr_r} " \
> -		"${soc}-apalis-${fdt_board}.dtb && " \
> -		"setenv dtbparam ${fdt_addr_r}\0"
> +	"emmcbootpart=1\0" \
> +	"emmcdev=0\0" \
> +	"emmcdtbload=setenv dtbparam; load mmc
> ${emmcdev}:${emmcbootpart} " \
> +		"${fdt_addr_r} ${soc}-apalis-${fdt_board}.dtb && " \
> +		"setenv dtbparam ${fdt_addr_r}\0" \
> +	"emmcfinduuid=part uuid mmc ${mmcdev}:${emmcrootpart} uuid\0" \
> +	"emmcrootpart=2\0"
>  
>  #define NFS_BOOTCMD \
>  	"nfsargs=ip=:::::eth0:on root=/dev/nfs rw\0" \
> @@ -72,26 +79,38 @@
>  		"&& setenv dtbparam ${fdt_addr_r}\0"
>  
>  #define SD_BOOTCMD \
> -	"sdargs=ip=off root=/dev/mmcblk1p2 rw rootfstype=ext4
> rootwait\0" \
> -	"sdboot=run setup; setenv bootargs ${defargs} ${sdargs}
> ${setupargs} " \
> +	"set_sdargs=setenv sdargs ip=off root=PARTUUID=${uuid} rw

Same here.

>  " \
> +	"rootfstype=ext4 rootwait\0" \
> +	"sdboot=run setup; run sdfinduuid; run set_sdargs; " \
> +		"setenv bootargs ${defargs} ${sdargs} ${setupargs} " \
>  		"${vidargs}; echo Booting from SD card in 8bit slot...;
> " \
> -		"run sddtbload; load mmc 1:1 ${kernel_addr_r} " \
> -		"${boot_file} && run fdt_fixup && " \
> +		"run sddtbload; load mmc ${sddev}:${sdbootpart} " \
> +		"${kernel_addr_r} ${boot_file} && run fdt_fixup && " \
>  		"bootm ${kernel_addr_r} - ${dtbparam}\0" \
> -	"sddtbload=setenv dtbparam; load mmc 1:1 ${fdt_addr_r} " \
> -		"${soc}-apalis-${fdt_board}.dtb " \
> -		"&& setenv dtbparam ${fdt_addr_r}\0"
> +	"sdbootpart=1\0" \
> +	"sddev=1\0" \
> +	"sddtbload=setenv dtbparam; load mmc ${sddev}:${sdbootpart} " \
> +		"${fdt_addr_r} ${soc}-apalis-${fdt_board}.dtb " \
> +		"&& setenv dtbparam ${fdt_addr_r}\0" \
> +	"sdfinduuid=part uuid mmc ${sddev}:${sdrootpart} uuid\0" \
> +	"sdrootpart=2\0"
>  
>  #define USB_BOOTCMD \
> -	"usbargs=ip=off root=/dev/sda2 rw rootfstype=ext4 rootwait\0" \
> -	"usbboot=run setup; setenv bootargs ${defargs} ${setupargs} " \
> +	"set_usbargs=setenv usbargs ip=off root=PARTUUID=${uuid} rw " \

And here.

> +		"rootfstype=ext4 rootwait\0" \
> +	"usbboot=run setup; usb start; run usbfinduuid; run
> set_usbargs; " \
> +		"setenv bootargs ${defargs} ${setupargs} " \
>  		"${usbargs} ${vidargs}; echo Booting from USB stick...;
> " \
> -		"usb start && run usbdtbload; load usb 0:1
> ${kernel_addr_r} " \
> -		"${boot_file} && run fdt_fixup && " \
> +		"run usbdtbload; load usb ${usbdev}:${usbbootpart} " \
> +		"${kernel_addr_r} ${boot_file} && run fdt_fixup && " \
>  		"bootm ${kernel_addr_r} - ${dtbparam}\0" \
> -	"usbdtbload=setenv dtbparam; load usb 0:1 ${fdt_addr_r} " \
> -		"${soc}-apalis-${fdt_board}.dtb " \
> -		"&& setenv dtbparam ${fdt_addr_r}\0"
> +	"usbbootpart=1\0" \
> +	"usbdev=0\0" \
> +	"usbdtbload=setenv dtbparam; load usb ${usbdev}:${usbbootpart}
> " \
> +		"${fdt_addr_r} ${soc}-apalis-${fdt_board}.dtb " \
> +		"&& setenv dtbparam ${fdt_addr_r}\0" \
> +	"usbfinduuid=part uuid usb ${usbdev}:${usbrootpart} uuid\0" \
> +	"usbrootpart=2\0"
>  
>  #define BOARD_EXTRA_ENV_SETTINGS \
>  	"boot_file=uImage\0" \
> @@ -104,6 +123,7 @@
>  	"fdt_fixup=;\0" \
>  	NFS_BOOTCMD \
>  	SD_BOOTCMD \
> +	USB_BOOTCMD \
>  	"setethupdate=if env exists ethaddr; then; else setenv ethaddr
> " \
>  		"00:14:2d:00:00:00; fi; pci enum && tftpboot
> ${loadaddr} " \
>  		"flash_eth.img && source ${loadaddr}\0" \

With the above fixed:

Acked-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>


More information about the U-Boot mailing list