[PATCH 4/8] qi-add-append_device_specific_cmdline-API.patch
Andy Green
andy at openmoko.com
Tue Feb 3 19:12:33 CET 2009
Add a board API callback that allows a device-specific
commandline area to be created at the time the kernel
commandline is being composed.
Signed-off-by: Andy Green <andy at openmoko.com>
---
include/qi.h | 1 +
src/phase2.c | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/qi.h b/include/qi.h
index 84fdc50..b99695d 100644
--- a/include/qi.h
+++ b/include/qi.h
@@ -102,6 +102,7 @@ struct board_api {
void (*early_port_init)(void);
void (*port_init)(void);
void (*post_serial_init)(void); /* print device-specific things */
+ char * (*append_device_specific_cmdline)(char *);
void (*putc)(char);
void (*close)(void);
u8 (*get_ui_keys)(void);
diff --git a/src/phase2.c b/src/phase2.c
index 1fe96b8..4a7ff18 100644
--- a/src/phase2.c
+++ b/src/phase2.c
@@ -185,7 +185,6 @@ static void do_params(unsigned initramfs_len,
(this_board->get_board_variant)();
const char *p;
char * cmdline;
- char * p1;
struct tag *params = (struct tag *)this_board->linux_tag_placement;
/* eat leading white space */
@@ -225,7 +224,18 @@ static void do_params(unsigned initramfs_len,
/* kernel commandline */
cmdline = params->u.cmdline.cmdline;
+
+ /* start with the fixed device part of the commandline */
+
cmdline += strlen(strcpy(cmdline, p));
+
+ /* if the board itself needs a computed commandline, add it now */
+
+ if (this_board->append_device_specific_cmdline)
+ cmdline = (this_board->append_device_specific_cmdline)(cmdline);
+
+ /* If he is giving an append commandline for this rootfs, apply that */
+
if (this_kernel->commandline_append)
cmdline += strlen(strcpy(cmdline,
this_kernel->commandline_append));
@@ -235,9 +245,10 @@ static void do_params(unsigned initramfs_len,
/* deal with any trailing newlines that hitched a ride */
- p1 = cmdline + strlen(cmdline) - 1;
- while (*p1 == '\n')
- *p1-- = '\0';
+ while (*(cmdline - 1) == '\n')
+ cmdline--;
+
+ *cmdline = '\0';
/*
* if he's still holding down the UI_ACTION_SKIPKERNEL key
More information about the openmoko-kernel
mailing list