aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/boot/main.c27
-rw-r--r--arch/powerpc/boot/prom.h7
2 files changed, 34 insertions, 0 deletions
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 816446f0e497..b66634c9ea34 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -33,6 +33,14 @@ extern char _vmlinux_end[];
33extern char _initrd_start[]; 33extern char _initrd_start[];
34extern char _initrd_end[]; 34extern char _initrd_end[];
35 35
36/* A buffer that may be edited by tools operating on a zImage binary so as to
37 * edit the command line passed to vmlinux (by setting /chosen/bootargs).
38 * The buffer is put in it's own section so that tools may locate it easier.
39 */
40static char builtin_cmdline[512]
41 __attribute__((section("__builtin_cmdline")));
42
43
36struct addr_range { 44struct addr_range {
37 unsigned long addr; 45 unsigned long addr;
38 unsigned long size; 46 unsigned long size;
@@ -204,6 +212,23 @@ static int is_elf32(void *hdr)
204 return 1; 212 return 1;
205} 213}
206 214
215void export_cmdline(void* chosen_handle)
216{
217 int len;
218 char cmdline[2] = { 0, 0 };
219
220 if (builtin_cmdline[0] == 0)
221 return;
222
223 len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline));
224 if (len > 0 && cmdline[0] != 0)
225 return;
226
227 setprop(chosen_handle, "bootargs", builtin_cmdline,
228 strlen(builtin_cmdline) + 1);
229}
230
231
207void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) 232void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
208{ 233{
209 int len; 234 int len;
@@ -289,6 +314,8 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
289 memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size); 314 memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size);
290 } 315 }
291 316
317 export_cmdline(chosen_handle);
318
292 /* Skip over the ELF header */ 319 /* Skip over the ELF header */
293#ifdef DEBUG 320#ifdef DEBUG
294 printf("... skipping 0x%lx bytes of ELF header\n\r", 321 printf("... skipping 0x%lx bytes of ELF header\n\r",
diff --git a/arch/powerpc/boot/prom.h b/arch/powerpc/boot/prom.h
index 3e2ddd4a5a81..a57b184c564f 100644
--- a/arch/powerpc/boot/prom.h
+++ b/arch/powerpc/boot/prom.h
@@ -31,4 +31,11 @@ static inline int getprop(void *phandle, const char *name,
31 return call_prom("getprop", 4, 1, phandle, name, buf, buflen); 31 return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
32} 32}
33 33
34
35static inline int setprop(void *phandle, const char *name,
36 void *buf, int buflen)
37{
38 return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
39}
40
34#endif /* _PPC_BOOT_PROM_H_ */ 41#endif /* _PPC_BOOT_PROM_H_ */