From 11d9dd468b34afe6b99ccbc647b5673ee20197cd Mon Sep 17 00:00:00 2001
From: Mauro Condarelli <mc5686@mclink.it>
Date: Wed, 2 Sep 2020 16:41:20 +0200
Subject: [PATCH 4/4] Project specific ENV initialization.

Signed-off-by: Mauro Condarelli <mc5686@mclink.it>
---
 include/configs/vocore2.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/configs/vocore2.h b/include/configs/vocore2.h
index dfdb8fcc04..ea8740720c 100644
--- a/include/configs/vocore2.h
+++ b/include/configs/vocore2.h
@@ -49,5 +49,19 @@
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
 
 /* Environment settings */
+#define CONFIG_BOOTCOMMAND \
+    "run fupdate; run boot_r"
+#define CONFIG_EXTRA_ENV_SETTINGS \
+    "default_bootargs=earlyprintk rootwait console=ttyS2,115200\0"                                                                                                                                                                     \
+    "mtdids=nor0=spi0.0\0"                                                                                                                                                                                                             \
+    "mtdparts=spi0.0:312k(u-boot),4k(env),4k(factory),2368k(kernel),-(filesystem)\0"                                                                                                                                                   \
+    "fupdate=mmc rescan && load mmc 0:1 84000000 uboot.scr && fatrm mmc 0:1 uboot.scr && source 84000000 && echo Flash updated\0"                                                                                                      \
+    "boot_a=echo \"Loading System A\";part=6;run boot_x\0"                                                                                                                                                                             \
+    "boot_b=echo \"Loading System B\";part=7;run boot_x\0"                                                                                                                                                                             \
+    "boot_x=load mmc 0:${part} 85000000 /boot/uImage && setenv bootargs \"${default_bootargs} mtdparts=${mtdparts} root=/dev/mmcblk0p${part}\" && bootm ${fileaddr}\0"                                                          \
+    "boot_r=echo \"Loading Recovery\"; setenv bootargs \"${default_bootargs} mtdparts=${mtdparts} root=/dev/mtdblock5\"; bootm bc050000\0"                                                                                             \
+    "remove_boot=if env exists BOOT_CURRENT; then setenv BOOT_CURRENT; saveenv; elif env exists BOOT_A_GOOD; then setenv BOOT_A_GOOD; saveenv; elif env exists BOOT_B_GOOD; then setenv BOOT_B_GOOD; saveenv; fi\0"                    \
+    "boot_now=if test \"${BOOT_CURRENT}\" = A; then run boot_a; elif test \"${BOOT_CURRENT}\" = B; then run boot_b; fi; if env exists BOOT_A_GOOD; then run boot_a; fi; if env exists BOOT_B_GOOD; then run boot_b; fi; run boot_r\0"  \
+    "do_boot=test ${bootcount} -gt 1 && run remove_boot; run boot_now"
 
 #endif //__VOCORE2_CONFIG_H__
-- 
2.25.1

