diff options
| -rw-r--r-- | kernel/Makefile | 2 | ||||
| -rwxr-xr-x | scripts/extract-ikconfig | 14 | ||||
| -rw-r--r-- | scripts/kconfig/Makefile | 34 | ||||
| -rw-r--r-- | scripts/kconfig/streamline_config.pl | 366 |
4 files changed, 414 insertions, 2 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index b833bd5cc127..961379caf666 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -117,7 +117,7 @@ $(obj)/config_data.gz: .config FORCE | |||
| 117 | $(call if_changed,gzip) | 117 | $(call if_changed,gzip) |
| 118 | 118 | ||
| 119 | quiet_cmd_ikconfiggz = IKCFG $@ | 119 | quiet_cmd_ikconfiggz = IKCFG $@ |
| 120 | cmd_ikconfiggz = (echo "static const char kernel_config_data[] = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") > $@ | 120 | cmd_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") > $@ |
| 121 | targets += config_data.h | 121 | targets += config_data.h |
| 122 | $(obj)/config_data.h: $(obj)/config_data.gz FORCE | 122 | $(obj)/config_data.h: $(obj)/config_data.gz FORCE |
| 123 | $(call if_changed,ikconfiggz) | 123 | $(call if_changed,ikconfiggz) |
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 72997c353cb3..de233ff43c1c 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
| @@ -17,6 +17,10 @@ dump_config() { | |||
| 17 | return | 17 | return |
| 18 | fi | 18 | fi |
| 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` |
| 20 | [ "$?" != "0" ] && end="-1" | ||
| 21 | if [ "$end" -eq "-1" ]; then | ||
| 22 | return | ||
| 23 | fi | ||
| 20 | 24 | ||
| 21 | start=`expr $start + 8` | 25 | start=`expr $start + 8` |
| 22 | size=`expr $end - $start` | 26 | size=`expr $end - $start` |
| @@ -55,6 +59,8 @@ dump_config "$image" | |||
| 55 | GZHDR1="0x1f 0x8b 0x08 0x00" | 59 | GZHDR1="0x1f 0x8b 0x08 0x00" |
| 56 | GZHDR2="0x1f 0x8b 0x08 0x08" | 60 | GZHDR2="0x1f 0x8b 0x08 0x08" |
| 57 | 61 | ||
| 62 | ELFHDR="0x7f 0x45 0x4c 0x46" | ||
| 63 | |||
| 58 | # vmlinux.gz: Check for a compressed images | 64 | # vmlinux.gz: Check for a compressed images |
| 59 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` | 65 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` |
| 60 | [ "$?" != "0" ] && off="-1" | 66 | [ "$?" != "0" ] && off="-1" |
| @@ -69,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then | |||
| 69 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ | 75 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ |
| 70 | zcat >"$TMPFILE" | 76 | zcat >"$TMPFILE" |
| 71 | dump_config "$TMPFILE" | 77 | dump_config "$TMPFILE" |
| 78 | |||
| 79 | # check if this is simply an ELF file | ||
| 80 | else | ||
| 81 | off=`$binoffset "$image" $ELFHDR 2>/dev/null` | ||
| 82 | [ "$?" != "0" ] && off="-1" | ||
| 83 | if [ "$off" -eq "0" ]; then | ||
| 84 | dump_config "$image" | ||
| 85 | fi | ||
| 72 | fi | 86 | fi |
| 73 | 87 | ||
| 74 | echo "ERROR: Unable to extract kernel configuration information." | 88 | echo "ERROR: Unable to extract kernel configuration information." |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5ddf8becd7a2..6d69c7ccdcc7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -2,7 +2,8 @@ | |||
| 2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
| 3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
| 4 | 4 | ||
| 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ |
| 6 | localmodconfig localyesconfig | ||
| 6 | 7 | ||
| 7 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
| 8 | Kconfig := $(KBUILD_KCONFIG) | 9 | Kconfig := $(KBUILD_KCONFIG) |
| @@ -28,6 +29,35 @@ oldconfig: $(obj)/conf | |||
| 28 | silentoldconfig: $(obj)/conf | 29 | silentoldconfig: $(obj)/conf |
| 29 | $< -s $(Kconfig) | 30 | $< -s $(Kconfig) |
| 30 | 31 | ||
| 32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
| 33 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
| 34 | $(Q)if [ -f .config ]; then \ | ||
| 35 | cmp -s .tmp.config .config || \ | ||
| 36 | (mv -f .config .config.old.1; \ | ||
| 37 | mv -f .tmp.config .config; \ | ||
| 38 | $(obj)/conf -s $(Kconfig); \ | ||
| 39 | mv -f .config.old.1 .config.old) \ | ||
| 40 | else \ | ||
| 41 | mv -f .tmp.config .config; \ | ||
| 42 | $(obj)/conf -s $(Kconfig); \ | ||
| 43 | fi | ||
| 44 | $(Q)rm -f .tmp.config | ||
| 45 | |||
| 46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
| 47 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
| 48 | $(Q)sed -i s/=m/=y/ .tmp.config | ||
| 49 | $(Q)if [ -f .config ]; then \ | ||
| 50 | cmp -s .tmp.config .config || \ | ||
| 51 | (mv -f .config .config.old.1; \ | ||
| 52 | mv -f .tmp.config .config; \ | ||
| 53 | $(obj)/conf -s $(Kconfig); \ | ||
| 54 | mv -f .config.old.1 .config.old) \ | ||
| 55 | else \ | ||
| 56 | mv -f .tmp.config .config; \ | ||
| 57 | $(obj)/conf -s $(Kconfig); \ | ||
| 58 | fi | ||
| 59 | $(Q)rm -f .tmp.config | ||
| 60 | |||
| 31 | # Create new linux.pot file | 61 | # Create new linux.pot file |
| 32 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 62 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
| 33 | # The symlink is used to repair a deficiency in arch/um | 63 | # The symlink is used to repair a deficiency in arch/um |
| @@ -83,6 +113,8 @@ help: | |||
| 83 | @echo ' xconfig - Update current config utilising a QT based front-end' | 113 | @echo ' xconfig - Update current config utilising a QT based front-end' |
| 84 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 114 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
| 85 | @echo ' oldconfig - Update current config utilising a provided .config as base' | 115 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
| 116 | @echo ' localmodconfig - Update current config disabling modules not loaded' | ||
| 117 | @echo ' localyesconfig - Update current config converting local mods to core' | ||
| 86 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' | 118 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' |
| 87 | @echo ' randconfig - New config with random answer to all options' | 119 | @echo ' randconfig - New config with random answer to all options' |
| 88 | @echo ' defconfig - New config with default answer to all options' | 120 | @echo ' defconfig - New config with default answer to all options' |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl new file mode 100644 index 000000000000..95984db8e1e0 --- /dev/null +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -0,0 +1,366 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # Copywrite 2005-2009 - Steven Rostedt | ||
| 4 | # Licensed under the terms of the GNU GPL License version 2 | ||
| 5 | # | ||
| 6 | # It's simple enough to figure out how this works. | ||
| 7 | # If not, then you can ask me at stripconfig@goodmis.org | ||
| 8 | # | ||
| 9 | # What it does? | ||
| 10 | # | ||
| 11 | # If you have installed a Linux kernel from a distribution | ||
| 12 | # that turns on way too many modules than you need, and | ||
| 13 | # you only want the modules you use, then this program | ||
| 14 | # is perfect for you. | ||
| 15 | # | ||
| 16 | # It gives you the ability to turn off all the modules that are | ||
| 17 | # not loaded on your system. | ||
| 18 | # | ||
| 19 | # Howto: | ||
| 20 | # | ||
| 21 | # 1. Boot up the kernel that you want to stream line the config on. | ||
| 22 | # 2. Change directory to the directory holding the source of the | ||
| 23 | # kernel that you just booted. | ||
| 24 | # 3. Copy the configuraton file to this directory as .config | ||
| 25 | # 4. Have all your devices that you need modules for connected and | ||
| 26 | # operational (make sure that their corresponding modules are loaded) | ||
| 27 | # 5. Run this script redirecting the output to some other file | ||
| 28 | # like config_strip. | ||
| 29 | # 6. Back up your old config (if you want too). | ||
| 30 | # 7. copy the config_strip file to .config | ||
| 31 | # 8. Run "make oldconfig" | ||
| 32 | # | ||
| 33 | # Now your kernel is ready to be built with only the modules that | ||
| 34 | # are loaded. | ||
| 35 | # | ||
| 36 | # Here's what I did with my Debian distribution. | ||
| 37 | # | ||
| 38 | # cd /usr/src/linux-2.6.10 | ||
| 39 | # cp /boot/config-2.6.10-1-686-smp .config | ||
| 40 | # ~/bin/streamline_config > config_strip | ||
| 41 | # mv .config config_sav | ||
| 42 | # mv config_strip .config | ||
| 43 | # make oldconfig | ||
| 44 | # | ||
| 45 | my $config = ".config"; | ||
| 46 | my $linuxpath = "."; | ||
| 47 | |||
| 48 | my $uname = `uname -r`; | ||
| 49 | chomp $uname; | ||
| 50 | |||
| 51 | my @searchconfigs = ( | ||
| 52 | { | ||
| 53 | "file" => ".config", | ||
| 54 | "exec" => "cat", | ||
| 55 | }, | ||
| 56 | { | ||
| 57 | "file" => "/proc/config.gz", | ||
| 58 | "exec" => "zcat", | ||
| 59 | }, | ||
| 60 | { | ||
| 61 | "file" => "/boot/config-$uname", | ||
| 62 | "exec" => "cat", | ||
| 63 | }, | ||
| 64 | { | ||
| 65 | "file" => "/boot/vmlinuz-$uname", | ||
| 66 | "exec" => "scripts/extract-ikconfig", | ||
| 67 | "test" => "scripts/extract-ikconfig", | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | "file" => "vmlinux", | ||
| 71 | "exec" => "scripts/extract-ikconfig", | ||
