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.
10 #include <linux/bug.h>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/string.h>
15 #include <asm/sgialib.h>
16 #include <asm/bootinfo.h>
20 static char *ignored[] = {
30 static char *used_arc[][2] = {
31 { "OSLoadPartition=", "root=" },
32 { "OSLoadOptions=", "" }
35 static char * __init move_firmware_args(char* cp)
40 actr = 1; /* Always ignore argv[0] */
42 while (actr < prom_argc) {
43 for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
44 int len = strlen(used_arc[i][0]);
46 if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
47 /* Ok, we want it. First append the replacement... */
48 strcat(cp, used_arc[i][1]);
49 cp += strlen(used_arc[i][1]);
50 /* ... and now the argument */
51 s = strchr(prom_argv(actr), '=');
67 void __init prom_init_cmdline(void)
72 actr = 1; /* Always ignore argv[0] */
76 * Move ARC variables to the beginning to make sure they can be
77 * overridden by later arguments.
79 cp = move_firmware_args(cp);
81 while (actr < prom_argc) {
82 for (i = 0; i < ARRAY_SIZE(ignored); i++) {
83 int len = strlen(ignored[i]);
85 if (!strncmp(prom_argv(actr), ignored[i], len))
89 strcpy(cp, prom_argv(actr));
90 cp += strlen(prom_argv(actr));
97 if (cp != arcs_cmdline) /* get rid of trailing space */
102 printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);