stm32mp1: add check for presence of environment in boot device
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 5 Jul 2019 15:20:21 +0000 (17:20 +0200)
committerPatrick Delaunay <patrick.delaunay@st.com>
Fri, 12 Jul 2019 09:18:53 +0000 (11:18 +0200)
For boot from flash, check presence of default environment to force
save env.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Pierre-Jean Texier <pjtexier@koncepto.io>
include/configs/stm32mp1.h

index 637f9bf5b0239ecaed66fc09e0126be510b7fcdf..ed01d4d9c22428be93d30a66745200da779e8baf 100644 (file)
        "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;" \
        "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