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

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/package/install-extmod-build+16−5
@@ -9,15 +9,22 @@ is_enabled() { · 8 unmodified lines
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 {
@@ -25,12 +32,16 @@ mkdir -p "${destdir}" · 1 unmodified line
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