blob: 6709ec868687e65f9c6aafb58aa8436b237a5f1d [file] [log] [blame]
---
title: Config-brainstorming
---
Brainstorming for enable Kconfig on compat-drivers
<h1>Step 1</h1>
Using the existing kernel's config, generate a Kconfig file that contains all the right symbols for that kernel:
<code>
<pre>
cat .config | genkconf.sh > kernel-kconfig
</pre>
</code>
where the script is this:
<code>
<pre>
#!/bin/bash
while read line ; do
case "${line:0:7}" in
"CONFIG_")
line="${line:7}"
cfg="${line%%=*}"
val="${line#*=}"
cfgtype="skip"
if [ "$val" = "m" ] ; then
cfgtype="tristate"
elif [ "$val" = "y" ] ; then
cfgtype="bool"
fi
if [ "$cfgtype" != "skip" ] ; then
echo "config $cfg"
echo " $cfgtype"
echo " default $val"
echo ""
fi
;;
"# CONFI")
cfg="${line:9}"
cfg="${cfg%% is not set}"
echo "config $cfg"
echo " bool"
echo " default n"
echo ""
;;
esac
done
</pre>
</code>
<h1>Step 2</h1>
Collect all Kconfig symbols from compat:
<code>
<pre>
find . -name Kconfig | xargs cat | sed 's/^config //;t;d' > symbols
</pre>
</code>
<h1>Step 3</h1>
Instead of patching Makefiles, replaces all CONFIG_ by CONFIG_COMPAT_ in all Makefiles:
<code><pre>
find . -name Makefile | xargs rpl "CONFIG_" "CONFIG_COMPAT_"
</pre></code>
This means that only things that are actually selected in compat will be built.
<h1>Step 4</h1>
Replace all "FOO" with "COMPAT_FOO" symbols in Kconfig and code files:
<code><pre>
for sym in $(cat symbols) ; do
find . -name Kconfig |\
xargs rpl -w "$sym" "COMPAT_$sym"
find . -name '*.c' -o -name '*.h' |\
xargs rpl -w "CONFIG_$sym" "CONFIG_COMPAT_$sym"
done
</pre></code>
<h1>Step 5</h1>
Build a Kconfig file:
<code><pre>
echo 'source "kernel-kconfig"' > Kconfig
for k in drivers/net/wireless/*/Kconfig ; do echo "source \"$k\"" >> Kconfig ; done
</pre></code>
etc. Currently, mac80211/cfg80211/... Kconfig isn't copied. They will need to be copied and potentially modified for dependencies like WEXT.
<h1>Step 6</h1>
Run menuconfig:
<code><pre>
/lib/modules/$(uname -r)/build/scripts/kconfig/mconf Kconfig
</pre></code>
<h1>Step 7</h1>
Build the thing.
The generated .config can be parsed with either the existing compat-drivers/scripts/gen-compat-autoconf.sh script or scripts/kconfig/confdata.c (conf --silentoldconfig). The generated include/linux/compat_autoconf.h is already included as part of the build of compat-drivers.