Skip to contentSkip to conversation

PATCH:2.4:CONFIG_CMDLINE_BOOL

PATCH Michael Pruznick 2 participants 2 messages Aug 6, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

The patch at the bottom of this message adds support so that a board can choose to have a command line specified in the .config file or hard-coded. This is similar to what is in the ppc tree. All this patch does is create a config question and store the info in the config file. It is up to each board to read or not read this info.

Here is one example of its use:

Quoted 4 lines

#ifndef CONFIG_CMDLINE_BOOL
#define CONFIG_CMDLINE "console=ttyS0,38400 ip=any root=nfs rw" #endif
char arcs_cmdline[CL_SIZE] = CONFIG_CMDLINE;

Dynamic setting of args like this will still work with out any changes.

Quoted 7 lines
#ifdef CONFIG_NE2000
       argptr = prom_getcmdline();
       if ((argptr = strstr(argptr, "ne_eth=")) == NULL) { 
               argptr = prom_getcmdline();
               strcat(argptr, " ne_eth=0x6020280,29");
       }

#endif

To you this you may need to modify this fn keeping two things in mind. A) setting *arcs_cmdline to 0 unconditionally will clear the .config/hard-coded default. B) If the board supports a f/w command line string that should probably over-ride and .config/hard-coded default.

Quoted 16 lines

void __init
prom_init_cmdline(int argc, char **argv)

{
      int i;  /* Always ignore the "-c" at argv[0] */

      /* ignore all built-in args if any f/w args given */
      if (argc > 1) {
              *arcs_cmdline = '\0';
      }
      for (i = 1; i < argc; i++) {
              if (i != 1) {
                      strcat(arcs_cmdline, " ");
              }
              strcat(arcs_cmdline, argv[i]);
      }
}

Index: config-shared.in
===================================================================
RCS file: /home/cvs/linux/arch/mips/Attic/config-shared.in,v retrieving revision 1.1.2.80

config-shared.in 6 Aug 2003 19:52:41 -0000 renamed from config-shared.in 5 Aug 2003 11:13:39 -0000 1.1.2.80 +5 -0
diff -u -r1.1.2.80 config-shared.in
@@ -891,6 +891,11 @@
 fi
 endmenu
 
+bool 'Default kernel loader arguments' CONFIG_CMDLINE_BOOL
+if [ "$CONFIG_CMDLINE_BOOL" = "y" ] ; then
+   string 'Initial kernel command string' CONFIG_CMDLINE ""
+fi
+
 source drivers/mtd/Config.in
 
 source drivers/parport/Config.in
#1 lore raw
Quoted 7 lines · Michael Pruznick

The patch at the bottom of this message adds support so that a board can choose to have a command line specified in the .config file or hard-coded. This is similar to what is in the ppc tree. All this patch does is create a config question and store the info in the config file. It is up to each board to read or not read this info.

This is a good feature.

However, I think it is better to

1) always have CONFIG_CMDLINE defined
2) for boards that don't use it, it is "" (NULL string)
3) we need to modify all boards' prom_init routines so that they respect this config.
4) (optionally) some ugly static ctrcpy of cmdline can now be moved to use config options

Jun