From af6c159885537eb6582a61156ccfb73e83c0478d Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Sun, 15 Feb 2009 22:15:16 +0100 Subject: [PATCH 01/53] kconfig: handle comment entries within choice/endchoice Implement support for comment entries within choice groups. Comment entries are displayed visually distinct from normal configs, and selecting them is a no-op. Signed-off-by: Peter Korsgaard Cc: Roman Zippel Signed-off-by: Sam Ravnborg --- scripts/kconfig/lxdialog/checklist.c | 3 ++- scripts/kconfig/mconf.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index b2a878c936d6..bcc6f19c3a35 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c @@ -41,7 +41,8 @@ static void print_item(WINDOW * win, int choice, int selected) wmove(win, choice, check_x); wattrset(win, selected ? dlg.check_selected.atr : dlg.check.atr); - wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); + if (!item_is_tag(':')) + wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); mvwaddch(win, choice, item_x, item_str()[0]); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 6841e95c0989..3bcacb4bfd3a 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -732,7 +732,12 @@ static void conf_choice(struct menu *menu) for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; - item_make("%s", _(menu_get_prompt(child))); + if (child->sym) + item_make("%s", _(menu_get_prompt(child))); + else { + item_make("*** %s ***", _(menu_get_prompt(child))); + item_set_tag(':'); + } item_set_data(child); if (child->sym == active) item_set_selected(1); @@ -748,6 +753,9 @@ static void conf_choice(struct menu *menu) case 0: if (selected) { child = item_data(); + if (!child->sym) + break; + sym_set_tristate_value(child->sym, yes); } return; From 4f66199b4b372a530333d0f25aeb5d80362241ed Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:08:31 +0200 Subject: [PATCH 02/53] kbuild, deb-pkg: minor general improvements in builddeb script Minor coding style improvements and typo fix in leading comment. Signed-off-by: Frans Pop Cc: Andres Salomon Acked-by: maximilian attems Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 1264b8e2829d..eff7f9de30dc 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -4,7 +4,7 @@ # Copyright 2003 Wichert Akkerman # # Simple script to generate a deb package for a Linux kernel. All the -# complexity of what to do with a kernel after it is installer or removed +# complexity of what to do with a kernel after it is installed or removed # is left to other scripts and packages: they can install scripts in the # /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on # package install and removal. @@ -13,13 +13,13 @@ set -e # Some variables and settings used throughout the script version=$KERNELRELEASE -revision=`cat .version` +revision=$(cat .version) tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" packagename=linux-$version fwpackagename=linux-firmware-image -if [ "$ARCH" == "um" ] ; then +if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi @@ -27,12 +27,12 @@ fi rm -rf "$tmpdir" "$fwdir" mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" -if [ "$ARCH" == "um" ] ; then +if [ "$ARCH" = "um" ] ; then mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" fi # Build and install the kernel -if [ "$ARCH" == "um" ] ; then +if [ "$ARCH" = "um" ] ; then $MAKE linux cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" cp .config "$tmpdir/usr/share/doc/$packagename/config" @@ -46,7 +46,7 @@ fi if grep -q '^CONFIG_MODULES=y' .config ; then INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install - if [ "$ARCH" == "um" ] ; then + if [ "$ARCH" = "um" ] ; then mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" rmdir "$tmpdir/lib/modules/$version" fi @@ -77,9 +77,8 @@ linux ($version-$revision) unstable; urgency=low EOF # Generate a control file -if [ "$ARCH" == "um" ]; then - -cat < debian/control +if [ "$ARCH" = "um" ]; then + cat < debian/control Source: linux Section: base Priority: optional @@ -101,7 +100,7 @@ Description: User Mode Linux kernel, version $version EOF else -cat < debian/control + cat < debian/control Source: linux Section: base Priority: optional @@ -116,6 +115,7 @@ Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other files version $version EOF + fi # Fix some ownership and permissions @@ -143,4 +143,3 @@ dpkg-gencontrol -isp -p$packagename dpkg --build "$tmpdir" .. exit 0 - From 3e2ab2563a599c3d3fd03952c056af09fc03b74a Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:08:44 +0200 Subject: [PATCH 03/53] kbuild, deb-pkg: refactor code to reduce duplication Factor out code to build package into separate function and only write "source" section for the debian/control file once. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index eff7f9de30dc..feebd69c2eea 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -11,6 +11,18 @@ set -e +create_package() { + local pname="$1" pdir="$2" + + # Fix ownership and permissions + chown -R root:root "$pdir" + chmod -R go-w "$pdir" + + # Create the package + dpkg-gencontrol -isp -p$pname -P"$pdir" + dpkg --build "$pdir" .. +} + # Some variables and settings used throughout the script version=$KERNELRELEASE revision=$(cat .version) @@ -77,13 +89,16 @@ linux ($version-$revision) unstable; urgency=low EOF # Generate a control file -if [ "$ARCH" = "um" ]; then - cat < debian/control +cat < debian/control Source: linux Section: base Priority: optional Maintainer: $name Standards-Version: 3.6.1 +EOF + +if [ "$ARCH" = "um" ]; then + cat <> debian/control Package: $packagename Provides: kernel-image-$version, linux-image-$version @@ -100,12 +115,7 @@ Description: User Mode Linux kernel, version $version EOF else - cat < debian/control -Source: linux -Section: base -Priority: optional -Maintainer: $name -Standards-Version: 3.6.1 + cat <> debian/control Package: $packagename Provides: kernel-image-$version, linux-image-$version @@ -118,10 +128,6 @@ EOF fi -# Fix some ownership and permissions -chown -R root:root "$tmpdir" -chmod -R go-w "$tmpdir" - # Do we have firmware? Move it out of the way and build it into a package. if [ -e "$tmpdir/lib/firmware" ]; then mv "$tmpdir/lib/firmware" "$fwdir/lib/" @@ -134,12 +140,9 @@ Description: Linux kernel firmware, version $version This package contains firmware from the Linux kernel, version $version EOF - dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir" - dpkg --build "$fwdir" .. + create_package "$fwpackagename" "$fwdir" fi -# Perform the final magic -dpkg-gencontrol -isp -p$packagename -dpkg --build "$tmpdir" .. +create_package "$packagename" "$tmpdir" exit 0 From a89b433bddea41a743d7937c87be5290ef4f1057 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:09:04 +0200 Subject: [PATCH 04/53] kbuild, deb-pkg: fix 'file not found' error when building .deb package for arm Not all architectures prepend the $(boot) path in $(KBUILD_IMAGE). Allow for that fact in the builddeb script. Example is arm. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index feebd69c2eea..4876ff3154a1 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -53,7 +53,10 @@ if [ "$ARCH" = "um" ] ; then else cp System.map "$tmpdir/boot/System.map-$version" cp .config "$tmpdir/boot/config-$version" - cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" + # Not all arches include the boot path in KBUILD_IMAGE + if ! cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"; then + cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" + fi fi if grep -q '^CONFIG_MODULES=y' .config ; then From 4964451a321cfd6a05ea32af1317345c53b3ecb7 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:09:25 +0200 Subject: [PATCH 05/53] kbuild, deb-pkg: pass Debian maintainer script parameters to packaging hook scripts The Debian packaging scripts created by the deb-pkg target do not pass on the standard Debian maintainer script parameters to hook scripts, which means that those scripts cannot tell whether they are being called during e.g. install vs. upgrade, or removal vs. purge of the package. As there are several variantions in how hook scripts are called from kernel packages, we pass the parameters in the environment variable DEB_MAINT_PARAMS rather than as extra arguments. Bump version of builddep script to 1.3. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 4876ff3154a1..5eecbbe58114 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -1,6 +1,6 @@ #!/bin/sh # -# builddeb 1.2 +# builddeb 1.3 # Copyright 2003 Wichert Akkerman # # Simple script to generate a deb package for a Linux kernel. All the @@ -75,6 +75,9 @@ for script in postinst postrm preinst prerm ; do set -e +# Pass maintainer script parameters to hook scripts +export DEB_MAINT_PARAMS="\$@" + test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d exit 0 EOF From c72c75db86cf9f53c4c0df6724c0cf06db017652 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:09:44 +0200 Subject: [PATCH 06/53] kbuild, deb-pkg: allow to specify a custom revision for .deb packages Allow to specify a custom revision for the generated .deb by exporting the environment variable KDEB_PKGVERSION. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 5eecbbe58114..5868c0f2e613 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -26,6 +26,11 @@ create_package() { # Some variables and settings used throughout the script version=$KERNELRELEASE revision=$(cat .version) +if [ -n "$KDEB_PKGVERSION" ]; then + packageversion=$KDEB_PKGVERSION +else + packageversion=$version-$revision +fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" packagename=linux-$version @@ -87,7 +92,7 @@ done name="Kernel Compiler <$(id -nu)@$(hostname -f)>" # Generate a simple changelog template cat < debian/changelog -linux ($version-$revision) unstable; urgency=low +linux ($packageversion) unstable; urgency=low * A standard release From fe233cb6bfd36fcf5a36bbde7fa116d8ab5f4301 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:10:10 +0200 Subject: [PATCH 07/53] kbuild, deb-pkg: allow alternative hook scripts directory in .deb packages Hook scripts in the default directory /etc/kernel are also executed by official Debian kernel packages as well as kernel packages created using make-kpkg. Allow to specify an alternative hook scripts directory by exporting the environment variable KDEB_HOOKDIR. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 5868c0f2e613..c01f81287ce6 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -6,8 +6,9 @@ # Simple script to generate a deb package for a Linux kernel. All the # complexity of what to do with a kernel after it is installed or removed # is left to other scripts and packages: they can install scripts in the -# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on -# package install and removal. +# /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location +# specified in KDEB_HOOKDIR) that will be called on package install and +# removal. set -e @@ -73,8 +74,11 @@ if grep -q '^CONFIG_MODULES=y' .config ; then fi # Install the maintainer scripts +# Note: hook scripts under /etc/kernel are also executed by official Debian +# kernel packages, as well as kernel packages built using make-kpkg +debhookdir=${KDEB_HOOKDIR:-/etc/kernel} for script in postinst postrm preinst prerm ; do - mkdir -p "$tmpdir/etc/kernel/$script.d" + mkdir -p "$tmpdir$debhookdir/$script.d" cat < "$tmpdir/DEBIAN/$script" #!/bin/sh @@ -83,7 +87,7 @@ set -e # Pass maintainer script parameters to hook scripts export DEB_MAINT_PARAMS="\$@" -test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d +test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d exit 0 EOF chmod 755 "$tmpdir/DEBIAN/$script" From a83ca2777f7f28e365de7c87903bad5e928f87ad Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:10:25 +0200 Subject: [PATCH 08/53] kbuild, deb-pkg: improve changelog entry and package descriptions Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index c01f81287ce6..0449147af066 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -98,7 +98,7 @@ name="Kernel Compiler <$(id -nu)@$(hostname -f)>" cat < debian/changelog linux ($packageversion) unstable; urgency=low - * A standard release + * Custom built Linux kernel. -- $name $(date -R) EOF @@ -126,7 +126,7 @@ Description: User Mode Linux kernel, version $version many other things. . This package contains the Linux kernel, modules and corresponding other - files version $version + files, version: $version. EOF else @@ -138,7 +138,7 @@ Suggests: $fwpackagename Architecture: any Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other - files version $version + files, version: $version. EOF fi @@ -152,7 +152,7 @@ if [ -e "$tmpdir/lib/firmware" ]; then Package: $fwpackagename Architecture: all Description: Linux kernel firmware, version $version - This package contains firmware from the Linux kernel, version $version + This package contains firmware from the Linux kernel, version $version. EOF create_package "$fwpackagename" "$fwdir" From 9461f666e42f2412e134a49e90ffd4a3340dfc0a Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Fri, 24 Apr 2009 19:08:24 +0200 Subject: [PATCH 09/53] kbuild, deb-pkg: generate debian/copyright file On Thursday 23 April 2009, Frans Pop wrote: Add a basic debian/copyright to the binary packages. Based on an earlier patch from Maximilian Attems. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 0449147af066..122becc9cef7 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -15,6 +15,8 @@ set -e create_package() { local pname="$1" pdir="$2" + cp debian/copyright "$pdir/usr/share/doc/$pname/" + # Fix ownership and permissions chown -R root:root "$pdir" chmod -R go-w "$pdir" @@ -43,10 +45,10 @@ fi # Setup the directory structure rm -rf "$tmpdir" "$fwdir" -mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" -mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" +mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" +mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" if [ "$ARCH" = "um" ] ; then - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" + mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" fi # Build and install the kernel @@ -103,6 +105,26 @@ linux ($packageversion) unstable; urgency=low -- $name $(date -R) EOF +# Generate copyright file +cat < debian/copyright +This is a packacked upstream version of the Linux kernel. + +The sources may be found at most Linux ftp sites, including: +ftp://ftp.kernel.org/pub/linux/kernel + +Copyright: 1991 - 2009 Linus Torvalds and others. + +The git repository for mainline kernel development is at: +git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git + + 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; version 2 dated June, 1991. + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. +EOF + # Generate a control file cat < debian/control Source: linux From edec611db0474e90503d46428e4f196d5e30c091 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 23 Apr 2009 01:11:20 +0200 Subject: [PATCH 10/53] kbuild, deb-pkg: improve maintainer identification Try harder to find email and maintainer name. Debian's own devscripts all use DEBEMAIL or DEBFULLNAME prior to an eventual EMAIL or NAME environment variable. Match their logic. "Anonymous" sounds nicer then "Kernel Compiler" if no name is found. Signed-off-by: maximilian attems Signed-off-by: Frans Pop Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 122becc9cef7..9d464fde0df4 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -95,14 +95,30 @@ EOF chmod 755 "$tmpdir/DEBIAN/$script" done -name="Kernel Compiler <$(id -nu)@$(hostname -f)>" +# Try to determine maintainer and email values +if [ -n "$DEBEMAIL" ]; then + email=$DEBEMAIL +elif [ -n "$EMAIL" ]; then + email=$EMAIL +else + email=$(id -nu)@$(hostname -f) +fi +if [ -n "$DEBFULLNAME" ]; then + name=$DEBFULLNAME +elif [ -n "$NAME" ]; then + name=$NAME +else + name="Anonymous" +fi +maintainer="$name <$email>" + # Generate a simple changelog template cat < debian/changelog linux ($packageversion) unstable; urgency=low * Custom built Linux kernel. - -- $name $(date -R) + -- $maintainer $(date -R) EOF # Generate copyright file @@ -130,7 +146,7 @@ cat < debian/control Source: linux Section: base Priority: optional -Maintainer: $name +Maintainer: $maintainer Standards-Version: 3.6.1 EOF From 4bf4cd4939975c2f6375443212109dbb8c4e8731 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Thu, 23 Apr 2009 01:11:43 +0200 Subject: [PATCH 11/53] kbuild, deb-pkg: improve Source field The Source: field is defined as the source package in the package archive from which a binary packages are built. As deb-pkg does not generate a source package, we should avoid to use any existing source packages here. Signed-off-by: Frans Pop Acked-by: maximilian attems Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 9d464fde0df4..6d3b7e59637f 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -114,7 +114,7 @@ maintainer="$name <$email>" # Generate a simple changelog template cat < debian/changelog -linux ($packageversion) unstable; urgency=low +linux-upstream ($packageversion) unstable; urgency=low * Custom built Linux kernel. @@ -143,7 +143,7 @@ EOF # Generate a control file cat < debian/control -Source: linux +Source: linux-upstream Section: base Priority: optional Maintainer: $maintainer From f7a2c31f1e4e622056c8a14260937e87f1277867 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 23 Apr 2009 01:12:01 +0200 Subject: [PATCH 12/53] kbuild, deb-pkg: fix generated package name The binary package that make deb-pkg creates is a linux-image. To be fixed may also be the addition of $DEB_ARCH. Signed-off-by: maximilian attems Signed-off-by: Frans Pop Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 6d3b7e59637f..1ade570b3c60 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -36,7 +36,7 @@ else fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" -packagename=linux-$version +packagename=linux-image-$version fwpackagename=linux-firmware-image if [ "$ARCH" = "um" ] ; then From 8ebc2fe9c5e502a0f34be498b0732bb3b897b12d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 23 Apr 2009 01:12:21 +0200 Subject: [PATCH 13/53] kbuild, deb-pkg: fix Provides field kernel-image naming has been dropped for the Lenny release and was only transitional for Etch. As it builds modules it provides linux-modules-$version. Signed-off-by: maximilian attems Signed-off-by: Frans Pop Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 1ade570b3c60..e1dd1892eb30 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -154,7 +154,7 @@ if [ "$ARCH" = "um" ]; then cat <> debian/control Package: $packagename -Provides: kernel-image-$version, linux-image-$version +Provides: linux-image, linux-image-2.6, linux-modules-$version Architecture: any Description: User Mode Linux kernel, version $version User-mode Linux is a port of the Linux kernel to its own system call @@ -171,7 +171,7 @@ else cat <> debian/control Package: $packagename -Provides: kernel-image-$version, linux-image-$version +Provides: linux-image, linux-image-2.6, linux-modules-$version Suggests: $fwpackagename Architecture: any Description: Linux kernel, version $version From 54c3355658bb66bbe20aef9b6297d72ac85571f4 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 23 Apr 2009 01:12:41 +0200 Subject: [PATCH 14/53] kbuild, deb-pkg: fix Section field Section "base" has been removed, the base is defined by Priority field. For Squeeze the section should be "kernel", but as that's not yet supported for Sarge and Etch we stay with admin for now. Signed-off-by: maximilian attems Signed-off-by: Frans Pop Cc: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index e1dd1892eb30..9708d265cdac 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -144,7 +144,7 @@ EOF # Generate a control file cat < debian/control Source: linux-upstream -Section: base +Section: admin Priority: optional Maintainer: $maintainer Standards-Version: 3.6.1 From 6d9923219c6cd1df360f8823253717623f3ad348 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 23 Apr 2009 01:12:58 +0200 Subject: [PATCH 15/53] kbuild, deb-pkg: bump standards version Latest Debian policy is 3.8.1. Even if we are not yet compliant to it strive for the latest. Signed-off-by: maximilian attems Signed-off-by: Frans Pop Acked-by: Andres Salomon Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 9708d265cdac..01c2d13dd020 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -147,7 +147,7 @@ Source: linux-upstream Section: admin Priority: optional Maintainer: $maintainer -Standards-Version: 3.6.1 +Standards-Version: 3.8.1 EOF if [ "$ARCH" = "um" ]; then From fd6c3a8dc44329d3aff9a578b5120982f63711ee Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 12 Mar 2009 10:58:33 +0000 Subject: [PATCH 16/53] initconst adjustments - add .init.rodata to INIT_DATA, and group all initconst flavors together - move strings generated from __setup_param() into .init.rodata - add .*init.rodata to modpost's sets of init sections - make modpost warn about references between meminit and cpuinit as well as memexit and cpuexit sections (as CPU and memory hotplug are independently selectable features) Signed-off-by: Jan Beulich Signed-off-by: Sam Ravnborg --- include/asm-generic/vmlinux.lds.h | 5 ++-- include/linux/init.h | 3 +- scripts/mod/modpost.c | 48 ++++++++++++++++++++++++------- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 89853bcd27a6..3edb11499743 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -336,10 +336,11 @@ #define INIT_DATA \ *(.init.data) \ DEV_DISCARD(init.data) \ - DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.data) \ - CPU_DISCARD(init.rodata) \ MEM_DISCARD(init.data) \ + *(.init.rodata) \ + DEV_DISCARD(init.rodata) \ + CPU_DISCARD(init.rodata) \ MEM_DISCARD(init.rodata) #define INIT_TEXT \ diff --git a/include/linux/init.h b/include/linux/init.h index 0e06c176f185..9f70c9f25d4b 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -225,7 +225,8 @@ struct obs_kernel_param { * obs_kernel_param "array" too far apart in .init.setup. */ #define __setup_param(str, unique_id, fn, early) \ - static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ + static const char __setup_str_##unique_id[] __initconst \ + __aligned(1) = str; \ static struct obs_kernel_param __setup_##unique_id \ __used __section(.init.setup) \ __attribute__((aligned((sizeof(long))))) \ diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 161b7846733e..94e71efb2c14 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -763,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_INIT_DATA_SECTIONS \ + ".init.setup$", ".init.rodata$", \ + ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \ ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" #define ALL_EXIT_DATA_SECTIONS \ ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" @@ -772,21 +774,23 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_EXIT_TEXT_SECTIONS \ ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" -#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS -#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS +#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \ + CPU_INIT_SECTIONS, MEM_INIT_SECTIONS +#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \ + CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS #define DATA_SECTIONS ".data$", ".data.rel$" #define TEXT_SECTIONS ".text$" -#define INIT_SECTIONS ".init.data$", ".init.text$" -#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$" -#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$" -#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$" +#define INIT_SECTIONS ".init.*" +#define DEV_INIT_SECTIONS ".devinit.*" +#define CPU_INIT_SECTIONS ".cpuinit.*" +#define MEM_INIT_SECTIONS ".meminit.*" -#define EXIT_SECTIONS ".exit.data$", ".exit.text$" -#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$" -#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$" -#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$" +#define EXIT_SECTIONS ".exit.*" +#define DEV_EXIT_SECTIONS ".devexit.*" +#define CPU_EXIT_SECTIONS ".cpuexit.*" +#define MEM_EXIT_SECTIONS ".memexit.*" /* init data sections */ static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; @@ -869,12 +873,36 @@ const struct sectioncheck sectioncheck[] = { .tosec = { INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_INIT, }, +/* Do not reference cpuinit code/data from meminit code/data */ +{ + .fromsec = { MEM_INIT_SECTIONS, NULL }, + .tosec = { CPU_INIT_SECTIONS, NULL }, + .mismatch = XXXINIT_TO_INIT, +}, +/* Do not reference meminit code/data from cpuinit code/data */ +{ + .fromsec = { CPU_INIT_SECTIONS, NULL }, + .tosec = { MEM_INIT_SECTIONS, NULL }, + .mismatch = XXXINIT_TO_INIT, +}, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_EXIT, }, +/* Do not reference cpuexit code/data from memexit code/data */ +{ + .fromsec = { MEM_EXIT_SECTIONS, NULL }, + .tosec = { CPU_EXIT_SECTIONS, NULL }, + .mismatch = XXXEXIT_TO_EXIT, +}, +/* Do not reference memexit code/data from cpuexit code/data */ +{ + .fromsec = { CPU_EXIT_SECTIONS, NULL }, + .tosec = { MEM_EXIT_SECTIONS, NULL }, + .mismatch = XXXEXIT_TO_EXIT, +}, /* Do not use exit code/data from init code */ { .fromsec = { ALL_INIT_SECTIONS, NULL }, From cefdff4b4d5ba3f9b7eee2c1c1827553794cb465 Mon Sep 17 00:00:00 2001 From: Amerigo Wang Date: Thu, 4 Jun 2009 22:12:09 -0400 Subject: [PATCH 17/53] kbuild: clean up scripts/headers.sh 'drop' variable is unused. 'ppc' and 'sparc64' directories don't exist in arch/, and I think their headers can be well exported now, so just remove them. Signed-off-by: WANG Cong Signed-off-by: Sam Ravnborg --- scripts/headers.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/headers.sh b/scripts/headers.sh index d33426f866db..0308ecc10d5b 100755 --- a/scripts/headers.sh +++ b/scripts/headers.sh @@ -15,19 +15,12 @@ do_command() fi } -# Do not try this architecture -drop="generic um ppc sparc64 cris" - archs=$(ls ${srctree}/arch) for arch in ${archs}; do case ${arch} in um) # no userspace export ;; - ppc) # headers exported by powerpc - ;; - sparc64) # headers exported by sparc - ;; cris) # headers export are known broken ;; *) From 2d51005c27a12e43d672debbbb918e7f74987f96 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 31 May 2009 18:05:34 +0200 Subject: [PATCH 18/53] kbuild: allow docproc invocation from external - getcwd returns path without a slash at the end, add the slash - add KBUILD_SRC env support, so that we can specify path for kernel (to know where scripts/kernel-doc resides) and SRCTREE (for searching files referenced in .tmpl) separately [v2] - use KBUILD_SRC instead of a newly introduced environment variable Signed-off-by: Jiri Slaby Acked-by: Randy Dunlap Signed-off-by: Sam Ravnborg --- scripts/basic/docproc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 35bdc68b6e66..4c9523ef9c00 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c @@ -69,7 +69,7 @@ FILELINE * docsection; #define NOFUNCTION "-nofunction" #define NODOCSECTIONS "-no-doc-sections" -char *srctree; +static char *srctree, *kernsrctree; void usage (void) { @@ -77,7 +77,8 @@ void usage (void) fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); fprintf(stderr, "doc: frontend when generating kernel documentation\n"); fprintf(stderr, "depend: generate list of files referenced within file\n"); - fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n"); + fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n"); + fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n"); } /* @@ -96,8 +97,8 @@ void exec_kernel_doc(char **svec) exit(1); case 0: memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, srctree, PATH_MAX); - strncat(real_filename, KERNELDOCPATH KERNELDOC, + strncat(real_filename, kernsrctree, PATH_MAX); + strncat(real_filename, "/" KERNELDOCPATH KERNELDOC, PATH_MAX - strlen(real_filename)); execvp(real_filename, svec); fprintf(stderr, "exec "); @@ -178,6 +179,7 @@ void find_export_symbols(char * filename) char real_filename[PATH_MAX + 1]; memset(real_filename, 0, sizeof(real_filename)); strncat(real_filename, srctree, PATH_MAX); + strncat(real_filename, "/", PATH_MAX - strlen(real_filename)); strncat(real_filename, filename, PATH_MAX - strlen(real_filename)); sym = add_new_file(filename); @@ -382,6 +384,9 @@ int main(int argc, char *argv[]) srctree = getenv("SRCTREE"); if (!srctree) srctree = getcwd(NULL, 0); + kernsrctree = getenv("KBUILD_SRC"); + if (!kernsrctree) + kernsrctree = srctree; if (argc != 3) { usage(); exit(1); From 3e56f08bffe9e3e2b936eb73bd51d8800d1b42c2 Mon Sep 17 00:00:00 2001 From: David VomLehn Date: Sat, 30 May 2009 18:13:32 -0700 Subject: [PATCH 19/53] kbuild/Documentation: Incorrect makefile syntax in example There is an error in the make syntax for one of the kbuild examples Signed-off-by: David VomLehn Signed-off-by: Sam Ravnborg --- Documentation/kbuild/modules.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt index b1096da953c8..0767cf69c69e 100644 --- a/Documentation/kbuild/modules.txt +++ b/Documentation/kbuild/modules.txt @@ -275,7 +275,7 @@ following files: KERNELDIR := /lib/modules/`uname -r`/build all:: - $(MAKE) -C $KERNELDIR M=`pwd` $@ + $(MAKE) -C $(KERNELDIR) M=`pwd` $@ # Module specific targets genbin: From b8b0618cf6fab3bd5b1da8c72f4b29847d81ac42 Mon Sep 17 00:00:00 2001 From: Cheng Renquan Date: Tue, 26 May 2009 16:03:07 +0800 Subject: [PATCH 20/53] kbuild: remove extra ifdef/endif of top Makefile The GNU make's origin function know undefined variable well, so the outer ifdef/endif conditional checking is unneeded. From `info make` documentation, origin will return `undefined' if VARIABLE was never defined. `command line' if VARIABLE was defined on the command line. ... Therefore, $(origin V) will get a value anyway, killing ifdef/endif is viable and safe. Furthermore, I've checked the minimal requirements from Documentation/Changes is GNU make 3.79.1, and that version of GNU make has support of origin function well already, so now it's safe to kill the outer conditional checking, without upgrading the minimal requirements. Signed-off-by: Cheng Renquan Signed-off-by: Sam Ravnborg --- Makefile | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 106515492089..0c8ee91bc26a 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,8 @@ MAKEFLAGS += -rR --no-print-directory # To put more focus on warnings, be less verbose as default # Use 'make V=1' to see the full commands -ifdef V - ifeq ("$(origin V)", "command line") - KBUILD_VERBOSE = $(V) - endif +ifeq ("$(origin V)", "command line") + KBUILD_VERBOSE = $(V) endif ifndef KBUILD_VERBOSE KBUILD_VERBOSE = 0 @@ -54,10 +52,8 @@ endif # See the file "Documentation/sparse.txt" for more details, including # where to get the "sparse" utility. -ifdef C - ifeq ("$(origin C)", "command line") - KBUILD_CHECKSRC = $(C) - endif +ifeq ("$(origin C)", "command line") + KBUILD_CHECKSRC = $(C) endif ifndef KBUILD_CHECKSRC KBUILD_CHECKSRC = 0 @@ -69,12 +65,10 @@ endif ifdef SUBDIRS KBUILD_EXTMOD ?= $(SUBDIRS) endif -ifdef M - ifeq ("$(origin M)", "command line") - KBUILD_EXTMOD := $(M) - endif -endif +ifeq ("$(origin M)", "command line") + KBUILD_EXTMOD := $(M) +endif # kbuild supports saving output files in a separate directory. # To locate output files in a separate directory two syntaxes are supported. @@ -98,10 +92,8 @@ ifeq ($(KBUILD_SRC),) # OK, Make called in directory where kernel src resides # Do we want to locate output files in a separate directory? -ifdef O - ifeq ("$(origin O)", "command line") - KBUILD_OUTPUT := $(O) - endif +ifeq ("$(origin O)", "command line") + KBUILD_OUTPUT := $(O) endif # That's our default target when none is given on the command line From 6f26e5e412ddc23e1d698390243e39802410ab15 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:45 +0200 Subject: [PATCH 21/53] kconfig: fix typo "mconfig" to "menuconfig" in a comment Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index fa8c2dd9c983..47e3f2e2af4f 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -104,7 +104,7 @@ HOST_EXTRACFLAGS += -DLOCALE # =========================================================================== # Shared Makefile for the various kconfig executables: # conf: Used for defconfig, oldconfig and related targets -# mconf: Used for the mconfig target. +# mconf: Used for the menuconfig target # Utilizes the lxdialog package # qconf: Used for the xconfig target # Based on QT which needs to be installed to compile it From 590a5857291e88c00a1be53fb373e8bf82f86284 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:46 +0200 Subject: [PATCH 22/53] kconfig: add a note about the deps to the 'silentoldconfig' help Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- README | 1 + scripts/kconfig/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index d6c6c742c1d7..7a078ff0ee06 100644 --- a/README +++ b/README @@ -174,6 +174,7 @@ CONFIGURING the kernel: "make silentoldconfig" Like above, but avoids cluttering the screen with questions already answered. + Additionally updates the dependencies. "make defconfig" Create a ./.config file by using the default symbol values from arch/$ARCH/defconfig. "make allyesconfig" diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 47e3f2e2af4f..5ddf8becd7a2 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -83,7 +83,7 @@ help: @echo ' xconfig - Update current config utilising a QT based front-end' @echo ' gconfig - Update current config utilising a GTK based front-end' @echo ' oldconfig - Update current config utilising a provided .config as base' - @echo ' silentoldconfig - Same as oldconfig, but quietly' + @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' @echo ' randconfig - New config with random answer to all options' @echo ' defconfig - New config with default answer to all options' @echo ' allmodconfig - New config selecting modules when possible' From 98f540d31ba0d3598b52177e194dde0bc498352d Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:47 +0200 Subject: [PATCH 23/53] kconfig: resort the documentation of the environment variables All the KCONFIG_ environment variables were previously located in a section "Environment variables in 'menuconfig'", but neither are they restricted to 'menuconfig' nor are they all used by 'menuconfig'. Introduce the following three sections for these variables: * Environment variables for '*config' * Environment variables for '{allyes/allmod/allno/rand}config' * Environment variables for 'silentoldconfig' Furthermore this puts MENUCONFIG_MODE next to MENUCONFIG_COLOR into a common section "User interface options for 'menuconfig'". Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- Documentation/kbuild/kconfig.txt | 152 ++++++++++++++++--------------- 1 file changed, 78 insertions(+), 74 deletions(-) diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt index 26a7c0a93193..849b5e56d06f 100644 --- a/Documentation/kbuild/kconfig.txt +++ b/Documentation/kbuild/kconfig.txt @@ -35,6 +35,79 @@ new .config files to see the differences: (Yes, we need something better here.) +______________________________________________________________________ +Environment variables for '*config' + +KCONFIG_CONFIG +-------------------------------------------------- +This environment variable can be used to specify a default kernel config +file name to override the default name of ".config". + +KCONFIG_OVERWRITECONFIG +-------------------------------------------------- +If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not +break symlinks when .config is a symlink to somewhere else. + +KCONFIG_NOTIMESTAMP +-------------------------------------------------- +If this environment variable exists and is non-null, the timestamp line +in generated .config files is omitted. + +______________________________________________________________________ +Environment variables for '{allyes/allmod/allno/rand}config' + +KCONFIG_ALLCONFIG +-------------------------------------------------- +(partially based on lkml email from/by Rob Landley, re: miniconfig) +-------------------------------------------------- +The allyesconfig/allmodconfig/allnoconfig/randconfig variants can +also use the environment variable KCONFIG_ALLCONFIG as a flag or a +filename that contains config symbols that the user requires to be +set to a specific value. If KCONFIG_ALLCONFIG is used without a +filename, "make *config" checks for a file named +"all{yes/mod/no/random}.config" (corresponding to the *config command +that was used) for symbol values that are to be forced. If this file +is not found, it checks for a file named "all.config" to contain forced +values. + +This enables you to create "miniature" config (miniconfig) or custom +config files containing just the config symbols that you are interested +in. Then the kernel config system generates the full .config file, +including symbols of your miniconfig file. + +This 'KCONFIG_ALLCONFIG' file is a config file which contains +(usually a subset of all) preset config symbols. These variable +settings are still subject to normal dependency checks. + +Examples: + KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig +or + KCONFIG_ALLCONFIG=mini.config make allnoconfig +or + make KCONFIG_ALLCONFIG=mini.config allnoconfig + +These examples will disable most options (allnoconfig) but enable or +disable the options that are explicitly listed in the specified +mini-config files. + +______________________________________________________________________ +Environment variables for 'silentoldconfig' + +KCONFIG_NOSILENTUPDATE +-------------------------------------------------- +If this variable has a non-blank value, it prevents silent kernel +config udpates (requires explicit updates). + +KCONFIG_AUTOCONFIG +-------------------------------------------------- +This environment variable can be set to specify the path & name of the +"auto.conf" file. Its default value is "include/config/auto.conf". + +KCONFIG_AUTOHEADER +-------------------------------------------------- +This environment variable can be set to specify the path & name of the +"autoconf.h" (header) file. Its default value is "include/linux/autoconf.h". + ====================================================================== menuconfig @@ -60,10 +133,11 @@ Searching in menuconfig: /^hotplug - ______________________________________________________________________ -Color Themes for 'menuconfig' +User interface options for 'menuconfig' +MENUCONFIG_COLOR +-------------------------------------------------- It is possible to select different color themes using the variable MENUCONFIG_COLOR. To select a theme use: @@ -75,83 +149,13 @@ Available themes are: classic => theme with blue background. The classic look bluetitle => a LCD friendly version of classic. (default) -______________________________________________________________________ -Environment variables in 'menuconfig' - -KCONFIG_ALLCONFIG --------------------------------------------------- -(partially based on lkml email from/by Rob Landley, re: miniconfig) --------------------------------------------------- -The allyesconfig/allmodconfig/allnoconfig/randconfig variants can -also use the environment variable KCONFIG_ALLCONFIG as a flag or a -filename that contains config symbols that the user requires to be -set to a specific value. If KCONFIG_ALLCONFIG is used without a -filename, "make *config" checks for a file named -"all{yes/mod/no/random}.config" (corresponding to the *config command -that was used) for symbol values that are to be forced. If this file -is not found, it checks for a file named "all.config" to contain forced -values. - -This enables you to create "miniature" config (miniconfig) or custom -config files containing just the config symbols that you are interested -in. Then the kernel config system generates the full .config file, -including dependencies of your miniconfig file, based on the miniconfig -file. - -This 'KCONFIG_ALLCONFIG' file is a config file which contains -(usually a subset of all) preset config symbols. These variable -settings are still subject to normal dependency checks. - -Examples: - KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig -or - KCONFIG_ALLCONFIG=mini.config make allnoconfig -or - make KCONFIG_ALLCONFIG=mini.config allnoconfig - -These examples will disable most options (allnoconfig) but enable or -disable the options that are explicitly listed in the specified -mini-config files. - -KCONFIG_NOSILENTUPDATE --------------------------------------------------- -If this variable has a non-blank value, it prevents silent kernel -config udpates (requires explicit updates). - -KCONFIG_CONFIG --------------------------------------------------- -This environment variable can be used to specify a default kernel config -file name to override the default name of ".config". - -KCONFIG_OVERWRITECONFIG --------------------------------------------------- -If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not -break symlinks when .config is a symlink to somewhere else. - -KCONFIG_NOTIMESTAMP --------------------------------------------------- -If this environment variable exists and is non-null, the timestamp line -in generated .config files is omitted. - -KCONFIG_AUTOCONFIG --------------------------------------------------- -This environment variable can be set to specify the path & name of the -"auto.conf" file. Its default value is "include/config/auto.conf". - -KCONFIG_AUTOHEADER --------------------------------------------------- -This environment variable can be set to specify the path & name of the -"autoconf.h" (header) file. Its default value is "include/linux/autoconf.h". - -______________________________________________________________________ -menuconfig User Interface Options ----------------------------------------------------------------------- MENUCONFIG_MODE -------------------------------------------------- This mode shows all sub-menus in one large tree. Example: - MENUCONFIG_MODE=single_menu make menuconfig + make MENUCONFIG_MODE=single_menu menuconfig + ====================================================================== xconfig From c26dd719a5b9d94d12211f2d101bd7dffb7f9f1f Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:48 +0200 Subject: [PATCH 24/53] gitignore: ignore Kconfig i18n files Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index b49584c932cc..6a36a76e6606 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore @@ -8,6 +8,9 @@ lex.*.c zconf.hash.c *.moc lkc_defs.h +gconf.glade.h +*.pot +*.mo # # configuration programs From 98403a91389d11edd954e8f89dcffc3db525657f Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:49 +0200 Subject: [PATCH 25/53] kconfig qconf: fix -Wall compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These compiler warnings occure when adding -Wall to HOSTCXXFLAGS in /Makefile scripts/kconfig/qconf.h: In constructor ‘ConfigInfoView::ConfigInfoView(QWidget*, const char*)’: scripts/kconfig/qconf.h:274: warning: ‘ConfigInfoView::menu’ will be initialized after scripts/kconfig/qconf.h:273: warning: ‘symbol* ConfigInfoView::sym’ scripts/kconfig/qconf.cc:922: warning: when initialized here scripts/kconfig/qconf.cc: In member function ‘void ConfigMainWindow::setMenuLink(menu*)’: scripts/kconfig/qconf.cc:1498: warning: enumeration value ‘menuMode’ not handled in switch scripts/kconfig/qconf.cc:1498: warning: enumeration value ‘listMode’ not handled in switch scripts/kconfig/qconf.cc: In member function ‘void ConfigMainWindow::saveSettings()’: scripts/kconfig/qconf.cc:1664: warning: enumeration value ‘menuMode’ not handled in switch scripts/kconfig/qconf.cc:1664: warning: enumeration value ‘listMode’ not handled in switch Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/qconf.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 5d0fd38b089b..2bd6ed021aac 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -920,7 +920,7 @@ void ConfigView::updateListAll(void) } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) - : Parent(parent, name), menu(0), sym(0) + : Parent(parent, name), sym(0), menu(0) { if (name) { configSettings->beginGroup(name); @@ -1524,6 +1524,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) case fullMode: list = configList; break; + default: + break; } if (list) { @@ -1673,6 +1675,9 @@ void ConfigMainWindow::saveSettings(void) case fullMode : entry = "full"; break; + + default: + break; } configSettings->writeEntry("/listMode", entry); From 7298b936017859fce4906e38f485c131520fe857 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:50 +0200 Subject: [PATCH 26/53] kconfig qconf: fix namespace for Horizontal and Vertical enum values They were used as QSplitter::Horizontal resp. QSplitter::Vertical, but are defined in the 'Qt' namespace. Fixes the following compiler errors after a quick conversion with 'qt3to4', which occured with g++ 3.4.6 and 4.1.2, but not anymore with 4.3.2. scripts/kconfig/qconf.cc: In constructor 'ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow*, const char*)': scripts/kconfig/qconf.cc:1213: error: 'Vertical' is not a member of 'QSplitter' scripts/kconfig/qconf.cc: In constructor 'ConfigMainWindow::ConfigMainWindow()': scripts/kconfig/qconf.cc:1304: error: 'Horizontal' is not a member of 'QSplitter' scripts/kconfig/qconf.cc:1311: error: 'Vertical' is not a member of 'QSplitter' Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/qconf.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 2bd6ed021aac..7433dac6b90a 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1199,7 +1199,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam layout1->addLayout(layout2); split = new QSplitter(this); - split->setOrientation(QSplitter::Vertical); + split->setOrientation(Qt::Vertical); list = new ConfigView(split, name); list->list->mode = listMode; info = new ConfigInfoView(split, name); @@ -1290,14 +1290,14 @@ ConfigMainWindow::ConfigMainWindow(void) move(x, y); split1 = new QSplitter(this); - split1->setOrientation(QSplitter::Horizontal); + split1->setOrientation(Qt::Horizontal); setCentralWidget(split1); menuView = new ConfigView(split1, "menu"); menuList = menuView->list; split2 = new QSplitter(split1); - split2->setOrientation(QSplitter::Vertical); + split2->setOrientation(Qt::Vertical); // create config tree configView = new ConfigView(split2, "config"); From fbb86374445d97072dd994f1a4adf023bfd1e86e Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:51 +0200 Subject: [PATCH 27/53] kconfig qconf: add namespace for use of Key_ enum values They are defined in the 'Qt' namespace. Fixes the following compiler errors after a quick conversion with 'qt3to4', which occured with g++ 3.4.6 and 4.1.2, but not anymore with 4.3.2. scripts/kconfig/qconf.cc: In member function 'virtual void ConfigLineEdit::keyPressEvent(QKeyEvent*)': scripts/kconfig/qconf.cc:311: error: 'Key_Escape' was not declared in this scope scripts/kconfig/qconf.cc:313: error: 'Key_Return' was not declared in this scope scripts/kconfig/qconf.cc:314: error: 'Key_Enter' was not declared in this scope scripts/kconfig/qconf.cc: In member function 'virtual void ConfigList::keyPressEvent(QKeyEvent*)': scripts/kconfig/qconf.cc:653: error: 'Key_Escape' was not declared in this scope scripts/kconfig/qconf.cc:666: error: 'Key_Return' was not declared in this scope scripts/kconfig/qconf.cc:667: error: 'Key_Enter' was not declared in this scope scripts/kconfig/qconf.cc:681: error: 'Key_Space' was not declared in this scope scripts/kconfig/qconf.cc:684: error: 'Key_N' was not declared in this scope scripts/kconfig/qconf.cc:687: error: 'Key_M' was not declared in this scope scripts/kconfig/qconf.cc:690: error: 'Key_Y' was not declared in this scope scripts/kconfig/qconf.cc: In constructor 'ConfigMainWindow::ConfigMainWindow()': scripts/kconfig/qconf.cc:1329: error: 'CTRL' was not declared in this scope scripts/kconfig/qconf.cc:1329: error: 'Key_Q' was not declared in this scope scripts/kconfig/qconf.cc:1331: error: 'Key_L' was not declared in this scope scripts/kconfig/qconf.cc:1333: error: 'Key_S' was not declared in this scope scripts/kconfig/qconf.cc:1340: error: 'Key_F' was not declared in this scope Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/qconf.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 7433dac6b90a..afae613ae0d8 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -297,10 +297,10 @@ void ConfigLineEdit::show(ConfigItem* i) void ConfigLineEdit::keyPressEvent(QKeyEvent* e) { switch (e->key()) { - case Key_Escape: + case Qt::Key_Escape: break; - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: sym_set_string_value(item->menu->sym, text().latin1()); parent()->updateList(item); break; @@ -639,7 +639,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) struct menu *menu; enum prop_type type; - if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) { + if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { emit parentSelected(); ev->accept(); return; @@ -652,8 +652,8 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) item = (ConfigItem*)i; switch (ev->key()) { - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: if (item->goParent) { emit parentSelected(); break; @@ -667,16 +667,16 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) emit menuSelected(menu); break; } - case Key_Space: + case Qt::Key_Space: changeValue(item); break; - case Key_N: + case Qt::Key_N: setValue(item, no); break; - case Key_M: + case Qt::Key_M: setValue(item, mod); break; - case Key_Y: + case Qt::Key_Y: setValue(item, yes); break; default: @@ -1315,18 +1315,18 @@ ConfigMainWindow::ConfigMainWindow(void) backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); backAction->setEnabled(FALSE); - QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this); + QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); connect(quitAction, SIGNAL(activated()), SLOT(close())); - QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this); + QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); - saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this); + saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); - QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this); + QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); From 8d90c97e46930d01e9394bceb6276c7175136bdc Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:52 +0200 Subject: [PATCH 28/53] kconfig qconf: fix the type of the desktop widget QApplication::desktop() returns a pointer to QDesktopWidget, not to QWidget. Fixes the following compiler error after a quick conversion with 'qt3to4', which occured with g++ 3.4.6 and 4.1.2, but not anymore with 4.3.2. scripts/kconfig/qconf.cc: In constructor 'ConfigMainWindow::ConfigMainWindow()': scripts/kconfig/qconf.cc:1289: error: cannot convert 'QDesktopWidget*' to 'QWidget*' in initialization Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/qconf.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index afae613ae0d8..19811fcca6d6 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -1275,7 +1276,7 @@ ConfigMainWindow::ConfigMainWindow(void) int x, y, width, height; char title[256]; - QWidget *d = configApp->desktop(); + QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), getenv("KERNELVERSION")); setCaption(title); From 284026cdfb5a899e558dcb7a36aefaf54a78c094 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:53 +0200 Subject: [PATCH 29/53] kconfig: do not hardcode ".config" filename Rather than hardcoding ".config" use conf_get_configname(), which also respects the environment variable KCONFIG_CONFIG. This fixes "make silentoldconfig" when KCONFIG_CONFIG is used and also suggests the given filename for "Load" and "Save as" in qconf. Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/conf.c | 7 ++++--- scripts/kconfig/qconf.cc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index d190092c3b6e..3baaaecd6b13 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -498,14 +498,15 @@ int main(int ac, char **av) conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { - if (stat(".config", &tmpstat)) { + name = conf_get_configname(); + if (stat(name, &tmpstat)) { fprintf(stderr, _("***\n" "*** You have not yet configured your kernel!\n" - "*** (missing kernel .config file)\n" + "*** (missing kernel config file \"%s\")\n" "***\n" "*** Please run some configurator (e.g. \"make oldconfig\" or\n" "*** \"make menuconfig\" or \"make xconfig\").\n" - "***\n")); + "***\n"), name); exit(1); } } diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 19811fcca6d6..ce7d508c7520 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1448,7 +1448,7 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = QFileDialog::getOpenFileName(".config", NULL, this); + QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; if (conf_read(QFile::encodeName(s))) @@ -1464,7 +1464,7 @@ void ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { - QString s = QFileDialog::getSaveFileName(".config", NULL, this); + QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; if (conf_write(QFile::encodeName(s))) From 12122f62324e7c6837ee8b0fa8d257ce7ebcfc6f Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 18 May 2009 01:36:54 +0200 Subject: [PATCH 30/53] kconfig: do not hardcode "include/config/auto.conf" filename Regardless of KCONFIG_AUTOCONFIG, the filename written as a Make target into "include/config/auto.conf.cmd" was always the default one. Of course this doesn't make it work for the Kernel kbuild system, since there the filename is hardcoded at several places in the Makefiles. Signed-off-by: Markus Heidelberg Signed-off-by: Sam Ravnborg --- scripts/kconfig/confdata.c | 20 ++++++++++++-------- scripts/kconfig/lkc.h | 1 + scripts/kconfig/util.c | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 273d73888f9d..a04da3459f0f 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -41,6 +41,13 @@ const char *conf_get_configname(void) return name ? name : ".config"; } +const char *conf_get_autoconfig_name(void) +{ + char *name = getenv("KCONFIG_AUTOCONFIG"); + + return name ? name : "include/config/auto.conf"; +} + static char *conf_expand_value(const char *in) { struct symbol *sym; @@ -555,15 +562,14 @@ int conf_write(const char *name) int conf_split_config(void) { - char *name, path[128]; + const char *name; + char path[128]; char *s, *d, c; struct symbol *sym; struct stat sb; int res, i, fd; - name = getenv("KCONFIG_AUTOCONFIG"); - if (!name) - name = "include/config/auto.conf"; + name = conf_get_autoconfig_name(); conf_read_simple(name, S_DEF_AUTO); if (chdir("include/config")) @@ -670,7 +676,7 @@ int conf_write_autoconf(void) { struct symbol *sym; const char *str; - char *name; + const char *name; FILE *out, *out_h; time_t now; int i, l; @@ -773,9 +779,7 @@ int conf_write_autoconf(void) name = "include/linux/autoconf.h"; if (rename(".tmpconfig.h", name)) return 1; - name = getenv("KCONFIG_AUTOCONFIG"); - if (!name) - name = "include/config/auto.conf"; + name = conf_get_autoconfig_name(); /* * This must be the last step, kbuild has a dependency on auto.conf * and this marks the successful completion of the previous steps. diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 4a9af6f7886b..f379b0bf8c9e 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -74,6 +74,7 @@ char *zconf_curname(void); /* confdata.c */ const char *conf_get_configname(void); +const char *conf_get_autoconfig_name(void); char *conf_get_default_confname(void); void sym_set_change_count(int count); void sym_add_change_count(int count); diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 3cc9f9369036..b6b2a46af14c 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -46,8 +46,8 @@ int file_write_dep(const char *name) else fprintf(out, "\t%s\n", file->name); } - fprintf(out, "\ninclude/config/auto.conf: \\\n" - "\t$(deps_config)\n\n"); + fprintf(out, "\n%s: \\\n" + "\t$(deps_config)\n\n", conf_get_autoconfig_name()); expr_list_for_each_sym(sym_env_list, e, sym) { struct property *prop; @@ -61,7 +61,7 @@ int file_write_dep(const char *name) if (!value) value = ""; fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); - fprintf(out, "include/config/auto.conf: FORCE\n"); + fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name()); fprintf(out, "endif\n"); } From ad6ccfad6f759a5d657dabe2071a8f2a503fcc84 Mon Sep 17 00:00:00 2001 From: Manish Katiyar Date: Tue, 12 May 2009 13:43:35 -0700 Subject: [PATCH 31/53] kernel/kallsyms.c: replace deprecated __initcall with device_initcall and fix whitespace Fix coding style whitespace issues and replace __initcall with device_initcall. Fixed multi-line comments as per coding style. Errors as reported by checkpatch.pl :- Before: total: 14 errors, 14 warnings, 487 lines checked After : total: 0 errors, 8 warnings, 507 lines checked Compile tested binary verified as :- Before: text data bss dec hex filename 2405 4 0 2409 969 kernel/kallsyms.o After : text data bss dec hex filename 2405 4 0 2409 969 kernel/kallsyms.o Signed-off-by: Manish Katiyar Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- kernel/kallsyms.c | 134 +++++++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 56 deletions(-) diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 374faf9bfdc7..3a29dbe7898e 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -30,12 +30,16 @@ #define all_var 0 #endif -/* These will be re-linked against their real values during the second link stage */ +/* + * These will be re-linked against their real values + * during the second link stage. + */ extern const unsigned long kallsyms_addresses[] __attribute__((weak)); extern const u8 kallsyms_names[] __attribute__((weak)); -/* tell the compiler that the count isn't in the small data section if the arch - * has one (eg: FRV) +/* + * Tell the compiler that the count isn't in the small data section if the arch + * has one (eg: FRV). */ extern const unsigned long kallsyms_num_syms __attribute__((weak, section(".rodata"))); @@ -75,31 +79,37 @@ static int is_ksym_addr(unsigned long addr) return is_kernel_text(addr) || is_kernel_inittext(addr); } -/* expand a compressed symbol data into the resulting uncompressed string, - given the offset to where the symbol is in the compressed stream */ +/* + * Expand a compressed symbol data into the resulting uncompressed string, + * given the offset to where the symbol is in the compressed stream. + */ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result) { int len, skipped_first = 0; const u8 *tptr, *data; - /* get the compressed symbol length from the first symbol byte */ + /* Get the compressed symbol length from the first symbol byte. */ data = &kallsyms_names[off]; len = *data; data++; - /* update the offset to return the offset for the next symbol on - * the compressed stream */ + /* + * Update the offset to return the offset for the next symbol on + * the compressed stream. + */ off += len + 1; - /* for every byte on the compressed symbol data, copy the table - entry for that byte */ - while(len) { - tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ]; + /* + * For every byte on the compressed symbol data, copy the table + * entry for that byte. + */ + while (len) { + tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; data++; len--; while (*tptr) { - if(skipped_first) { + if (skipped_first) { *result = *tptr; result++; } else @@ -110,36 +120,46 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result) *result = '\0'; - /* return to offset to the next symbol */ + /* Return to offset to the next symbol. */ return off; } -/* get symbol type information. This is encoded as a single char at the - * begining of the symbol name */ +/* + * Get symbol type information. This is encoded as a single char at the + * beginning of the symbol name. + */ static char kallsyms_get_symbol_type(unsigned int off) { - /* get just the first code, look it up in the token table, and return the - * first char from this token */ - return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ]; + /* + * Get just the first code, look it up in the token table, + * and return the first char from this token. + */ + return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]]; } -/* find the offset on the compressed stream given and index in the - * kallsyms array */ +/* + * Find the offset on the compressed stream given and index in the + * kallsyms array. + */ static unsigned int get_symbol_offset(unsigned long pos) { const u8 *name; int i; - /* use the closest marker we have. We have markers every 256 positions, - * so that should be close enough */ - name = &kallsyms_names[ kallsyms_markers[pos>>8] ]; + /* + * Use the closest marker we have. We have markers every 256 positions, + * so that should be close enough. + */ + name = &kallsyms_names[kallsyms_markers[pos >> 8]]; - /* sequentially scan all the symbols up to the point we're searching for. - * Every symbol is stored in a [][ bytes of data] format, so we - * just need to add the len to the current pointer for every symbol we - * wish to skip */ - for(i = 0; i < (pos&0xFF); i++) + /* + * Sequentially scan all the symbols up to the point we're searching + * for. Every symbol is stored in a [][ bytes of data] format, + * so we just need to add the len to the current pointer for every + * symbol we wish to skip. + */ + for (i = 0; i < (pos & 0xFF); i++) name = name + (*name) + 1; return name - kallsyms_names; @@ -190,7 +210,7 @@ static unsigned long get_symbol_pos(unsigned long addr, /* This kernel should never had been booted. */ BUG_ON(!kallsyms_addresses); - /* do a binary search on the sorted kallsyms_addresses array */ + /* Do a binary search on the sorted kallsyms_addresses array. */ low = 0; high = kallsyms_num_syms; @@ -203,15 +223,15 @@ static unsigned long get_symbol_pos(unsigned long addr, } /* - * search for the first aliased symbol. Aliased - * symbols are symbols with the same address + * Search for the first aliased symbol. Aliased + * symbols are symbols with the same address. */ while (low && kallsyms_addresses[low-1] == kallsyms_addresses[low]) --low; symbol_start = kallsyms_addresses[low]; - /* Search for next non-aliased symbol */ + /* Search for next non-aliased symbol. */ for (i = low + 1; i < kallsyms_num_syms; i++) { if (kallsyms_addresses[i] > symbol_start) { symbol_end = kallsyms_addresses[i]; @@ -219,7 +239,7 @@ static unsigned long get_symbol_pos(unsigned long addr, } } - /* if we found no next symbol, we use the end of the section */ + /* If we found no next symbol, we use the end of the section. */ if (!symbol_end) { if (is_kernel_inittext(addr)) symbol_end = (unsigned long)_einittext; @@ -252,10 +272,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, /* * Lookup an address - * - modname is set to NULL if it's in the kernel - * - we guarantee that the returned name is valid until we reschedule even if - * it resides in a module - * - we also guarantee that modname will be valid until rescheduled + * - modname is set to NULL if it's in the kernel. + * - We guarantee that the returned name is valid until we reschedule even if. + * It resides in a module. + * - We also guarantee that modname will be valid until rescheduled. */ const char *kallsyms_lookup(unsigned long addr, unsigned long *symbolsize, @@ -276,7 +296,7 @@ const char *kallsyms_lookup(unsigned long addr, return namebuf; } - /* see if it's in a module */ + /* See if it's in a module. */ return module_address_lookup(addr, symbolsize, offset, modname, namebuf); } @@ -294,7 +314,7 @@ int lookup_symbol_name(unsigned long addr, char *symname) kallsyms_expand_symbol(get_symbol_offset(pos), symname); return 0; } - /* see if it's in a module */ + /* See if it's in a module. */ return lookup_module_symbol_name(addr, symname); } @@ -313,7 +333,7 @@ int lookup_symbol_attrs(unsigned long addr, unsigned long *size, modname[0] = '\0'; return 0; } - /* see if it's in a module */ + /* See if it's in a module. */ return lookup_module_symbol_attrs(addr, size, offset, modname, name); } @@ -342,6 +362,7 @@ int sprint_symbol(char *buffer, unsigned long address) return len; } +EXPORT_SYMBOL_GPL(sprint_symbol); /* Look up a kernel symbol and print it to the kernel messages. */ void __print_symbol(const char *fmt, unsigned long address) @@ -352,13 +373,13 @@ void __print_symbol(const char *fmt, unsigned long address) printk(fmt, buffer); } +EXPORT_SYMBOL(__print_symbol); /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */ -struct kallsym_iter -{ +struct kallsym_iter { loff_t pos; unsigned long value; - unsigned int nameoff; /* If iterating in core kernel symbols */ + unsigned int nameoff; /* If iterating in core kernel symbols. */ char type; char name[KSYM_NAME_LEN]; char module_name[MODULE_NAME_LEN]; @@ -404,7 +425,7 @@ static int update_iter(struct kallsym_iter *iter, loff_t pos) iter->pos = pos; return get_ksymbol_mod(iter); } - + /* If we're not on the desired position, reset to new position. */ if (pos != iter->pos) reset_iter(iter, pos); @@ -439,23 +460,25 @@ static int s_show(struct seq_file *m, void *p) { struct kallsym_iter *iter = m->private; - /* Some debugging symbols have no name. Ignore them. */ + /* Some debugging symbols have no name. Ignore them. */ if (!iter->name[0]) return 0; if (iter->module_name[0]) { char type; - /* Label it "global" if it is exported, - * "local" if not exported. */ + /* + * Label it "global" if it is exported, + * "local" if not exported. + */ type = iter->exported ? toupper(iter->type) : tolower(iter->type); seq_printf(m, "%0*lx %c %s\t[%s]\n", - (int)(2*sizeof(void*)), + (int)(2 * sizeof(void *)), iter->value, type, iter->name, iter->module_name); } else seq_printf(m, "%0*lx %c %s\n", - (int)(2*sizeof(void*)), + (int)(2 * sizeof(void *)), iter->value, iter->type, iter->name); return 0; } @@ -469,9 +492,11 @@ static const struct seq_operations kallsyms_op = { static int kallsyms_open(struct inode *inode, struct file *file) { - /* We keep iterator in m->private, since normal case is to + /* + * We keep iterator in m->private, since normal case is to * s_start from where we left off, so we avoid doing - * using get_symbol_offset for every symbol */ + * using get_symbol_offset for every symbol. + */ struct kallsym_iter *iter; int ret; @@ -500,7 +525,4 @@ static int __init kallsyms_init(void) proc_create("kallsyms", 0444, NULL, &kallsyms_operations); return 0; } -__initcall(kallsyms_init); - -EXPORT_SYMBOL(__print_symbol); -EXPORT_SYMBOL_GPL(sprint_symbol); +device_initcall(kallsyms_init); From 1581c1cede3b180b77aa08024c6ca406252cc21f Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Tue, 12 May 2009 13:43:36 -0700 Subject: [PATCH 32/53] scripts/headers_check.pl: correct RE in header CONFIG leak check Correct the regular expression in scripts/headers_check.pl to include '_' as a valid character in the class; otherwise, the check will report a "leaked" symbol of CONFIG_A_B_C as merely CONFIG_A. This patch will make no difference whatsoever in the current kernel tree as the call to the perl routine that does that check is currently commented out: &check_include(); &check_asm_types(); &check_sizetypes(); &check_prototypes(); # Dropped for now. Too much noise &check_config(); However, I noticed that problem when I was building the yum downloadable kernel source rpm for fedora 11 (beta), which *does* run that check, and that's where the problem became obvious. Signed-off-by: Robert P. J. Day Cc: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 56f90a480899..4414c43857ad 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -70,7 +70,7 @@ sub check_prototypes sub check_config { - if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) { + if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) { printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n"; } } From 8b8b76c045beb85c1c2b28e07eff6599a1e95cf1 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 6 Jun 2009 00:18:05 +0200 Subject: [PATCH 33/53] kbuild: add hint about __refdata to modpost As requested by Guennadi Liakhovetski Cc: Guennadi Liakhovetski Signed-off-by: Sam Ravnborg --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 94e71efb2c14..4522948a012e 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1196,7 +1196,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, "The variable %s references\n" "the %s %s%s%s\n" "If the reference is valid then annotate the\n" - "variable with __init* (see linux/init.h) " + "variable with __init* or __refdata (see linux/init.h) " "or name the variable:\n", fromsym, to, sec2annotation(tosec), tosym, to_p); while (*s) From a9eb522375abc79c2bf23940a067bc0046276236 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 5 Jun 2009 15:02:47 -0700 Subject: [PATCH 34/53] menu: fix embedded menu presentation The STRIP_ASM_SYMS kconfig symbol mucks up the embedded menu because STRIP_ASM_SYMS is in the middle of the embedded menu items but it does not depend on EMBEDDED. Move it to beyond the end of the embedded menu so that the menu is presented correctly. Or if STRIP_ASM_SYMS should depend on EMBEDDED, that can also be fixed. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- init/Kconfig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 7be4d3836745..4389cee99db0 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -808,14 +808,6 @@ config KALLSYMS_EXTRA_PASS you wait for kallsyms to be fixed. -config STRIP_ASM_SYMS - bool "Strip assembler-generated symbols during link" - default n - help - Strip internal assembler-generated symbols during a link (symbols - that look like '.Lxxx') so they don't pollute the output of - get_wchan() and suchlike. - config HOTPLUG bool "Support for hot-pluggable devices" if EMBEDDED default y @@ -961,6 +953,14 @@ config SLUB_DEBUG SLUB sysfs support. /sys/slab will not exist and there will be no support for cache validation etc. +config STRIP_ASM_SYMS + bool "Strip assembler-generated symbols during link" + default n + help + Strip internal assembler-generated symbols during a link (symbols + that look like '.Lxxx') so they don't pollute the output of + get_wchan() and suchlike. + config COMPAT_BRK bool "Disable heap randomization" default y From bdefe35d40c6bb5859dadee26c2e19bf58540f1d Mon Sep 17 00:00:00 2001 From: dann frazier Date: Fri, 5 Jun 2009 15:02:49 -0700 Subject: [PATCH 35/53] Remove bashisms from scripts The '-e' option to echo and brace expansion are not guaranteed to be supported by a POSIX-compliant /bin/sh (e.g. dash) Signed-off-by: dann frazier Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/gcc-version.sh | 2 +- scripts/ver_linux | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh index cc767b388baf..debecb5561c4 100644 --- a/scripts/gcc-version.sh +++ b/scripts/gcc-version.sh @@ -18,7 +18,7 @@ compiler="$*" if [ ${#compiler} -eq 0 ]; then echo "Error: No compiler specified." - echo -e "Usage:\n\t$0 " + printf "Usage:\n\t$0 \n" exit 1 fi diff --git a/scripts/ver_linux b/scripts/ver_linux index dbb3037f1346..7de36df4eaa5 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -65,7 +65,7 @@ sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ 'NR==1{print "Dynamic linker (ldd) ", $NF}' -ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ +ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so 2>/dev/null | awk -F. \ '{print "Linux C++ Library " $4"."$5"."$6}' ps --version 2>&1 | grep version | awk \ From 35763e854f8aa2d579236a4670c32c078d143b3a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 26 May 2009 19:37:54 -0400 Subject: [PATCH 36/53] ignore *.patch files Signed-off-by: Mike Frysinger Signed-off-by: Sam Ravnborg --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 51bd99d6a260..3433d7c0d36d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ *.elf *.bin *.gz +*.patch # # Top-level generic files From 7211b8b9028854eee0d03ee6231440b7fb492521 Mon Sep 17 00:00:00 2001 From: Sergei Poselenov Date: Fri, 5 Jun 2009 16:11:09 +0400 Subject: [PATCH 37/53] kbuild: fix "Argument list too long" error for "make headers_check", I'm trying to install kernel headers to build a cross-toolchain, but got the following: make ARCH=arm INSTALL_HDR_PATH=/work/psl/eldk-builds/arm-2009-04-21/work/var/tmp/crosstool-0.43-3-root/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/ +arm-linux-gnueabi/arm-linux-gnueabi/ headers_check ... CHECK include/linux/raid (2 files) CHECK include/linux/spi (1 files) CHECK include/linux/sunrpc (1 files) CHECK include/linux/tc_act (6 files) CHECK include/linux/tc_ematch (4 files) CHECK include/linux/usb (8 files) make[2]: execvp: /bin/sh: Argument list too long make[2]: *** [/work/psl/eldk-builds/arm-2009-04-21/work/var/tmp/crosstool-0.43-3-root/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueab +i/arm-linux-gnueabi//include/linux/.check] Error 127 make[1]: *** [linux] Error 2 make: *** [headers_check] Error 2 -> Introduce use of xargs to fix this. Signed-off-by: Sergei Poselenov Cc: Wolfgang Denk Signed-off-by: Sam Ravnborg --- scripts/Makefile.headersinst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 095cfc8b9dbf..0fcd83838771 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -54,8 +54,12 @@ quiet_cmd_remove = REMOVE $(unwanted) cmd_remove = rm -f $(unwanted-file) quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) - cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \ - $(addprefix $(install)/, $(all-files)); \ +# Headers list can be pretty long, xargs helps to avoid +# the "Argument list too long" error. + cmd_check = for f in $(all-files); do \ + echo "$(install)/$${f}"; done \ + | xargs \ + $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ touch $@ PHONY += __headersinst __headerscheck From 67b7ebe091cd92fd69f732da3170720d79c4e632 Mon Sep 17 00:00:00 2001 From: Amerigo Wang Date: Thu, 4 Jun 2009 22:12:01 -0400 Subject: [PATCH 38/53] kbuild/headers_check: refine extern check 'extern' checking information is not clear, refine it. Plus, fix a comment. Signed-off-by: WANG Cong [sam: redid the extern error message] Acked-by: Arnd Bergmann Signed-off-by: Sam Ravnborg --- scripts/headers_check.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 4414c43857ad..db1dd7a549f2 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -2,7 +2,7 @@ # # headers_check.pl execute a number of trivial consistency checks # -# Usage: headers_check.pl dir [files...] +# Usage: headers_check.pl dir arch [files...] # dir: dir to look for included files # arch: architecture # files: list of files to check @@ -37,7 +37,7 @@ foreach my $file (@files) { &check_include(); &check_asm_types(); &check_sizetypes(); - &check_prototypes(); + &check_declarations(); # Dropped for now. Too much noise &check_config(); } close FH; @@ -61,10 +61,12 @@ sub check_include } } -sub check_prototypes +sub check_declarations { - if ($line =~ m/^\s*extern\b/) { - printf STDERR "$filename:$lineno: extern's make no sense in userspace\n"; + if ($line =~m/^\s*extern\b/) { + printf STDERR "$filename:$lineno: " . + "userspace cannot call function or variable " . + "defined in the kernel\n"; } } From eedc9d83eaab2d35fb9dd1ec25b765dec964e26c Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 6 Jun 2009 22:47:11 +0100 Subject: [PATCH 39/53] kbuild: fix headers_exports with boolean expression When we had code like this in a header unifdef failed to deduct that the expression was always false - and we had code exported that was not intended for userspace. #if defined(__KERNEL__) && !defined(__ASSEMBLY__) int a; #endif This commit implment support in unidef which allows it to work out if an #if expression always evaluates true or false for symbols which are being undefined/always defined. The patch is slightly more complicated than I'd hoped because unifdef needs to see lines fully evaluated - doing otherwise causes it to mark the line as "dirty" and copy it over no matter what. Signed-off-by: Russell King Signed-off-by: Sam Ravnborg --- scripts/unifdef.c | 48 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/scripts/unifdef.c b/scripts/unifdef.c index 05a31a6c7e1b..30d459fb0709 100644 --- a/scripts/unifdef.c +++ b/scripts/unifdef.c @@ -678,8 +678,10 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp) if (*cp == '!') { debug("eval%d !", ops - eval_ops); cp++; - if (eval_unary(ops, valp, &cp) == LT_IF) + if (eval_unary(ops, valp, &cp) == LT_IF) { + *cpp = cp; return (LT_IF); + } *valp = !*valp; } else if (*cp == '(') { cp++; @@ -700,13 +702,16 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp) return (LT_IF); cp = skipcomment(cp); sym = findsym(cp); - if (sym < 0) - return (LT_IF); - *valp = (value[sym] != NULL); cp = skipsym(cp); cp = skipcomment(cp); if (*cp++ != ')') return (LT_IF); + if (sym >= 0) + *valp = (value[sym] != NULL); + else { + *cpp = cp; + return (LT_IF); + } keepthis = false; } else if (!endsym(*cp)) { debug("eval%d symbol", ops - eval_ops); @@ -741,11 +746,11 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) const struct op *op; const char *cp; int val; + Linetype lhs, rhs; debug("eval%d", ops - eval_ops); cp = *cpp; - if (ops->inner(ops+1, valp, &cp) == LT_IF) - return (LT_IF); + lhs = ops->inner(ops+1, valp, &cp); for (;;) { cp = skipcomment(cp); for (op = ops->op; op->str != NULL; op++) @@ -755,14 +760,32 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) break; cp += strlen(op->str); debug("eval%d %s", ops - eval_ops, op->str); - if (ops->inner(ops+1, &val, &cp) == LT_IF) - return (LT_IF); - *valp = op->fn(*valp, val); + rhs = ops->inner(ops+1, &val, &cp); + if (op->fn == op_and && (lhs == LT_FALSE || rhs == LT_FALSE)) { + debug("eval%d: and always false", ops - eval_ops); + if (lhs == LT_IF) + *valp = val; + lhs = LT_FALSE; + continue; + } + if (op->fn == op_or && (lhs == LT_TRUE || rhs == LT_TRUE)) { + debug("eval%d: or always true", ops - eval_ops); + if (lhs == LT_IF) + *valp = val; + lhs = LT_TRUE; + continue; + } + if (rhs == LT_IF) + lhs = LT_IF; + if (lhs != LT_IF) + *valp = op->fn(*valp, val); } *cpp = cp; debug("eval%d = %d", ops - eval_ops, *valp); - return (*valp ? LT_TRUE : LT_FALSE); + if (lhs != LT_IF) + lhs = (*valp ? LT_TRUE : LT_FALSE); + return lhs; } /* @@ -773,12 +796,15 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) static Linetype ifeval(const char **cpp) { + const char *cp = *cpp; int ret; int val; debug("eval %s", *cpp); keepthis = killconsts ? false : true; - ret = eval_table(eval_ops, &val, cpp); + ret = eval_table(eval_ops, &val, &cp); + if (ret != LT_IF) + *cpp = cp; debug("eval = %d", val); return (keepthis ? LT_IF : ret); } From ef53dae8658cf0e93d380983824a661067948d87 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 7 Jun 2009 20:46:37 +0200 Subject: [PATCH 40/53] Improve vmlinux.lds.h support for arch specific linker scripts To support alingment of the individual architecture specific linker scripts provide a set of general definitions in vmlinux.lds.h With these definitions applied the diverse linekr scripts can be reduced in line count and their readability are improved - IMO. A sample linker script is included to give the preferred order of the sections for the architectures that do not have any special requirments. These definitions are also a first step towards eventual support for -ffunction-sections. The definitions makes it much easier to do a global renaming of section names - but the main purpose is to clean up the linker scripts. Tim Aboot has provided a lot of inputs to improve the definitions - all faults are mine. Signed-off-by: Sam Ravnborg Cc: Tim Abbott --- include/asm-generic/vmlinux.lds.h | 231 +++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 7 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 3edb11499743..fba42236e942 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -1,4 +1,58 @@ -#include +/* + * Helper macros to support writing architecture specific + * linker scripts. + * + * A minimal linker scripts has following content: + * [This is a sample, architectures may have special requiriements] + * + * OUTPUT_FORMAT(...) + * OUTPUT_ARCH(...) + * ENTRY(...) + * SECTIONS + * { + * . = START; + * __init_begin = .; + * HEAD_SECTION + * INIT_TEXT_SECTION(PAGE_SIZE) + * INIT_DATA_SECTION(...) + * PERCPU(PAGE_SIZE) + * __init_end = .; + * + * _stext = .; + * TEXT_SECTION = 0 + * _etext = .; + * + * _sdata = .; + * RO_DATA_SECTION(PAGE_SIZE) + * RW_DATA_SECTION(...) + * _edata = .; + * + * EXCEPTION_TABLE(...) + * NOTES + * + * __bss_start = .; + * BSS_SECTION(0, 0) + * __bss_stop = .; + * _end = .; + * + * /DISCARD/ : { + * EXIT_TEXT + * EXIT_DATA + * *(.exitcall.exit) + * } + * STABS_DEBUG + * DWARF_DEBUG + * } + * + * [__init_begin, __init_end] is the init section that may be freed after init + * [_stext, _etext] is the text section + * [_sdata, _edata] is the data section + * + * Some of the included output section have their own set of constants. + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and + * [__nosave_begin, __nosave_end] for the nosave data + */ + #include #ifndef LOAD_OFFSET #define LOAD_OFFSET 0 @@ -116,7 +170,36 @@ FTRACE_EVENTS() \ TRACE_SYSCALLS() -#define RO_DATA(align) \ +/* + * Data section helpers + */ +#define NOSAVE_DATA \ + . = ALIGN(PAGE_SIZE); \ + VMLINUX_SYMBOL(__nosave_begin) = .; \ + *(.data.nosave) \ + . = ALIGN(PAGE_SIZE); \ + VMLINUX_SYMBOL(__nosave_end) = .; + +#define PAGE_ALIGNED_DATA(page_align) \ + . = ALIGN(page_align); \ + *(.data.page_aligned) + +#define READ_MOSTLY_DATA(align) \ + . = ALIGN(align); \ + *(.data.read_mostly) + +#define CACHELINE_ALIGNED_DATA(align) \ + . = ALIGN(align); \ + *(.data.cacheline_aligned) + +#define INIT_TASK(align) \ + . = ALIGN(align); \ + *(.data.init_task) + +/* + * Read only Data + */ +#define RO_DATA_SECTION(align) \ . = ALIGN((align)); \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start_rodata) = .; \ @@ -270,9 +353,10 @@ } \ . = ALIGN((align)); -/* RODATA provided for backward compatibility. +/* RODATA & RO_DATA provided for backward compatibility. * All archs are supposed to use RO_DATA() */ -#define RODATA RO_DATA(4096) +#define RODATA RO_DATA_SECTION(4096) +#define RO_DATA(align) RO_DATA_SECTION(align) #define SECURITY_INIT \ .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ @@ -332,6 +416,31 @@ /* Section used for early init (in .S files) */ #define HEAD_TEXT *(HEAD_TEXT_SECTION) +#define HEAD_SECTION \ + .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ + HEAD_TEXT \ + } + +/* + * Exception table + */ +#define EXCEPTION_TABLE(align) \ + . = ALIGN(align); \ + __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ex_table) = .; \ + *(__ex_table) \ + VMLINUX_SYMBOL(__stop___ex_table) = .; \ + } + +/* + * Init task + */ +#define INIT_TASK_DATA(align) \ + . = ALIGN(align); \ + .data.init_task : { \ + INIT_TASK \ + } + /* init and exit section handling */ #define INIT_DATA \ *(.init.data) \ @@ -364,9 +473,32 @@ CPU_DISCARD(exit.text) \ MEM_DISCARD(exit.text) - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to - the beginning of the section so we begin them at 0. */ +/* + * bss (Block Started by Symbol) - uninitialized data + * zeroed during startup + */ +#define SBSS \ + .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ + *(.sbss) \ + *(.scommon) \ + } + +#define BSS(bss_align) \ + . = ALIGN(bss_align); \ + .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__bss_start) = .; \ + *(.bss.page_aligned) \ + *(.dynbss) \ + *(.bss) \ + *(COMMON) \ + VMLINUX_SYMBOL(__bss_stop) = .; \ + } + +/* + * DWARF debug sections. + * Symbols in the DWARF debugging sections are relative to + * the beginning of the section so we begin them at 0. + */ #define DWARF_DEBUG \ /* DWARF 1 */ \ .debug 0 : { *(.debug) } \ @@ -433,6 +565,12 @@ VMLINUX_SYMBOL(__stop_notes) = .; \ } +#define INIT_SETUP(initsetup_align) \ + . = ALIGN(initsetup_align); \ + VMLINUX_SYMBOL(__setup_start) = .; \ + *(.init.setup) \ + VMLINUX_SYMBOL(__setup_end) = .; + #define INITCALLS \ *(.initcallearly.init) \ VMLINUX_SYMBOL(__early_initcall_end) = .; \ @@ -454,6 +592,31 @@ *(.initcall7.init) \ *(.initcall7s.init) +#define INIT_CALLS \ + VMLINUX_SYMBOL(__initcall_start) = .; \ + INITCALLS \ + VMLINUX_SYMBOL(__initcall_end) = .; + +#define CON_INITCALL \ + VMLINUX_SYMBOL(__con_initcall_start) = .; \ + *(.con_initcall.init) \ + VMLINUX_SYMBOL(__con_initcall_end) = .; + +#define SECURITY_INITCALL \ + VMLINUX_SYMBOL(__security_initcall_start) = .; \ + *(.security_initcall.init) \ + VMLINUX_SYMBOL(__security_initcall_end) = .; + +#ifdef CONFIG_BLK_DEV_INITRD +#define INIT_RAM_FS \ + . = ALIGN(PAGE_SIZE); \ + VMLINUX_SYMBOL(__initramfs_start) = .; \ + *(.init.ramfs) \ + VMLINUX_SYMBOL(__initramfs_end) = .; +#else +#define INITRAMFS +#endif + /** * PERCPU_VADDR - define output section for percpu area * @vaddr: explicit base address (optional) @@ -510,3 +673,57 @@ *(.data.percpu.shared_aligned) \ VMLINUX_SYMBOL(__per_cpu_end) = .; \ } + + +/* + * Definition of the high level *_SECTION macros + * They will fit only a subset of the architectures + */ + + +/* + * Writeable data. + * All sections are combined in a single .data section. + * The sections following CONSTRUCTORS are arranged so their + * typical alignment matches. + * A cacheline is typical/always less than a PAGE_SIZE so + * the sections that has this restriction (or similar) + * is located before the ones requiring PAGE_SIZE alignment. + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which + * matches the requirment of PAGE_ALIGNED_DATA. + * +/* use 0 as page_align if page_aligned data is not used */ +#define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \ + . = ALIGN(PAGE_SIZE); \ + .data : AT(ADDR(.data) - LOAD_OFFSET) { \ + INIT_TASK(inittask) \ + CACHELINE_ALIGNED_DATA(cacheline) \ + READ_MOSTLY_DATA(cacheline) \ + DATA_DATA \ + CONSTRUCTORS \ + NOSAVE_DATA(nosave) \ + PAGE_ALIGNED_DATA(pagealigned) \ + } + +#define INIT_TEXT_SECTION(inittext_align) \ + . = ALIGN(inittext_align); \ + .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(_sinittext) = .; \ + INIT_TEXT \ + VMLINUX_SYMBOL(_einittext) = .; \ + } + +#define INIT_DATA_SECTION(initsetup_align) \ + .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \ + INIT_DATA \ + INIT_SETUP(initsetup_align) \ + INIT_CALLS \ + CON_INITCALL \ + SECURITY_INITCALL \ + INIT_RAM_FS \ + } + +#define BSS_SECTION(sbss_align, bss_align) \ + SBSS \ + BSS(bss_align) \ + . = ALIGN(4); \ From b9d97328e27b9272ed2ff2ad18de61aa1bf12af8 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 9 Jun 2009 08:50:38 -0700 Subject: [PATCH 41/53] kernel-doc: cleanup perl script Various cleanups of scripts/kernel-doc: - don't use **/ as an ending kernel-doc block since it's not preferred; - typos/spellos - add whitespace around ==, after comma, & around . operator; Signed-off-by: Randy Dunlap Signed-off-by: Sam Ravnborg --- scripts/kernel-doc | 174 ++++++++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 3208a3a7e7fe..5c58478eb914 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -5,7 +5,7 @@ use strict; ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## ## Copyright (C) 2000, 1 Tim Waugh ## ## Copyright (C) 2001 Simon Huggins ## -## Copyright (C) 2005-2008 Randy Dunlap ## +## Copyright (C) 2005-2009 Randy Dunlap ## ## ## ## #define enhancements by Armin Kuster ## ## Copyright (c) 2000 MontaVista Software, Inc. ## @@ -85,7 +85,7 @@ use strict; # # /** # * my_function -# **/ +# */ # # If the Description: header tag is omitted, then there must be a blank line # after the last parameter specification. @@ -105,7 +105,7 @@ use strict; # */ # etc. # -# Beside functions you can also write documentation for structs, unions, +# Besides functions you can also write documentation for structs, unions, # enums and typedefs. Instead of the function name you must write the name # of the declaration; the struct/union/enum/typedef must always precede # the name. Nesting of declarations is not supported. @@ -223,7 +223,7 @@ sub usage { } # read arguments -if ($#ARGV==-1) { +if ($#ARGV == -1) { usage(); } @@ -240,12 +240,12 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June', " " . ((localtime)[5]+1900); # Essentially these are globals -# They probably want to be tidied up made more localised or summat. -# CAVEAT EMPTOR! Some of the others I localised may not want to be which +# They probably want to be tidied up, made more localised or something. +# CAVEAT EMPTOR! Some of the others I localised may not want to be, which # could cause "use of undefined value" or other bugs. -my ($function, %function_table,%parametertypes,$declaration_purpose); -my ($type,$declaration_name,$return_type); -my ($newsection,$newcontents,$prototype,$filelist, $brcount, %source_map); +my ($function, %function_table, %parametertypes, $declaration_purpose); +my ($type, $declaration_name, $return_type); +my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map); if (defined($ENV{'KBUILD_VERBOSE'})) { $verbose = "$ENV{'KBUILD_VERBOSE'}"; @@ -279,10 +279,10 @@ my $doc_special = "\@\%\$\&"; my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. my $doc_end = '\*/'; my $doc_com = '\s*\*\s*'; -my $doc_decl = $doc_com.'(\w+)'; -my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)'; -my $doc_content = $doc_com.'(.*)'; -my $doc_block = $doc_com.'DOC:\s*(.*)?'; +my $doc_decl = $doc_com . '(\w+)'; +my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; +my $doc_content = $doc_com . '(.*)'; +my $doc_block = $doc_com . 'DOC:\s*(.*)?'; my %constants; my %parameterdescs; @@ -485,12 +485,12 @@ sub output_enum_html(%) { my %args = %{$_[0]}; my ($parameter); my $count; - print "

