Following is stuff pending in kbuild-next.git for upcoming
merge window.
Headlines:
- make *config targets are less chatty (and thus faster too)
- support for arch/$ARCH/include
- 3x faster headers_check and much less verbose
- added a diffconfig utility that shows difference between two configs
Most of the kconfig stuff is fresh patches - the rest has been in kbuild-next.git
for a while and thus in -next (which has caught a lot of issues - thanks Stephen!).
Other news
We are moving soon and this will impact both my connectivity and
the time I can use on kbuild stuff.
So if I fail to act on your mails then I am most likely busy
moving, painting, gardening or other practical stuff.
If you really need help then drop by and help me - then
we can always fix the kbuild stuff over a beer.
Sam
Shortlog (patches follows).
Alexey Dobriyan (2):
kbuild: make clean removes *.o.* as well
kbuild: remove Module.markers during mrproper
Geert Uytterhoeven (1):
kbuild: sparse needs CF not CHECKFLAGS
Jan Beulich (1):
vmlinux.lds: move __attribute__((__cold__)) functions back into final .text section
Randy Dunlap (1):
kernel-doc: handle/strip __init
Roman Zippel (1):
kconfig: set all new symbols automatically
S.Çağlar Onur (1):
init: fix URL of "The GNU Accounting Utilities"
Sam Ravnborg (16):
kbuild: refactor headers_* targets in Makefile
kbuild: always unifdef files in headers_install*
kbuild: drop support of ALTARCH for headers_*
kbuild: code refactoring in Makefile.headerinst
kbuild: error out early in make headers_install
kbuild: only one call for include/ in make headers_*
kbuild: optimize headers_* targets
kbuild: install all headers when arch is changed
kbuild: prepare headers_* for arch/$ARCH/include
kbuild: support arch/$ARCH/include for tags, cscope
kbuild: asm symlink support for arch/$ARCH/include
kbuild: add arch/$ARCH/include to search path
kconfig: prefix hex values with 0x in .config
kconfig: speed up all*config + randconfig
kconfig: make oldconfig is now less chatty
kconfig: make defconfig is no longer chatty
Tim Bird (1):
kconfig: add diffconfig utility
Documentation/sparse.txt | 8 +-
Kbuild | 3 +-
Makefile | 116 +++++++++------
arch/x86/boot/compressed/relocs.c | 2 +-
include/Kbuild | 4 +-
include/asm-generic/vmlinux.lds.h | 4 +-
init/Kconfig | 2 +-
scripts/Makefile.headersinst | 292 +++++++++++++------------------------
scripts/diffconfig | 129 ++++++++++++++++
scripts/hdrcheck.sh | 10 --
scripts/headers.sh | 41 +++++
scripts/headers_check.pl | 56 +++++++
scripts/headers_install.pl | 45 ++++++
scripts/kconfig/conf.c | 161 +++++++++------------
scripts/kconfig/confdata.c | 72 +++++++++-
scripts/kconfig/lkc.h | 9 +
scripts/kernel-doc | 1 +
17 files changed, 602 insertions(+), 353 deletions(-)
o Use lower case for local variables
o Add a helper target for common targets
o Use $(hdr-inst)= ... to make Make invocations simpler
o Add -rR to make invocations
In total this adds more lines than it removes but the
benefit is better readability
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: David Woodhouse <[email protected]>
---
Makefile | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index 6aff5f4..c65fe4f 100644
--- a/Makefile
+++ b/Makefile
@@ -996,36 +996,43 @@ depend dep:
# ---------------------------------------------------------------------------
# Kernel headers
-INSTALL_HDR_PATH=$(objtree)/usr
-export INSTALL_HDR_PATH
-HDRFILTER=generic i386 x86_64
-HDRARCHES=$(filter-out $(HDRFILTER),$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
+#Default location for installed headers
+export INSTALL_HDR_PATH = $(objtree)/usr
-PHONY += headers_install_all
-headers_install_all: include/linux/version.h scripts_basic FORCE
+hdr-filter := generic um ppc
+hdr-archs := $(filter-out $(hdr-filter), \
+ $(patsubst $(srctree)/include/asm-%/Kbuild,%, \
+ $(wildcard $(srctree)/include/asm-*/Kbuild)))
+hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+
+PHONY += __headers
+__headers: include/linux/version.h scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
- $(Q)for arch in $(HDRARCHES); do \
- $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
+
+PHONY += headers_install_all
+headers_install_all: __headers
+ $(Q)for arch in $(hdr-archs); do \
+ $(MAKE) ARCH=$$arch $(hdr-inst)=include BIASMDIR=-bi-$$arch ;\
done
PHONY += headers_install
-headers_install: include/linux/version.h scripts_basic FORCE
- @if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
+headers_install: __headers
+ $(Q)if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \
- exit 1 ; fi
- $(Q)$(MAKE) $(build)=scripts scripts/unifdef
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include
+ exit 1 ; \
+ fi
+ $(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH)
PHONY += headers_check_all
headers_check_all: headers_install_all
- $(Q)for arch in $(HDRARCHES); do \
- $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
+ $(Q)for arch in $(hdr-archs); do \
+ $(MAKE) ARCH=$$arch $(hdr-inst)=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
done
PHONY += headers_check
headers_check: headers_install
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH) HDRCHECK=1
# ---------------------------------------------------------------------------
# Modules
--
1.5.6.1.93.gef98
Fix the a.out.h case by setting SRCARCH and error
out early in case of an error.
The a.out.h case failed with the *_all targets.
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index c65fe4f..d676c39 100644
--- a/Makefile
+++ b/Makefile
@@ -1012,8 +1012,9 @@ __headers: include/linux/version.h scripts_basic FORCE
PHONY += headers_install_all
headers_install_all: __headers
- $(Q)for arch in $(hdr-archs); do \
- $(MAKE) ARCH=$$arch $(hdr-inst)=include BIASMDIR=-bi-$$arch ;\
+ $(Q)set -e; for arch in $(hdr-archs); do \
+ $(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
+ BIASMDIR=-bi-$$arch ;\
done
PHONY += headers_install
@@ -1026,8 +1027,9 @@ headers_install: __headers
PHONY += headers_check_all
headers_check_all: headers_install_all
- $(Q)for arch in $(hdr-archs); do \
- $(MAKE) ARCH=$$arch $(hdr-inst)=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
+ $(Q)set -e; for arch in $(hdr-archs); do \
+ $(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
+ BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
done
PHONY += headers_check
--
1.5.6.1.93.gef98
From: Alexey Dobriyan <[email protected]>
Those are left presumably from aborted ccache(1) compilations:
arch/x86/kernel/.tmp_io_apic_64.o.T5veul
arch/x86/kvm/.tmp_x86.o.SZWn69
arch/x86/mm/.tmp_pgtable.o.sL1LTf
drivers/ieee1394/.tmp_ieee1394_transactions.o.bUj6o1
drivers/infiniband/hw/mlx4/.tmp_main.o.vy0ep6
BTW, with git there is nice way to check for such nuisainces:
make mrproper
git-ls-files -o
should give empty output.
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 2f087df..572ecfb 100644
--- a/Makefile
+++ b/Makefile
@@ -1144,7 +1144,8 @@ clean: archclean $(clean-dirs)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
- -o -name '*.symtypes' -o -name 'modules.order' \) \
+ -o -name '*.symtypes' -o -name 'modules.order' \
+ -o -name '*.o.*' \) \
-type f -print | xargs rm -f
# mrproper - Delete all generated files, including .config
--
1.5.6.1.93.gef98
No functional changes just improved readability
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/Makefile.headersinst | 64 +++++++++++++++++++++++-------------------
1 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1fb8c00..599adc6 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -10,7 +10,7 @@
UNIFDEF := scripts/unifdef -U__KERNEL__
# Eliminate the contents of (and inclusions of) compiler.h
-HDRSED := sed -e "s/ inline / __inline__ /g" \
+HDRSED := sed -e "s/ inline / __inline__ /g" \
-e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \
-e "s/(__user[[:space:]]\{1,\}/ (/g" \
-e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
@@ -37,6 +37,8 @@ ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
_dst := include/asm
endif
+install := $(INSTALL_HDR_PATH)/$(_dst)
+
header-y := $(sort $(header-y) $(unifdef-y))
subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
header-y := $(filter-out %/, $(header-y))
@@ -45,34 +47,34 @@ header-y := $(filter-out %/, $(header-y))
check-y := $(patsubst %,.check.%,$(header-y) $(objhdr-y))
# Work out what needs to be removed
-oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h))
-unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
+oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h))
+unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
-oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h))
-unwanted += $(filter-out $(check-y),$(oldcheckstamps))
+oldcheckstamps := $(patsubst $(install)/%,%,$(wildcard $(install)/.check.*.h))
+unwanted += $(filter-out $(check-y),$(oldcheckstamps))
# Prefix them all with full paths to $(INSTALL_HDR_PATH)
-header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
-objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
-check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
+header-y := $(patsubst %,$(install)/%,$(header-y))
+objhdr-y := $(patsubst %,$(install)/%,$(objhdr-y))
+check-y := $(patsubst %,$(install)/%,$(check-y))
-quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
- $(INSTALL_HDR_PATH)/$(_dst)
+quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+ cmd_o_hdr_install = cp $(patsubst $(install)/%,$(objtree)/$(obj)/%,$@) \
+ $(install)
-quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
- | $(HDRSED) > $@ || :
+quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+ cmd_unifdef = $(UNIFDEF) $(patsubst $(install)/%,$(srctree)/$(obj)/%,$@)\
+ | $(HDRSED) > $@ || :
-quiet_cmd_check = CHECK $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/.check.%,$(_dst)/%,$@)
- cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \
- $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@
+quiet_cmd_check = CHECK $(patsubst $(install)/.check.%,$(_dst)/%,$@)
+ cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \
+ $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@
-quiet_cmd_remove = REMOVE $(_dst)/$@
- cmd_remove = rm -f $(INSTALL_HDR_PATH)/$(_dst)/$@
+quiet_cmd_remove = REMOVE $(_dst)/$@
+ cmd_remove = rm -f $(install)/$@
-quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_mkdir = mkdir -p $@
+quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+ cmd_mkdir = mkdir -p $@
.PHONY: __headersinst __headerscheck
@@ -80,13 +82,14 @@ ifdef HDRCHECK
__headerscheck: $(subdir-y) $(check-y)
@true
-$(check-y) : $(INSTALL_HDR_PATH)/$(_dst)/.check.%.h : $(INSTALL_HDR_PATH)/$(_dst)/%.h
+$(check-y) : $(install)/.check.%.h : $(install)/%.h
$(call cmd,check)
# Other dependencies for $(check-y)
include /dev/null $(wildcard $(check-y))
-# ... but leave $(check-y) as .PHONY for now until those deps are actually correct.
+# but leave $(check-y) as .PHONY for now until those
+# deps are actually correct.
.PHONY: $(check-y)
else
@@ -94,26 +97,29 @@ else
__headersinst: $(subdir-y) $(header-y) $(objhdr-y)
@true
-$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
+$(objhdr-y) $(subdir-y) $(header-y): | $(install) $(unwanted)
-$(INSTALL_HDR_PATH)/$(_dst):
+$(install):
$(call cmd,mkdir)
+# Rules for removing unwanted header files
.PHONY: $(unwanted)
$(unwanted):
$(call cmd,remove)
-$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
+# Install generated files
+$(objhdr-y): $(install)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
$(call cmd,o_hdr_install)
-$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
+# Unifdef header files and install them
+$(header-y): $(install)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
$(call cmd,unifdef)
endif
-hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
# Recursion
.PHONY: $(subdir-y)
$(subdir-y):
- $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel)
+ $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
--
1.5.6.1.93.gef98
We see some header files that are selected dependent on
the actual architecture so force a reinstallation
of all header files when the arch changes.
This slows down "make headers_check_all" but then
we better reflect reality.
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/Makefile.headersinst | 7 ++++---
scripts/headers_install.pl | 13 ++++++++-----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index be2b70c..612dc13 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -43,9 +43,10 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
file$(if $(word 2, $(all-files)),s))
- cmd_install = $(PERL) $< $(srctree)/$(obj) $(install) $(header-y); \
- $(PERL) $< $(objtree)/$(obj) $(install) $(objhdr-y); \
- touch $@
+ cmd_install = \
+ $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
+ $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
+ touch $@
quiet_cmd_remove = REMOVE $(unwanted)
cmd_remove = rm -f $(unwanted-file)
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index f0ff9a3..68591cd 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -3,10 +3,13 @@
# headers_install prepare the listed header files for use in
# user space and copy the files to their destination.
#
-# Usage: headers_install.pl odir installdir [files...]
-# odir: dir to open files
-# install: dir to install the files
-# files: list of files to check
+# Usage: headers_install.pl readdir installdir arch [files...]
+# readdir: dir to open files
+# installdir: dir to install the files
+# arch: current architecture
+# arch is used to force a reinstallation when the arch
+# changes because kbuild then detect a command line change.
+# files: list of files to check
#
# Step in preparation for users space:
# 1) Drop all use of compiler.h definitions
@@ -16,7 +19,7 @@
use strict;
use warnings;
-my ($readdir, $installdir, @files) = @ARGV;
+my ($readdir, $installdir, $arch, @files) = @ARGV;
my $unifdef = "scripts/unifdef -U__KERNEL__";
--
1.5.6.1.93.gef98
ALTARCH is no longer used by any arch(*) so drop
support for this from Makefile.headerinst
Dropping ALTARCH support simplifies Makefile.headerinst
(*) sparc64 uses it but work is ongoing to drop it
and no furter usage is planned.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: David Miller <[email protected]>
---
scripts/Makefile.headersinst | 84 ++++-------------------------------------
1 files changed, 9 insertions(+), 75 deletions(-)
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 22b17af..1fb8c00 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -23,30 +23,17 @@ HDRSED := sed -e "s/ inline / __inline__ /g" \
_dst := $(if $(dst),$(dst),$(obj))
-ifeq (,$(patsubst include/asm/%,,$(obj)/))
-# For producing the generated stuff in include/asm for biarch builds, include
-# both sets of Kbuild files; we'll generate anything which is mentioned in
-# _either_ arch, and recurse into subdirectories which are mentioned in either
-# arch. Since some directories may exist in one but not the other, we must
-# use $(wildcard...).
-GENASM := 1
-archasm := $(subst include/asm,asm-$(ARCH),$(obj))
-altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj))
-KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild)
-else
-KBUILDFILES := $(srctree)/$(obj)/Kbuild
-endif
+kbuild-file := $(srctree)/$(obj)/Kbuild
+include $(kbuild-file)
-include $(KBUILDFILES)
+include scripts/Kbuild.include
-include scripts/Kbuild.include
-
-# If this is include/asm-$(ARCH) and there's no $(ALTARCH), then
-# override $(_dst) so that we install to include/asm directly.
+# If this is include/asm-$(ARCH) then override $(_dst) so that
+# we install to include/asm directly.
# Unless $(BIASMDIR) is set, in which case we're probably doing
# a 'headers_install_all' build and we should keep the -$(ARCH)
# in the directory name.
-ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR))
+ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
_dst := include/asm
endif
@@ -69,18 +56,6 @@ header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
-
-ifdef ALTARCH
-ifeq ($(obj),include/asm-$(ARCH))
-altarch-y := altarch-dir
-endif
-endif
-
-# Make the definitions visible for recursive make invocations
-export ALTARCH
-export ARCHDEF
-export ALTARCHDEF
-
quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
$(INSTALL_HDR_PATH)/$(_dst)
@@ -99,34 +74,6 @@ quiet_cmd_remove = REMOVE $(_dst)/$@
quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_mkdir = mkdir -p $@
-quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_gen = \
-FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@); \
-STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \
-(echo "/* File autogenerated by 'make headers_install' */" ; \
-echo "\#ifndef $$STUBDEF" ; \
-echo "\#define $$STUBDEF" ; \
-echo "\# if $(ARCHDEF)" ; \
-if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \
- echo "\# include <$(archasm)/$$FNAME>" ; \
-else \
- echo "\# error $(archasm)/$$FNAME does not exist in" \
- "the $(ARCH) architecture" ; \
-fi ; \
-echo "\# elif $(ALTARCHDEF)" ; \
-if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \
- echo "\# include <$(altarchasm)/$$FNAME>" ; \
-else \
- echo "\# error $(altarchasm)/$$FNAME does not exist in" \
- "the $(ALTARCH) architecture" ; \
-fi ; \
-echo "\# else" ; \
-echo "\# warning This machine appears to be" \
- "neither $(ARCH) nor $(ALTARCH)." ; \
-echo "\# endif" ; \
-echo "\#endif /* $$STUBDEF */" ; \
-) > $@
-
.PHONY: __headersinst __headerscheck
ifdef HDRCHECK
@@ -144,7 +91,7 @@ include /dev/null $(wildcard $(check-y))
else
# Rules for installing headers
-__headersinst: $(subdir-y) $(header-y) $(altarch-y) $(objhdr-y)
+__headersinst: $(subdir-y) $(header-y) $(objhdr-y)
@true
$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
@@ -156,29 +103,16 @@ $(INSTALL_HDR_PATH)/$(_dst):
$(unwanted):
$(call cmd,remove)
-ifdef GENASM
-$(objhdr-y) $(header-y): $(KBUILDFILES)
- $(call cmd,gen)
-
-else
-$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
+$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
$(call cmd,o_hdr_install)
-$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
+$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
$(call cmd,unifdef)
endif
-endif
hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
-.PHONY: altarch-dir
-# All the files in the normal arch dir must be created first, since we test
-# for their existence.
-altarch-dir: $(subdir-y) $(header-y) $(objhdr-y)
- $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
- $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR)
-
# Recursion
.PHONY: $(subdir-y)
$(subdir-y):
--
1.5.6.1.93.gef98
Move it to the top-level file to decide if we install/check
the generic headers or the arch specific headers.
This revealed a long standing bug where "make headers_check_all"
relied on the files in asm/ for the current architecture.
So make headers_check_all is now broken by this commit.
In addition:
o add a simpler way to detect if an arch support
exporting header files.
o add 'set -e;' so we error out early if
make headers_check_all fails.
o add sparc64 and cris to arch we do not process
in make headers_*_all because:
sparc64 - use sparc to export headers
cris - is know seriously broken
Includes suggestions from: David Woodhouse
<[email protected]>.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: David Woodhouse <[email protected]>
---
Makefile | 24 +++++++++++++-----------
include/Kbuild | 4 ++--
scripts/Makefile.headersinst | 9 ---------
3 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
index d676c39..2f087df 100644
--- a/Makefile
+++ b/Makefile
@@ -1000,7 +1000,7 @@ depend dep:
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
-hdr-filter := generic um ppc
+hdr-filter := generic um ppc sparc64 cris
hdr-archs := $(filter-out $(hdr-filter), \
$(patsubst $(srctree)/include/asm-%/Kbuild,%, \
$(wildcard $(srctree)/include/asm-*/Kbuild)))
@@ -1012,29 +1012,31 @@ __headers: include/linux/version.h scripts_basic FORCE
PHONY += headers_install_all
headers_install_all: __headers
+ $(Q)$(MAKE) $(hdr-inst)=include
$(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
- BIASMDIR=-bi-$$arch ;\
+ $(MAKE) $(hdr-inst)=include/asm-$$arch \
+ SRCARCH=$$arch dst=include/asm-$$arch; \
done
PHONY += headers_install
headers_install: __headers
- $(Q)if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
- echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \
- exit 1 ; \
- fi
- $(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH)
+ $(if $(wildcard $(srctree)/include/asm-$(SRCARCH)/Kbuild),, \
+ $(error Headers not exportable for this architecture ($(SRCARCH))))
+ $(Q)$(MAKE) $(hdr-inst)=include
+ $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) dst=include/asm
PHONY += headers_check_all
headers_check_all: headers_install_all
+ $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
$(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) ARCH=$$arch SRCARCH=$$arch $(hdr-inst)=include \
- BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
+ $(MAKE) SRCARCH=$$arch $(hdr-inst)=include/asm-$$arch HDRCHECK=1 ;\
done
PHONY += headers_check
headers_check: headers_install
- $(Q)$(MAKE) $(hdr-inst)=include ARCH=$(SRCARCH) HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \
+ dst=include/asm HDRCHECK=1
# ---------------------------------------------------------------------------
# Modules
diff --git a/include/Kbuild b/include/Kbuild
index b522887..6ae595c 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,8 +1,8 @@
+# Top-level Makefile calls into asm-$(ARCH)
+
header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
-
-header-y += asm-$(ARCH)/
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 599adc6..599503f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -28,15 +28,6 @@ include $(kbuild-file)
include scripts/Kbuild.include
-# If this is include/asm-$(ARCH) then override $(_dst) so that
-# we install to include/asm directly.
-# Unless $(BIASMDIR) is set, in which case we're probably doing
-# a 'headers_install_all' build and we should keep the -$(ARCH)
-# in the directory name.
-ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
- _dst := include/asm
-endif
-
install := $(INSTALL_HDR_PATH)/$(_dst)
header-y := $(sort $(header-y) $(unifdef-y))
--
1.5.6.1.93.gef98
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index acb961e..39b997f 100644
--- a/Makefile
+++ b/Makefile
@@ -1399,7 +1399,11 @@ define find-sources
\( -name config -o -name 'asm-*' \) -prune \
-o -name $1 -print; \
for arch in $(ALLINCLUDE_ARCHS) ; do \
- find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
+ test -e $(__srctree)include/asm-$${arch} && \
+ find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
+ -name $1 -print; \
+ test -e $(__srctree)arch/$${arch}/include/asm && \
+ find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
-name $1 -print; \
done ; \
find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
--
1.5.6.1.93.gef98
Move the core functionality of headers_install
and headers_check to two small perl scripts.
The makefile is adapted to use the perl scrip and
changed to operate on all files in a directory.
So if one file is changed then all files in the
directory is processed.
perl were chosen for the helper scripts because this
is pure text processing which perl is good at and
especially the headers_check.pl script are expected to
see changes / new checks implmented.
The speed is ~300% faster on this box.
And the output generated to the screen is now down to
two lines per directory (one for install, one for check)
so it is easier to scroll back after a kernel build.
The perl scripts has been brought to sanity by patient
feedback from: Vegard Nossum <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/Makefile.headersinst | 145 ++++++++++++++++++------------------------
scripts/hdrcheck.sh | 10 ---
scripts/headers_check.pl | 56 ++++++++++++++++
scripts/headers_install.pl | 42 ++++++++++++
4 files changed, 161 insertions(+), 92 deletions(-)
delete mode 100755 scripts/hdrcheck.sh
create mode 100644 scripts/headers_check.pl
create mode 100644 scripts/headers_install.pl
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 599503f..be2b70c 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -1,26 +1,14 @@
# ==========================================================================
# Installing headers
#
-# header-y files will be installed verbatim
-# unifdef-y are the files where unifdef will be run before installing files
-# objhdr-y are generated files that will be installed verbatim
+# header-y - list files to be installed. They are preprocessed
+# to remove __KERNEL__ section of the file
+# unifdef-y - Same as header-y. Obsolete
+# objhdr-y - Same as header-y but for generated files
#
# ==========================================================================
-UNIFDEF := scripts/unifdef -U__KERNEL__
-
-# Eliminate the contents of (and inclusions of) compiler.h
-HDRSED := sed -e "s/ inline / __inline__ /g" \
- -e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \
- -e "s/(__user[[:space:]]\{1,\}/ (/g" \
- -e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
- -e "s/(__force[[:space:]]\{1,\}/ (/g" \
- -e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \
- -e "s/(__iomem[[:space:]]\{1,\}/ (/g" \
- -e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \
- -e "s/[[:space:]]__attribute_const__$$//" \
- -e "/^\#include <linux\/compiler.h>/d"
-
+# called may set destination dir (when installing to asm/)
_dst := $(if $(dst),$(dst),$(obj))
kbuild-file := $(srctree)/$(obj)/Kbuild
@@ -28,89 +16,82 @@ include $(kbuild-file)
include scripts/Kbuild.include
-install := $(INSTALL_HDR_PATH)/$(_dst)
-
-header-y := $(sort $(header-y) $(unifdef-y))
-subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
-header-y := $(filter-out %/, $(header-y))
+install := $(INSTALL_HDR_PATH)/$(_dst)
-# stamp files for header checks
-check-y := $(patsubst %,.check.%,$(header-y) $(objhdr-y))
-
-# Work out what needs to be removed
-oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h))
-unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
+header-y := $(sort $(header-y) $(unifdef-y))
+subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
+header-y := $(filter-out %/, $(header-y))
-oldcheckstamps := $(patsubst $(install)/%,%,$(wildcard $(install)/.check.*.h))
-unwanted += $(filter-out $(check-y),$(oldcheckstamps))
+# files used to track state of install/check
+install-file := $(install)/.install
+check-file := $(install)/.check
-# Prefix them all with full paths to $(INSTALL_HDR_PATH)
-header-y := $(patsubst %,$(install)/%,$(header-y))
-objhdr-y := $(patsubst %,$(install)/%,$(objhdr-y))
-check-y := $(patsubst %,$(install)/%,$(check-y))
+# all headers files for this dir
+all-files := $(header-y) $(objhdr-y)
+input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \
+ $(addprefix $(objtree)/$(obj)/,$(objhdr-y))
+output-files := $(addprefix $(install)/, $(all-files))
-quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_o_hdr_install = cp $(patsubst $(install)/%,$(objtree)/$(obj)/%,$@) \
- $(install)
-
-quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_unifdef = $(UNIFDEF) $(patsubst $(install)/%,$(srctree)/$(obj)/%,$@)\
- | $(HDRSED) > $@ || :
+# Work out what needs to be removed
+oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h))
+unwanted := $(filter-out $(all-files),$(oldheaders))
-quiet_cmd_check = CHECK $(patsubst $(install)/.check.%,$(_dst)/%,$@)
- cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \
- $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@
+# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
+unwanted-file := $(addprefix $(install)/, $(unwanted))
-quiet_cmd_remove = REMOVE $(_dst)/$@
- cmd_remove = rm -f $(install)/$@
+printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
-quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_mkdir = mkdir -p $@
+quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
+ file$(if $(word 2, $(all-files)),s))
+ cmd_install = $(PERL) $< $(srctree)/$(obj) $(install) $(header-y); \
+ $(PERL) $< $(objtree)/$(obj) $(install) $(objhdr-y); \
+ touch $@
-.PHONY: __headersinst __headerscheck
+quiet_cmd_remove = REMOVE $(unwanted)
+ cmd_remove = rm -f $(unwanted-file)
-ifdef HDRCHECK
-__headerscheck: $(subdir-y) $(check-y)
- @true
+quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
+ cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \
+ $(addprefix $(install)/, $(all-files)); \
+ touch $@
-$(check-y) : $(install)/.check.%.h : $(install)/%.h
- $(call cmd,check)
+PHONY += __headersinst __headerscheck
-# Other dependencies for $(check-y)
-include /dev/null $(wildcard $(check-y))
+ifndef HDRCHECK
+# Rules for installing headers
+__headersinst: $(subdirs) $(install-file)
+ @:
-# but leave $(check-y) as .PHONY for now until those
-# deps are actually correct.
-.PHONY: $(check-y)
+targets += $(install-file)
+$(install-file): scripts/headers_install.pl $(input-files) FORCE
+ $(if $(unwanted),$(call cmd,remove),)
+ $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
+ $(call if_changed,install)
else
-# Rules for installing headers
-__headersinst: $(subdir-y) $(header-y) $(objhdr-y)
- @true
+__headerscheck: $(subdirs) $(check-file)
+ @:
-$(objhdr-y) $(subdir-y) $(header-y): | $(install) $(unwanted)
+targets += $(check-file)
+$(check-file): scripts/headers_check.pl $(output-files) FORCE
+ $(call if_changed,check)
-$(install):
- $(call cmd,mkdir)
-
-# Rules for removing unwanted header files
-.PHONY: $(unwanted)
-$(unwanted):
- $(call cmd,remove)
+endif
-# Install generated files
-$(objhdr-y): $(install)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
- $(call cmd,o_hdr_install)
+# Recursion
+hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+.PHONY: $(subdirs)
+$(subdirs):
+ $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
-# Unifdef header files and install them
-$(header-y): $(install)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
- $(call cmd,unifdef)
+targets := $(wildcard $(sort $(targets)))
+cmd_files := $(wildcard \
+ $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
+ifneq ($(cmd_files),)
+ include $(cmd_files)
endif
-hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
-
-# Recursion
-.PHONY: $(subdir-y)
-$(subdir-y):
- $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
+.PHONY: $(PHONY)
+PHONY += FORCE
+FORCE: ;
diff --git a/scripts/hdrcheck.sh b/scripts/hdrcheck.sh
deleted file mode 100755
index 3159858..0000000
--- a/scripts/hdrcheck.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
- if [ ! -r $1/$FILE ]; then
- echo $2 requires $FILE, which does not exist in exported headers
- exit 1
- fi
-done
-# FIXME: List dependencies into $3
-touch $3
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
new file mode 100644
index 0000000..15d53a6
--- /dev/null
+++ b/scripts/headers_check.pl
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# headers_check.pl execute a number of trivial consistency checks
+#
+# Usage: headers_check.pl dir [files...]
+# dir: dir to look for included files
+# arch: architecture
+# files: list of files to check
+#
+# The script reads the supplied files line by line and:
+#
+# 1) for each include statement it checks if the
+# included file actually exists.
+# Only include files located in asm* and linux* are checked.
+# The rest are assumed to be system include files.
+#
+# 2) TODO: check for leaked CONFIG_ symbols
+
+use strict;
+use warnings;
+
+my ($dir, $arch, @files) = @ARGV;
+
+my $ret = 0;
+my $line;
+my $lineno = 0;
+my $filename;
+
+foreach my $file (@files) {
+ $filename = $file;
+ open(my $fh, '<', "$filename") or die "$filename: $!\n";
+ $lineno = 0;
+ while ($line = <$fh>) {
+ $lineno++;
+ check_include();
+ }
+ close $fh;
+}
+exit $ret;
+
+sub check_include
+{
+ if ($line =~ m/^\s*#\s*include\s+<((asm|linux).*)>/) {
+ my $inc = $1;
+ my $found;
+ $found = stat($dir . "/" . $inc);
+ if (!$found) {
+ $inc =~ s#asm/#asm-$arch/#;
+ $found = stat($dir . "/" . $inc);
+ }
+ if (!$found) {
+ printf STDERR "$filename:$lineno: included file '$inc' is not exported\n";
+ $ret = 1;
+ }
+ }
+}
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
new file mode 100644
index 0000000..f0ff9a3
--- /dev/null
+++ b/scripts/headers_install.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+#
+# headers_install prepare the listed header files for use in
+# user space and copy the files to their destination.
+#
+# Usage: headers_install.pl odir installdir [files...]
+# odir: dir to open files
+# install: dir to install the files
+# files: list of files to check
+#
+# Step in preparation for users space:
+# 1) Drop all use of compiler.h definitions
+# 2) Drop include of compiler.h
+# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
+
+use strict;
+use warnings;
+
+my ($readdir, $installdir, @files) = @ARGV;
+
+my $unifdef = "scripts/unifdef -U__KERNEL__";
+
+foreach my $file (@files) {
+ my $tmpfile = "$installdir/$file.tmp";
+ open(my $infile, '<', "$readdir/$file")
+ or die "$readdir/$file: $!\n";
+ open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
+ while (my $line = <$infile>) {
+ $line =~ s/([\s(])__user\s/$1/g;
+ $line =~ s/([\s(])__force\s/$1/g;
+ $line =~ s/([\s(])__iomem\s/$1/g;
+ $line =~ s/\s__attribute_const__\s/ /g;
+ $line =~ s/\s__attribute_const__$//g;
+ $line =~ s/^#include <linux\/compiler.h>//;
+ printf $outfile "%s", $line;
+ }
+ close $outfile;
+ close $infile;
+ system $unifdef . " $tmpfile > $installdir/$file";
+ unlink $tmpfile;
+}
+exit 0;
--
1.5.6.1.93.gef98
unifdef utility is fast enough to warrant that we always
run the scripts through unifdef.
This patch runs all headers listed with header-y and unifdef-y
through unifdef.
Next step is to drop unifdef-y in all Kbuild files and
that can now be done in smaller steps.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Adrian Bunk <[email protected]>
---
scripts/Makefile.headersinst | 29 ++++++++++-------------------
1 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 53dae3e..22b17af 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -50,25 +50,22 @@ ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR))
_dst := include/asm
endif
-header-y := $(sort $(header-y))
-unifdef-y := $(sort $(unifdef-y))
+header-y := $(sort $(header-y) $(unifdef-y))
subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
header-y := $(filter-out %/, $(header-y))
-header-y := $(filter-out $(unifdef-y),$(header-y))
# stamp files for header checks
-check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y))
+check-y := $(patsubst %,.check.%,$(header-y) $(objhdr-y))
# Work out what needs to be removed
oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h))
-unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders))
+unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h))
unwanted += $(filter-out $(check-y),$(oldcheckstamps))
# Prefix them all with full paths to $(INSTALL_HDR_PATH)
header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
-unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y))
objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
@@ -88,10 +85,6 @@ quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
$(INSTALL_HDR_PATH)/$(_dst)
-quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
- > $@
-
quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
| $(HDRSED) > $@ || :
@@ -151,10 +144,10 @@ include /dev/null $(wildcard $(check-y))
else
# Rules for installing headers
-__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y)
+__headersinst: $(subdir-y) $(header-y) $(altarch-y) $(objhdr-y)
@true
-$(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
+$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
$(INSTALL_HDR_PATH)/$(_dst):
$(call cmd,mkdir)
@@ -164,18 +157,16 @@ $(unwanted):
$(call cmd,remove)
ifdef GENASM
-$(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES)
+$(objhdr-y) $(header-y): $(KBUILDFILES)
$(call cmd,gen)
else
-$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
+$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
$(call cmd,o_hdr_install)
-$(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
- $(call cmd,headers_install)
-
-$(unifdef-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
+$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
$(call cmd,unifdef)
+
endif
endif
@@ -184,7 +175,7 @@ hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
.PHONY: altarch-dir
# All the files in the normal arch dir must be created first, since we test
# for their existence.
-altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y)
+altarch-dir: $(subdir-y) $(header-y) $(objhdr-y)
$(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
$(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR)
--
1.5.6.1.93.gef98
Adjust the asm symlink support so we do not create the
symlink unless really needed.
We check the precense of include/asm-$ARCH by checking
for the system.h file. We may end up with a stale directory
so it is not enough to check if the directory is present.
Signed-off-by: Sam Ravnborg <[email protected]>
---
Kbuild | 3 +--
Makefile | 42 ++++++++++++++++++++++++++++--------------
2 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/Kbuild b/Kbuild
index e750e9c..f056b4f 100644
--- a/Kbuild
+++ b/Kbuild
@@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
# 2) Generate asm-offsets.h
#
-offsets-file := include/asm-$(SRCARCH)/asm-offsets.h
+offsets-file := include/asm/asm-offsets.h
always += $(offsets-file)
targets += $(offsets-file)
@@ -81,7 +81,6 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
$(call if_changed_dep,cc_s_c)
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
- $(Q)mkdir -p $(dir $@)
$(call cmd,offsets)
#####
diff --git a/Makefile b/Makefile
index 39b997f..339f6d3 100644
--- a/Makefile
+++ b/Makefile
@@ -921,7 +921,9 @@ ifneq ($(KBUILD_SRC),)
/bin/false; \
fi;
$(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
- $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm
+ $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
+ ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
+ fi
endif
# prepare2 creates a makefile if using a separate output directory
@@ -947,22 +949,34 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
# The asm symlink changes when $(ARCH) changes.
# Detect this and ask user to run make mrproper
-
-include/asm: FORCE
- $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
- if [ -L include/asm ]; then \
- if [ "$$asmlink" != "$(SRCARCH)" ]; then \
+define check-symlink
+ set -e; \
+ if [ -L include/asm ]; then \
+ asmlink=`readlink include/asm | cut -d '-' -f 2`; \
+ if [ "$$asmlink" != "$(SRCARCH)" ]; then \
echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
- exit 1; \
- fi; \
- else \
- echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
- if [ ! -d include ]; then \
- mkdir -p include; \
- fi; \
- ln -fsn asm-$(SRCARCH) $@; \
+ exit 1; \
+ fi; \
+ fi
+endef
+
+# We create the target directory of the symlink if it does
+# not exist so the test in chack-symlink works and we have a
+# directory for generated filesas used by some architectures.
+define create-symlink
+ if [ ! -L include/asm ]; then \
+ echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
+ if [ ! -d include/asm-$(SRCARCH) ]; then \
+ mkdir -p include/asm-$(SRCARCH); \
+ fi; \
+ ln -fsn asm-$(SRCARCH) $@; \
fi
+endef
+
+include/asm: FORCE
+ $(Q)$(check-symlink)
+ $(Q)$(create-symlink)
# Generate some files
# ---------------------------------------------------------------------------
--
1.5.6.1.93.gef98
This patch conclude the support for
arch/$ARCH/include
Note: The individual architectures will most likely require
a few minor patches to support locating header files in
arch/$ARCH/include
Testing shows that it worked out-of-the-box for sparc.
x86 required a few trivial changes in the arch
specific Makefile and a few include paths had to be adjusted.
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 339f6d3..4a1ed80 100644
--- a/Makefile
+++ b/Makefile
@@ -329,7 +329,8 @@ AFLAGS_KERNEL =
# Needed to be compatible with the O= option
LINUXINCLUDE := -Iinclude \
$(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
- -include include/linux/autoconf.h
+ -I$(srctree)/arch/$(hdr-arch)/include \
+ -include include/linux/autoconf.h
KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
--
1.5.6.1.93.gef98
From: Tim Bird <[email protected]>
Diffconfig is a simple utility for comparing two kernel configuration files.
See usage in the script for more info.
Signed-off-by: Tim Bird <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/diffconfig | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 129 insertions(+), 0 deletions(-)
create mode 100755 scripts/diffconfig
diff --git a/scripts/diffconfig b/scripts/diffconfig
new file mode 100755
index 0000000..b91f3e3
--- /dev/null
+++ b/scripts/diffconfig
@@ -0,0 +1,129 @@
+#!/usr/bin/python
+#
+# diffconfig - a tool to compare .config files.
+#
+# originally written in 2006 by Matt Mackall
+# (at least, this was in his bloatwatch source code)
+# last worked on 2008 by Tim Bird
+#
+
+import sys, os
+
+def usage():
+ print """Usage: diffconfig [-h] [-m] [<config1> <config2>]
+
+Diffconfig is a simple utility for comparing two .config files.
+Using standard diff to compare .config files often includes extraneous and
+distracting information. This utility produces sorted output with only the
+changes in configuration values between the two files.
+
+Added and removed items are shown with a leading plus or minus, respectively.
+Changed items show the old and new values on a single line.
+
+If -m is specified, then output will be in "merge" style, which has the
+changed and new values in kernel config option format.
+
+If no config files are specified, .config and .config.old are used.
+
+Example usage:
+ $ diffconfig .config config-with-some-changes
+-EXT2_FS_XATTR n
+-EXT2_FS_XIP n
+ CRAMFS n -> y
+ EXT2_FS y -> n
+ LOG_BUF_SHIFT 14 -> 16
+ PRINTK_TIME n -> y
+"""
+ sys.exit(0)
+
+# returns a dictionary of name/value pairs for config items in the file
+def readconfig(config_file):
+ d = {}
+ for line in config_file:
+ line = line[:-1]
+ if line[:7] == "CONFIG_":
+ name, val = line[7:].split("=", 1)
+ d[name] = val
+ if line[-11:] == " is not set":
+ d[line[9:-11]] = "n"
+ return d
+
+def print_config(op, config, value, new_value):
+ global merge_style
+
+ if merge_style:
+ if new_value:
+ if new_value=="n":
+ print "# CONFIG_%s is not set" % config
+ else:
+ print "CONFIG_%s=%s" % (config, new_value)
+ else:
+ if op=="-":
+ print "-%s %s" % (config, value)
+ elif op=="+":
+ print "+%s %s" % (config, new_value)
+ else:
+ print " %s %s -> %s" % (config, value, new_value)
+
+def main():
+ global merge_style
+
+ # parse command line args
+ if ("-h" in sys.argv or "--help" in sys.argv):
+ usage()
+
+ merge_style = 0
+ if "-m" in sys.argv:
+ merge_style = 1
+ sys.argv.remove("-m")
+
+ argc = len(sys.argv)
+ if not (argc==1 or argc == 3):
+ print "Error: incorrect number of arguments or unrecognized option"
+ usage()
+
+ if argc == 1:
+ # if no filenames given, assume .config and .config.old
+ build_dir=""
+ if os.environ.has_key("KBUILD_OUTPUT"):
+ build_dir = os.environ["KBUILD_OUTPUT"]+"/"
+
+ configa_filename = build_dir + ".config.old"
+ configb_filename = build_dir + ".config"
+ else:
+ configa_filename = sys.argv[1]
+ configb_filename = sys.argv[2]
+
+ a = readconfig(file(configa_filename))
+ b = readconfig(file(configb_filename))
+
+ # print items in a but not b (accumulate, sort and print)
+ old = []
+ for config in a:
+ if config not in b:
+ old.append(config)
+ old.sort()
+ for config in old:
+ print_config("-", config, a[config], None)
+ del a[config]
+
+ # print items that changed (accumulate, sort, and print)
+ changed = []
+ for config in a:
+ if a[config] != b[config]:
+ changed.append(config)
+ else:
+ del b[config]
+ changed.sort()
+ for config in changed:
+ print_config("->", config, a[config], b[config])
+ del b[config]
+
+ # now print items in b but not in a
+ # (items from b that were in a were removed above)
+ new = b.keys()
+ new.sort()
+ for config in new:
+ print_config("+", config, None, b[config])
+
+main()
--
1.5.6.1.93.gef98
Previously when running "make oldconfig" we saw all the propmt lines
from kconfig and noone actully read this.
With this patch the user will only see output if there is new symbols.
This will be seen as "make oldconfig" runs which does not generate any output.
A typical run now looks like this:
$ make oldconfig
scripts/kconfig/conf -o arch/x86/Kconfig
$
If a new symbol is found then we restart the config process like this:
$ make oldconfig
scripts/kconfig/conf -o arch/x86/Kconfig
*
* Restart config...
*
*
* General setup
*
Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [Y/n/?] y
Local version - append to kernel release (LOCALVERSION) []
...
The bahaviour is similar to what we know when running the implicit
oldconfig target "make silentoldconfig".
"make silentoldconfig" are run as part of the kernel build process
if the configuration has changed.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Roman Zippel <[email protected]>
---
scripts/kconfig/conf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index bd2a27e..6cdaa0c 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -590,10 +590,10 @@ int main(int ac, char **av)
conf_set_all_new_symbols(def_random);
break;
case ask_silent:
+ case ask_new:
if (conf_silent_update())
exit(1);
break;
- case ask_new:
case ask_all:
case set_default:
if (conf_update())
--
1.5.6.1.93.gef98
Drop the chatty mode when we generate the all*config, randconfig
configurations.
Ths speeds up the process considerably and noone looked
at the output anyway.
This patch uses the conf_set_all_new_symbols() function
just added to kconfig.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Roman Zippel <[email protected]>
---
scripts/kconfig/conf.c | 154 +++++++++++++++++++++---------------------------
1 files changed, 68 insertions(+), 86 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index fda6313..bd2a27e 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -76,7 +76,6 @@ static void check_stdin(void)
static int conf_askvalue(struct symbol *sym, const char *def)
{
enum symbol_type type = sym_get_type(sym);
- tristate val;
if (!sym_has_value(sym))
printf(_("(NEW) "));
@@ -92,15 +91,6 @@ static int conf_askvalue(struct symbol *sym, const char *def)
}
switch (input_mode) {
- case set_no:
- case set_mod:
- case set_yes:
- case set_random:
- if (sym_has_value(sym)) {
- printf("%s\n", def);
- return 0;
- }
- break;
case ask_new:
case ask_silent:
if (sym_has_value(sym)) {
@@ -128,52 +118,6 @@ static int conf_askvalue(struct symbol *sym, const char *def)
default:
;
}
- switch (input_mode) {
- case set_yes:
- if (sym_tristate_within_range(sym, yes)) {
- line[0] = 'y';
- line[1] = '\n';
- line[2] = 0;
- break;
- }
- case set_mod:
- if (type == S_TRISTATE) {
- if (sym_tristate_within_range(sym, mod)) {
- line[0] = 'm';
- line[1] = '\n';
- line[2] = 0;
- break;
- }
- } else {
- if (sym_tristate_within_range(sym, yes)) {
- line[0] = 'y';
- line[1] = '\n';
- line[2] = 0;
- break;
- }
- }
- case set_no:
- if (sym_tristate_within_range(sym, no)) {
- line[0] = 'n';
- line[1] = '\n';
- line[2] = 0;
- break;
- }
- case set_random:
- do {
- val = (tristate)(rand() % 3);
- } while (!sym_tristate_within_range(sym, val));
- switch (val) {
- case no: line[0] = 'n'; break;
- case mod: line[0] = 'm'; break;
- case yes: line[0] = 'y'; break;
- }
- line[1] = '\n';
- line[2] = 0;
- break;
- default:
- break;
- }
printf("%s", line);
return 1;
}
@@ -374,16 +318,12 @@ static int conf_choice(struct menu *menu)
else
continue;
break;
- case set_random:
- if (is_new)
- def = (rand() % cnt) + 1;
case set_default:
- case set_yes:
- case set_mod:
- case set_no:
cnt = def;
printf("%d\n", cnt);
break;
+ default:
+ break;
}
conf_childs:
@@ -494,6 +434,43 @@ static void check_conf(struct menu *menu)
check_conf(child);
}
+static void conf_do_update(void)
+{
+ /* Update until a loop caused no more changes */
+ do {
+ conf_cnt = 0;
+ check_conf(&rootmenu);
+ } while (conf_cnt);
+}
+
+static int conf_silent_update(void)
+{
+ const char *name;
+
+ if (conf_get_changed()) {
+ name = getenv("KCONFIG_NOSILENTUPDATE");
+ if (name && *name) {
+ fprintf(stderr,
+ _("\n*** Kernel configuration requires explicit update.\n\n"));
+ return 1;
+ }
+ conf_do_update();
+ }
+ return 0;
+}
+
+static int conf_update(void)
+{
+ rootEntry = &rootmenu;
+ conf(&rootmenu);
+ if (input_mode == ask_all) {
+ input_mode = ask_silent;
+ valid_stdin = 1;
+ }
+ conf_do_update();
+ return 0;
+}
+
int main(int ac, char **av)
{
int opt;
@@ -599,36 +576,41 @@ int main(int ac, char **av)
default:
break;
}
+ switch (input_mode) {
+ case set_no:
+ conf_set_all_new_symbols(def_no);
+ break;
+ case set_yes:
+ conf_set_all_new_symbols(def_yes);
+ break;
+ case set_mod:
+ conf_set_all_new_symbols(def_mod);
+ break;
+ case set_random:
+ conf_set_all_new_symbols(def_random);
+ break;
+ case ask_silent:
+ if (conf_silent_update())
+ exit(1);
+ break;
+ case ask_new:
+ case ask_all:
+ case set_default:
+ if (conf_update())
+ exit(1);
+ break;
+ }
- if (input_mode != ask_silent) {
- rootEntry = &rootmenu;
- conf(&rootmenu);
- if (input_mode == ask_all) {
- input_mode = ask_silent;
- valid_stdin = 1;
- }
- } else if (conf_get_changed()) {
- name = getenv("KCONFIG_NOSILENTUPDATE");
- if (name && *name) {
- fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
- return 1;
- }
- } else
- goto skip_check;
-
- do {
- conf_cnt = 0;
- check_conf(&rootmenu);
- } while (conf_cnt);
- if (conf_write(NULL)) {
+ if (conf_get_changed() && conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
- return 1;
+ exit(1);
}
-skip_check:
+ /* ask_silent is used during the build so we shall update autoconf.
+ * All other commands are only used to generate a config.
+ */
if (input_mode == ask_silent && conf_write_autoconf()) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
return 1;
}
-
return 0;
}
--
1.5.6.1.93.gef98
From: Randy Dunlap <[email protected]>
Handle __init in functions with kernel-doc notation by stripping the
__init away from the output doc. This is already being done for
"__devinit". This patch fixes these kernel-doc error/aborts:
Error(linux-next-20080619//drivers/usb/gadget/config.c:132): cannot understand prototype: 'struct usb_descriptor_header **__init usb_copy_descriptors(struct usb_descriptor_header **src) '
Error(linux-next-20080619//drivers/usb/gadget/config.c:182): cannot understand prototype: 'struct usb_endpoint_descriptor *__init usb_find_endpoint( struct usb_descriptor_header **src, struct usb_descriptor_header **copy, struct usb_endpoint_descriptor *match ) '
Signed-off-by: Randy Dunlap <[email protected]>
Cc: David Brownell <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/kernel-doc | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 88e3934..d8f77e2 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1643,6 +1643,7 @@ sub dump_function($$) {
$prototype =~ s/^__always_inline +//;
$prototype =~ s/^noinline +//;
$prototype =~ s/__devinit +//;
+ $prototype =~ s/__init +//;
$prototype =~ s/^#define\s+//; #ak added
$prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
--
1.5.6.1.93.gef98
make defconfig generated a lot of output
then noone actually read.
Use conf_set_all_new_symbols() to generate the default
configuration and avoid the chatty output.
A typical run now looks like this:
$ make defconfig
*** Default configuration is based on 'i386_defconfig'
arch/x86/configs/i386_defconfig:13:warning: trying to assign nonexistent symbol SEMAPHORE_SLEEPERS
arch/x86/configs/i386_defconfig:176:warning: trying to assign nonexistent symbol PREEMPT_BKL
...
arch/x86/configs/i386_defconfig:1386:warning: trying to assign nonexistent symbol INSTRUMENTATION
$
As an added benefit we now clearly see the warnings generated
in the start of the process.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Roman Zippel <[email protected]>
---
scripts/kconfig/conf.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 6cdaa0c..9fba838 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -102,9 +102,6 @@ static int conf_askvalue(struct symbol *sym, const char *def)
fflush(stdout);
fgets(line, 128, stdin);
return 1;
- case set_default:
- printf("%s\n", def);
- return 1;
default:
break;
}
@@ -318,10 +315,6 @@ static int conf_choice(struct menu *menu)
else
continue;
break;
- case set_default:
- cnt = def;
- printf("%d\n", cnt);
- break;
default:
break;
}
@@ -589,13 +582,15 @@ int main(int ac, char **av)
case set_random:
conf_set_all_new_symbols(def_random);
break;
+ case set_default:
+ conf_set_all_new_symbols(def_default);
+ break;
case ask_silent:
case ask_new:
if (conf_silent_update())
exit(1);
break;
case ask_all:
- case set_default:
if (conf_update())
exit(1);
break;
--
1.5.6.1.93.gef98
From: Geert Uytterhoeven <[email protected]>
Documentation/sparse.txt tells to use:
make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__"
However, this still doesn't enable endian checks. The correct syntax is:
make C=2 CF="-D__CHECK_ENDIAN__"
This documentation bug was introduced by the following commit:
commit 1c7bafe7206d928eaccbcbd08d868733e0fb7054
Author: Robert P. J. Day <[email protected]>
Date: Wed Sep 13 07:57:50 2006 -0400
kbuild: clarify "make C=" build option
Clarify the use of "make C=" in the top-level Makefile, and fix a
typo in the Documentation file.
Signed-off-by: Sam Ravnborg <[email protected]>
This `typo' was not a typo, as `CF' had been introduced much earlier, by:
commit 7b49bb9aff8b14d15da58111d8908c877c0a525e
Author: [email protected] <[email protected]>
Date: Fri Sep 9 21:14:35 2005 +0100
[PATCH] kbuild: CF=<arguments> passes arguments to sparse
Allows to add to sparse arguments without mutilating makefiles - just
pass CF=<arguments> and they will be added to CHECKFLAGS.
Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
Documentation/sparse.txt | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
index 1a3bdc2..42f43fa 100644
--- a/Documentation/sparse.txt
+++ b/Documentation/sparse.txt
@@ -73,10 +73,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to
be recompiled or not. The latter is a fast way to check the whole tree if you
have already built it.
-The optional make variable CHECKFLAGS can be used to pass arguments to sparse.
-The build system passes -Wbitwise to sparse automatically. To perform
-endianness checks, you may define __CHECK_ENDIAN__:
+The optional make variable CF can be used to pass arguments to sparse. The
+build system passes -Wbitwise to sparse automatically. To perform endianness
+checks, you may define __CHECK_ENDIAN__:
- make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__"
+ make C=2 CF="-D__CHECK_ENDIAN__"
These checks are disabled by default as they generate a host of warnings.
--
1.5.6.1.93.gef98
Factor out the headers_*_all support to a seperate
shell script and add support for arch specific
header files can be located in either
arch/$ARCH/include/asm
or
include/asm-$ARCH/
In "make help" always display the headers_* targets.
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 49 ++++++++++++++++++++++---------------------------
scripts/headers.sh | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 27 deletions(-)
create mode 100755 scripts/headers.sh
diff --git a/Makefile b/Makefile
index 572ecfb..acb961e 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,9 @@ ifeq ($(ARCH),x86_64)
SRCARCH := x86
endif
+# Where to locate arch specific headers
+hdr-arch := $(SRCARCH)
+
KCONFIG_CONFIG ?= .config
# SHELL used by kbuild
@@ -1000,43 +1003,39 @@ depend dep:
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
-hdr-filter := generic um ppc sparc64 cris
-hdr-archs := $(filter-out $(hdr-filter), \
- $(patsubst $(srctree)/include/asm-%/Kbuild,%, \
- $(wildcard $(srctree)/include/asm-*/Kbuild)))
hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+# Find out where the Kbuild file is located to support
+# arch/$(ARCH)/include/asm
+hdr-dir = $(strip \
+ $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
+ arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
+
+# If we do an all arch process set dst to asm-$(hdr-arch)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
PHONY += __headers
__headers: include/linux/version.h scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
PHONY += headers_install_all
-headers_install_all: __headers
- $(Q)$(MAKE) $(hdr-inst)=include
- $(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) $(hdr-inst)=include/asm-$$arch \
- SRCARCH=$$arch dst=include/asm-$$arch; \
- done
+headers_install_all:
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
PHONY += headers_install
headers_install: __headers
- $(if $(wildcard $(srctree)/include/asm-$(SRCARCH)/Kbuild),, \
- $(error Headers not exportable for this architecture ($(SRCARCH))))
+ $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
+ $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include
- $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) dst=include/asm
+ $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
PHONY += headers_check_all
headers_check_all: headers_install_all
- $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
- $(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) SRCARCH=$$arch $(hdr-inst)=include/asm-$$arch HDRCHECK=1 ;\
- done
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
- $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \
- dst=include/asm HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
# ---------------------------------------------------------------------------
# Modules
@@ -1217,21 +1216,17 @@ help:
@echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string'
@echo ' kernelversion - Output the version stored in Makefile'
- @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
- echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
+ @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
echo ' (default: $(INSTALL_HDR_PATH))'; \
- fi
- @echo ''
+ echo ''
@echo 'Static analysers'
@echo ' checkstack - Generate a list of stack hogs'
@echo ' namespacecheck - Name space analysis on compiled kernel'
@echo ' versioncheck - Sanity check on version.h usage'
@echo ' includecheck - Check for duplicate included header files'
@echo ' export_report - List the usages of all exported symbols'
- @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
- echo ' headers_check - Sanity check on exported headers'; \
- fi
- @echo ''
+ @echo ' headers_check - Sanity check on exported headers'; \
+ echo ''
@echo 'Kernel packaging:'
@$(MAKE) $(build)=$(package-dir) help
@echo ''
diff --git a/scripts/headers.sh b/scripts/headers.sh
new file mode 100755
index 0000000..d33426f
--- /dev/null
+++ b/scripts/headers.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Run headers_$1 command for all suitable architectures
+
+# Stop on error
+set -e
+
+do_command()
+{
+ if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
+ make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
+ elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then
+ make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
+ else
+ printf "Ignoring arch: %s\n" ${arch}
+ 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
+ ;;
+ *)
+ if [ -d ${srctree}/arch/${arch} ]; then
+ do_command $1 ${arch}
+ fi
+ ;;
+ esac
+done
+
+
--
1.5.6.1.93.gef98
From: Alexey Dobriyan <[email protected]>
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 4a1ed80..f2c181a 100644
--- a/Makefile
+++ b/Makefile
@@ -1140,7 +1140,7 @@ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
include/linux/autoconf.h include/linux/version.h \
include/linux/utsrelease.h \
include/linux/bounds.h include/asm*/asm-offsets.h \
- Module.symvers tags TAGS cscope*
+ Module.symvers Module.markers tags TAGS cscope*
# clean - Delete most, but leave enough to build external modules
#
--
1.5.6.1.93.gef98
From: Jan Beulich <[email protected]>
Due to the addition of __attribute__((__cold__)) to a few symbols
without adjusting the linker scripts, those symbols currently may end
up outside the [_stext,_etext) range, as they get placed in
.text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
Hence we need to add .text.unlikely (and for future uses of
__attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.
Issue observed by Lukas Lipavsky.
Signed-off-by: Jan Beulich <[email protected]>
Tested-by: Lukas Lipavsky <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
include/asm-generic/vmlinux.lds.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f054778..5a544bf 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -204,6 +204,7 @@
* during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
+ *(.text.hot) \
*(.text) \
*(.ref.text) \
*(.text.init.refok) \
@@ -213,7 +214,8 @@
CPU_KEEP(init.text) \
CPU_KEEP(exit.text) \
MEM_KEEP(init.text) \
- MEM_KEEP(exit.text)
+ MEM_KEEP(exit.text) \
+ *(.text.unlikely)
/* sched.text is aling to function alignment to secure we have same
--
1.5.6.1.93.gef98
From: Roman Zippel <[email protected]>
Add conf_set_all_new_symbols() which set all symbols (which don't have a
value yet) to a specifed value.
Signed-off-by: Roman Zippel <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/kconfig/confdata.c | 70 ++++++++++++++++++++++++++++++++++++++++++++
scripts/kconfig/lkc.h | 9 +++++
2 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index ee5fe94..0759761 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -812,3 +812,73 @@ void conf_set_changed_callback(void (*fn)(void))
{
conf_changed_callback = fn;
}
+
+
+void conf_set_all_new_symbols(enum conf_def_mode mode)
+{
+ struct symbol *sym, *csym;
+ struct property *prop;
+ struct expr *e;
+ int i, cnt, def;
+
+ for_all_symbols(i, sym) {
+ if (sym_has_value(sym))
+ continue;
+ switch (sym_get_type(sym)) {
+ case S_BOOLEAN:
+ case S_TRISTATE:
+ switch (mode) {
+ case def_yes:
+ sym->def[S_DEF_USER].tri = yes;
+ break;
+ case def_mod:
+ sym->def[S_DEF_USER].tri = mod;
+ break;
+ case def_no:
+ sym->def[S_DEF_USER].tri = no;
+ break;
+ case def_random:
+ sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
+ break;
+ default:
+ continue;
+ }
+ if (!sym_is_choice(sym) || mode != def_random)
+ sym->flags |= SYMBOL_DEF_USER;
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ if (modules_sym)
+ sym_calc_value(modules_sym);
+
+ if (mode != def_random)
+ return;
+
+ for_all_symbols(i, csym) {
+ if (sym_has_value(csym) || !sym_is_choice(csym))
+ continue;
+
+ sym_calc_value(csym);
+ prop = sym_get_choice_prop(csym);
+ def = -1;
+ while (1) {
+ cnt = 0;
+ expr_list_for_each_sym(prop->expr, e, sym) {
+ if (sym->visible == no)
+ continue;
+ if (def == cnt++) {
+ csym->def[S_DEF_USER].val = sym;
+ break;
+ }
+ }
+ if (def >= 0 || cnt < 2)
+ break;
+ def = (rand() % cnt) + 1;
+ }
+ csym->flags |= SYMBOL_DEF_USER;
+ }
+}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 96521cb..4a9af6f 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -42,6 +42,14 @@ extern "C" {
#define TF_PARAM 0x0002
#define TF_OPTION 0x0004
+enum conf_def_mode {
+ def_default,
+ def_yes,
+ def_mod,
+ def_no,
+ def_random
+};
+
#define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2
#define T_OPT_ENV 3
@@ -69,6 +77,7 @@ const char *conf_get_configname(void);
char *conf_get_default_confname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
+void conf_set_all_new_symbols(enum conf_def_mode mode);
/* kconfig_load.c */
void kconfig_load(void);
--
1.5.6.1.93.gef98
We could hit a situation where hex values
are stored internally in kconfig without 0x prefix, so if we see
one of these add 0x prefix when we write value to .config.
The real fix is to make sure we always prefix hex
values with 0x in kconfig.
Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Roman Zippel <[email protected]>
---
arch/x86/boot/compressed/relocs.c | 2 +-
scripts/kconfig/confdata.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
index edaadea..88d27f6 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/boot/compressed/relocs.c
@@ -244,7 +244,7 @@ static void read_ehdr(FILE *fp)
static void read_shdrs(FILE *fp)
{
int i;
- if (ehdr.e_shnum > MAX_SHDRS) {
+ if (1 || ehdr.e_shnum > MAX_SHDRS) {
die("%d section headers supported: %d\n",
ehdr.e_shnum, MAX_SHDRS);
}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 0759761..6f39c80 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -510,7 +510,7 @@ int conf_write(const char *name)
case S_HEX:
str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
- fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
+ fprintf(out, "CONFIG_%s=0x%s\n", sym->name, str);
break;
}
case S_INT:
--
1.5.6.1.93.gef98
* Sam Ravnborg <[email protected]> wrote:
> We could hit a situation where hex values
> are stored internally in kconfig without 0x prefix, so if we see
> one of these add 0x prefix when we write value to .config.
> The real fix is to make sure we always prefix hex
> values with 0x in kconfig.
>
> Signed-off-by: Sam Ravnborg <[email protected]>
> Cc: Roman Zippel <[email protected]>
> ---
> arch/x86/boot/compressed/relocs.c | 2 +-
> scripts/kconfig/confdata.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
> index edaadea..88d27f6 100644
> --- a/arch/x86/boot/compressed/relocs.c
> +++ b/arch/x86/boot/compressed/relocs.c
> @@ -244,7 +244,7 @@ static void read_ehdr(FILE *fp)
> static void read_shdrs(FILE *fp)
> {
> int i;
> - if (ehdr.e_shnum > MAX_SHDRS) {
> + if (1 || ehdr.e_shnum > MAX_SHDRS) {
> die("%d section headers supported: %d\n",
> ehdr.e_shnum, MAX_SHDRS);
> }
note: stale x86 change slipped into this patch, please do not commit it
to the kbuild tree. (i suspect it happened when you sent me the
MAX_SHDRS debug patch yesterday)
Ingo
On Tue, Jul 01, 2008 at 08:41:22AM +0200, Ingo Molnar wrote:
>
> * Sam Ravnborg <[email protected]> wrote:
>
> > We could hit a situation where hex values
> > are stored internally in kconfig without 0x prefix, so if we see
> > one of these add 0x prefix when we write value to .config.
> > The real fix is to make sure we always prefix hex
> > values with 0x in kconfig.
> >
> > Signed-off-by: Sam Ravnborg <[email protected]>
> > Cc: Roman Zippel <[email protected]>
> > ---
> > arch/x86/boot/compressed/relocs.c | 2 +-
> > scripts/kconfig/confdata.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
> > index edaadea..88d27f6 100644
> > --- a/arch/x86/boot/compressed/relocs.c
> > +++ b/arch/x86/boot/compressed/relocs.c
> > @@ -244,7 +244,7 @@ static void read_ehdr(FILE *fp)
> > static void read_shdrs(FILE *fp)
> > {
> > int i;
> > - if (ehdr.e_shnum > MAX_SHDRS) {
> > + if (1 || ehdr.e_shnum > MAX_SHDRS) {
> > die("%d section headers supported: %d\n",
> > ehdr.e_shnum, MAX_SHDRS);
> > }
>
> note: stale x86 change slipped into this patch, please do not commit it
> to the kbuild tree. (i suspect it happened when you sent me the
> MAX_SHDRS debug patch yesterday)
Crap - thanks for noticing.
I will rebase tonight when I get home.
Sam
On Monday 2008-06-30 23:35, Sam Ravnborg wrote:
>From: Alexey Dobriyan <[email protected]>
>
>Those are left presumably from aborted ccache(1) compilations:
>
> arch/x86/kernel/.tmp_io_apic_64.o.T5veul
> arch/x86/kvm/.tmp_x86.o.SZWn69
> arch/x86/mm/.tmp_pgtable.o.sL1LTf
> drivers/ieee1394/.tmp_ieee1394_transactions.o.bUj6o1
> drivers/infiniband/hw/mlx4/.tmp_main.o.vy0ep6
I'd suggest using '.tmp_*.o.*' instead of '*.o.*'.
On Tue, Jul 01, 2008 at 02:10:26PM +0200, Jan Engelhardt wrote:
>
> On Monday 2008-06-30 23:35, Sam Ravnborg wrote:
>
> >From: Alexey Dobriyan <[email protected]>
> >
> >Those are left presumably from aborted ccache(1) compilations:
> >
> > arch/x86/kernel/.tmp_io_apic_64.o.T5veul
> > arch/x86/kvm/.tmp_x86.o.SZWn69
> > arch/x86/mm/.tmp_pgtable.o.sL1LTf
> > drivers/ieee1394/.tmp_ieee1394_transactions.o.bUj6o1
> > drivers/infiniband/hw/mlx4/.tmp_main.o.vy0ep6
>
> I'd suggest using '.tmp_*.o.*' instead of '*.o.*'.
Agreed. Fixed and pushed out a new set of patches.
Sam