diff options
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/preboot-override.patch')
-rw-r--r-- | meta/packages/uboot/u-boot-mkimage-openmoko-native/preboot-override.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/preboot-override.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/preboot-override.patch new file mode 100644 index 0000000000..f32cbde27b --- /dev/null +++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/preboot-override.patch | |||
@@ -0,0 +1,137 @@ | |||
1 | Provide a place where the loader can patch the binary, such that it executes a | ||
2 | command string from RAM. We use this for automated installs, where we can thus | ||
3 | use the same u-boot binary for all stages. | ||
4 | |||
5 | include/configs/neo1973.h: new option CFG_PREBOOT_OVERRIDE to allow setting of | ||
6 | the preboot command in memory | ||
7 | cpu/arm920t/start.S: added variable "preboot_override" at known location | ||
8 | (_start+0x40) | ||
9 | common/main.c (main_loop): if preboot_override is set, execute the command | ||
10 | string found there | ||
11 | common/env_common.c (env_relocate): if preboot_override is set, always use the | ||
12 | default environment | ||
13 | |||
14 | - Werner Almesberger <werner@openmoko.org> | ||
15 | |||
16 | Index: u-boot/cpu/arm920t/start.S | ||
17 | =================================================================== | ||
18 | --- u-boot.orig/cpu/arm920t/start.S | ||
19 | +++ u-boot/cpu/arm920t/start.S | ||
20 | @@ -77,6 +77,14 @@ _fiq: .word fiq | ||
21 | ************************************************************************* | ||
22 | */ | ||
23 | |||
24 | + | ||
25 | +/* Must follow the .balign above, so we get a well-known address ! */ | ||
26 | +#ifdef CFG_PREBOOT_OVERRIDE | ||
27 | +.globl preboot_override | ||
28 | +preboot_override: | ||
29 | + .word 0 | ||
30 | +#endif | ||
31 | + | ||
32 | #ifdef CONFIG_S3C2410_NAND_BOOT | ||
33 | .globl booted_from_nand | ||
34 | booted_from_nand: | ||
35 | Index: u-boot/include/configs/neo1973_gta01.h | ||
36 | =================================================================== | ||
37 | --- u-boot.orig/include/configs/neo1973_gta01.h | ||
38 | +++ u-boot/include/configs/neo1973_gta01.h | ||
39 | @@ -207,6 +207,7 @@ | ||
40 | #define CFG_ENV_IS_IN_NAND 1 | ||
41 | #define CFG_ENV_SIZE 0x4000 /* 16k Total Size of Environment Sector */ | ||
42 | #define CFG_ENV_OFFSET_OOB 1 /* Location of ENV stored in block 0 OOB */ | ||
43 | +#define CFG_PREBOOT_OVERRIDE 1 /* allow preboot from memory */ | ||
44 | |||
45 | #define NAND_MAX_CHIPS 1 | ||
46 | #define CFG_NAND_BASE 0x4e000000 | ||
47 | Index: u-boot/common/main.c | ||
48 | =================================================================== | ||
49 | --- u-boot.orig/common/main.c | ||
50 | +++ u-boot/common/main.c | ||
51 | @@ -85,6 +85,11 @@ int do_mdm_init = 0; | ||
52 | extern void mdm_init(void); /* defined in board.c */ | ||
53 | #endif | ||
54 | |||
55 | +#ifdef CFG_PREBOOT_OVERRIDE | ||
56 | +extern char *preboot_override; | ||
57 | +#endif | ||
58 | + | ||
59 | + | ||
60 | /*************************************************************************** | ||
61 | * Watch for 'delay' seconds for autoboot stop or autoboot delay string. | ||
62 | * returns: 0 - no key string, allow autoboot | ||
63 | @@ -306,8 +311,8 @@ void main_loop (void) | ||
64 | char *s; | ||
65 | int bootdelay; | ||
66 | #endif | ||
67 | -#ifdef CONFIG_PREBOOT | ||
68 | - char *p; | ||
69 | +#if defined(CONFIG_PREBOOT) || defined(CFG_PREBOOT_OVERRIDE) | ||
70 | + char *p = NULL; | ||
71 | #endif | ||
72 | #ifdef CONFIG_BOOTCOUNT_LIMIT | ||
73 | unsigned long bootcount = 0; | ||
74 | @@ -364,8 +369,23 @@ void main_loop (void) | ||
75 | install_auto_complete(); | ||
76 | #endif | ||
77 | |||
78 | +#if defined(CONFIG_PREBOOT) || defined(CFG_PREBOOT_OVERRIDE) | ||
79 | #ifdef CONFIG_PREBOOT | ||
80 | - if ((p = getenv ("preboot")) != NULL) { | ||
81 | + p = getenv ("preboot"); | ||
82 | +#endif | ||
83 | +#ifdef CFG_PREBOOT_OVERRIDE | ||
84 | + if (preboot_override) { | ||
85 | + /* for convenience, preboot_override may end in \n, not \0 */ | ||
86 | + p = strchr(preboot_override, '\n'); | ||
87 | + if (p) | ||
88 | + *p = 0; | ||
89 | + /* make sure we can overwrite the load area if we want to */ | ||
90 | + p = strdup(preboot_override); | ||
91 | + /* clean the image in case we want to flash it */ | ||
92 | + preboot_override = NULL; | ||
93 | + } | ||
94 | +#endif /* CFG_PREBOOT_OVERRIDE */ | ||
95 | + if (p) { | ||
96 | # ifdef CONFIG_AUTOBOOT_KEYED | ||
97 | int prev = disable_ctrlc(1); /* disable Control C checking */ | ||
98 | # endif | ||
99 | @@ -381,7 +401,7 @@ void main_loop (void) | ||
100 | disable_ctrlc(prev); /* restore Control C checking */ | ||
101 | # endif | ||
102 | } | ||
103 | -#endif /* CONFIG_PREBOOT */ | ||
104 | +#endif /* CONFIG_PREBOOT || CFG_PREBOOT_OVERRIDE */ | ||
105 | |||
106 | #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) | ||
107 | s = getenv ("bootdelay"); | ||
108 | Index: u-boot/common/env_common.c | ||
109 | =================================================================== | ||
110 | --- u-boot.orig/common/env_common.c | ||
111 | +++ u-boot/common/env_common.c | ||
112 | @@ -37,6 +37,10 @@ | ||
113 | # define SHOW_BOOT_PROGRESS(arg) | ||
114 | #endif | ||
115 | |||
116 | +#ifdef CFG_PREBOOT_OVERRIDE | ||
117 | +extern char *preboot_override; | ||
118 | +#endif | ||
119 | + | ||
120 | DECLARE_GLOBAL_DATA_PTR; | ||
121 | |||
122 | #ifdef CONFIG_AMIGAONEG3SE | ||
123 | @@ -234,7 +238,14 @@ void env_relocate (void) | ||
124 | puts ("*** Warning - bad CRC, using default environment\n\n"); | ||
125 | SHOW_BOOT_PROGRESS (-1); | ||
126 | #endif | ||
127 | + } | ||
128 | + | ||
129 | +#ifdef CFG_PREBOOT_OVERRIDE | ||
130 | + if (preboot_override) | ||
131 | + gd->env_valid = 0; | ||
132 | +#endif | ||
133 | |||
134 | + if (gd->env_valid == 0) { | ||
135 | if (sizeof(default_environment) > ENV_SIZE) | ||
136 | { | ||
137 | puts ("*** Error - default environment is too large\n\n"); | ||