enum ".$args{'enum'}."

\n"; + print "

enum " . $args{'enum'} . "

\n"; - print "enum ".$args{'enum'}." {
\n"; + print "enum " . $args{'enum'} . " {
\n"; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { - print " ".$parameter.""; + print " " . $parameter . ""; if ($count != $#{$args{'parameterlist'}}) { $count++; print ",\n"; @@ -502,7 +502,7 @@ sub output_enum_html(%) { print "

Constants

\n"; print "
\n"; foreach $parameter (@{$args{'parameterlist'}}) { - print "
".$parameter."\n"; + print "
" . $parameter . "\n"; print "
"; output_highlight($args{'parameterdescs'}{$parameter}); } @@ -516,9 +516,9 @@ sub output_typedef_html(%) { my %args = %{$_[0]}; my ($parameter); my $count; - print "

typedef ".$args{'typedef'}."

\n"; + print "

typedef " . $args{'typedef'} . "

\n"; - print "typedef ".$args{'typedef'}."\n"; + print "typedef " . $args{'typedef'} . "\n"; output_section_html(@_); print "
\n"; } @@ -528,8 +528,8 @@ sub output_struct_html(%) { my %args = %{$_[0]}; my ($parameter); - print "

".$args{'type'}." ".$args{'struct'}. " - " .$args{'purpose'}."

\n"; - print "".$args{'type'}." ".$args{'struct'}." {
\n"; + print "

" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "

\n"; + print "" . $args{'type'} . " " . $args{'struct'} . " {
\n"; foreach $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { print "$parameter
\n"; @@ -561,7 +561,7 @@ sub output_struct_html(%) { $parameter_name =~ s/\[.*//; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; - print "
".$parameter."\n"; + print "
" . $parameter . "\n"; print "
"; output_highlight($args{'parameterdescs'}{$parameter_name}); } @@ -576,9 +576,9 @@ sub output_function_html(%) { my ($parameter, $section); my $count; - print "

" .$args{'function'}." - ".$args{'purpose'}."

\n"; - print "".$args{'functiontype'}."\n"; - print "".$args{'function'}."\n"; + print "

" . $args{'function'} . " - " . $args{'purpose'} . "

\n"; + print "" . $args{'functiontype'} . "\n"; + print "" . $args{'function'} . "\n"; print "("; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { @@ -587,7 +587,7 @@ sub output_function_html(%) { # pointer-to-function print "$1$parameter) ($2)"; } else { - print "".$type." ".$parameter.""; + print "" . $type . " " . $parameter . ""; } if ($count != $#{$args{'parameterlist'}}) { $count++; @@ -603,7 +603,7 @@ sub output_function_html(%) { $parameter_name =~ s/\[.*//; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; - print "
".$parameter."\n"; + print "
" . $parameter . "\n"; print "
"; output_highlight($args{'parameterdescs'}{$parameter_name}); } @@ -657,7 +657,7 @@ sub output_function_xml(%) { my $count; my $id; - $id = "API-".$args{'function'}; + $id = "API-" . $args{'function'}; $id =~ s/[^A-Za-z0-9]/-/g; print "\n"; @@ -667,12 +667,12 @@ sub output_function_xml(%) { print " $man_date\n"; print "\n"; print "\n"; - print " ".$args{'function'}."\n"; + print " " . $args{'function'} . "\n"; print " 9\n"; print " " . $kernelversion . "\n"; print "\n"; print "\n"; - print " ".$args{'function'}."\n"; + print " " . $args{'function'} . "\n"; print " \n"; print " "; output_highlight ($args{'purpose'}); @@ -682,8 +682,8 @@ sub output_function_xml(%) { print "\n"; print " Synopsis\n"; print " \n"; - print " ".$args{'functiontype'}." "; - print "".$args{'function'}." \n"; + print " " . $args{'functiontype'} . " "; + print "" . $args{'function'} . " \n"; $count = 0; if ($#{$args{'parameterlist'}} >= 0) { @@ -694,7 +694,7 @@ sub output_function_xml(%) { print " $1$parameter)\n"; print " $2\n"; } else { - print " ".$type; + print " " . $type; print " $parameter\n"; } } @@ -734,7 +734,7 @@ sub output_struct_xml(%) { my ($parameter, $section); my $id; - $id = "API-struct-".$args{'struct'}; + $id = "API-struct-" . $args{'struct'}; $id =~ s/[^A-Za-z0-9]/-/g; print "\n"; @@ -744,12 +744,12 @@ sub output_struct_xml(%) { print " $man_date\n"; print "\n"; print "\n"; - print " ".$args{'type'}." ".$args{'struct'}."\n"; + print " " . $args{'type'} . " " . $args{'struct'} . "\n"; print " 9\n"; print " " . $kernelversion . "\n"; print "\n"; print "\n"; - print " ".$args{'type'}." ".$args{'struct'}."\n"; + print " " . $args{'type'} . " " . $args{'struct'} . "\n"; print " \n"; print " "; output_highlight ($args{'purpose'}); @@ -759,7 +759,7 @@ sub output_struct_xml(%) { print "\n"; print " Synopsis\n"; print " \n"; - print $args{'type'}." ".$args{'struct'}." {\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n"; foreach $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { print "$parameter\n"; @@ -779,7 +779,7 @@ sub output_struct_xml(%) { # bitfield print " $1 $parameter$2;\n"; } else { - print " ".$type." ".$parameter.";\n"; + print " " . $type . " " . $parameter . ";\n"; } } print "};"; @@ -824,7 +824,7 @@ sub output_enum_xml(%) { my $count; my $id; - $id = "API-enum-".$args{'enum'}; + $id = "API-enum-" . $args{'enum'}; $id =~ s/[^A-Za-z0-9]/-/g; print "\n"; @@ -834,12 +834,12 @@ sub output_enum_xml(%) { print " $man_date\n"; print "\n"; print "\n"; - print " enum ".$args{'enum'}."\n"; + print " enum " . $args{'enum'} . "\n"; print " 9\n"; print " " . $kernelversion . "\n"; print "\n"; print "\n"; - print " enum ".$args{'enum'}."\n"; + print " enum " . $args{'enum'} . "\n"; print " \n"; print " "; output_highlight ($args{'purpose'}); @@ -849,7 +849,7 @@ sub output_enum_xml(%) { print "\n"; print " Synopsis\n"; print " \n"; - print "enum ".$args{'enum'}." {\n"; + print "enum " . $args{'enum'} . " {\n"; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { print " $parameter"; @@ -891,7 +891,7 @@ sub output_typedef_xml(%) { my ($parameter, $section); my $id; - $id = "API-typedef-".$args{'typedef'}; + $id = "API-typedef-" . $args{'typedef'}; $id =~ s/[^A-Za-z0-9]/-/g; print "\n"; @@ -901,11 +901,11 @@ sub output_typedef_xml(%) { print " $man_date\n"; print "\n"; print "\n"; - print " typedef ".$args{'typedef'}."\n"; + print " typedef " . $args{'typedef'} . "\n"; print " 9\n"; print "\n"; print "\n"; - print " typedef ".$args{'typedef'}."\n"; + print " typedef " . $args{'typedef'} . "\n"; print " \n"; print " "; output_highlight ($args{'purpose'}); @@ -914,7 +914,7 @@ sub output_typedef_xml(%) { print "\n"; print " Synopsis\n"; - print " typedef ".$args{'typedef'}.";\n"; + print " typedef " . $args{'typedef'} . ";\n"; print "\n"; output_section_xml(@_); @@ -963,15 +963,15 @@ sub output_function_gnome { my $count; my $id; - $id = $args{'module'}."-".$args{'function'}; + $id = $args{'module'} . "-" . $args{'function'}; $id =~ s/[^A-Za-z0-9]/-/g; print "\n"; - print " ".$args{'function'}."\n"; + print " " . $args{'function'} . "\n"; print " \n"; - print " ".$args{'functiontype'}." "; - print "".$args{'function'}." "; + print " " . $args{'functiontype'} . " "; + print "" . $args{'function'} . " "; print "\n"; $count = 0; @@ -983,7 +983,7 @@ sub output_function_gnome { print " $1 $parameter)\n"; print " $2\n"; } else { - print " ".$type; + print " " . $type; print " $parameter\n"; } } @@ -1043,13 +1043,13 @@ sub output_function_man(%) { print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n"; print ".SH NAME\n"; - print $args{'function'}." \\- ".$args{'purpose'}."\n"; + print $args{'function'} . " \\- " . $args{'purpose'} . "\n"; print ".SH SYNOPSIS\n"; if ($args{'functiontype'} ne "") { - print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; + print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n"; } else { - print ".B \"".$args{'function'}."\n"; + print ".B \"" . $args{'function'} . "\n"; } $count = 0; my $parenth = "("; @@ -1061,10 +1061,10 @@ sub output_function_man(%) { $type = $args{'parametertypes'}{$parameter}; if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function - print ".BI \"".$parenth.$1."\" ".$parameter." \") (".$2.")".$post."\"\n"; + print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n"; } else { $type =~ s/([^\*])$/$1 /; - print ".BI \"".$parenth.$type."\" ".$parameter." \"".$post."\"\n"; + print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n"; } $count++; $parenth = ""; @@ -1075,7 +1075,7 @@ sub output_function_man(%) { my $parameter_name = $parameter; $parameter_name =~ s/\[.*//; - print ".IP \"".$parameter."\" 12\n"; + print ".IP \"" . $parameter . "\" 12\n"; output_highlight($args{'parameterdescs'}{$parameter_name}); } foreach $section (@{$args{'sectionlist'}}) { @@ -1094,10 +1094,10 @@ sub output_enum_man(%) { print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n"; print ".SH NAME\n"; - print "enum ".$args{'enum'}." \\- ".$args{'purpose'}."\n"; + print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n"; print ".SH SYNOPSIS\n"; - print "enum ".$args{'enum'}." {\n"; + print "enum " . $args{'enum'} . " {\n"; $count = 0; foreach my $parameter (@{$args{'parameterlist'}}) { print ".br\n.BI \" $parameter\"\n"; @@ -1116,7 +1116,7 @@ sub output_enum_man(%) { my $parameter_name = $parameter; $parameter_name =~ s/\[.*//; - print ".IP \"".$parameter."\" 12\n"; + print ".IP \"" . $parameter . "\" 12\n"; output_highlight($args{'parameterdescs'}{$parameter_name}); } foreach $section (@{$args{'sectionlist'}}) { @@ -1131,13 +1131,13 @@ sub output_struct_man(%) { my %args = %{$_[0]}; my ($parameter, $section); - print ".TH \"$args{'module'}\" 9 \"".$args{'type'}." ".$args{'struct'}."\" \"$man_date\" \"API Manual\" LINUX\n"; + print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n"; print ".SH NAME\n"; - print $args{'type'}." ".$args{'struct'}." \\- ".$args{'purpose'}."\n"; + print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n"; print ".SH SYNOPSIS\n"; - print $args{'type'}." ".$args{'struct'}." {\n.br\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n.br\n"; foreach my $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { @@ -1151,13 +1151,13 @@ sub output_struct_man(%) { $type = $args{'parametertypes'}{$parameter}; if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function - print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n"; + print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n"; } elsif ($type =~ m/^(.*?)\s*(:.*)/) { # bitfield - print ".BI \" ".$1."\ \" ".$parameter.$2." \""."\"\n;\n"; + print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n"; } else { $type =~ s/([^\*])$/$1 /; - print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n"; + print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n"; } print "\n.br\n"; } @@ -1171,7 +1171,7 @@ sub output_struct_man(%) { $parameter_name =~ s/\[.*//; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; - print ".IP \"".$parameter."\" 12\n"; + print ".IP \"" . $parameter . "\" 12\n"; output_highlight($args{'parameterdescs'}{$parameter_name}); } foreach $section (@{$args{'sectionlist'}}) { @@ -1189,7 +1189,7 @@ sub output_typedef_man(%) { print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n"; print ".SH NAME\n"; - print "typedef ".$args{'typedef'}." \\- ".$args{'purpose'}."\n"; + print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n"; foreach $section (@{$args{'sectionlist'}}) { print ".SH \"$section\"\n"; @@ -1218,13 +1218,13 @@ sub output_function_text(%) { my $start; print "Name:\n\n"; - print $args{'function'}." - ".$args{'purpose'}."\n"; + print $args{'function'} . " - " . $args{'purpose'} . "\n"; print "\nSynopsis:\n\n"; if ($args{'functiontype'} ne "") { - $start = $args{'functiontype'}." ".$args{'function'}." ("; + $start = $args{'functiontype'} . " " . $args{'function'} . " ("; } else { - $start = $args{'function'}." ("; + $start = $args{'function'} . " ("; } print $start; @@ -1233,9 +1233,9 @@ sub output_function_text(%) { $type = $args{'parametertypes'}{$parameter}; if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function - print $1.$parameter.") (".$2; + print $1 . $parameter . ") (" . $2; } else { - print $type." ".$parameter; + print $type . " " . $parameter; } if ($count != $#{$args{'parameterlist'}}) { $count++; @@ -1251,7 +1251,7 @@ sub output_function_text(%) { my $parameter_name = $parameter; $parameter_name =~ s/\[.*//; - print $parameter."\n\t".$args{'parameterdescs'}{$parameter_name}."\n"; + print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n"; } output_section_text(@_); } @@ -1276,8 +1276,8 @@ sub output_enum_text(%) { my $count; print "Enum:\n\n"; - print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n"; - print "enum ".$args{'enum'}." {\n"; + print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n"; + print "enum " . $args{'enum'} . " {\n"; $count = 0; foreach $parameter (@{$args{'parameterlist'}}) { print "\t$parameter"; @@ -1292,7 +1292,7 @@ sub output_enum_text(%) { print "Constants:\n\n"; foreach $parameter (@{$args{'parameterlist'}}) { print "$parameter\n\t"; - print $args{'parameterdescs'}{$parameter}."\n"; + print $args{'parameterdescs'}{$parameter} . "\n"; } output_section_text(@_); @@ -1305,7 +1305,7 @@ sub output_typedef_text(%) { my $count; print "Typedef:\n\n"; - print "typedef ".$args{'typedef'}." - ".$args{'purpose'}."\n"; + print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n"; output_section_text(@_); } @@ -1314,8 +1314,8 @@ sub output_struct_text(%) { my %args = %{$_[0]}; my ($parameter); - print $args{'type'}." ".$args{'struct'}." - ".$args{'purpose'}."\n\n"; - print $args{'type'}." ".$args{'struct'}." {\n"; + print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n"; foreach $parameter (@{$args{'parameterlist'}}) { if ($parameter =~ /^#/) { print "$parameter\n"; @@ -1334,7 +1334,7 @@ sub output_struct_text(%) { # bitfield print "\t$1 $parameter$2;\n"; } else { - print "\t".$type." ".$parameter.";\n"; + print "\t" . $type . " " . $parameter . ";\n"; } } print "};\n\n"; @@ -1348,7 +1348,7 @@ sub output_struct_text(%) { ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; print "$parameter\n\t"; - print $args{'parameterdescs'}{$parameter_name}."\n"; + print $args{'parameterdescs'}{$parameter_name} . "\n"; } print "\n"; output_section_text(@_); @@ -1387,7 +1387,7 @@ sub output_declaration { # generic output function - calls the right one based on current output mode. sub output_blockhead { no strict 'refs'; - my $func = "output_blockhead_".$output_mode; + my $func = "output_blockhead_" . $output_mode; &$func(@_); $section_counter++; } @@ -1398,7 +1398,7 @@ sub output_blockhead { sub dump_declaration($$) { no strict 'refs'; my ($prototype, $file) = @_; - my $func = "dump_".$decl_type; + my $func = "dump_" . $decl_type; &$func(@_); } @@ -1645,7 +1645,7 @@ sub push_parameter($$$) { "or member '$param' not " . "described in '$declaration_name'\n"; } - print STDERR "Warning(${file}:$.):". + print STDERR "Warning(${file}:$.):" . " No description found for parameter '$param'\n"; ++$warnings; } @@ -1907,7 +1907,7 @@ sub process_state3_type($$) { ($2 eq '{') && $brcount++; ($2 eq '}') && $brcount--; if (($2 eq ';') && ($brcount == 0)) { - dump_declaration($prototype,$file); + dump_declaration($prototype, $file); reset_state(); last; } @@ -2084,7 +2084,7 @@ sub process_file($) { $section = $section_default; $contents = ""; } else { - $contents .= $1."\n"; + $contents .= $1 . "\n"; } } else { # i dont know - bad line? ignore. From 7923f90fffa8746f6457d4eea2109fd3d6414189 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 14 Jun 2009 22:10:41 +0200 Subject: [PATCH 42/53] vmlinux.lds.h update Updated after review by Tim Abbott. - Use HEAD_TEXT_SECTION - Drop use of section-names.h and delete file - Introduce EXIT_CALL Deleting section-names.h required a few simple updates of init.h Signed-off-by: Sam Ravnborg Cc: Tim Abbott --- include/asm-generic/vmlinux.lds.h | 17 ++++++++++------- include/linux/init.h | 4 +--- include/linux/section-names.h | 6 ------ 3 files changed, 11 insertions(+), 16 deletions(-) delete mode 100644 include/linux/section-names.h diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index fba42236e942..7381f701f3f3 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -12,7 +12,7 @@ * { * . = START; * __init_begin = .; - * HEAD_SECTION + * HEAD_TEXT_SECTION * INIT_TEXT_SECTION(PAGE_SIZE) * INIT_DATA_SECTION(...) * PERCPU(PAGE_SIZE) @@ -38,7 +38,7 @@ * /DISCARD/ : { * EXIT_TEXT * EXIT_DATA - * *(.exitcall.exit) + * EXIT_CALL * } * STABS_DEBUG * DWARF_DEBUG @@ -52,7 +52,6 @@ * Examples are: [__initramfs_start, __initramfs_end] for initramfs and * [__nosave_begin, __nosave_end] for the nosave data */ - #include #ifndef LOAD_OFFSET #define LOAD_OFFSET 0 @@ -414,9 +413,9 @@ #endif /* Section used for early init (in .S files) */ -#define HEAD_TEXT *(HEAD_TEXT_SECTION) +#define HEAD_TEXT *(.head.text) -#define HEAD_SECTION \ +#define HEAD_TEXT_SECTION \ .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ HEAD_TEXT \ } @@ -473,6 +472,9 @@ CPU_DISCARD(exit.text) \ MEM_DISCARD(exit.text) +#define EXIT_CALL \ + *(.exitcall.exit) + /* * bss (Block Started by Symbol) - uninitialized data * zeroed during startup @@ -692,7 +694,7 @@ * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which * matches the requirment of PAGE_ALIGNED_DATA. * -/* use 0 as page_align if page_aligned data is not used */ + * use 0 as page_align if page_aligned data is not used */ #define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \ . = ALIGN(PAGE_SIZE); \ .data : AT(ADDR(.data) - LOAD_OFFSET) { \ @@ -726,4 +728,5 @@ #define BSS_SECTION(sbss_align, bss_align) \ SBSS \ BSS(bss_align) \ - . = ALIGN(4); \ + . = ALIGN(4); + diff --git a/include/linux/init.h b/include/linux/init.h index 9f70c9f25d4b..b2189803f19a 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -2,8 +2,6 @@ #define _LINUX_INIT_H #include -#include -#include /* These macros are used to mark some functions or * initialized data (doesn't apply to uninitialized data) @@ -101,7 +99,7 @@ #define __memexitconst __section(.memexit.rodata) /* For assembly routines */ -#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax" +#define __HEAD .section ".head.text","ax" #define __INIT .section ".init.text","ax" #define __FINIT .previous diff --git a/include/linux/section-names.h b/include/linux/section-names.h deleted file mode 100644 index c956f4eb2adf..000000000000 --- a/include/linux/section-names.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __LINUX_SECTION_NAMES_H -#define __LINUX_SECTION_NAMES_H - -#define HEAD_TEXT_SECTION .head.text - -#endif /* !__LINUX_SECTION_NAMES_H */ From b2d8993026a26f4ece8c8b3f2e138d2ba8f18eaa Mon Sep 17 00:00:00 2001 From: Patrick Ringl Date: Fri, 12 Jun 2009 13:58:36 +0200 Subject: [PATCH 43/53] README: fix misleading pointer to the defconf directory Signed-off-by: Patrick Ringl Cc: Arnd Bergmann --- README | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README b/README index 7a078ff0ee06..737838fe73cc 100644 --- a/README +++ b/README @@ -176,7 +176,15 @@ CONFIGURING the kernel: with questions already answered. Additionally updates the dependencies. "make defconfig" Create a ./.config file by using the default - symbol values from arch/$ARCH/defconfig. + symbol values from either arch/$ARCH/defconfig + or arch/$ARCH/configs/${PLATFORM}_defconfig, + depending on the architecture. + "make ${PLATFORM}_defconfig" + Create a ./.config file by using the default + symbol values from + arch/$ARCH/configs/${PLATFORM}_defconfig. + Use "make help" to get a list of all available + platforms of your architecture. "make allyesconfig" Create a ./.config file by setting symbol values to 'y' as much as possible. From a2bb90a08cb3b64dd815d762ffde2312582a6ec9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 12 Jun 2009 09:59:52 +0200 Subject: [PATCH 44/53] kbuild: fix delay in setlocalversion on readonly source Do not update index on read only media. Idea published by Christian Kujau . Cc: Nico Schottelius Cc: Christian Kujau --- scripts/setlocalversion | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 00790472f641..46989b88d734 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then printf -- '-svn%s' "`git svn find-rev $head`" fi - # Are there uncommitted changes? - git update-index --refresh --unmerged > /dev/null + # Update index only on r/w media + [ -w . ] && git update-index --refresh --unmerged > /dev/null + + # Check for uncommitted changes if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | read dummy; then printf '%s' -dirty From f2ac5e78928bf94118b4d4911166a02e8a87d3ea Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Thu, 11 Jun 2009 12:21:47 +0300 Subject: [PATCH 45/53] gitignore: Add GNU GLOBAL files to top .gitignore Ignore GPATH, GRTAGS, GSYMS, and GTAGS generated by GNU GLOBAL. Signed-off-by: Jani Nikula Signed-off-by: Sam Ravnborg --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 3433d7c0d36d..f3b09fe989ef 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,12 @@ series cscope.* ncscope.* +# gnu global files +GPATH +GRTAGS +GSYMS +GTAGS + *.orig *~ \#*# From d067aa741589a9783cc43315119e0f431b4e382c Mon Sep 17 00:00:00 2001 From: Amerigo Wang Date: Wed, 10 Jun 2009 12:48:23 -0700 Subject: [PATCH 46/53] kbuild: fix a compile warning gcc-4.4.1: HOSTCC scripts/basic/fixdep scripts/basic/fixdep.c: In function 'traps': scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rules scripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules (Apparently -fno-strict-aliasing will fix this too) Signed-off-by: WANG Cong Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/basic/fixdep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 8912c0f5460b..72c15205bb2b 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -373,10 +373,11 @@ void print_deps(void) void traps(void) { static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; + int *p = (int *)test; - if (*(int *)test != INT_CONF) { + if (*p != INT_CONF) { fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", - *(int *)test); + *p); exit(2); } } From 2185a5ecd98d2cebc6a29b07b1ea4f7334c2ccc3 Mon Sep 17 00:00:00 2001 From: Adam Lackorzynski Date: Sun, 14 Jun 2009 22:38:59 +0200 Subject: [PATCH 47/53] documentation: make version fix The Makefiles in the build directories use the internal make variable MAKEFILE_LIST which is available from make 3.80 only. (The patch would be valid back to 2.6.25) Signed-off-by: Adam Lackorzynski Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Documentation/Changes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Changes b/Documentation/Changes index b95082be4d5e..112e7657943e 100644 --- a/Documentation/Changes +++ b/Documentation/Changes @@ -29,7 +29,7 @@ hardware, for example, you probably needn't concern yourself with isdn4k-utils. o Gnu C 3.2 # gcc --version -o Gnu make 3.79.1 # make --version +o Gnu make 3.80 # make --version o binutils 2.12 # ld -v o util-linux 2.10o # fdformat --version o module-init-tools 0.9.10 # depmod -V @@ -61,7 +61,7 @@ computer. Make ---- -You will need Gnu make 3.79.1 or later to build the kernel. +You will need Gnu make 3.80 or later to build the kernel. Binutils -------- From 028f042613c3c99db20dd7f4e4069fbbcea92dd7 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 10 Jul 2006 06:25:40 +0000 Subject: [PATCH 48/53] kallsyms: support kernel symbols in Blackfin on-chip memory The Blackfin arch has a discontiguous .text layout due to having on-chip instruction memory and no virtual memory support. As such, we need to add explicit checks for these additional .text regions. Signed-off-by: Robin Getz Signed-off-by: Bryan Wu Signed-off-by: Mike Frysinger Signed-off-by: Sam Ravnborg --- scripts/kallsyms.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 6654cbed965b..fb82a5b49809 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -35,6 +35,7 @@ struct sym_entry { static struct sym_entry *table; static unsigned int table_size, table_cnt; static unsigned long long _text, _stext, _etext, _sinittext, _einittext; +static unsigned long long _stext_l1, _etext_l1, _stext_l2, _etext_l2; static int all_symbols = 0; static char symbol_prefix_char = '\0'; @@ -92,6 +93,14 @@ static int read_symbol(FILE *in, struct sym_entry *s) _sinittext = s->addr; else if (strcmp(sym, "_einittext") == 0) _einittext = s->addr; + else if (strcmp(sym, "_stext_l1") == 0) + _stext_l1 = s->addr; + else if (strcmp(sym, "_etext_l1") == 0) + _etext_l1 = s->addr; + else if (strcmp(sym, "_stext_l2") == 0) + _stext_l2 = s->addr; + else if (strcmp(sym, "_etext_l2") == 0) + _etext_l2 = s->addr; else if (toupper(stype) == 'A') { /* Keep these useful absolute symbols */ @@ -157,7 +166,9 @@ static int symbol_valid(struct sym_entry *s) * and inittext sections are discarded */ if (!all_symbols) { if ((s->addr < _stext || s->addr > _etext) - && (s->addr < _sinittext || s->addr > _einittext)) + && (s->addr < _sinittext || s->addr > _einittext) + && (s->addr < _stext_l1 || s->addr > _etext_l1) + && (s->addr < _stext_l2 || s->addr > _etext_l2)) return 0; /* Corner case. Discard any symbols with the same value as * _etext _einittext; they can move between pass 1 and 2 when From 17b1f0de79dbdf5cfb2686b63a7fb9ecc440da7c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 8 Jun 2009 19:12:13 -0400 Subject: [PATCH 49/53] kallsyms: generalize text region handling Signed-off-by: Mike Frysinger Signed-off-by: Sam Ravnborg --- scripts/kallsyms.c | 87 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 26 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index fb82a5b49809..3cb57895c9ea 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -23,6 +23,10 @@ #include #include +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) +#endif + #define KSYM_NAME_LEN 128 struct sym_entry { @@ -32,10 +36,23 @@ struct sym_entry { unsigned char *sym; }; +struct text_range { + const char *stext, *etext; + unsigned long long start, end; +}; + +static unsigned long long _text; +static struct text_range text_ranges[] = { + { "_stext", "_etext" }, + { "_sinittext", "_einittext" }, + { "_stext_l1", "_etext_l1" }, /* Blackfin on-chip L1 inst SRAM */ + { "_stext_l2", "_etext_l2" }, /* Blackfin on-chip L2 SRAM */ +}; +#define text_range_text (&text_ranges[0]) +#define text_range_inittext (&text_ranges[1]) + static struct sym_entry *table; static unsigned int table_size, table_cnt; -static unsigned long long _text, _stext, _etext, _sinittext, _einittext; -static unsigned long long _stext_l1, _etext_l1, _stext_l2, _etext_l2; static int all_symbols = 0; static char symbol_prefix_char = '\0'; @@ -62,6 +79,26 @@ static inline int is_arm_mapping_symbol(const char *str) && (str[2] == '\0' || str[2] == '.'); } +static int read_symbol_tr(const char *sym, unsigned long long addr) +{ + size_t i; + struct text_range *tr; + + for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) { + tr = &text_ranges[i]; + + if (strcmp(sym, tr->stext) == 0) { + tr->start = addr; + return 0; + } else if (strcmp(sym, tr->etext) == 0) { + tr->end = addr; + return 0; + } + } + + return 1; +} + static int read_symbol(FILE *in, struct sym_entry *s) { char str[500]; @@ -85,22 +122,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) /* Ignore most absolute/undefined (?) symbols. */ if (strcmp(sym, "_text") == 0) _text = s->addr; - else if (strcmp(sym, "_stext") == 0) - _stext = s->addr; - else if (strcmp(sym, "_etext") == 0) - _etext = s->addr; - else if (strcmp(sym, "_sinittext") == 0) - _sinittext = s->addr; - else if (strcmp(sym, "_einittext") == 0) - _einittext = s->addr; - else if (strcmp(sym, "_stext_l1") == 0) - _stext_l1 = s->addr; - else if (strcmp(sym, "_etext_l1") == 0) - _etext_l1 = s->addr; - else if (strcmp(sym, "_stext_l2") == 0) - _stext_l2 = s->addr; - else if (strcmp(sym, "_etext_l2") == 0) - _etext_l2 = s->addr; + else if (read_symbol_tr(sym, s->addr) == 0) + /* nothing to do */; else if (toupper(stype) == 'A') { /* Keep these useful absolute symbols */ @@ -136,6 +159,21 @@ static int read_symbol(FILE *in, struct sym_entry *s) return 0; } +static int symbol_valid_tr(struct sym_entry *s) +{ + size_t i; + struct text_range *tr; + + for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) { + tr = &text_ranges[i]; + + if (s->addr >= tr->start && s->addr < tr->end) + return 0; + } + + return 1; +} + static int symbol_valid(struct sym_entry *s) { /* Symbols which vary between passes. Passes 1 and 2 must have @@ -165,10 +203,7 @@ static int symbol_valid(struct sym_entry *s) /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ if (!all_symbols) { - if ((s->addr < _stext || s->addr > _etext) - && (s->addr < _sinittext || s->addr > _einittext) - && (s->addr < _stext_l1 || s->addr > _etext_l1) - && (s->addr < _stext_l2 || s->addr > _etext_l2)) + if (symbol_valid_tr(s) == 0) return 0; /* Corner case. Discard any symbols with the same value as * _etext _einittext; they can move between pass 1 and 2 when @@ -176,10 +211,10 @@ static int symbol_valid(struct sym_entry *s) * they may get dropped in pass 2, which breaks the kallsyms * rules. */ - if ((s->addr == _etext && - strcmp((char *)s->sym + offset, "_etext")) || - (s->addr == _einittext && - strcmp((char *)s->sym + offset, "_einittext"))) + if ((s->addr == text_range_text->end && + strcmp((char *)s->sym + offset, text_range_text->etext)) || + (s->addr == text_range_inittext->end && + strcmp((char *)s->sym + offset, text_range_inittext->etext))) return 0; } From 566432224731c3d8fa7925ce07953701f536a666 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Sun, 14 Jun 2009 22:48:07 +0200 Subject: [PATCH 50/53] kbuild: handle non-existing options in scripts/config If an option does not exist in .config, set it at the end of the file. Signed-off-by: Michal Marek Signed-off-by: Sam Ravnborg --- scripts/config | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/config b/scripts/config index db6084b78a10..30825a5677f6 100755 --- a/scripts/config +++ b/scripts/config @@ -26,8 +26,6 @@ options: config doesn't check the validity of the .config file. This is done at next make time. -The options need to be already in the file before they can be changed, -but sometimes you can cheat with the --*-after options. EOL exit 1 } @@ -45,8 +43,18 @@ checkarg() { ARG="`echo $ARG | tr a-z A-Z`" } -replace() { - sed -i -e "$@" $FN +set_var() { + local name=$1 new=$2 before=$3 + + name_re="^($name=|# $name is not set)" + before_re="^($before=|# $before is not set)" + if test -n "$before" && grep -Eq "$before_re" "$FN"; then + sed -ri "/$before_re/a $new" "$FN" + elif grep -Eq "$name_re" "$FN"; then + sed -ri "s:$name_re.*:$new:" "$FN" + else + echo "$new" >>"$FN" + fi } if [ "$1" = "--file" ]; then @@ -70,20 +78,19 @@ while [ "$1" != "" ] ; do case "$CMD" in --enable|-e) checkarg "$1" - replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/" + set_var "CONFIG_$ARG" "CONFIG_$ARG=y" shift ;; --disable|-d) checkarg "$1" - replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/" + set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" shift ;; --module|-m) checkarg "$1" - replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" + set_var "CONFIG_$ARG" "CONFIG_$ARG=m" shift ;; @@ -109,9 +116,7 @@ while [ "$1" != "" ] ; do A=$ARG checkarg "$2" B=$ARG - replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \ - -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/" + set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" shift shift ;; @@ -121,9 +126,7 @@ while [ "$1" != "" ] ; do A=$ARG checkarg "$2" B=$ARG - replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \ - -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \ - -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/" + set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" shift shift ;; @@ -133,10 +136,7 @@ while [ "$1" != "" ] ; do A=$ARG checkarg "$2" B=$ARG - replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \ - -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \ - -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ - -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" + set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" shift shift ;; From 47312d2cfd9b769c1739738602c163c4c9814c7b Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 25 May 2009 16:43:25 +0200 Subject: [PATCH 51/53] kbuild: simplify argument loop in scripts/config Signed-off-by: Michal Marek Signed-off-by: Sam Ravnborg --- scripts/config | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/scripts/config b/scripts/config index 30825a5677f6..640c6fe4d644 100755 --- a/scripts/config +++ b/scripts/config @@ -62,8 +62,7 @@ if [ "$1" = "--file" ]; then if [ "$FN" = "" ] ; then usage fi - shift - shift + shift 2 else FN=.config fi @@ -76,26 +75,34 @@ while [ "$1" != "" ] ; do CMD="$1" shift case "$CMD" in - --enable|-e) + --refresh) + ;; + --*-after) + checkarg "$1" + A=$ARG + checkarg "$2" + B=$ARG + shift 2 + ;; + --*) checkarg "$1" - set_var "CONFIG_$ARG" "CONFIG_$ARG=y" shift ;; + esac + case "$CMD" in + --enable|-e) + set_var "CONFIG_$ARG" "CONFIG_$ARG=y" + ;; --disable|-d) - checkarg "$1" set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" - shift ;; --module|-m) - checkarg "$1" set_var "CONFIG_$ARG" "CONFIG_$ARG=m" - shift ;; --state|-s) - checkarg "$1" if grep -q "# CONFIG_$ARG is not set" $FN ; then echo n else @@ -108,37 +115,18 @@ while [ "$1" != "" ] ; do echo "$V" fi fi - shift ;; --enable-after|-E) - checkarg "$1" - A=$ARG - checkarg "$2" - B=$ARG set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" - shift - shift ;; --disable-after|-D) - checkarg "$1" - A=$ARG - checkarg "$2" - B=$ARG set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" - shift - shift ;; --module-after|-M) - checkarg "$1" - A=$ARG - checkarg "$2" - B=$ARG set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" - shift - shift ;; # undocumented because it ignores --file (fixme) From 1f990cf94559e0a7363d56aade1d5dc6c515b60b Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 25 May 2009 16:43:27 +0200 Subject: [PATCH 52/53] kbuild: add generic --set-str option to scripts/config Signed-off-by: Michal Marek Signed-off-by: Sam Ravnborg --- scripts/config | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/config b/scripts/config index 640c6fe4d644..608d7fdb13e8 100755 --- a/scripts/config +++ b/scripts/config @@ -9,8 +9,10 @@ config options command ... commands: --enable|-e option Enable option --disable|-d option Disable option - --module|-m option Turn option into a module - --state|-s option Print state of option (n,y,m,undef) + --module|-m option Turn option into a module + --set-str option value + Set option to "value" + --state|-s option Print state of option (n,y,m,undef) --enable-after|-E beforeopt option Enable option directly after other option @@ -102,6 +104,11 @@ while [ "$1" != "" ] ; do set_var "CONFIG_$ARG" "CONFIG_$ARG=m" ;; + --set-str) + set_var "CONFIG_$ARG" "CONFIG_$ARG=\"$1\"" + shift + ;; + --state|-s) if grep -q "# CONFIG_$ARG is not set" $FN ; then echo n From 3f8d9ced7746f3f329ccca0bb3f3c7a2c15c47bb Mon Sep 17 00:00:00 2001 From: Arne Janbu Date: Wed, 10 Jun 2009 18:25:10 +0200 Subject: [PATCH 53/53] .gitignore: ignore *.lzma files Signed-off-by: Sam Ravnborg --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f3b09fe989ef..e9950be749f4 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ *.elf *.bin *.gz +*.lzma *.patch #