Skip to content

Commit 7211b8b

Browse files
sposelenov-emcraftsravnborg
authored andcommitted
kbuild: fix "Argument list too long" error for "make headers_check",
I'm trying to install kernel headers to build a cross-toolchain, but got the following: make ARCH=arm INSTALL_HDR_PATH=/work/psl/eldk-builds/arm-2009-04-21/work/var/tmp/crosstool-0.43-3-root/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/ +arm-linux-gnueabi/arm-linux-gnueabi/ headers_check ... CHECK include/linux/raid (2 files) CHECK include/linux/spi (1 files) CHECK include/linux/sunrpc (1 files) CHECK include/linux/tc_act (6 files) CHECK include/linux/tc_ematch (4 files) CHECK include/linux/usb (8 files) make[2]: execvp: /bin/sh: Argument list too long make[2]: *** [/work/psl/eldk-builds/arm-2009-04-21/work/var/tmp/crosstool-0.43-3-root/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueab +i/arm-linux-gnueabi//include/linux/.check] Error 127 make[1]: *** [linux] Error 2 make: *** [headers_check] Error 2 -> Introduce use of xargs to fix this. Signed-off-by: Sergei Poselenov <[email protected]> Cc: Wolfgang Denk <[email protected]> Signed-off-by: Sam Ravnborg <[email protected]>
1 parent 35763e8 commit 7211b8b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/Makefile.headersinst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ quiet_cmd_remove = REMOVE $(unwanted)
5454
cmd_remove = rm -f $(unwanted-file)
5555

5656
quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
57-
cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \
58-
$(addprefix $(install)/, $(all-files)); \
57+
# Headers list can be pretty long, xargs helps to avoid
58+
# the "Argument list too long" error.
59+
cmd_check = for f in $(all-files); do \
60+
echo "$(install)/$${f}"; done \
61+
| xargs \
62+
$(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
5963
touch $@
6064

6165
PHONY += __headersinst __headerscheck

0 commit comments

Comments
 (0)