kbuild: fix some packaging issues, and use git-archive for source package
cover kbuild: fix some packaging issues, and use git-archive for source package
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Masahiro Yamada (6):
kbuild: deb-pkg: make debian source package working again
kbuild: deb-pkg: do not take KERNELRELEASE from the source version
kbuild: deb-pkg: set CROSS_COMPILE only when undefined
kbuild: deb-pkg: split image and debug objects staging out into
functions
kbuild: deb-pkg: use dh_listpackages to know enabled packages
kbuild: use git-archive for source package creation
.gitignore | 1 + Makefile | 9 +- scripts/.gitignore | 1 - scripts/Makefile | 2 +- scripts/Makefile.package | 113 ++-- scripts/check-git | 14 + scripts/list-gitignored.c | 1057 ------------------------------ scripts/package/builddeb | 269 ++++---- scripts/package/deb-build-option | 14 +- scripts/package/gen-diff-patch | 44 ++ scripts/package/mkdebian | 24 +- scripts/package/mkspec | 17 +- scripts/setlocalversion | 45 +- 13 files changed, 335 insertions(+), 1275 deletions(-) create mode 100755 scripts/check-git delete mode 100644 scripts/list-gitignored.c create mode 100755 scripts/package/gen-diff-patch
Signature · 1 line
2.34.1
PATCH 1/6 kbuild: deb-pkg: make debian source package working again
Since commit c5bf2efb058d ("kbuild: deb-pkg: fix binary-arch and clean in debian/rules"), the source package generated by 'make deb-pkg' fails to build.
I terribly missed the fact that the intdeb-pkg target may regenerate include/config/kernel.release due to the following in the top Makefile:
%pkg: include/config/kernel.release FORCE
Restore KERNELRELEASE= option to avoid the kernel.release disagreement between build-arch and binary-arch.
---
scripts/package/mkdebian | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/package/mkdebian +4 -1
@@ -239,6 +239,7 @@ cat <<EOF > debian/rules #!$(command -v $MAKE) -f srctree ?= . +KERNELRELEASE = ${KERNELRELEASE} build-indep: build-arch:
@@ -250,7 +251,9 @@ build: build-arch binary-indep: binary-arch: build-arch - \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg + \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \ + KERNELRELEASE=\$(KERNELRELEASE) intdeb-pkg + clean: rm -rf debian/files debian/linux-* \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
Signature · 1 line
2.34.1
PATCH 2/6 kbuild: deb-pkg: do not take KERNELRELEASE from the source version
In reply to Masahiro YamadaKERNELRELEASE does not need to match the package version in changelog. Rather, it conventially matches what is called 'ABINAME', which is a part of the binary package names.
Both are the same by default, but the former might be overridden by KDEB_PKGVERSION. In this case, the resulting package would not boot because /lib/modules/$(uname -r) does not point the module directory.
Partially revert 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package").
---
scripts/package/deb-build-option | 9 ++++----- scripts/package/mkdebian | 1 + 2 files changed, 5 insertions(+), 5 deletions(-)
scripts/package/deb-build-option +4 -5
@@ -8,9 +8,8 @@ if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUI fi version=$(dpkg-parsechangelog -S Version) -version_upstream="${version%-*}" -debian_revision="${version#${version_upstream}}" -debian_revision="${debian_revision#*-}" +debian_revision="${version##*-}" -echo KERNELRELEASE=${version_upstream} -echo KBUILD_BUILD_VERSION=${debian_revision} +if [ "${version}" != "${debian_revision}" ]; then + echo KBUILD_BUILD_VERSION=${debian_revision} +fi
scripts/package/mkdebian +1 -0
@@ -244,6 +244,7 @@ KERNELRELEASE = ${KERNELRELEASE} build-indep: build-arch: \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \ + KERNELRELEASE=\$(KERNELRELEASE) \ \$(shell \$(srctree)/scripts/package/deb-build-option) \ olddefconfig all
Signature · 1 line
2.34.1
Re: [PATCH 2/6] kbuild: deb-pkg: do not take KERNELRELEASE from the source version
Hi,
Quoted 10 lines · Masahiro Yamada
KERNELRELEASE does not need to match the package version in changelog. Rather, it conventially matches what is called 'ABINAME', which is a part of the binary package names.
Both are the same by default, but the former might be overridden by
KDEB_PKGVERSION. In this case, the resulting package would not boot because /lib/modules/$(uname -r) does not point the module directory.Partially revert
3ab18a625ce4("kbuild: deb-pkg: improve the usability of source package").
Thank you, I have tested locally and in our CI, bindeb-pkg target works again.
Quoted 40 lines
Reported-by Péter Ujfalusi <[email protected]>Fixes 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package")Signed-off-by Masahiro Yamada <[email protected]>---
scripts/package/deb-build-option | 9 ++++----- scripts/package/mkdebian | 1 + 2 files changed, 5 insertions(+), 5 deletions(-)scripts/package/deb-build-option +4
-5@@ -8,9 +8,8 @@ if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUI fi version=$(dpkg-parsechangelog -S Version) -version_upstream="${version%-*}" -debian_revision="${version#${version_upstream}}" -debian_revision="${debian_revision#*-}" +debian_revision="${version##*-}" -echo KERNELRELEASE=${version_upstream} -echo KBUILD_BUILD_VERSION=${debian_revision} +if [ "${version}" != "${debian_revision}" ]; then + echo KBUILD_BUILD_VERSION=${debian_revision} +fiscripts/package/mkdebian +1
-0@@ -244,6 +244,7 @@ KERNELRELEASE = ${KERNELRELEASE} build-indep: build-arch: \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \ + KERNELRELEASE=\$(KERNELRELEASE) \ \$(shell \$(srctree)/scripts/package/deb-build-option) \ olddefconfig all
Signature · 1 line
Péter
PATCH 3/6 kbuild: deb-pkg: set CROSS_COMPILE only when undefined
In reply to Masahiro YamadaCommit 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package") set needless CROSS_COMPILE.
For example, 'make allnoconfig bindeb-pkg' on a x86_64 system will set CROSS_COMPILE=i686-linux-gnu-, where the biarch compiler 'gcc' should work for building the i386 kernel.
$ uname -m x86_64 $ make allnoconfig bindeb-pkg >/dev/null dpkg-architecture: warning: specified GNU system type i686-linux-gnu does not match CC system type x86_64-linux-gnu, try setting a correct CC environment variable dpkg-source --before-build . debian/rules binary scripts/Kconfig.include:39: C compiler 'i686-linux-gnu-gcc' not found make[6]: *** [scripts/kconfig/Makefile:77: olddefconfig] Error 1 make[5]: *** [Makefile:693: olddefconfig] Error 2 make[4]: *** [Makefile:358: __build_one_by_one] Error 2 make[3]: *** [debian/rules:7: build-arch] Error 2 dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2 make[2]: *** [scripts/Makefile.package:127: bindeb-pkg] Error 2 make[1]: *** [Makefile:1657: bindeb-pkg] Error 2 make: *** [Makefile:358: __build_one_by_one] Error 2
Check whether CROSS_COMPILE is defined, instead of whether it is non-empty.
If you invoke debian/rules via Kbuild, CROSS_COMPILE is always defined in the top Makefile.
---
scripts/package/deb-build-option | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
scripts/package/deb-build-option +2 -3
@@ -1,9 +1,8 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only -# Set up CROSS_COMPILE if we are cross-compiling, but not called from the -# kernel toplevel Makefile -if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then +# Set up CROSS_COMPILE if not defined yet +if [ "${CROSS_COMPILE+set}" != "set" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- fi
Signature · 1 line
2.34.1
PATCH 4/6 kbuild: deb-pkg: split image and debug objects staging out into functions
In reply to Masahiro YamadaPrepare for the refactoring in the next commit.
---
scripts/package/builddeb | 222 ++++++++++++++++++++------------------- 1 file changed, 116 insertions(+), 106 deletions(-)
scripts/package/builddeb +116 -106
@@ -51,6 +51,115 @@ create_package() { dpkg-deb $dpkg_deb_opts ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" .. } +install_linux_image () { + pdir=$1 + pname=$2 + + rm -rf ${pdir} + + # Only some architectures with OF support have this target + if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then + ${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install + fi + + if is_enabled CONFIG_MODULES; then + ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install + rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build" + rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source" + if [ "${SRCARCH}" = um ] ; then + mkdir -p "${pdir}/usr/lib/uml/modules" + mv "${pdir}/lib/modules/${KERNELRELEASE}" "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}" + fi + fi + + # Install the kernel + if [ "${ARCH}" = um ] ; then + mkdir -p "${pdir}/usr/bin" "${pdir}/usr/share/doc/${pname}" + cp System.map "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}/System.map" + cp ${KCONFIG_CONFIG} "${pdir}/usr/share/doc/${pname}/config" + gzip "${pdir}/usr/share/doc/${pname}/config" + else + mkdir -p "${pdir}/boot" + cp System.map "${pdir}/boot/System.map-${KERNELRELEASE}" + cp ${KCONFIG_CONFIG} "${pdir}/boot/config-${KERNELRELEASE}" + fi + + # Not all arches have the same installed path in debian + # XXX: have each arch Makefile export a variable of the canonical image install + # path instead + case "${SRCARCH}" in + um) + installed_image_path="usr/bin/linux-${KERNELRELEASE}";; + parisc|mips|powerpc) + installed_image_path="boot/vmlinux-${KERNELRELEASE}";; + *) + installed_image_path="boot/vmlinuz-${KERNELRELEASE}";; + esac + cp "$(${MAKE} -s -f ${srctree}/Makefile image_name)" "${pdir}/${installed_image_path}" + + # Install the maintainer scripts + # Note: hook scripts under /etc/kernel are also executed by official Debian + # kernel packages, as well as kernel packages built using make-kpkg. + # make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and + # so do we; recent versions of dracut and initramfs-tools will obey this. + debhookdir=${KDEB_HOOKDIR:-/etc/kernel} + for script in postinst postrm preinst prerm; do + mkdir -p "${pdir}${debhookdir}/${script}.d" + + mkdir -p "${pdir}/DEBIAN" + cat <<-EOF > "${pdir}/DEBIAN/${script}" + + #!/bin/sh + + set -e + + # Pass maintainer script parameters to hook scripts + export DEB_MAINT_PARAMS="\$*" + + # Tell initramfs builder whether it's wanted + export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No) + + test -d ${debhookdir}/${script}.d && run-parts --arg="${KERNELRELEASE}" --arg="/${installed_image_path}" ${debhookdir}/${script}.d + exit 0 + EOF + chmod 755 "${pdir}/DEBIAN/${script}" + done +} + +install_linux_image_dbg () { + pdir=$1 + image_pdir=$2 + + rm -rf ${pdir} + + for module in $(find ${image_pdir}/lib/modules/ -name *.ko -printf '%P\n'); do + module=lib/modules/${module} + mkdir -p $(dirname ${pdir}/usr/lib/debug/${module}) + # only keep debug symbols in the debug file + ${OBJCOPY} --only-keep-debug ${image_pdir}/${module} ${pdir}/usr/lib/debug/${module} + # strip original module from debug symbols + ${OBJCOPY} --strip-debug ${image_pdir}/${module} + # then add a link to those + ${OBJCOPY} --add-gnu-debuglink=${pdir}/usr/lib/debug/${module} ${image_pdir}/${module} + done + + # re-sign stripped modules + if is_enabled CONFIG_MODULE_SIG_ALL; then + ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${image_pdir}" modules_sign + fi + + # Build debug package + # Different tools want the image in different locations + # perf + mkdir -p ${pdir}/usr/lib/debug/lib/modules/${KERNELRELEASE}/ + cp vmlinux ${pdir}/usr/lib/debug/lib/modules/${KERNELRELEASE}/ + # systemtap + mkdir -p ${pdir}/usr/lib/debug/boot/ + ln -s ../lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/boot/vmlinux-${KERNELRELEASE} + # kdump-tools + ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE} +} + deploy_kernel_headers () { pdir=$1
@@ -105,8 +214,6 @@ deploy_libc_headers () { } version=$KERNELRELEASE -tmpdir=debian/linux-image -dbg_dir=debian/linux-image-dbg packagename=linux-image-$version dbg_packagename=$packagename-dbg
@@ -114,97 +221,7 @@ if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi -# Not all arches have the same installed path in debian -# XXX: have each arch Makefile export a variable of the canonical image install -# path instead -case $ARCH in -um) - installed_image_path="usr/bin/linux-$version" - ;; -parisc|mips|powerpc) - installed_image_path="boot/vmlinux-$version" - ;; -*) - installed_image_path="boot/vmlinuz-$version" -esac - -BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes) - -# Setup the directory structure -rm -rf "$tmpdir" "$dbg_dir" debian/files -mkdir -m 755 -p "$tmpdir/DEBIAN" -mkdir -p "$tmpdir/lib" "$tmpdir/boot" - -# Install the kernel -if [ "$ARCH" = "um" ] ; then - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename" - cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" - cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config" - gzip "$tmpdir/usr/share/doc/$packagename/config" -else - cp System.map "$tmpdir/boot/System.map-$version" - cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version" -fi -cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path" - -if is_enabled CONFIG_OF_EARLY_FLATTREE; then - # Only some architectures with OF support have this target - if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then - $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install - fi -fi - -if is_enabled CONFIG_MODULES; then - INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install - rm -f "$tmpdir/lib/modules/$version/build" - rm -f "$tmpdir/lib/modules/$version/source" - if [ "$ARCH" = "um" ] ; then - mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" - rmdir "$tmpdir/lib/modules/$version" - fi - if [ -n "$BUILD_DEBUG" ] ; then - for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do - module=lib/modules/$module - mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) - # only keep debug symbols in the debug file - $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module - # strip original module from debug symbols - $OBJCOPY --strip-debug $tmpdir/$module - # then add a link to those - $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module - done - - # resign stripped modules - if is_enabled CONFIG_MODULE_SIG_ALL; then - INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign - fi - fi -fi - -# Install the maintainer scripts -# Note: hook scripts under /etc/kernel are also executed by official Debian -# kernel packages, as well as kernel packages built using make-kpkg. -# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and -# so do we; recent versions of dracut and initramfs-tools will obey this. -debhookdir=${KDEB_HOOKDIR:-/etc/kernel} -for script in postinst postrm preinst prerm ; do - mkdir -p "$tmpdir$debhookdir/$script.d" - cat <<EOF > "$tmpdir/DEBIAN/$script" -#!/bin/sh - -set -e - -# Pass maintainer script parameters to hook scripts -export DEB_MAINT_PARAMS="\$*" - -# Tell initramfs builder whether it's wanted -export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No) - -test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d -exit 0 -EOF - chmod 755 "$tmpdir/DEBIAN/$script" -done +rm -f debian/files if [ "$ARCH" != "um" ]; then if is_enabled CONFIG_MODULES; then
@@ -216,20 +233,13 @@ if [ "$ARCH" != "um" ]; then create_package linux-libc-dev debian/linux-libc-dev fi -create_package "$packagename" "$tmpdir" +install_linux_image debian/linux-image "$packagename" -if [ -n "$BUILD_DEBUG" ] ; then - # Build debug package - # Different tools want the image in different locations - # perf - mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/ - cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/ - # systemtap - mkdir -p $dbg_dir/usr/lib/debug/boot/ - ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version - # kdump-tools - ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version - create_package "$dbg_packagename" "$dbg_dir" +if is_enabled CONFIG_DEBUG_INFO; then + install_linux_image_dbg debian/linux-image-dbg debian/linux-image + create_package "$dbg_packagename" debian/linux-image-dbg fi +create_package "$packagename" debian/linux-image + exit 0
Signature · 1 line
2.34.1
PATCH 5/6 kbuild: deb-pkg: use dh_listpackages to know enabled packages
In reply to Masahiro YamadaUse dh_listpackages to get a list of all binary packages.
With this, debian/control lists which binary packages will be produced. Previously, ARCH=um listed linux-libc-dev in debian/control, but it was not generated because each of mkdebian and builddeb independently maintained the if-conditionals.
Another motivation is to allow scripts/package/builddeb to get the package name (linux-image-*, etc.) dynamically from debian/control.
This will also allow the BuildProfile to control the generation of the binary packages.
---
scripts/package/builddeb | 61 ++++++++++++++++++++++------------------ scripts/package/mkdebian | 7 ++++- 2 files changed, 39 insertions(+), 29 deletions(-)
scripts/package/builddeb +33 -28
@@ -160,7 +160,7 @@ install_linux_image_dbg () { ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE} } -deploy_kernel_headers () { +install_kernel_headers () { pdir=$1 rm -rf $pdir
@@ -198,7 +198,7 @@ deploy_kernel_headers () { ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build } -deploy_libc_headers () { +install_libc_headers () { pdir=$1 rm -rf $pdir
@@ -213,33 +213,38 @@ deploy_libc_headers () { mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ } -version=$KERNELRELEASE -packagename=linux-image-$version -dbg_packagename=$packagename-dbg - -if [ "$ARCH" = "um" ] ; then - packagename=user-mode-linux-$version -fi - rm -f debian/files -if [ "$ARCH" != "um" ]; then - if is_enabled CONFIG_MODULES; then - deploy_kernel_headers debian/linux-headers - create_package linux-headers-$version debian/linux-headers - fi - - deploy_libc_headers debian/linux-libc-dev - create_package linux-libc-dev debian/linux-libc-dev -fi - -install_linux_image debian/linux-image "$packagename" - -if is_enabled CONFIG_DEBUG_INFO; then - install_linux_image_dbg debian/linux-image-dbg debian/linux-image - create_package "$dbg_packagename" debian/linux-image-dbg -fi - -create_package "$packagename" debian/linux-image +packages_enabled=$(dh_listpackages) + +for package in ${packages_enabled} +do + case ${package} in + *-dbg) + # This must be done after linux-image, that is, we expect the + # debug package appears after linux-image in debian/control. + install_linux_image_dbg debian/linux-image-dbg debian/linux-image;; + linux-image-*|user-mode-linux-*) + install_linux_image debian/linux-image ${package};; + linux-libc-dev) + install_libc_headers debian/linux-libc-dev;; + linux-headers-*) + install_kernel_headers debian/linux-headers;; + esac +done + +for package in ${packages_enabled} +do + case ${package} in + *-dbg) + create_package ${package} debian/linux-image-dbg;; + linux-image-*|user-mode-linux-*) + create_package ${package} debian/linux-image;; + linux-libc-dev) + create_package ${package} debian/linux-libc-dev;; + linux-headers-*) + create_package ${package} debian/linux-headers;; + esac +done exit 0
scripts/package/mkdebian +6 -1
@@ -192,7 +192,7 @@ Section: kernel Priority: optional Maintainer: $maintainer Rules-Requires-Root: no -Build-Depends: bc, rsync, kmod, cpio, bison, flex $extra_build_depends +Build-Depends: bc, debhelper, rsync, kmod, cpio, bison, flex $extra_build_depends Homepage: https://www.kernel.org/ Package: $packagename-$version
@@ -200,6 +200,10 @@ Architecture: $debarch Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other files, version: $version. +EOF + +if [ "${SRCARCH}" != um ]; then +cat <<EOF >> debian/control Package: linux-libc-dev Section: devel
@@ -222,6 +226,7 @@ Description: Linux kernel headers for $version on $debarch This is useful for people who need to build external modules EOF fi +fi if is_enabled CONFIG_DEBUG_INFO; then cat <<EOF >> debian/control
Signature · 1 line
2.34.1
PATCH 6/6 kbuild: use git-archive for source package creation
In reply to Masahiro YamadaCommit 5c3d1d0abb12 ("kbuild: add a tool to list files ignored by git") added a new tool, scripts/list-gitignored. My intention was to create source packages without cleaning the source tree, without relying on git.
Linus strongly objected to it, and suggested using 'git archive'. [1] [2] [3]
This commit goes in that direction. Remove scripts/list-gitignored.c and rewrites Makefiles and scripts to use 'git archive'.
Going forward, building source packages is only possible in a git-managed tree. Building binary packages does not require git.
[1]: https://lore.kernel.org/lkml/CAHk-=wi49sMaC7vY1yMagk7eqLK=1jHeHQ=yZ_k45P=xBccnmA@mail.gmail.com/
[2]: https://lore.kernel.org/lkml/CAHk-=wh5AixGsLeT0qH2oZHKq0FLUTbyTw4qY921L=PwYgoGVw@mail.gmail.com/
[3]: https://lore.kernel.org/lkml/CAHk-=wgM-W6Fu==EoAVCabxyX8eYBz9kNC88-tm9ExRQwA79UQ@mail.gmail.com/
---
.gitignore | 1 + Makefile | 9 +- scripts/.gitignore | 1 - scripts/Makefile | 2 +- scripts/Makefile.package | 113 ++-- scripts/check-git | 14 + scripts/list-gitignored.c | 1057 -------------------------------- scripts/package/gen-diff-patch | 44 ++ scripts/package/mkdebian | 11 +- scripts/package/mkspec | 17 +- scripts/setlocalversion | 45 +- 11 files changed, 176 insertions(+), 1138 deletions(-) create mode 100755 scripts/check-git delete mode 100644 scripts/list-gitignored.c create mode 100755 scripts/package/gen-diff-patch
.gitignore +1 -0
@@ -78,6 +78,7 @@ modules.order # RPM spec file (make rpm-pkg) # /*.spec +/rpmbuild/ # # Debian directory (make deb-pkg)
Makefile +2 -7
@@ -274,8 +274,7 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers headers_% archheaders archscripts \ %asm-generic kernelversion %src-pkg dt_binding_check \ - outputmakefile rustavailable rustfmt rustfmtcheck \ - scripts_package + outputmakefile rustavailable rustfmt rustfmtcheck # Installation targets should not require compiler. Unfortunately, vdso_install # is an exception where build artifacts may be updated. This must be fixed. no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
@@ -1605,7 +1604,7 @@ MRPROPER_FILES += include/config include/generated \ certs/signing_key.pem \ certs/x509.genkey \ vmlinux-gdb.py \ - *.spec \ + *.spec rpmbuild \ rust/libmacros.so # clean - Delete most, but leave enough to build external modules
@@ -1656,10 +1655,6 @@ distclean: mrproper %pkg: include/config/kernel.release FORCE $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ -PHONY += scripts_package -scripts_package: scripts_basic - $(Q)$(MAKE) $(build)=scripts scripts/list-gitignored - # Brief documentation of the typical targets used # ---------------------------------------------------------------------------
scripts/.gitignore +0 -1
@@ -3,7 +3,6 @@ /generate_rust_target /insert-sys-cert /kallsyms -/list-gitignored /module.lds /recordmcount /sign-file
scripts/Makefile +1 -1
@@ -38,7 +38,7 @@ HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED endif # The following programs are only built on demand -hostprogs += list-gitignored unifdef +hostprogs += unifdef # The module linker script is preprocessed on demand targets += module.lds
scripts/Makefile.package +55 -58
170 lines not on this page · raw message
scripts/check-git new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only +# +# succeed if this script is in the git-managed repository + +srctree="$(dirname $0)/.." + +if ! git -C "${srctree}" rev-parse --verify HEAD >/dev/null 2>/dev/null; then + exit 1 +fi + +if ! test -z $(git -C "${srctree}" rev-parse --show-cdup 2>/dev/null); then + exit 1 +fi
scripts/list-gitignored.c deleted +0 -1057
1,057 lines not on this page · raw message
scripts/package/gen-diff-patch new file +44 -0
44 lines not on this page · raw message
scripts/package/mkdebian +10 -1
@@ -88,10 +88,11 @@ rm -rf debian # Some variables and settings used throughout the script version=$KERNELRELEASE + if [ -n "$KDEB_PKGVERSION" ]; then packageversion=$KDEB_PKGVERSION else - packageversion=$version-$($srctree/init/build-version) + packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/init/build-version) fi sourcename=${KDEB_SOURCENAME:-linux-upstream}
@@ -152,6 +153,14 @@ mkdir -p debian/patches } > debian/patches/config echo config > debian/patches/series +$(dirname $0)/gen-diff-patch debian/patches/diff.patch debian/patches/untracked.patch +if [ -f debian/patches/diff.patch ]; then + echo diff.patch >> debian/patches/series +fi +if [ -f debian/patches/untracked.patch ]; then + echo untracked.patch >> debian/patches/series +fi + echo $debarch > debian/arch extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)" extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
scripts/package/mkspec +15 -2
@@ -15,6 +15,11 @@ if [ "$1" = prebuilt ]; then MAKE="$MAKE -f $srctree/Makefile" else S= + + mkdir -p rpmbuild/SOURCES + cp .config rpmbuild/SOURCES/config + $(dirname $0)/gen-diff-patch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch + touch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch fi if grep -q CONFIG_MODULES=y .config; then
@@ -48,7 +53,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF Vendor: The Linux Community URL: https://www.kernel.org $S Source0: linux.tar.gz -$S Source1: .config +$S Source1: config +$S Source2: diff.patch +$S Source3: untracked.patch Provides: $PROVIDES $S BuildRequires: bc binutils bison dwarves $S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
@@ -85,7 +92,13 @@ $S$M against the $__KERNELRELEASE kernel package. $S$M $S %prep $S %setup -q -n linux -$S cp %{SOURCE1} . +$S cp %{SOURCE1} .config +$S if [ -s %{SOURCE2} ]; then +$S patch -p1 < %{SOURCE2} +$S fi +$S if [ -s %{SOURCE3} ]; then +$S patch -p1 < %{SOURCE3} +$S fi $S $S %build $S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
scripts/setlocalversion +34 -11
81 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 6/6 kbuild: use git-archive for source package creation
This patch cause build time a bit longer.
I use "time make targz-pkg -i -j8" build kernel, this patch will first create *.tar file, then create *.tar.gz file, build time a bit longer. './System.map' -> 'tar-install/boot/System.map-6.3.0-rc5-android-x86_64+'
'.config' -> 'tar-install/boot/config-6.3.0-rc5-android-x86_64+'
'./vmlinux' -> 'tar-install/boot/vmlinux-6.3.0-rc5-android-x86_64+'
'./arch/x86/boot/bzImage' -> 'tar-install/boot/vmlinuz-6.3.0-rc5-android-x86_64+'
TAR linux-6.3.0-rc5-android-x86_64+-x86.tar
GZIP linux-6.3.0-rc5-android-x86_64+-x86.tar.gz
real 0m37.991s user 0m47.529s sys 0m8.235s
Revert "kbuild: use git-archive for source package creation" './System.map' -> 'tar-install/boot/System.map-6.3.0-rc5-android-x86_64+' '.config' -> 'tar-install/boot/config-6.3.0-rc5-android-x86_64+' './vmlinux' -> 'tar-install/boot/vmlinux-6.3.0-rc5-android-x86_64+' './arch/x86/boot/bzImage' -> 'tar-install/boot/vmlinuz-6.3.0-rc5-android-x86_64+'
TAR linux-6.3.0-rc5-android-x86_64+-x86.tar.gz
real 0m11.006s user 0m21.079s sys 0m7.830s
I don't like *.tar file, i will delete *.tar file when every time build kernel, i need *.tar.gz file, if one file is i needn't, i will delete it. linux-6.3.0-rc5-android-x86_64+-x86.tar.gz file is i need, linux-6.3.0-rc5-android-x86_64+-x86.tar is i needn't.
Re: [PATCH 6/6] kbuild: use git-archive for source package creation
Quoted 21 lines · On Fri, Apr 7, 2023 at 12:25 AM youling257 <[email protected]> wrote:
This patch cause build time a bit longer.
I use "time make targz-pkg -i -j8" build kernel, this patch will first create *.tar file, then create *.tar.gz file, build time a bit longer. './System.map' -> 'tar-install/boot/System.map-6.3.0-rc5-android-x86_64+'
'.config' -> 'tar-install/boot/config-6.3.0-rc5-android-x86_64+'
'./vmlinux' -> 'tar-install/boot/vmlinux-6.3.0-rc5-android-x86_64+'
'./arch/x86/boot/bzImage' -> 'tar-install/boot/vmlinuz-6.3.0-rc5-android-x86_64+'
TAR linux-6.3.0-rc5-android-x86_64+-x86.tar
GZIP linux-6.3.0-rc5-android-x86_64+-x86.tar.gzreal 0m37.991s user 0m47.529s sys 0m8.235sRevert "kbuild: use git-archive for source package creation" './System.map' -> 'tar-install/boot/System.map-6.3.0-rc5-android-x86_64+' '.config' -> 'tar-install/boot/config-6.3.0-rc5-android-x86_64+' './vmlinux' -> 'tar-install/boot/vmlinux-6.3.0-rc5-android-x86_64+' '
./arch/x86/boot/bzImage' -> 'tar-install/boot/vmlinuz-6.3.0-rc5-android-x86_64+'
TAR linux-6.3.0-rc5-android-x86_64+-x86.tar.gz
Quoted 6 lines
real 0m11.006s user 0m21.079s sys 0m7.830sI don't like *.tar file, i will delete *.tar file when every time build kernel, i need *.tar.gz file, if one file is i needn't, i will delete it. linux-6.3.0-rc5-android-x86_64+-x86.tar.gz file is i need, linux-6.3.0-rc5-android-x86_64+-x86.tar is i needn't.
OK.
On second thought, splitting tar and compression was unneeded.
I submitted a patch set to avoid unneeded *.tar creation.
https://lore.kernel.org/lkml/[email protected]/T/#t
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Thanks, looks good.
Shouldn't we also revert e0ca16749ac3 ("kbuild: make perf-tar*-src-pkg work without relying on git")?
Linus
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Quoted 6 lines
Thanks, looks good.
Shouldn't we also revert
e0ca16749ac3("kbuild: make perf-tar*-src-pkg work without relying on git")?Linus
Right.
6/6 did that.
It may not be clear enough from the commit description, but I added the following tag to 6/6.
relying on git")
Instead of a verbatim revert, I made some refactoring to share code among deb-pkg, rpm-pkg, perf-tar*-src-pkg.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 2 lines · Masahiro Yamada
6/6 did that.
Oh, I looked at that one, but only reacted to the removal of the ignored-files script, not realizing that it also did that revert.
No complaints then,
Linus
Quoted 5 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Quoted 8 lines
Masahiro Yamada (6):
kbuild: deb-pkg: make debian source package working again
kbuild: deb-pkg: do not take KERNELRELEASE from the source version
kbuild: deb-pkg: setCROSS_COMPILEonly when undefined
kbuild: deb-pkg: split image and debug objects staging out into
functions
kbuild: deb-pkg: usedh_listpackagesto know enabled packages
kbuild: use git-archive for source package creation
I tried this series and got the following error:
11:05:53 Install lsb-release or set $KDEB_CHANGELOG_DIST explicitly 11:05:53 dpkg-buildpackage: info: source package linux-upstream 11:05:53 dpkg-buildpackage: info: source version 6.3.0-rc2-gdc71b1b23e6d-1 11:05:53 dpkg-buildpackage: info: source distribution unstable 11:05:53 dpkg-buildpackage: info: source changed by root <root@5621c2cf448d> 11:05:53 dpkg-buildpackage: info: host architecture arm64 11:05:53 dpkg-source --before-build . 11:05:53 dpkg-source: info: using options from linux/debian/source/local-options: --diff-ignore --extend-diff-ignore=.* 11:05:53 dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper 11:05:53 dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting 11:05:53 dpkg-buildpackage: warning: (Use -d flag to override.) 11:05:53 make[1]: *** [scripts/Makefile.package:117: deb-pkg] Error 3 11:05:53 make: *** [Makefile:1656: deb-pkg] Error 2
Thanks
Quoted 22 lines
.gitignore | 1 + Makefile | 9 +- scripts/.gitignore | 1 - scripts/Makefile | 2 +- scripts/Makefile.package | 113 ++-- scripts/check-git | 14 + scripts/list-gitignored.c | 1057 ------------------------------ scripts/package/builddeb | 269 ++++---- scripts/package/deb-build-option | 14 +- scripts/package/gen-diff-patch | 44 ++ scripts/package/mkdebian | 24 +- scripts/package/mkspec | 17 +- scripts/setlocalversion | 45 +- 13 files changed, 335 insertions(+), 1275 deletions(-) create mode 100755 scripts/check-git delete mode 100644 scripts/list-gitignored.c create mode 100755 scripts/package/gen-diff-patchSignature · 1 line
2.34.1
Quoted 31 lines · Leon Romanovsky
Quoted 5 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Quoted 8 lines
Masahiro Yamada (6):
kbuild: deb-pkg: make debian source package working again
kbuild: deb-pkg: do not take KERNELRELEASE from the source version
kbuild: deb-pkg: setCROSS_COMPILEonly when undefined
kbuild: deb-pkg: split image and debug objects staging out into
functions
kbuild: deb-pkg: usedh_listpackagesto know enabled packages
kbuild: use git-archive for source package creationI tried this series and got the following error:
11:05:53 Install lsb-release or set $KDEB_CHANGELOG_DIST explicitly 11:05:53 dpkg-buildpackage: info: source package linux-upstream 11:05:53 dpkg-buildpackage: info: source version 6.3.0-rc2-gdc71b1b23e6d-1 11:05:53 dpkg-buildpackage: info: source distribution unstable 11:05:53 dpkg-buildpackage: info: source changed by root <root@5621c2cf448d> 11:05:53 dpkg-buildpackage: info: host architecture arm64 11:05:53 dpkg-source --before-build . 11:05:53 dpkg-source: info: using options from linux/debian/source/local-options: --diff-ignore --extend-diff-ignore=.* 11:05:53 dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper 11:05:53 dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting 11:05:53 dpkg-buildpackage: warning: (Use -d flag to override.) 11:05:53 make[1]: *** [scripts/Makefile.package:117: deb-pkg] Error 3 11:05:53 make: *** [Makefile:1656: deb-pkg] Error 2
Quoted 1 line
Thanks
Do you have debhelper available on your system? As debhelper is a build dependency, such a fail is expected if debhelper is not available.
Kind regards,
Nicolas
Quoted 32 lines · Nicolas Schier
Quoted 31 lines · Leon Romanovsky
Quoted 5 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Quoted 8 lines
Masahiro Yamada (6):
kbuild: deb-pkg: make debian source package working again
kbuild: deb-pkg: do not take KERNELRELEASE from the source version
kbuild: deb-pkg: setCROSS_COMPILEonly when undefined
kbuild: deb-pkg: split image and debug objects staging out into
functions
kbuild: deb-pkg: usedh_listpackagesto know enabled packages
kbuild: use git-archive for source package creationI tried this series and got the following error:
11:05:53 Install lsb-release or set $KDEB_CHANGELOG_DIST explicitly 11:05:53 dpkg-buildpackage: info: source package linux-upstream 11:05:53 dpkg-buildpackage: info: source version 6.3.0-rc2-gdc71b1b23e6d-1 11:05:53 dpkg-buildpackage: info: source distribution unstable 11:05:53 dpkg-buildpackage: info: source changed by root <root@5621c2cf448d> 11:05:53 dpkg-buildpackage: info: host architecture arm64 11:05:53 dpkg-source --before-build . 11:05:53 dpkg-source: info: using options from linux/debian/source/local-options: --diff-ignore --extend-diff-ignore=.* 11:05:53 dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper 11:05:53 dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting 11:05:53 dpkg-buildpackage: warning: (Use -d flag to override.) 11:05:53 make[1]: *** [scripts/Makefile.package:117: deb-pkg] Error 3 11:05:53 make: *** [Makefile:1656: deb-pkg] Error 2
Quoted 5 lines
Quoted 1 line
Thanks
Do you have debhelper available on your system? As debhelper is a build dependency, such a fail is expected if debhelper is not available.
Yes, we don't have debhelper in our build container. The thing is that we are using same container as we used before this series and never needed debhelper.
Thanks
Quoted 3 lines
Kind regards,
Nicolas
Hi Masahiro,
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
I apologize if this is a stupid question, but it's not immediately apparent to me...
Previously, I was overriding the deb file output name by the setting of LOCALVERSION_AUTO; but with this series applied, that seems to be ignored?
Now if I pass LOCALVERSION="" I end up with e.g. linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb whereas previously, I would end up with linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
How would I restore the old naming behaviour?
-- steev
Quoted 14 lines · Steev Klimaszewski
Hi Masahiro,
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
I apologize if this is a stupid question, but it's not immediately apparent to me...
Previously, I was overriding the deb file output name by the setting of
LOCALVERSION_AUTO; but with this series applied, that seems to be ignored?
Quoted 6 lines
Now if I pass LOCALVERSION="" I end up with e.g. linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb whereas previously, I would end up with linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
How would I restore the old naming behaviour?
-- steev
The same string "6.3.0-rc2" is repeated in the file name. The first one is what Debian calls the ABI version, and the second one is the version of the package.
They are usually different on real Debian kernels.
LOCALVERSION affects the former, and KDEB_PKGVERSION the second.
My recommendation is "just let it be"
because "linux-upstream_6.3.0-rc2.orig.tar.gz"
you would generate is not the real 6.3.0-rc2.
If you want to restore what you previously did,
make deb-pkg KDEB_PKGVERSION=6.3.0-rc2-100
will create such a file name.
Signature · 2 lines
Best Regards Masahiro Yamada
Hi Masahiro,
Quoted 37 lines · Masahiro Yamada
Quoted 14 lines · Steev Klimaszewski
Hi Masahiro,
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
I apologize if this is a stupid question, but it's not immediately apparent to me...
Previously, I was overriding the deb file output name by the setting of
LOCALVERSION_AUTO; but with this series applied, that seems to be ignored?Quoted 6 lines
Now if I pass LOCALVERSION="" I end up with e.g. linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb whereas previously, I would end up with linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
How would I restore the old naming behaviour?
-- steev
The same string "6.3.0-rc2" is repeated in the file name. The first one is what Debian calls the ABI version, and the second one is the version of the package.
They are usually different on real Debian kernels.LOCALVERSION affects the former, and
KDEB_PKGVERSIONthe second.My recommendation is "just let it be"
because "linux-upstream_6.3.0-rc2.orig.tar.gz"
you would generate is not the real 6.3.0-rc2.
Quoted 6 lines
If you want to restore what you previously did,
make deb-pkg KDEB_PKGVERSION=6.3.0-rc2-100
will create such a file name.
My apologies, my text editor seemed to swallow up half of my previous email as what I was trying to say wasn't all in there... What I meant to say is that, prior to this patchset, if LOCALVERSION_AUTO=y we would end up with
linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb
where
LOCALVERSION_AUTO="00575-g46c71cad996d"
NUMBEROFBUILDS="100" (i'm not sure where this number was stored previously)
Assuming the above 2 are what the current settings are...
And if you turned LOCALVERSION_AUTO off, and had changes on top of the git repo, you would end up with
linux-image-6.3.0-rc2_6.3.0-rc2+-100_arm64.deb
Then if you would pass LOCALVERSION="", on top of LOCALVERSION_AUTO being unset, you would end up with
linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
Now with your patchset applied, with LOCALVERSION_AUTO being unset, you end up with
linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb
Which means that LOCALVERSION_AUTO goes away? I'm not sure why the package version overrides what I'm trying to set in the first place in the kernel config?
Your workaround is mostly fine, but that "-100" on the end means I have to now personally track how many builds I've done?
Quoted 5 lines
--
Best Regards
Masahiro Yamada
Hi Masahiro,
Quoted 73 lines · Steev Klimaszewski
Hi Masahiro,
Quoted 37 lines · Masahiro Yamada
Quoted 14 lines · Steev Klimaszewski
Hi Masahiro,
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
I apologize if this is a stupid question, but it's not immediately apparent to me...
Previously, I was overriding the deb file output name by the setting of
LOCALVERSION_AUTO; but with this series applied, that seems to be ignored?Quoted 6 lines
Now if I pass LOCALVERSION="" I end up with e.g. linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb whereas previously, I would end up with linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
How would I restore the old naming behaviour?
-- steev
The same string "6.3.0-rc2" is repeated in the file name. The first one is what Debian calls the ABI version, and the second one is the version of the package.
They are usually different on real Debian kernels.LOCALVERSION affects the former, and
KDEB_PKGVERSIONthe second.My recommendation is "just let it be"
because "linux-upstream_6.3.0-rc2.orig.tar.gz"
you would generate is not the real 6.3.0-rc2.Quoted 6 lines
If you want to restore what you previously did,
make deb-pkg KDEB_PKGVERSION=6.3.0-rc2-100
will create such a file name.
My apologies, my text editor seemed to swallow up half of my previous email as what I was trying to say wasn't all in there... What I meant to say is that, prior to this patchset, if LOCALVERSION_AUTO=y we would end up with
linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb
where
LOCALVERSION_AUTO="00575-g46c71cad996d"
NUMBEROFBUILDS="100" (i'm not sure where this number was stored previously)Assuming the above 2 are what the current settings are...
And if you turned
LOCALVERSION_AUTOoff, and had changes on top of the git repo, you would end up withlinux-image-6.3.0-rc2_6.3.0-rc2+-100_arm64.deb
Then if you would pass LOCALVERSION="", on top of
LOCALVERSION_AUTObeing unset, you would end up withlinux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
Now with your patchset applied, with
LOCALVERSION_AUTObeing unset, you end up with
Quoted 14 lines
linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb
Which means that
LOCALVERSION_AUTOgoes away? I'm not sure why the package version overrides what I'm trying to set in the first place in the kernel config?Your workaround is mostly fine, but that "-100" on the end means I have to now personally track how many builds I've done?
Quoted 5 lines
--
Best Regards
Masahiro Yamada
I've been trying for a while now to reproduce the previous behaviour of version numbers and with this change in, it just does not seem possible at all. If I try to put any variables into KDEB_PKGVERSION, it simply ignores then and sets it to what LOCALVERSION_AUTO would be.
-- steev
Quoted 68 lines · Steev Klimaszewski
Hi Masahiro,
Quoted 37 lines · Masahiro Yamada
Quoted 14 lines · Steev Klimaszewski
Hi Masahiro,
Quoted 3 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
I apologize if this is a stupid question, but it's not immediately apparent to me...
Previously, I was overriding the deb file output name by the setting of
LOCALVERSION_AUTO; but with this series applied, that seems to be ignored?Quoted 6 lines
Now if I pass LOCALVERSION="" I end up with e.g. linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb whereas previously, I would end up with linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
How would I restore the old naming behaviour?
-- steev
The same string "6.3.0-rc2" is repeated in the file name. The first one is what Debian calls the ABI version, and the second one is the version of the package.
They are usually different on real Debian kernels.LOCALVERSION affects the former, and
KDEB_PKGVERSIONthe second.My recommendation is "just let it be"
because "linux-upstream_6.3.0-rc2.orig.tar.gz"
you would generate is not the real 6.3.0-rc2.Quoted 6 lines
If you want to restore what you previously did,
make deb-pkg KDEB_PKGVERSION=6.3.0-rc2-100
will create such a file name.
My apologies, my text editor seemed to swallow up half of my previous email as what I was trying to say wasn't all in there... What I meant to say is that, prior to this patchset, if LOCALVERSION_AUTO=y we would end up with
linux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb
where
LOCALVERSION_AUTO="00575-g46c71cad996d"
NUMBEROFBUILDS="100" (i'm not sure where this number was stored previously)Assuming the above 2 are what the current settings are...
And if you turned
LOCALVERSION_AUTOoff, and had changes on top of the git repo, you would end up withlinux-image-6.3.0-rc2_6.3.0-rc2+-100_arm64.deb
Then if you would pass LOCALVERSION="", on top of
LOCALVERSION_AUTObeing unset, you would end up with
Quoted 8 lines
linux-image-6.3.0-rc2_6.3.0-rc2-100_arm64.deb
Now with your patchset applied, with
LOCALVERSION_AUTObeing unset, you end up withlinux-image-6.3.0-rc2_6.3.0-rc2-00575-g46c71cad996d-100_arm64.deb
Which means that
LOCALVERSION_AUTOgoes away?
It did not go away.LOCALVERSION_AUTO is meant to set kernelrelease, which will result in 'uname -r' in the installed system.
LOCALVERSION_AUTO should not affect the Debian package version, which is a different thing.
Quoted 6 lines
I'm not sure why the
package version overrides what I'm trying to set in the first place in the kernel config?Your workaround is mostly fine, but that "-100" on the end means I have to now personally track how many builds I've done?
"-100" is the build revision, which will go into the .version file while building the kernel.
It is not so important, you can set whatever number.
If you leave the revision auto-incremented, this is equivalent to what Kbuild is doing internally.
make KDEB_PKGVERSION=$(make kernelversion)-$(init/build-version) bindeb-pkg
Quoted 6 lines
Quoted 6 lines
--
Best Regards
Masahiro Yamada
Signature · 2 lines
Best Regards Masahiro Yamada
Hi Masahiro,
Once again, sincerest apologies, but i do appreciate your time and knowledge!
Quoted 2 lines · Masahiro Yamada
On Sun, Mar 19, 2023 at 12:21 PM Steev Klimaszewski <[email protected]> wrote:
<snip>
Quoted 14 lines
It did not go away.
LOCALVERSION_AUTOis meant to set kernelrelease, which will result in 'uname -r' in the installed system.
LOCALVERSION_AUTOshould not affect the Debian package version, which is a different thing.Quoted 4 lines
I'm not sure why the
package version overrides what I'm trying to set in the first place in the kernel config?
Quoted 7 lines
Quoted 2 lines
Your workaround is mostly fine, but that "-100" on the end means I have to now personally track how many builds I've done?
"-100" is the build revision, which will go into the .version file while building the kernel.
It is not so important, you can set whatever number.
This is actually what was throwing me for a loop!
Quoted 5 lines
If you leave the revision auto-incremented, this is equivalent to what
Kbuildis doing internally.make KDEB_PKGVERSION=$(make kernelversion)-$(init/build-version) bindeb-pkg
Aha! So the issue seems to be that I do out of tree builds, and init/build-version does not take that into account, so I was always getting whatever is in the kernel source's .version and not what is in my actual build directory. I'm still not entirely sure how to get that one, but I'm a lot closer, thank you again so much, for your time in putting together the patchset to fix the building of the packages, as well as answering my questions.
-- steev
Quoted 5 lines · Masahiro Yamada
This series fixes some bugs, then switch to 'git archive' for source package creation as suggested by Linus.
Quoted 9 lines
Masahiro Yamada (6):
kbuild: deb-pkg: make debian source package working again
kbuild: deb-pkg: do not take KERNELRELEASE from the source version
kbuild: deb-pkg: setCROSS_COMPILEonly when undefined
kbuild: deb-pkg: split image and debug objects staging out into
functions
kbuild: deb-pkg: usedh_listpackagesto know enabled packages
kbuild: use git-archive for source package creation
Thanks,