| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: GPL-2.0-only |
| 3 | |
| 4 | set -e |
| 5 | |
| 6 | destdir=${1} |
| 7 | |
| 8 | test -n "${srctree}" |
| 9 | test -n "${SRCARCH}" |
| 10 | |
| 11 | is_enabled() { |
| 12 | grep -q "^$1=y" include/config/auto.conf |
| 13 | } |
| 14 | |
| 15 | mkdir -p "${destdir}" |
| 16 | |
| 17 | ( |
| 18 | cd "${srctree}" |
| 19 | echo Makefile |
| 20 | find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*' |
| 21 | find include scripts -type f -o -type l |
| 22 | find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform |
| 23 | find "arch/${SRCARCH}" -name include -o -name scripts -type d |
| 24 | ) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}" |
| 25 | |
| 26 | { |
| 27 | if is_enabled CONFIG_OBJTOOL; then |
| 28 | echo tools/objtool/objtool |
| 29 | fi |
| 30 | |
| 31 | find "arch/${SRCARCH}/include" Module.symvers include scripts -type f |
| 32 | |
| 33 | if is_enabled CONFIG_GCC_PLUGINS; then |
| 34 | find scripts/gcc-plugins -name '*.so' |
| 35 | fi |
| 36 | } | tar -c -f - -T - | tar -xf - -C "${destdir}" |
| 37 | |
| 38 | # copy .config manually to be where it's expected to be |
| 39 | cp "${KCONFIG_CONFIG}" "${destdir}/.config" |