History

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/

Masahiro Yamada committed 2 years ago

Commit aaed5c71 parent a660deb1 file · +16 −5Browse files

Unified · Split

scripts/package/install-extmod-build+16−5
@@ -9,15 +9,22 @@ is_enabled() { · 8 unmodified lines
9 grep -q "^$1=y" include/config/auto.conf9 grep -q "^$1=y" include/config/auto.conf
10}10}
11 11
12find_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
12mkdir -p "${destdir}"18mkdir -p "${destdir}"
13 19
14(20(
15 cd "${srctree}"21 cd "${srctree}"
16 echo Makefile22 echo Makefile
17 find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'23 find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
18 find include scripts -type f -o -type l24 find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print
19 find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform25 find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
20 find "arch/${SRCARCH}" -name include -type d26 find include \( -name config -o -name generated \) -prune -o \( -type f -o -type l \) -print
27 find_in_scripts
21) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"28) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
22 29
23{30{
@@ -25,12 +32,16 @@ mkdir -p "${destdir}" · 1 unmodified line
25 echo tools/objtool/objtool32 echo tools/objtool/objtool
26 fi33 fi
27 34
28 find "arch/${SRCARCH}/include" Module.symvers include scripts -type f35 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
29 41
30 if is_enabled CONFIG_GCC_PLUGINS; then42 if is_enabled CONFIG_GCC_PLUGINS; then
31 find scripts/gcc-plugins -name '*.so'43 find scripts/gcc-plugins -name '*.so'
32 fi44 fi
33} | tar -c -f - -T - | tar -xf - -C "${destdir}"45} | tar -c -f - -T - | tar -xf - -C "${destdir}"
34 46
35# copy .config manually to be where it's expected to be47find "${destdir}" \( -name '.*.cmd' -o -name '*.o' \) -delete
36cp "${KCONFIG_CONFIG}" "${destdir}/.config"