u-boot-aspeed: Generate default env for eMMC

Generate a default environment to boot an eMMC based on a txt
file. Populate the generated environment image into the eMMC.

Change-Id: I9d4a68decb93a51ec4419c0491ae020f647692af
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bb b/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bb
index 3ecd17c..99bcafc 100644
--- a/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bb
+++ b/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bb
@@ -6,3 +6,17 @@
 
 PROVIDES += "u-boot"
 DEPENDS += "bc-native dtc-native"
+
+SRC_URI_append_df-phosphor-mmc = " file://u-boot-env-ast2600.txt"
+
+UBOOT_ENV_SIZE_df-phosphor-mmc = "0x10000"
+UBOOT_ENV_df-phosphor-mmc = "u-boot-env"
+UBOOT_ENV_SUFFIX_df-phosphor-mmc = "bin"
+
+do_compile_append() {
+    if [ -n "${UBOOT_ENV}" ]
+    then
+        # Generate redundant environment image
+        ${B}/tools/mkenvimage -r -s ${UBOOT_ENV_SIZE} -o ${WORKDIR}/${UBOOT_ENV_BINARY} ${WORKDIR}/u-boot-env-ast2600.txt
+    fi
+}