Exclude directories and files unnecessary for building external modules: - include/config/ (except include/config/{auto.conf,kernel.release}) - scripts/atomic/ - scripts/dtc/ - scripts/kconfig/ - scripts/mod/mk_elfconfig - scripts/package/ - scripts/unifdef - .config - *.o - .*.cmd Avoid copying files twice for the following directories: - include/generated/ - arch/*/include/generated/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
47 lines
1.2 KiB
Bash
Executable file
47 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
set -eu
|
|
|
|
destdir=${1}
|
|
|
|
is_enabled() {
|
|
grep -q "^$1=y" include/config/auto.conf
|
|
}
|
|
|
|
find_in_scripts() {
|
|
find scripts \
|
|
\( -name atomic -o -name dtc -o -name kconfig -o -name package \) -prune -o \
|
|
! -name unifdef -a ! -name mk_elfconfig -a \( -type f -o -type l \) -print
|
|
}
|
|
|
|
mkdir -p "${destdir}"
|
|
|
|
(
|
|
cd "${srctree}"
|
|
echo Makefile
|
|
find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
|
|
find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print
|
|
find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
|
|
find include \( -name config -o -name generated \) -prune -o \( -type f -o -type l \) -print
|
|
find_in_scripts
|
|
) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
|
|
|
|
{
|
|
if is_enabled CONFIG_OBJTOOL; then
|
|
echo tools/objtool/objtool
|
|
fi
|
|
|
|
echo Module.symvers
|
|
echo "arch/${SRCARCH}/include/generated"
|
|
echo include/config/auto.conf
|
|
echo include/config/kernel.release
|
|
echo include/generated
|
|
find_in_scripts
|
|
|
|
if is_enabled CONFIG_GCC_PLUGINS; then
|
|
find scripts/gcc-plugins -name '*.so'
|
|
fi
|
|
} | tar -c -f - -T - | tar -xf - -C "${destdir}"
|
|
|
|
find "${destdir}" \( -name '.*.cmd' -o -name '*.o' \) -delete
|