Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28755
b: refs/heads/master
c: 30d8caf
h: refs/heads/master
i:
  28753: a75b6e5
  28751: 609285a
v: v3
  • Loading branch information
mostrows@watson.ibm.com authored and Paul Mackerras committed Jun 15, 2006
1 parent 5c48713 commit 088435e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 204face4fb3ba2ca09a4073e7debc595e14c2388
refs/heads/master: 30d8caf7c625203b295a78f143820cdc3124830b
27 changes: 27 additions & 0 deletions trunk/arch/powerpc/boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ extern char _vmlinux_end[];
extern char _initrd_start[];
extern char _initrd_end[];

/* A buffer that may be edited by tools operating on a zImage binary so as to
* edit the command line passed to vmlinux (by setting /chosen/bootargs).
* The buffer is put in it's own section so that tools may locate it easier.
*/
static char builtin_cmdline[512]
__attribute__((section("__builtin_cmdline")));


struct addr_range {
unsigned long addr;
unsigned long size;
Expand Down Expand Up @@ -204,6 +212,23 @@ static int is_elf32(void *hdr)
return 1;
}

void export_cmdline(void* chosen_handle)
{
int len;
char cmdline[2] = { 0, 0 };

if (builtin_cmdline[0] == 0)
return;

len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline));
if (len > 0 && cmdline[0] != 0)
return;

setprop(chosen_handle, "bootargs", builtin_cmdline,
strlen(builtin_cmdline) + 1);
}


void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
{
int len;
Expand Down Expand Up @@ -289,6 +314,8 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size);
}

export_cmdline(chosen_handle);

/* Skip over the ELF header */
#ifdef DEBUG
printf("... skipping 0x%lx bytes of ELF header\n\r",
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/powerpc/boot/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ static inline int getprop(void *phandle, const char *name,
return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
}


static inline int setprop(void *phandle, const char *name,
void *buf, int buflen)
{
return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
}

#endif /* _PPC_BOOT_PROM_H_ */

0 comments on commit 088435e

Please sign in to comment.