generic: fix occasional "execvp: /bin/sh: Argument list too long" is kernel header...
[openwrt/staging/yousong.git] / target / linux / generic / patches-3.10 / 205-fix-headers_install.patch
1 From e60cc1b011bf0f1acdb7e5168b7bed4ebb78c91f Mon Sep 17 00:00:00 2001
2 From: Bruce Ashfield <bruce.ashfield@windriver.com>
3 Date: Wed, 9 Jan 2013 16:24:39 -0500
4 Subject: [PATCH] scripts/Makefile.headersinst: install headers from scratch file
5
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
8 with:
9
10 | make[2]: execvp: /bin/sh: Argument list too long
11 | make[2]: ***
12
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.
16
17 Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
18 [jow@openwrt.org: adapt to Linux 3.10]
19 Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
20 ---
21 scripts/Makefile.headersinst | 4 +++-
22 1 files changed, 3 insertions(+), 1 deletions(-)
23
24 --- a/scripts/Makefile.headersinst
25 +++ b/scripts/Makefile.headersinst
26 @@ -72,7 +72,7 @@ printdir = $(patsubst $(INSTALL_HDR_PATH
27 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
28 file$(if $(word 2, $(all-files)),s))
29 cmd_install = \
30 - $(CONFIG_SHELL) $< $(installdir) $(input-files); \
31 + xargs $(CONFIG_SHELL) $< $(installdir) < $(INSTALL_HDR_PATH)/.input-files; \
32 for F in $(wrapper-files); do \
33 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
34 done; \
35 @@ -101,7 +101,9 @@ targets += $(install-file)
36 $(install-file): scripts/headers_install.sh $(input-files) FORCE
37 $(if $(unwanted),$(call cmd,remove),)
38 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
39 + @echo $(input-files) > $(INSTALL_HDR_PATH)/.input-files
40 $(call if_changed,install)
41 + @rm $(INSTALL_HDR_PATH)/.input-files
42
43 else
44 __headerscheck: $(subdirs) $(check-file)