optional hardcoded kernel command line i386, x86_64 linux-2.4.20
PATCH 1/1 optional hardcoded kernel command line i386, x86_64 linux-2.4.20
2003.03.04 -- cmdline-linux-2.4.20.patch
This patch provides an optional hardcoded kernel command line along with with specifyable override behaviour against the command line provided by the bootloader (if any) written for arch/i386 and arch/x86_64 in linux-2.4.20 by Eric Noack (Corvus V Corax) <[email protected]>
I have seen this feature as a patch for >= 2.5.x , but missed it for linux 2.4.x, so i just wrote it, maybe there is already one, which I missed, so just take the better ;-)
I guess it might be useful for floppy boot, but it needs testing at least on the x86_64 architecture, i dont have one of these yet
patch is at
http://gemia.de/test/cmdline-patch.tgz
\ README \ cmdline-linux-2.4.20.patch
please tell me if there are any problems with it, would you? ;) have fun ...
Corvus Corax
(aka Eric Noack)
Quoted 7 lines
2003.03.04 -- cmdline-linux-2.4.20.patch
This patch provides an optional hardcoded kernel command line along with with specifyable override behaviour against the command line provided by the bootloader (if any) written forarch/i386andarch/x86_64in linux-2.4.20 by Eric Noack (Corvus V Corax) <[email protected]>
if this format pleases you more
attached: i386+x86_64-cmdline-linux-2.4.20.patch.tgz
\ README
\ cmdline-linux-2.4.20.patch
Quoted 3 lines
Corvus Corax
(aka Eric Noack)
Re: [PATCH] (update) optional hardcoded cmdline i386, x86_64 linux-2.4.20
Am Wed, 5 Mar 2003 02:13:34 +0100
schrieb Corvus Corax <[email protected]>:
Quoted 7 lines
2003.03.04 -- cmdline-linux-2.4.20.patch
This patch provides an optional hardcoded kernel command line along with with specifyable override behaviour against the command line provided by the bootloader (if any) written forarch/i386andarch/x86_64in linux-2.4.20 by Eric Noack (Corvus V Corax) <[email protected]>
this patch should now fullfill the requirements of both code-style and patch-committing-style, does it?
Quoted 3 lines
Corvus Corax
(aka Eric Noack) _ __ ____ _____ _______ ________ ____
.*°` ` ` ` ` ` `
i386+x86_64-cmdline-linux-2.4.20.patch / 2nd try
_,____,____,____,___,__,_,_,_,_,_,_,_,,,.*°
arch/i386/config.in +6 -0
@@ -316,6 +316,12 @@ bool ' Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF fi +bool 'Hardcoded kernel command line' CONFIG_CMDLINE_ENABLE +if [ "$CONFIG_CMDLINE_ENABLE" = "y" ]; then + bool ' Bootloader overrides hardcoded' CONFIG_CMDLINE_OVERRIDE + string ' Initial kernel command line' CONFIG_CMDLINE "root=301 ro" +fi + endmenu source drivers/mtd/Config.in
arch/i386/kernel/setup.c +16 -2
@@ -325,6 +325,18 @@ }#endif +#ifdef CONFIG_CMDLINE_ENABLE +#ifdef CONFIG_CMDLINE_OVERRIDE +static inline char *choose_valid_command_line () + { +if (*COMMAND_LINE )return COMMAND_LINE ;else return CONFIG_CMDLINE ; + } +#else +static inline char *choose_valid_command_line () {return CONFIG_CMDLINE ;} +#endif +#else +static inline char *choose_valid_command_line () {return COMMAND_LINE ;} +#endif static char command_line[COMMAND_LINE_SIZE ];char saved_command_line[COMMAND_LINE_SIZE ];
@@ -733,12 +745,14 @@static void __init parse_cmdline_early (char ** cmdline_p) { -char c =' ' , *to = command_line, *from =COMMAND_LINE ; +char c =' ' , *to = command_line, *from;int len =0 ;int userdef =0 ; + from=choose_valid_command_line (); +/* Save unparsed command line copy for /proc/cmdline */ -memcpy (saved_command_line,COMMAND_LINE ,COMMAND_LINE_SIZE ); +memcpy (saved_command_line, from,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] ='\0' ;for (;;) {
arch/x86_64/config.in +6 -0
@@ -118,6 +118,12 @@ fi fi +bool 'Hardcoded kernel command line' CONFIG_CMDLINE_ENABLE +if [ "$CONFIG_CMDLINE_ENABLE" = "y" ]; then + bool ' Bootloader overrides hardcoded' CONFIG_CMDLINE_OVERRIDE + string ' Initial kernel command line' CONFIG_CMDLINE "root=301 ro" +fi + endmenu source drivers/mtd/Config.in
arch/x86_64/kernel/e820.c +17 -2
@@ -473,18 +473,33 @@e820_print_map (who); } +#ifdef CONFIG_CMDLINE_ENABLE +#ifdef CONFIG_CMDLINE_OVERRIDE +static inline char *choose_valid_command_line () + { +if (*COMMAND_LINE )return COMMAND_LINE ;else return CONFIG_CMDLINE ; + } +#else +static inline char *choose_valid_command_line () {return CONFIG_CMDLINE ;} +#endif +#else +static inline char *choose_valid_command_line () {return COMMAND_LINE ;} +#endif +extern char command_line[], saved_command_line[];extern int fallback_aper_order;extern int iommu_setup (char *opt);void __init parse_mem_cmdline (char ** cmdline_p) { -char c =' ' , *to = command_line, *from =COMMAND_LINE ; +char c =' ' , *to = command_line, *from;int len =0 ;int usermem =0 ; + from=choose_valid_command_line (); +/* Save unparsed command line copy for /proc/cmdline */ -memcpy (saved_command_line,COMMAND_LINE ,COMMAND_LINE_SIZE ); +memcpy (saved_command_line, from,COMMAND_LINE_SIZE ); saved_command_line[COMMAND_LINE_SIZE -1 ] ='\0' ;for (;;) {
Documentation/Configure.help +20 -0
@@ -24033,6 +24033,24 @@ You can also say M here to compile this support as a module (which will be called arthur.o). +Hardcoded kernel command line +CONFIG_CMDLINE_ENABLE + When you create a kernel for booting directly from a floppy, or you + don't trust the command line provided by the bootloader for security + reasons, you can add support for a hardcoded command line by saying Y. + Most times you won't need this, say N. + +Bootloader overrides hardcoded +CONFIG_CMDLINE_OVERRIDE + If you specify a hardcoded kernel command line, but you want to use + the same kernel with your favorite bootmanager (p.e. LILO), + the bootloader can set its own command line, this way overriding + the internal hardcoded one, if set to Y, + If you set this to N the bootloaders command line will just + be ignored and the hardcoded command line will be used instead. + This might be important doe to security reasons. + Most times it's better to say Y. + Initial kernel command line CONFIG_CMDLINE On some architectures (EBSA110 and CATS), there is currently no way
@@ -24040,6 +24058,8 @@ architectures, you should supply some command-line options at build time by entering them here. As a minimum, you should specify the memory size and the root device (e.g., mem=64M root=/dev/nfs). + This item has been added to i386 and x64_64, + as an optional feature, too. Kernel-mode alignment trap handler CONFIG_ALIGNMENT_TRAP
===END=OF=FILE=================================================================