2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * cmdline.c: Kernel command line creation using ARCS argc/argv.
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/string.h>
14 #include <asm/sgialib.h>
15 #include <asm/bootinfo.h>
19 char * __init
prom_getcmdline(void)
24 static char *ignored
[] = {
34 static char *used_arc
[][2] = {
35 { "OSLoadPartition=", "root=" },
36 { "OSLoadOptions=", "" }
39 static char * __init
move_firmware_args(char* cp
)
44 actr
= 1; /* Always ignore argv[0] */
46 while (actr
< prom_argc
) {
47 for(i
= 0; i
< ARRAY_SIZE(used_arc
); i
++) {
48 int len
= strlen(used_arc
[i
][0]);
50 if (!strncmp(prom_argv(actr
), used_arc
[i
][0], len
)) {
51 /* Ok, we want it. First append the replacement... */
52 strcat(cp
, used_arc
[i
][1]);
53 cp
+= strlen(used_arc
[i
][1]);
54 /* ... and now the argument */
55 s
= strstr(prom_argv(actr
), "=");
71 void __init
prom_init_cmdline(void)
76 actr
= 1; /* Always ignore argv[0] */
80 * Move ARC variables to the beginning to make sure they can be
81 * overridden by later arguments.
83 cp
= move_firmware_args(cp
);
85 while (actr
< prom_argc
) {
86 for (i
= 0; i
< ARRAY_SIZE(ignored
); i
++) {
87 int len
= strlen(ignored
[i
]);
89 if (!strncmp(prom_argv(actr
), ignored
[i
], len
))
93 strcpy(cp
, prom_argv(actr
));
94 cp
+= strlen(prom_argv(actr
));
101 if (cp
!= arcs_cmdline
) /* get rid of trailing space */
106 printk(KERN_DEBUG
"prom cmdline: %s\n", arcs_cmdline
);