In a small moment of forgetfulness I forgot to compile ext2 support into my kernel when switching from manual compilation to using genkernel. I don't use ext2, so only had it as a module. Naturally that kernel was broken, as it couldn't mount the ext2 initrd. No doubt more people will do similar, and have done in the past. So if people want to use the initrd, ext2 is very much a required feature, lets turn it on if off. sauron genkernel # diff -u gen_configkernel.sh.orig gen_configkernel.sh --- gen_configkernel.sh.orig 2004-05-31 15:12:16.572117703 +0100 +++ gen_configkernel.sh 2004-05-31 15:28:33.380547637 +0100 @@ -82,4 +82,10 @@ [ "$?" != "0" ] && gen_die "Error: xconfig failed." fi + EXT2CFG=`egrep "CONFIG_EXT2_FS=m|CONFIG_EXT2_FS is not set" .config` + if [ "${EXT2CFG}" != "" ] + then + sed -i .config -e "s/${EXT2CFG}/CONFIG_EXT2_FS=y/" + fi + } Perhaps a configuration option could be added to optionally skip this. Reproducible: Always Steps to Reproduce: 1. 2. 3.
There's no need to use ``egrep'' there since you can just do a grep for "CONFIG_EXT2_FS=y" and if it's not there; and then you can do an "s/CONFIG_EXT2_FS=.+/CONFIG_EXT2_FS=y/"... If you could tweak that patch and attach a new one I'd be happy to add it into the next release. Thanks!
Thanks for the quick feedback! I used an egrep to count for the possibility of ext2 support being turned off alltogether. Your example wouldn't work there, as the sed wouldn't find 'CONFIG_EXT2_FS=.+'. Plus in my 2.6.5 kernel config there are 2 lines matching 'CONFIG_EXT2_FS', hence the belt and braces approach.
Good point, but it can still be done with a simple sed: $ cat tempConfig CONFIG_EXT2_FS=m CONFIG_EXT2_FS=y # CONFIG_EXT2_FS is not set CONFIG_EXT2_FS_MOO=m CONFIG_EXT2_FS_MOO=y # CONFIG_EXT2_FS_MOO is not set $ grep 'CONFIG_EXT2_FS=y' tempConfig CONFIG_EXT2_FS=y $ sed tempConfig -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y CONFIG_EXT2_FS_MOO=m CONFIG_EXT2_FS_MOO=y # CONFIG_EXT2_FS_MOO is not set
Oh, sed god :) I see what it's doing, but don't really understand how the '#\? \?' bit work. Anyway, updated patch. --- gen_configkernel.sh.orig 2004-05-31 15:12:16.000000000 +0100 +++ gen_configkernel.sh 2004-05-31 17:24:08.649960120 +0100 @@ -82,4 +82,7 @@ [ "$?" != "0" ] && gen_die "Error: xconfig failed." fi + # Make sure EXT2 support is turned on. + sed -i .config -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' + }
\? = a GNU sed extension for "match previous character once, or no times". Therefore, "#\? \?Moo" will match "Moo", " Moo", "#Moo" and "# Moo" which suits us fine just incase the .config is not in the best shape somehow. One could also do 's/^\(# \)\?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' which will only match 'CONFIG_'... and '# CONFIG...' but that incurs the penalty of having to store '# ' in a buffer and then not even use it...
The patch should be in Portage with genkernel-3.0.2e; please reopen this bug if you have any issues with it. Thanks!
I use a cramfs initrd; so ext2 is not needed for me. Is it possible to add a command-line switch, to prevent forcing ext2 for those who don't want it ? Or (the better solution?) -- give the choice between a ext2 or cramfs initrd ? I think displaying a warning if the user forgets ext2 is fine, but forcing ext2 for everyone without notice is not too good (imho). Btw I have a script which turns genkernel's ext2 initrd into a cramfs. I'll sure provide it if someone is interested !