[U-Boot] [PATCH v2 14/16] stm32mp1: add check for presence of environment in boot device

Pierre-Jean Texier pjtexier at koncepto.io
Sun Jul 7 18:14:04 UTC 2019


Le 05/07/2019 à 17:20, Patrick Delaunay a écrit :
> For boot from flash, check presence of default environment to force
> save env.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
> 
> Changes in v2: None
> 
>   include/configs/stm32mp1.h | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
> index 1d385e0..6c74b4b 100644
> --- a/include/configs/stm32mp1.h
> +++ b/include/configs/stm32mp1.h
> @@ -112,6 +112,7 @@
>   	"if test ${boot_device} = serial || test ${boot_device} = usb;" \
>   	"then stm32prog ${boot_device} ${boot_instance}; " \
>   	"else " \
> +		"run env_check;" \
>   		"if test ${boot_device} = mmc;" \
>   		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
>   		"if test ${boot_device} = nand;" \
> @@ -143,6 +144,9 @@
>   	"ramdisk_addr_r=0xc4400000\0" \
>   	"fdt_high=0xffffffff\0" \
>   	"initrd_high=0xffffffff\0" \
> +	"env_default=1\0"				\
> +	"env_check=if test $env_default -eq 1;"\
> +		" then env set env_default 0;env save;fi\0" \
>   	STM32MP_BOOTCMD \
>   	STM32MP_MTDPARTS \
>   	BOOTENV
> 

Tested: stm32mp157a-dk1 (OS Buildroot with ^metadata_csum option for
mke2fs)

STM32MP> env print env_default
env_default=1
STM32MP> run bootcmd
Boot over mmc0!
Saving Environment to EXT4... Journal Scan Completed
Recovery required
Journal Recovery Completed
file found, deleting
update journal finished
File System is consistent
update journal finished
done
OK
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:4...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
125 bytes read in 3 ms (40 KiB/s)
1:      stm32mp15-buildroot
Retrieving file: /boot/zImage
3948320 bytes read in 170 ms (22.1 MiB/s)
append: root=/dev/mmcblk0p4 rootwait
Retrieving file: /boot/stm32mp157a-dk1.dtb
38698 bytes read in 5 ms (7.4 MiB/s)
...

So,

Tested-by: Pierre-Jean Texier <pjtexier at koncepto.io>

Regards,
-- 
Pierre-Jean Texier
Embedded Linux Engineer
https://koncepto.io


More information about the U-Boot mailing list