Hi,
a topic that just came up in kernel summit is a script to remove
unneeded kernel configs automatically to reduce the compile time.
Incidentally, I already wrote such a script during the last SUSE hack
week a couple of weeks ago, so I'd like to share here, hopefully to
give an idea for further improvements.
The script checks the currently loaded modules and trims other
CONFIG_XXX=m simply, and tries make oldconfig, and writes out the
resultant .config in the current directory after some checks. You can specify the config file via option, as default, it reads from
/proc/config.gz.
The script is VERY hackish. I should have begun with perl or whatever
better script language, but I chose bash and co. So, don't expect
much code quality. I'm no script guy after all :)
Takashi
---
#!/bin/sh
# this magic makes grep and co a lot faster
export LANG=C
kroot=
subarch=$(uname -i)
c)
oldconfig="$OPTARG"
if [ ! -f "$oldconfig" ]; then
echo "Cannot find old config $oldconfig"
exit 1
fi
find_kconfig () {
module=$1
modregex=$(echo $1 | sed -e's/_/[_-]/g')
grep -E '^[[:space:]]*obj-\$\([A-Za-z0-9_]*\)[[:space:]]*[+:]=.*[[:space:]]'"$modregex"'\.o' $tmpd/makefiles | \
sed -e's/^.*://g' -e's/^[[:space:]]*obj-\$(\(.*\)).*$/\1/g'
}