Change boot logic a bit to work with both installers.
prisminstall sets BOOT_SIDE, and ginstall sets ACTIVATED_KERNEL_NAME,
change the boot code a bit to work with either installer.
Change-Id: Ibdaa3bc9f99e948a6bcb5f178f58871b5aa8c079
diff --git a/board/mv_feroceon/mv_kw2/mv_main.c b/board/mv_feroceon/mv_kw2/mv_main.c
index 4620f17..75fb62c 100644
--- a/board/mv_feroceon/mv_kw2/mv_main.c
+++ b/board/mv_feroceon/mv_kw2/mv_main.c
@@ -378,6 +378,44 @@
return;
}
+
+// Try to be compatible with both ginstall and prisminstall.
+// Prismintall sets a BOOT_SIDE sysvar, and ginstall sets
+// ACTIVATED_KERNEL_NAME, which is the same as the TV boxes.
+static void set_boot_variables() {
+ // Try to get the boot partition, either from BOOT_SIDE
+ // (set by prisminstall) or ACTIVATED_KERNEL_NAME (set by ginstall)
+ // First look for BOOT_SIDE.
+ char value[SYSVAR_VALUE];
+ if (sf_getvar("BOOT_SIDE", value, SYSVAR_VALUE) == 0) {
+ printf("BOOT_SIDE = %s ", value);
+ if (value[0] == '2' && value[1] == '\0') {
+ printf("Boot from MTD image2 ...\n");
+ setenv("bootcmd","sf read "LOAD_ADDR_STR" 0xF80000 0xE00000;"
+ "setenv bootargs ${console} ${mtdparts} debug=1 ${mvNetConfig} ${mvPhoneConfig};"
+ "bootm "LOAD_ADDR_STR";");
+ return;
+ }
+ if (value[0] == '1' && value[1] == '\0') {
+ printf("Boot from MTD image1 ...\n");
+ setenv("bootcmd","sf read "LOAD_ADDR_STR" 0x180000 0xE00000;"
+ "setenv bootargs ${console} ${mtdparts} debug=1 ${mvNetConfig} ${mvPhoneConfig};"
+ "bootm "LOAD_ADDR_STR";");
+ return;
+ }
+ }
+
+ // Now look for ACTIVATED_KERNEL_NAME. Setenv that value and the bootscript
+ // will branch to the right boot location.
+ if (sf_getvar("ACTIVATED_KERNEL_NAME", value, SYSVAR_VALUE) == 0) {
+ setenv("ACTIVATED_KERNEL_NAME", value);
+ } else {
+ setenv("ACTIVATED_KERNEL_NAME", "kernel0");
+ }
+ return;
+}
+
+
void misc_init_r_env(void){
char *env;
char tmp_buf[10];
@@ -742,22 +780,7 @@
ip=${ipaddr}:${serverip}${bootargs_end};bootm "LOAD_ADDR_STR";");
#endif
- char value[SYSVAR_VALUE];
- if (sf_getvar("BOOT_SIDE", value, SYSVAR_VALUE) == 0) {
- printf("BOOT_SIDE = %s ", value);
- if (value[0] == '2' && value[1] == '\0') {
- printf("Boot from MTD image2 ...\n");
- setenv("bootcmd","sf read "LOAD_ADDR_STR" 0xF80000 0xE00000;\
-setenv bootargs ${console} ${mtdparts} debug=1 ${mvNetConfig} ${mvPhoneConfig};\
-bootm "LOAD_ADDR_STR";");
- }
- else if (value[0] == '1' && value[1] == '\0') {
- printf("Boot from MTD image1 ...\n");
- setenv("bootcmd","sf read "LOAD_ADDR_STR" 0x180000 0xE00000;\
-setenv bootargs ${console} ${mtdparts} debug=1 ${mvNetConfig} ${mvPhoneConfig};\
-bootm "LOAD_ADDR_STR";");
- }
- }
+ set_boot_variables();
#endif /* (CONFIG_BOOTDELAY >= 0) */
env = getenv("standalone");