From patchwork Tue Mar 31 16:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 244653 List-Id: U-Boot discussion From: patrick.delaunay at st.com (Patrick Delaunay) Date: Tue, 31 Mar 2020 18:04:21 +0200 Subject: [PATCH 04/16] arm: stm32mp: detect U-Boot version used to save environment In-Reply-To: <20200331180330.1.Ied6708bad5048382a57618f95d67c549aae49f42@changeid> References: <20200331180330.1.Ied6708bad5048382a57618f95d67c549aae49f42@changeid> Message-ID: <20200331160456.26254-1-patrick.delaunay@st.com> Imply CONFIG_VERSION_VARIABLE for stm32mp1 target and test U-Boot version ($env_ver) when the environment was saved for the last time and to display warning trace. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/Kconfig | 1 + include/configs/stm32mp1.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index 032facff31..a86288cb76 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -67,6 +67,7 @@ config TARGET_ST_STM32MP15x imply DISABLE_CONSOLE imply PRE_CONSOLE_BUFFER imply SILENT_CONSOLE + imply VERSION_VARIABLE help target the STMicroelectronics board with SOC STM32MP15x managed by board/st/stm32mp1: diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index 42717c167e..ae060fbc4b 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -222,9 +222,14 @@ "splashimage=0xc4300000\0" \ "ramdisk_addr_r=0xc4400000\0" \ "altbootcmd=run bootcmd\0" \ - "env_default=1\0" \ - "env_check=if test $env_default -eq 1;"\ - " then env set env_default 0;env save;fi\0" \ + "env_check=" \ + "env exists env_ver || env set env_ver ${ver};" \ + "if env info -p -d -q; then env save; fi;" \ + "if test \"$env_ver\" != \"$ver\"; then" \ + " echo \"*** Warning: old environment ${env_ver}\";" \ + " echo '* set default: env default -a; env save; reset';" \ + " echo '* update current: env set env_ver ${ver}; env save';" \ + "fi;\0" \ STM32MP_BOOTCMD \ STM32MP_MTDPARTS \ STM32MP_DFU_ALT_RAM \