1 From b200d4bcffc86bb08fd3898bc7cde00f0686f62d Mon Sep 17 00:00:00 2001
2 From: Robert Yang <liezhi.yang@windriver.com>
3 Date: Fri, 13 Sep 2013 22:01:02 -0400
4 Subject: [PATCH] scripts/Makefile.headersinst: install headers from scratch file
6 If headers_install is executed from a deep/long directory structure, the
7 shell's maximum argument length can be execeeded, which breaks the operation
10 | make[2]: execvp: /bin/sh: Argument list too long
13 By dumping the input files to a scratch file and using xargs to read the
14 input list from the scratch file, we can avoid blowing out the maximum
15 argument size and install headers in a long path name environment.
18 Use "$(foreach ,,$(shell echo))" rather than "echo" to make it work when
21 Upstream-Status: Inappropriate [oe-specific]
23 Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
24 Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
26 RP: Refreshed for 3.10 as the problem still exists there on the autobuilders
27 scripts/Makefile.headersinst | 9 ++++++++-
28 1 file changed, 8 insertions(+), 1 deletion(-)
30 diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
31 --- a/scripts/Makefile.headersinst
32 +++ b/scripts/Makefile.headersinst
33 @@ -72,7 +72,7 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
34 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
35 file$(if $(word 2, $(all-files)),s))
37 - $(CONFIG_SHELL) $< $(installdir) $(input-files); \
38 + xargs $(CONFIG_SHELL) $< $(installdir) < $(INSTALL_HDR_PATH)/.input-files; \
39 for F in $(wrapper-files); do \
40 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
42 @@ -98,10 +98,17 @@ __headersinst: $(subdirs) $(install-file)
45 targets += $(install-file)
46 +# Use the $(foreach ,,$(shell echo)) to avoid the "Argument list too
47 +# long" error, and use the "$(shell echo)" rather than "echo" to keep
49 $(install-file): scripts/headers_install.sh $(input-files) FORCE
50 $(if $(unwanted),$(call cmd,remove),)
51 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
52 + $(shell echo -n > $(INSTALL_HDR_PATH)/.input-files)
53 + $(foreach f,$(input-files),$(shell echo -n "$(f) " >> \
54 + $(INSTALL_HDR_PATH)/.input-files))
55 $(call if_changed,install)
56 + @rm $(INSTALL_HDR_PATH)/.input-files
59 __headerscheck: $(subdirs) $(check-file)