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