Message ID | 20240727074526.1771247-4-masahiroy@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kbuild: cross-compile linux-headers package | expand |
On Sat, Jul 27, 2024 at 04:42:03PM +0900, Masahiro Yamada wrote: > Exclude directories and files unnecessary for building external modules: > > - include/config/ (except include/config/auto.conf) > - 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> > --- nice. Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Hi Masahiro, On 2024-07-27 16:42:03+0000, Masahiro Yamada wrote: > Exclude directories and files unnecessary for building external modules: > > - include/config/ (except include/config/auto.conf) > - 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> > --- > > scripts/package/install-extmod-build | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build > index 8cc9e13403ae..cc335945dfbc 100755 > --- a/scripts/package/install-extmod-build > +++ b/scripts/package/install-extmod-build > @@ -9,15 +9,22 @@ 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 include scripts -type f -o -type l > + find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print > find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform > - find "arch/${SRCARCH}" -name include -type d > + 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}" > > { > @@ -25,12 +32,15 @@ mkdir -p "${destdir}" > echo tools/objtool/objtool > fi > > - find "arch/${SRCARCH}/include" Module.symvers include scripts -type f > + echo Module.symvers > + echo "arch/${SRCARCH}/include/generated" > + echo include/config/auto.conf > + echo include/generated > + find_in_scripts This now excludes include/config/kernel.release which is used to set KERNELRELEASE, which is commonly used by Makefiles. See Documentation/kbuild/modules.txt, other users also seem not unlikely. IMO this specific file should be added back. Thanks, Thomas
On Sat, Aug 24, 2024 at 9:27 PM Thomas Weißschuh <thomas@t-8ch.de> wrote: > > Hi Masahiro, > > On 2024-07-27 16:42:03+0000, Masahiro Yamada wrote: > > Exclude directories and files unnecessary for building external modules: > > > > - include/config/ (except include/config/auto.conf) > > - 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> > > --- > > > > scripts/package/install-extmod-build | 20 +++++++++++++++----- > > 1 file changed, 15 insertions(+), 5 deletions(-) > > > > diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build > > index 8cc9e13403ae..cc335945dfbc 100755 > > --- a/scripts/package/install-extmod-build > > +++ b/scripts/package/install-extmod-build > > @@ -9,15 +9,22 @@ 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 include scripts -type f -o -type l > > + find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print > > find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform > > - find "arch/${SRCARCH}" -name include -type d > > + 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}" > > > > { > > @@ -25,12 +32,15 @@ mkdir -p "${destdir}" > > echo tools/objtool/objtool > > fi > > > > - find "arch/${SRCARCH}/include" Module.symvers include scripts -type f > > + echo Module.symvers > > + echo "arch/${SRCARCH}/include/generated" > > + echo include/config/auto.conf > > + echo include/generated > > + find_in_scripts > > This now excludes include/config/kernel.release which is used to set > KERNELRELEASE, which is commonly used by Makefiles. > See Documentation/kbuild/modules.txt, other users also seem not unlikely. > > IMO this specific file should be added back. Agree. I fixed it up locally. Thanks for the report.
On 7/27/2024 1:42 AM, Masahiro Yamada wrote: > Exclude directories and files unnecessary for building external modules: > > - include/config/ (except include/config/auto.conf) > - scripts/atomic/ > - scripts/dtc/ > - scripts/kconfig/ > - scripts/mod/mk_elfconfig > - scripts/package/ > - scripts/unifdef > - .config Please revert this (the removal of .config). I got some strange reports that our external module install broke, and traced it to this change. Our external module references the .config because we have different logic for the build depending on if other, related modules are present or not. Also, it looks like this broke DKMS for some configurations, which not only impacts DKMS itself [1] but also downstream projects [2]. While DKMS may be updated going forward to avoid this issue, there are plenty of affected version out in the wild. Also, I haven't surveyed every distro, but it looks like Ubuntu still packages the .config with their headers in their upcoming "Plucky" release based on 6.12. I suspect they wouldn't do that if they didn't feel it was needed/useful. -Jeff [1]: https://github.com/dell/dkms/issues/464 [2]: https://github.com/linux-surface/linux-surface/issues/1654
diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build index 8cc9e13403ae..cc335945dfbc 100755 --- a/scripts/package/install-extmod-build +++ b/scripts/package/install-extmod-build @@ -9,15 +9,22 @@ 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 include scripts -type f -o -type l + find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform - find "arch/${SRCARCH}" -name include -type d + 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}" { @@ -25,12 +32,15 @@ mkdir -p "${destdir}" echo tools/objtool/objtool fi - find "arch/${SRCARCH}/include" Module.symvers include scripts -type f + echo Module.symvers + echo "arch/${SRCARCH}/include/generated" + echo include/config/auto.conf + 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}" -# copy .config manually to be where it's expected to be -cp "${KCONFIG_CONFIG}" "${destdir}/.config" +find "${destdir}" \( -name '.*.cmd' -o -name '*.o' \) -delete
Exclude directories and files unnecessary for building external modules: - include/config/ (except include/config/auto.conf) - 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> --- scripts/package/install-extmod-build | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)