2 # SPDX-License-Identifier: GPL-2.0-only
9 grep -q "^$1=y" include
/config
/auto.conf
14 \
( -name atomic
-o -name dtc
-o -name kconfig
-o -name package \
) -prune -o \
15 ! -name unifdef
-a ! -name mk_elfconfig
-a \
( -type f
-o -type l \
) -print
23 find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
24 find "arch/${SRCARCH}" -name generated
-prune -o -name include
-type d
-print
25 find "arch/${SRCARCH}" -name Kbuild.platforms
-o -name Platform
26 find include \
( -name config
-o -name generated \
) -prune -o \
( -type f
-o -type l \
) -print
28 ) |
tar -c -f - -C "${srctree}" -T - |
tar -xf - -C "${destdir}"
31 if is_enabled CONFIG_OBJTOOL
; then
32 echo tools
/objtool
/objtool
36 echo "arch/${SRCARCH}/include/generated"
37 echo include
/config
/auto.conf
38 echo include
/config
/kernel.release
39 echo include
/generated
42 if is_enabled CONFIG_GCC_PLUGINS
; then
43 find scripts
/gcc-plugins
-name '*.so'
45 } |
tar -c -f - -T - |
tar -xf - -C "${destdir}"
47 # When ${CC} and ${HOSTCC} differ, rebuild host programs using ${CC}.
49 # This caters to host programs that participate in Kbuild. objtool and
50 # resolve_btfids are out of scope.
51 if [ "${CC}" != "${HOSTCC}" ]; then
52 echo "Rebuilding host programs with ${CC}..."
54 cat <<-'EOF' > "${destdir}/Kbuild"
58 # HOSTCXX is not overridden. The C++ compiler is used to build:
59 # - scripts/kconfig/qconf, which is unneeded for external module builds
60 # - GCC plugins, which will not work on the installed system even after
63 # Use the single-target build to avoid the modpost invocation, which
64 # would overwrite Module.symvers.
65 "${MAKE}" HOSTCC="${CC}" KBUILD_EXTMOD="${destdir}" scripts
/
67 cat <<-'EOF' > "${destdir}/scripts/Kbuild"
69 hostprogs-always-y := mod/modpost
70 mod/modpost-objs := $(addprefix mod/, modpost.o file2alias.o sumversion.o symsearch.o)
73 # Run once again to rebuild scripts/basic/ and scripts/mod/modpost.
74 "${MAKE}" HOSTCC="${CC}" KBUILD_EXTMOD="${destdir}" scripts
/
76 rm -f "${destdir}/Kbuild" "${destdir}/scripts/Kbuild"
79 find "${destdir}" \
( -name '.*.cmd' -o -name '*.o' \
) -delete