aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2006-06-23 16:46:23 -0400
committerTony Luck <tony.luck@intel.com>2006-06-23 16:46:23 -0400
commit8cf60e04a131310199d5776e2f9e915f0c468899 (patch)
tree373a68e88e6737713a0a5723d552cdeefffff929 /arch/powerpc/boot
parent1323523f505606cfd24af6122369afddefc3b09d (diff)
parent95eaa5fa8eb2c345244acd5f65b200b115ae8c65 (diff)
Auto-update from upstream
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--arch/powerpc/boot/main.c27
-rw-r--r--arch/powerpc/boot/prom.h7
3 files changed, 36 insertions, 2 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 840ae595a617..d961bfeed05f 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -29,8 +29,8 @@ OBJCOPYFLAGS := contents,alloc,load,readonly,data
29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
30OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment 30OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
31 31
32zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 32zlib := inffast.c inflate.c inftrees.c
33zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h 33zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
34zliblinuxheader := zlib.h zconf.h zutil.h 34zliblinuxheader := zlib.h zconf.h zutil.h
35 35
36$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 36$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
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_ */