scripts/Configure patch for automatic module compile
Hi,
If you're like me, you build everything as modules, boot with an initrd that loads in the disk or net driver and filesystem module, and then let kmod take care of the rest. Here's a patch that changes Configure (make config) to build all possible modules - in other words, to answer 'M' for every tristate of some form y/m/n. It also allows some tristates to be built into the kernel (y), so you can have a root filesystem and executables. This is done by changing tristates in arch/${ARCH}/defconfig to default to 'a'. For instance:
CONFIG_BINFMT_ELF=aCONFIG_BLK_DEV_RAM=aCONFIG_CRAMFS=a
I am posting the patch in the hope that someone finds it useful or uses it perhaps as inspiration for a better solution. Eventually, I'd like to cut down the config process to a short list of questions about CPU, bus, network, and then get all the modules automatically.
Caveats: hmm.. well, it's only tested on i386, though I don't see why it wouldn't work on anything else. If you're not running some kind of embedded system, the defconfig must be changed or the kernel won't be very useful. Of course, this only works with 'make config' - 'menuconfig' and 'xconfig' are unchanged.
Maciek
Configure renamed from Configure.old +4 -36
@@ -155,6 +155,7 @@ "m") echo "$1=m" >>$CONFIG + echo "$1=m" echo "#undef $1" >>$CONFIG_H echo "#define $1_MODULE 1" >>$CONFIG_H ;;
@@ -207,26 +208,11 @@ old=$(eval echo "\${$2}") def=${old:-'n'} case "$def" in - "y") defprompt="Y/m/n/?" + "a") define_tristate "$2" "y" ;; - "m") defprompt="M/n/y/?" - ;; - "n") defprompt="N/y/m/?" + * ) define_tristate "$2" "m" ;; esac - while :; do - readln "$1 ($2) [$defprompt] " "$def" "$old" - case "$ans" in - [yY] | [yY]es ) define_tristate "$2" "y" - break ;; - [nN] | [nN]o ) define_tristate "$2" "n" - break ;; - [mM] ) define_tristate "$2" "m" - break ;; - * ) help "$2" - ;; - esac - done fi }
@@ -269,25 +255,7 @@ "n") defprompt="N/m/?" ;; esac - while :; do - readln "$ques ($var) [$defprompt] " "$def" "$old" - case "$ans" in - [nN] | [nN]o ) define_tristate "$var" "n" - break ;; - [mM] ) define_tristate "$var" "m" - break ;; - [yY] | [yY]es ) echo - echo " This answer is not allowed, because it is not consistent with" - echo " your other choices." - echo " This driver depends on another one which you chose to compile" - echo " as a module. This means that you can either compile this one" - echo " as a module as well (with M) or leave it out altogether (N)." - echo - ;; - * ) help "$var" - ;; - esac - done + define_tristate "$var" "m" fi else tristate "$ques" "$var"
Quoted 5 lines · Maciek Nowacki
If you're like me, you build everything as modules, boot with an initrd that loads in the disk or net driver and filesystem module, and then let kmod take care of the rest. Here's a patch that changes Configure (make config) to build all possible modules - in other words, to answer 'M' for every tristate of some form y/m/n.
I already have a patch from Ghozlane Toumi in my inbox that supports:
make randconfig
answers randomly to the questions .
make allyes
answers 'yes' to all questions .
make allno
answers 'no' to all questions .
make allmod
answer 'm' if avaiable, 'yes' else .
Plus you can specify defaults in .force_default which will always be honoured. I have been using it to stress test the 2.4.4 configs and my 2.5 makefile rewrite, it works very nicely.