From 6e786a3971d414faa369de86c79d456f2c87fad0 Mon Sep 17 00:00:00 2001 From: Raptor Engineering Development Team Date: Sat, 15 Feb 2020 04:35:28 +0000 Subject: Automatically write default U-boot environment into Flash if environment damaged on U-boot load This allows the default environment string in the U-boot binary to be used versus the (potentially incorrect) default environment string in fw_printenv / fw_setenv --- .../files/save-default-environment-on-crc-fail.patch | 14 ++++++++++++++ meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed_2016.07.bb | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 meta-aspeed/recipes-bsp/u-boot/files/save-default-environment-on-crc-fail.patch diff --git a/meta-aspeed/recipes-bsp/u-boot/files/save-default-environment-on-crc-fail.patch b/meta-aspeed/recipes-bsp/u-boot/files/save-default-environment-on-crc-fail.patch new file mode 100644 index 000000000..a6b58b6dd --- /dev/null +++ b/meta-aspeed/recipes-bsp/u-boot/files/save-default-environment-on-crc-fail.patch @@ -0,0 +1,14 @@ +diff --git a/common/env_common.c b/common/env_common.c +index 13db7dc..00ca394 100644 +--- a/common/env_common.c ++++ b/common/env_common.c +@@ -122,6 +122,9 @@ void set_default_env(const char *s) + 0, NULL) == 0) + error("Environment import failed: errno = %d\n", errno); + ++ puts("Storing new environment in Flash\n\n"); ++ saveenv(); ++ + gd->flags |= GD_FLG_ENV_READY; + gd->flags |= GD_FLG_ENV_DEFAULT; + } diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed_2016.07.bb b/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed_2016.07.bb index ac1ead714..1409ca786 100644 --- a/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed_2016.07.bb +++ b/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed_2016.07.bb @@ -1,6 +1,8 @@ require u-boot-common-aspeed_${PV}.inc require recipes-bsp/u-boot/u-boot.inc +SRC_URI += "file://save-default-environment-on-crc-fail.patch" + PROVIDES += "u-boot" DEPENDS += "dtc-native" -- cgit v1.2.1