Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit aaed5c7

Browse files
committed
kbuild: slim down package for building external modules
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>
1 parent a660deb commit aaed5c7

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

scripts/package/install-extmod-build

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,39 @@ is_enabled() {
99
grep -q "^$1=y" include/config/auto.conf
1010
}
1111

12+
find_in_scripts() {
13+
find scripts \
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
16+
}
17+
1218
mkdir -p "${destdir}"
1319

1420
(
1521
cd "${srctree}"
1622
echo Makefile
1723
find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
18-
find include scripts -type f -o -type l
24+
find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print
1925
find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
20-
find "arch/${SRCARCH}" -name include -type d
26+
find include \( -name config -o -name generated \) -prune -o \( -type f -o -type l \) -print
27+
find_in_scripts
2128
) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
2229

2330
{
2431
if is_enabled CONFIG_OBJTOOL; then
2532
echo tools/objtool/objtool
2633
fi
2734

28-
find "arch/${SRCARCH}/include" Module.symvers include scripts -type f
35+
echo Module.symvers
36+
echo "arch/${SRCARCH}/include/generated"
37+
echo include/config/auto.conf
38+
echo include/config/kernel.release
39+
echo include/generated
40+
find_in_scripts
2941

3042
if is_enabled CONFIG_GCC_PLUGINS; then
3143
find scripts/gcc-plugins -name '*.so'
3244
fi
3345
} | tar -c -f - -T - | tar -xf - -C "${destdir}"
3446

35-
# copy .config manually to be where it's expected to be
36-
cp "${KCONFIG_CONFIG}" "${destdir}/.config"
47+
find "${destdir}" \( -name '.*.cmd' -o -name '*.o' \) -delete

0 commit comments

Comments
 (0)