diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2013-04-29 08:15:51 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2013-05-17 16:10:35 -0400 |
commit | c0ff68f1611d6855a06d672989ad5cfea160a4eb (patch) | |
tree | 66ce2b9af5930b2a0568d272dd93cbf4890693d8 /scripts | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) |
kbuild: fix make headers_install when path is too long
If headers_install is executed from a deep/long directory structure, the
shell's maximum argument length can be execeeded, which breaks the operation
with:
| make[2]: execvp: /bin/sh: Argument list too long
| make[2]: ***
Instead of passing each files name with the entire path, I give only the file
name without the source path and give this path as a new argument to
headers_install.pl.
Because there is three possible paths, I have tree input-files list, one per
path.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.headersinst | 20 | ||||
-rw-r--r-- | scripts/headers_install.sh | 7 |
2 files changed, 19 insertions, 8 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 182084d728c8..8ccf83056a7a 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -47,18 +47,24 @@ header-y := $(filter-out $(generic-y), $(header-y)) | |||
47 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) | 47 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) |
48 | output-files := $(addprefix $(installdir)/, $(all-files)) | 48 | output-files := $(addprefix $(installdir)/, $(all-files)) |
49 | 49 | ||
50 | input-files := $(foreach hdr, $(header-y), \ | 50 | input-files1 := $(foreach hdr, $(header-y), \ |
51 | $(if $(wildcard $(srcdir)/$(hdr)), \ | 51 | $(if $(wildcard $(srcdir)/$(hdr)), \ |
52 | $(wildcard $(srcdir)/$(hdr)), \ | 52 | $(wildcard $(srcdir)/$(hdr))) \ |
53 | ) | ||
54 | input-files1-name := $(notdir $(input-files1)) | ||
55 | input-files2 := $(foreach hdr, $(header-y), \ | ||
56 | $(if $(wildcard $(srcdir)/$(hdr)),, \ | ||
53 | $(if $(wildcard $(oldsrcdir)/$(hdr)), \ | 57 | $(if $(wildcard $(oldsrcdir)/$(hdr)), \ |
54 | $(wildcard $(oldsrcdir)/$(hdr)), \ | 58 | $(wildcard $(oldsrcdir)/$(hdr)), \ |
55 | $(error Missing UAPI file $(srcdir)/$(hdr))) \ | 59 | $(error Missing UAPI file $(srcdir)/$(hdr))) \ |
56 | )) \ | 60 | )) |
57 | $(foreach hdr, $(genhdr-y), \ | 61 | input-files2-name := $(notdir $(input-files2)) |
62 | input-files3 := $(foreach hdr, $(genhdr-y), \ | ||
58 | $(if $(wildcard $(gendir)/$(hdr)), \ | 63 | $(if $(wildcard $(gendir)/$(hdr)), \ |
59 | $(wildcard $(gendir)/$(hdr)), \ | 64 | $(wildcard $(gendir)/$(hdr)), \ |
60 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ | 65 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ |
61 | )) | 66 | )) |
67 | input-files3-name := $(notdir $(input-files3)) | ||
62 | 68 | ||
63 | # Work out what needs to be removed | 69 | # Work out what needs to be removed |
64 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) | 70 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) |
@@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) | |||
72 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | 78 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ |
73 | file$(if $(word 2, $(all-files)),s)) | 79 | file$(if $(word 2, $(all-files)),s)) |
74 | cmd_install = \ | 80 | cmd_install = \ |
75 | $(CONFIG_SHELL) $< $(installdir) $(input-files); \ | 81 | $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \ |
82 | $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \ | ||
83 | $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \ | ||
76 | for F in $(wrapper-files); do \ | 84 | for F in $(wrapper-files); do \ |
77 | echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ | 85 | echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ |
78 | done; \ | 86 | done; \ |
@@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file) | |||
98 | @: | 106 | @: |
99 | 107 | ||
100 | targets += $(install-file) | 108 | targets += $(install-file) |
101 | $(install-file): scripts/headers_install.sh $(input-files) FORCE | 109 | $(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE |
102 | $(if $(unwanted),$(call cmd,remove),) | 110 | $(if $(unwanted),$(call cmd,remove),) |
103 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) | 111 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) |
104 | $(call if_changed,install) | 112 | $(call if_changed,install) |
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index 643764f53ea7..5de5660cb708 100644 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | if [ $# -lt 1 ] | 3 | if [ $# -lt 1 ] |
4 | then | 4 | then |
5 | echo "Usage: headers_install.sh OUTDIR [FILES...] | 5 | echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...] |
6 | echo | 6 | echo |
7 | echo "Prepares kernel header files for use by user space, by removing" | 7 | echo "Prepares kernel header files for use by user space, by removing" |
8 | echo "all compiler.h definitions and #includes, removing any" | 8 | echo "all compiler.h definitions and #includes, removing any" |
@@ -10,6 +10,7 @@ then | |||
10 | echo "asm/inline/volatile keywords." | 10 | echo "asm/inline/volatile keywords." |
11 | echo | 11 | echo |
12 | echo "OUTDIR: directory to write each userspace header FILE to." | 12 | echo "OUTDIR: directory to write each userspace header FILE to." |
13 | echo "SRCDIR: source directory where files are picked." | ||
13 | echo "FILES: list of header files to operate on." | 14 | echo "FILES: list of header files to operate on." |
14 | 15 | ||
15 | exit 1 | 16 | exit 1 |
@@ -19,6 +20,8 @@ fi | |||
19 | 20 | ||
20 | OUTDIR="$1" | 21 | OUTDIR="$1" |
21 | shift | 22 | shift |
23 | SRCDIR="$1" | ||
24 | shift | ||
22 | 25 | ||
23 | # Iterate through files listed on command line | 26 | # Iterate through files listed on command line |
24 | 27 | ||
@@ -34,7 +37,7 @@ do | |||
34 | -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ | 37 | -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ |
35 | -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ | 38 | -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ |
36 | -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ | 39 | -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ |
37 | "$i" > "$OUTDIR/$FILE.sed" || exit 1 | 40 | "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1 |
38 | scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ | 41 | scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ |
39 | > "$OUTDIR/$FILE" | 42 | > "$OUTDIR/$FILE" |
40 | [ $? -gt 1 ] && exit 1 | 43 | [ $? -gt 1 ] && exit 1 |