aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 16:45:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 16:45:43 -0400
commit9b2e077c42a97fcbdc0dd71edb1fc9d15c74ad29 (patch)
tree20bf301d21f6c3776046acada5070630009ceedb /scripts
parenta54dfb1a845c38a97686268d8c4086a63d9493aa (diff)
parent10b63956fce7f369cc37fd4d994f09bd5203efe4 (diff)
Merge tag 'uapi-prep-20121002' of git://git.infradead.org/users/dhowells/linux-headers
Pull preparatory patches for user API disintegration from David Howells: "The patches herein prepare for the extraction of the Userspace API bits from the various header files named in the Kbuild files. New subdirectories are created under either include/uapi/ or arch/x/include/uapi/ that correspond to the subdirectory containing that file under include/ or arch/x/include/. The new subdirs under the uapi/ directory are populated with Kbuild files that mostly do nothing at this time. Further patches will disintegrate the headers in each original directory and fill in the Kbuild files as they do it. These patches also: (1) fix up #inclusions of "foo.h" rather than <foo.h>. (2) Remove some redundant #includes from the DRM code. (3) Make the kernel build infrastructure handle Kbuild files both in the old places and the new UAPI place that both specify headers to be exported. (4) Fix some kernel tools that #include kernel headers during their build. I have compile tested this with allyesconfig against x86_64, allmodconfig against i386 and a scattering of additional defconfigs of other arches. Prepared for main script Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Michael Kerrisk <mtk.manpages@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com> Acked-by: H. Peter Anvin <hpa@zytor.com>" * tag 'uapi-prep-20121002' of git://git.infradead.org/users/dhowells/linux-headers: UAPI: Plumb the UAPI Kbuilds into the user header installation and checking UAPI: x86: Differentiate the generated UAPI and internal headers UAPI: Remove the objhdr-y export list UAPI: Move linux/version.h UAPI: Set up uapi/asm/Kbuild.asm UAPI: x86: Fix insn_sanity build failure after UAPI split UAPI: x86: Fix the test_get_len tool UAPI: (Scripted) Set up UAPI Kbuild files UAPI: Partition the header include path sets and add uapi/ header directories UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ UAPI: (Scripted) Remove redundant DRM UAPI header #inclusions from drivers/gpu/. UAPI: Refer to the DRM UAPI headers with <...> and from certain headers only
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.headersinst52
-rw-r--r--scripts/headers_install.pl14
2 files changed, 41 insertions, 25 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index d3bae5e7b601..06ba4a70bd4d 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -3,13 +3,12 @@
3# 3#
4# header-y - list files to be installed. They are preprocessed 4# header-y - list files to be installed. They are preprocessed
5# to remove __KERNEL__ section of the file 5# to remove __KERNEL__ section of the file
6# objhdr-y - Same as header-y but for generated files 6# genhdr-y - Same as header-y but in a generated/ directory
7# genhdr-y - Same as objhdr-y but in a generated/ directory
8# 7#
9# ========================================================================== 8# ==========================================================================
10 9
11# called may set destination dir (when installing to asm/) 10# called may set destination dir (when installing to asm/)
12_dst := $(if $(dst),$(dst),$(obj)) 11_dst := $(or $(destination-y),$(dst),$(obj))
13 12
14# generated header directory 13# generated header directory
15gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) 14gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
@@ -17,49 +16,64 @@ gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
17kbuild-file := $(srctree)/$(obj)/Kbuild 16kbuild-file := $(srctree)/$(obj)/Kbuild
18include $(kbuild-file) 17include $(kbuild-file)
19 18
20_dst := $(if $(destination-y),$(destination-y),$(_dst)) 19old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
20ifneq ($(wildcard $(old-kbuild-file)),)
21include $(old-kbuild-file)
22endif
21 23
22include scripts/Kbuild.include 24include scripts/Kbuild.include
23 25
24install := $(INSTALL_HDR_PATH)/$(_dst) 26installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
25 27
26header-y := $(sort $(header-y)) 28header-y := $(sort $(header-y))
27subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) 29subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
28header-y := $(filter-out %/, $(header-y)) 30header-y := $(filter-out %/, $(header-y))
29 31
30# files used to track state of install/check 32# files used to track state of install/check
31install-file := $(install)/.install 33install-file := $(installdir)/.install
32check-file := $(install)/.check 34check-file := $(installdir)/.check
33 35
34# generic-y list all files an architecture uses from asm-generic 36# generic-y list all files an architecture uses from asm-generic
35# Use this to build a list of headers which require a wrapper 37# Use this to build a list of headers which require a wrapper
36wrapper-files := $(filter $(header-y), $(generic-y)) 38wrapper-files := $(filter $(header-y), $(generic-y))
37 39
40srcdir := $(srctree)/$(obj)
41gendir := $(objtree)/$(gen)
42
43oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
44
38# all headers files for this dir 45# all headers files for this dir
39header-y := $(filter-out $(generic-y), $(header-y)) 46header-y := $(filter-out $(generic-y), $(header-y))
40all-files := $(header-y) $(objhdr-y) $(genhdr-y) $(wrapper-files) 47all-files := $(header-y) $(genhdr-y) $(wrapper-files)
41input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ 48output-files := $(addprefix $(installdir)/, $(all-files))
42 $(addprefix $(objtree)/$(obj)/,$(objhdr-y)) \ 49
43 $(addprefix $(objtree)/$(gen)/,$(genhdr-y)) 50input-files := $(foreach hdr, $(header-y), \
44output-files := $(addprefix $(install)/, $(all-files)) 51 $(or \
52 $(wildcard $(srcdir)/$(hdr)), \
53 $(wildcard $(oldsrcdir)/$(hdr)), \
54 $(error Missing UAPI file $(srcdir)/$(hdr)) \
55 )) \
56 $(foreach hdr, $(genhdr-y), \
57 $(or \
58 $(wildcard $(gendir)/$(hdr)), \
59 $(error Missing generated UAPI file $(gendir)/$(hdr)) \
60 ))
45 61
46# Work out what needs to be removed 62# Work out what needs to be removed
47oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) 63oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
48unwanted := $(filter-out $(all-files),$(oldheaders)) 64unwanted := $(filter-out $(all-files),$(oldheaders))
49 65
50# Prefix unwanted with full paths to $(INSTALL_HDR_PATH) 66# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
51unwanted-file := $(addprefix $(install)/, $(unwanted)) 67unwanted-file := $(addprefix $(installdir)/, $(unwanted))
52 68
53printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) 69printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
54 70
55quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ 71quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
56 file$(if $(word 2, $(all-files)),s)) 72 file$(if $(word 2, $(all-files)),s))
57 cmd_install = \ 73 cmd_install = \
58 $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ 74 $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \
59 $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
60 $(PERL) $< $(objtree)/$(gen) $(install) $(SRCARCH) $(genhdr-y); \
61 for F in $(wrapper-files); do \ 75 for F in $(wrapper-files); do \
62 echo "\#include <asm-generic/$$F>" > $(install)/$$F; \ 76 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
63 done; \ 77 done; \
64 touch $@ 78 touch $@
65 79
@@ -70,7 +84,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
70# Headers list can be pretty long, xargs helps to avoid 84# Headers list can be pretty long, xargs helps to avoid
71# the "Argument list too long" error. 85# the "Argument list too long" error.
72 cmd_check = for f in $(all-files); do \ 86 cmd_check = for f in $(all-files); do \
73 echo "$(install)/$${f}"; done \ 87 echo "$(installdir)/$${f}"; done \
74 | xargs \ 88 | xargs \
75 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ 89 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
76 touch $@ 90 touch $@
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 48462be328bb..239d22d4207b 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -4,8 +4,7 @@
4# user space and copy the files to their destination. 4# user space and copy the files to their destination.
5# 5#
6# Usage: headers_install.pl readdir installdir arch [files...] 6# Usage: headers_install.pl readdir installdir arch [files...]
7# readdir: dir to open files 7# installdir: dir to install the files to
8# installdir: dir to install the files
9# arch: current architecture 8# arch: current architecture
10# arch is used to force a reinstallation when the arch 9# arch is used to force a reinstallation when the arch
11# changes because kbuild then detect a command line change. 10# changes because kbuild then detect a command line change.
@@ -18,15 +17,18 @@
18 17
19use strict; 18use strict;
20 19
21my ($readdir, $installdir, $arch, @files) = @ARGV; 20my ($installdir, $arch, @files) = @ARGV;
22 21
23my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; 22my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
24 23
25foreach my $file (@files) { 24foreach my $filename (@files) {
25 my $file = $filename;
26 $file =~ s!^.*/!!;
27
26 my $tmpfile = "$installdir/$file.tmp"; 28 my $tmpfile = "$installdir/$file.tmp";
27 29
28 open(my $in, '<', "$readdir/$file") 30 open(my $in, '<', $filename)
29 or die "$readdir/$file: $!\n"; 31 or die "$filename: $!\n";
30 open(my $out, '>', $tmpfile) 32 open(my $out, '>', $tmpfile)
31 or die "$tmpfile: $!\n"; 33 or die "$tmpfile: $!\n";
32 while (my $line = <$in>) { 34 while (my $line = <$in>) {