aboutsummaryrefslogtreecommitdiffstats
path: root/packages/u-boot/u-boot-1.3.2/boc01/014-081211-BOOT_RESCUE.patch
blob: d2ebdef77269ab694ea1a45f7c75352b6527270c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Index: u-boot-1.3.2/common/main.c
===================================================================
--- u-boot-1.3.2.orig/common/main.c
+++ u-boot-1.3.2/common/main.c
@@ -39,6 +39,7 @@
 #endif
 
 #include <post.h>
+#include <gpio.h>
 
 #ifdef CONFIG_SILENT_CONSOLE
 DECLARE_GLOBAL_DATA_PTR;
@@ -377,6 +378,15 @@ void main_loop (void)
 	}
 	else
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
+#ifdef CONFIG_ENV_BOOTRESCUE
+	if ( gpio_get(GPIO_RED_BUTTON) ) {
+		printf ("Red button pressed: booting in rescue mode.\n");
+		s = getenv (CONFIG_ENV_BOOTRESCUE);
+		if ( !s )
+			printf ("Warning: environment variable '" CONFIG_ENV_BOOTRESCUE "' not set. Giving up rescue boot.\n");
+	}
+	else
+#endif
 		s = getenv ("bootcmd");
 
 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
Index: u-boot-1.3.2/include/configs/MPC8313ERDB.h
===================================================================
--- u-boot-1.3.2.orig/include/configs/MPC8313ERDB.h
+++ u-boot-1.3.2/include/configs/MPC8313ERDB.h
@@ -406,6 +406,7 @@
 #define PRE_INIT_GPIO	0x28
 #define INIT_GPIO	0x08
 #define	MAX_GPIO_OUT 	7
+#define GPIO_RED_BUTTON 7
 
 /* Digital Thermometer and Thermostat */
 #define CONFIG_DTT_LM73		1
@@ -559,6 +560,7 @@
  * Environment Configuration
  */
 #define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_BOOTRESCUE   "bootrescue"
 
 #define CONFIG_ETHADDR		00:E0:0C:00:95:01
 #define CONFIG_HAS_ETH1