Support expressing the command line arguments at make invocation.  Use
same section name as Linux's zImage so that arguments can be manipulated
by external tools.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>

---

 Makefile  |    3 +++
 boot_of.c |    7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff -r 12da2c3245bb xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Thu Jul 27 20:07:02 2006 -0400
+++ b/xen/arch/powerpc/Makefile Tue Aug 01 22:42:18 2006 -0400
@@ -83,6 +83,9 @@ physdev.o: ../x86/physdev.c
 
 HDRS += $(wildcard *.h)
 
+CMDLINE = "xen"
+boot_of.o: CFLAGS += -DCMDLINE="\"$(CMDLINE)\""
+
 start.o: boot/start.S
        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
 
diff -r 12da2c3245bb xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Thu Jul 27 20:07:02 2006 -0400
+++ b/xen/arch/powerpc/boot_of.c        Tue Aug 01 22:42:18 2006 -0400
@@ -36,6 +36,9 @@ static int of_out;
 static int of_out;
 static ofdn_t boot_cpu;
 static char bootargs[256];
+
+static char builtin_cmdline[]
+    __attribute__((section("__builtin_cmdline"))) = CMDLINE;
 
 extern struct ns16550_defaults ns16550;
 
@@ -449,8 +452,8 @@ static void boot_of_bootargs(multiboot_i
     int rc;
 
     rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs));
-    if (rc == OF_FAILURE) {
-        strcpy(bootargs, "xen");
+    if (rc == OF_FAILURE || bootargs[0] == '\0') {
+        strlcpy(bootargs, builtin_cmdline, sizeof(bootargs));
     }
 
     mbi->flags |= MBI_CMDLINE;

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to