in-kernel config for 2.5.65
PATCH 1/1 in-kernel config for 2.5.65
Hi,
I've updated my in-kernel config (ikconfig) patch for 2.5.65. I've tried to collect and apply input from several people, so thanks if you've offered suggestions and/or code on this. (e.g., Khalid Aziz, Tom Rini, Steve Hemminger, Andrew Bray, Adrian Bunk, Sam Ravnborg; if I omitted someone, I apologize)
ikconfig patches are also available at
http://www.osdl.org/archive/rddunlap/patches/ikconfig/
--
~Randy
patch_name: ikconfig-2565-v3.patchpatch_version: 2003-03-20.10:38:44
author: Randy.Dunlap <[email protected]>
description: config option to save .config in kernel image or
expose it in /proc/ikconfig/config
product: Linuxproduct_versions: 2.5.65
changelog: add CONFIG_IKCONFIG option; optionally save .config in kernel image; another option to expose .config in /proc/ikconfig; add scripts and programs to extract .config on demand; URL: http://www.osdl.org/archive/rddunlap/patches/ikconfig/ maintainer: <[email protected]> diffstat: = init/Kconfig | 25 ++++++ kernel/Makefile | 10 ++ kernel/configs.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++ scripts/binoffset.c | 163 ++++++++++++++++++++++++++++++++++++++++ scripts/extract-ikconfig | 66 ++++++++++++++++ scripts/mkconfigs | 81 ++++++++++++++++++++ 6 files changed, 533 insertions(+)
scripts/mkconfigs renamed from scripts/mkconfigs%IKC +81 -0
@@ -0,0 +1,81 @@ +#!/bin/sh +# +# Copyright (C) 2002 Khalid Aziz <[email protected]> +# Copyright (C) 2002 Randy Dunlap <[email protected]> +# Copyright (C) 2002 Al Stone <[email protected]> +# Copyright (C) 2002 Hewlett-Packard Company +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# +# Rules to generate ikconfig.h from linux/.config: +# - Retain lines that begin with "CONFIG_" +# - Retain lines that begin with "# CONFIG_" +# - lines that use double-quotes must \\-escape-quote them + + +kernel_version() +{ + KERNVER="`grep VERSION $1 | head -1 | cut -f3 -d' '`.`grep PATCHLEVEL $1 | head -1 | cut -f3 -d' '`.`grep SUBLEVEL $1 | head -1 | cut -f3 -d' '``grep EXTRAVERSION $1 | head -1 | cut -f3 -d' '`" +} + +if [ $# -lt 2 ] +then + echo "Usage: `basename $0` <configuration_file> <Makefile>" + exit 1 +fi + +config=$1 +makefile=$2 + +echo "#ifndef _IKCONFIG_H" +echo "#define _IKCONFIG_H" +echo \ +"/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * + * This file is generated automatically by scripts/mkconfigs. Do not edit. + * + */" + +echo "static char *ikconfig_built_with =" +echo " \"`uname -s` `uname -r` `uname -v` `uname -m`\";" +echo +kernel_version $makefile +echo "#ifdef CONFIG_IKCONFIG_PROC" +echo "static char *ikconfig_config = " +echo "#else" +echo "static char *ikconfig_config __initdata __attribute__((unused)) = " +echo "#endif" +echo "\"CONFIG_BEGIN=n\\n\\" +echo "`cat $config | sed 's/\"/\\\\\"/g' | grep "^#\? \?CONFIG_" | awk '{ print $0, "\\\\n\\\\" }' `" +echo "CONFIG_END=n\";" +echo "#endif /* _IKCONFIG_H */"
scripts/extract-ikconfig renamed from scripts/extract-ikconfig%IKC +66 -0
66 lines not on this page · raw message
scripts/binoffset.c renamed from scripts/binoffset.c%IKC +163 -0
163 lines not on this page · raw message
kernel/configs.c renamed from kernel/configs.c%IKC +188 -0
188 lines not on this page · raw message
kernel/Makefile renamed from kernel/Makefile%IKC +10 -0
@@ -18,6 +18,10 @@ obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o obj-$(CONFIG_COMPAT) += compat.o +obj-$(CONFIG_IKCONFIG) += configs.o + +# files to be removed upon make clean +clean-files := ikconfig.h ifneq ($(CONFIG_IA64),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
@@ -27,3 +31,9 @@ # to get a correct value for the wait-channel (WCHAN in ps). --davidm CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer endif + +$(obj)/ikconfig.h: scripts/mkconfigs .config Makefile + $(CONFIG_SHELL) scripts/mkconfigs .config Makefile > $(obj)/ikconfig.h + +$(obj)/configs.o: $(obj)/ikconfig.h $(obj)/configs.c \ + include/linux/version.h include/linux/compile.h
init/Kconfig renamed from init/Kconfig%IKC +25 -0
@@ -108,6 +108,31 @@ 13 => 8 KB 12 => 4 KB +config IKCONFIG + bool "Kernel .config support" + ---help--- + This option enables the complete Linux kernel ".config" file + contents, information on compiler used to build the kernel, + kernel running when this kernel was built and kernel version + from Makefile to be saved in kernel. It provides documentation + of which kernel options are used in a running kernel or in an + on-disk kernel. This information can be extracted from the kernel + image file with the script scripts/extract-ikconfig and used as + input to rebuild the current kernel or to build another kernel. + It can also be extracted from a running kernel by reading + /proc/ikconfig/config and /proc/ikconfig/built_with, if enabled. + /proc/ikconfig/config will list the configuration that was used + to build the kernel and /proc/ikconfig/built_with will list + information on the compiler and host machine that was used to + build the kernel. + +config IKCONFIG_PROC + bool "Enable access to .config through /proc/ikconfig" + depends on IKCONFIG + ---help--- + This option enables access to kernel configuration file and build + information through /proc/ikconfig. + endmenu