patch-2.4.6 linux/arch/mips/arc/cmdline.c
Next file: linux/arch/mips/arc/console.c
Previous file: linux/arch/mips/Makefile
Back to the patch index
Back to the overall index
- Lines: 68
- Date:
Mon Jul 2 13:56:40 2001
- Orig file:
v2.4.5/linux/arch/mips/arc/cmdline.c
- Orig date:
Fri Apr 13 20:26:07 2001
diff -u --recursive --new-file v2.4.5/linux/arch/mips/arc/cmdline.c linux/arch/mips/arc/cmdline.c
@@ -25,10 +25,49 @@
"SystemPartition=",
"OSLoader=",
"OSLoadPartition=",
- "OSLoadFilename="
+ "OSLoadFilename=",
+ "OSLoadOptions="
};
#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+static char *used_arc[][2] = {
+ { "OSLoadPartition=", "root=" },
+ { "OSLoadOptions=", "" }
+};
+
+static char * __init move_firmware_args(char* cp)
+{
+ char *s;
+ int actr, i;
+
+ actr = 1; /* Always ignore argv[0] */
+
+ while (actr < prom_argc) {
+ for(i = 0; i < NENTS(used_arc); i++) {
+ int len = strlen(used_arc[i][0]);
+
+ if(!strncmp(prom_argv[actr], used_arc[i][0], len)) {
+ /* Ok, we want it. First append the replacement... */
+ strcat(cp, used_arc[i][1]);
+ cp += strlen(used_arc[i][1]);
+ /* ... and now the argument */
+ s = strstr(prom_argv[actr], "=");
+ if(s) {
+ s++;
+ strcpy(cp, s);
+ cp += strlen(s);
+ }
+ *cp++ = ' ';
+ break;
+ }
+ }
+ actr++;
+ }
+
+ return cp;
+}
+
+
void __init prom_init_cmdline(void)
{
char *cp;
@@ -37,8 +76,14 @@
actr = 1; /* Always ignore argv[0] */
cp = &(arcs_cmdline[0]);
- while(actr < prom_argc) {
- for(i = 0; i < NENTS(ignored); i++) {
+ /*
+ * Move ARC variables to the beginning to make sure they can be
+ * overridden by later arguments.
+ */
+ cp = move_firmware_args(cp);
+
+ while (actr < prom_argc) {
+ for (i = 0; i < NENTS(ignored); i++) {
int len = strlen(ignored[i]);
if(!strncmp(prom_argv[actr], ignored[i], len))
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)