62604063 | 14-Mar-2025 |
Alexandru Gagniuc <alexandru.gagniuc@hp.com> |
kbuild: deb-pkg: don't set KBUILD_BUILD_VERSION unconditionally
In ThinPro, we use the convention <upstream_ver>+hp<patchlevel> for the kernel package. This does not have a dash in the name or versi
kbuild: deb-pkg: don't set KBUILD_BUILD_VERSION unconditionally
In ThinPro, we use the convention <upstream_ver>+hp<patchlevel> for the kernel package. This does not have a dash in the name or version. This is built by editing ".version" before a build, and setting EXTRAVERSION="+hp" and KDEB_PKGVERSION make variables:
echo 68 > .version make -j<n> EXTRAVERSION="+hp" bindeb-pkg KDEB_PKGVERSION=6.12.2+hp69
.deb name: linux-image-6.12.2+hp_6.12.2+hp69_amd64.deb
Since commit 7d4f07d5cb71 ("kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules"), this no longer works. The deb build logic changed, even though, the commit message implies that the logic should be unmodified.
Before, KBUILD_BUILD_VERSION was not set if the KDEB_PKGVERSION did not contain a dash. After the change KBUILD_BUILD_VERSION is always set to KDEB_PKGVERSION. Since this determines UTS_VERSION, the uname output to look off:
(now) uname -a: version 6.12.2+hp ... #6.12.2+hp69 (expected) uname -a: version 6.12.2+hp ... #69
Update the debian/rules logic to restore the original behavior.
Fixes: 7d4f07d5cb71 ("kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules") Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@hp.com> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
f96beb84 | 13-Jan-2024 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: call more misc debhelper commands
Use dh_prep instead of removing old build directories manually.
Use dh_clean instead of removing build directories and debian/files manually.
Cal
kbuild: deb-pkg: call more misc debhelper commands
Use dh_prep instead of removing old build directories manually.
Use dh_clean instead of removing build directories and debian/files manually.
Call dh_testdir and dh_testroot for preliminary checks.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
1d7bae8f | 13-Jan-2024 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: build binary-arch in parallel
'make deb-pkg' builds build-arch in parallel, but binary-arch serially.
Given that all binary packages are independent of one another, they can be bui
kbuild: deb-pkg: build binary-arch in parallel
'make deb-pkg' builds build-arch in parallel, but binary-arch serially.
Given that all binary packages are independent of one another, they can be built in parallel.
I am uncertain whether debian/files is robust against a race condition. Just in case, make dh_gencontrol (dpkg-gencontrol) output to separate debian/*.files, which are then concatenated into debian/files.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
caf400c8 | 13-Jan-2024 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: make debian/rules quiet for 'make deb-pkg'
Add $(Q) to the commands in debian/rules to make them quiet when the package built is initiated by 'make deb-pkg' or when the 'terse' tag
kbuild: deb-pkg: make debian/rules quiet for 'make deb-pkg'
Add $(Q) to the commands in debian/rules to make them quiet when the package built is initiated by 'make deb-pkg' or when the 'terse' tag is set to DEB_BUILD_OPTIONS.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
1b5e9465 | 30-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: move 'make headers' to build-arch
Strictly speaking, 'make headers' should be a part of build-arch instead of binary-arch.
'make headers' constructs ready-to-copy UAPI headers in t
kbuild: deb-pkg: move 'make headers' to build-arch
Strictly speaking, 'make headers' should be a part of build-arch instead of binary-arch.
'make headers' constructs ready-to-copy UAPI headers in the kernel directory.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
5e73758b | 26-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: use more debhelper commands in builddeb
Commit 36862e14e316 ("kbuild: deb-pkg: use dh_listpackages to know enabled packages") started to require the debhelper tool suite.
Use more
kbuild: deb-pkg: use more debhelper commands in builddeb
Commit 36862e14e316 ("kbuild: deb-pkg: use dh_listpackages to know enabled packages") started to require the debhelper tool suite.
Use more dh_* commands in create_package():
- dh_installdocs to install copyright - dh_installchangelogs to install changelog - dh_compress to compress changelog - dh_fixperms to replace the raw chmod command - dh_gencontrol to replace the raw dpkg-gencontrol command - dh_md5sums to record the md5sum of included files - dh_builddeb to replace the raw dpkg-deb command
Set DEB_RULES_REQUIRES_ROOT to 'no' in case debian/rules is executed directly.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
68e262f8 | 26-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: remove unneeded '-f $srctree/Makefile' in debian/rules
This is unneeded because the Makefile in the output directory wraps the top-level Makefile in the srctree.
Just run $(MAKE) i
kbuild: deb-pkg: remove unneeded '-f $srctree/Makefile' in debian/rules
This is unneeded because the Makefile in the output directory wraps the top-level Makefile in the srctree.
Just run $(MAKE) irrespective of the build location.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
eaf80f7f | 26-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: allow to run debian/rules from output directory
'make O=... deb-pkg' creates the debian directory in the output directory. However, currently it is impossible to run debian/rules cr
kbuild: deb-pkg: allow to run debian/rules from output directory
'make O=... deb-pkg' creates the debian directory in the output directory. However, currently it is impossible to run debian/rules created in the separate output directory.
This commit delays the $(srctree) expansion by escaping '$' and by quoting the entire command, making it possible to run debian/rules in the output directory.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
159956f3 | 26-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: set DEB_* variables if debian/rules is directly executed
Since commit 491b146d4c13 ("kbuild: builddeb: Eliminate debian/arch use"), direct execution of debian/rules results in the f
kbuild: deb-pkg: set DEB_* variables if debian/rules is directly executed
Since commit 491b146d4c13 ("kbuild: builddeb: Eliminate debian/arch use"), direct execution of debian/rules results in the following error:
dpkg-architecture: error: unknown option 'DEB_HOST_MULTIARCH'
The current code:
dpkg-architecture -a$DEB_HOST_ARCH -qDEB_HOST_MULTIARCH
... does not look sensible because:
- For this code to work correctly, DEB_HOST_ARCH must be pre-defined, which is true when the packages are built via dpkg-buildpackage. In this case, DEB_HOST_MULTIARCH is also likely defined, hence there is no need to query DEB_HOST_MULTIARCH in the first place.
- If DEB_HOST_MULTIARCH is undefined, DEB_HOST_ARCH is likely undefined too. So, you cannot query DEB_HOST_MULTIARCH in this way. This is mostly the case where debian/rules is directly executed.
When debian/rules is directly executed, querying DEB_HOST_MUCHARCH is not enough because we need to know DEB_{BUILD,HOST}_GNU_TYPE as well.
All DEB_* variables are defined when the package build is initiated by dpkg-buildpackage, but otherwise, let's call dpkg-architecture to set all DEB_* environment variables.
This requires dpkg 1.20.6 or newer because --print-format option was added in dpkg commit 7c54fa2b232e ("dpkg-architecture: Add a --print-format option").
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
7d4f07d5 | 26-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules
The binary-arch target needs to use the same CROSS_COMPILE as used in build-arch; otherwise, 'make run-command' may attempt t
kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules
The binary-arch target needs to use the same CROSS_COMPILE as used in build-arch; otherwise, 'make run-command' may attempt to resync the .config file.
Squash scripts/package/deb-build-option into debian/rules, as it is a small amount of code.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
466e6fc4 | 26-Dec-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: factor out common Make options in debian/rules
This avoids code duplication between binary-arch and built-arch.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: N
kbuild: deb-pkg: factor out common Make options in debian/rules
This avoids code duplication between binary-arch and built-arch.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
ed79c34d | 21-Aug-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: deb-pkg: support DEB_BUILD_OPTIONS=parallel=N in debian/rules
'make srcdeb-pkg' generates a source package, which you can build later by using dpkg-buildpackage.
In older dpkg versions, 'dp
kbuild: deb-pkg: support DEB_BUILD_OPTIONS=parallel=N in debian/rules
'make srcdeb-pkg' generates a source package, which you can build later by using dpkg-buildpackage.
In older dpkg versions, 'dpkg-buildpackage --jobs=N' sets not only DEB_BUILD_OPTIONS but also MAKEFLAGS. Hence, passing -j or --jobs to dpkg-buildpackage was enough for kicking the parallel execution.
The behavior was changed by commit 1d0ea9b2ba3f ("dpkg-buildpackage: Change -j, --jobs semantics to non-force mode") of dpkg project. [1]
Since then, 'dpkg-buildpackage --jobs=N' sets only DEB_BUILD_OPTIONS, which is not parsed by the current debian/rules. To build the package in parallel, you need to pass the alternative --jobs-force option or set the MAKEFLAGS environment variable.
Debian policy [2] suggests the following code snippet for debian/rules.
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j$(NUMJOBS) endif
I tweaked the code to filter out parallel=1 and passed --jobs=1 to dpkg-buildpackage from scripts/Makefile.package. It is needed to force 'make deb-pkg' without the -j option to run in serial. Please note that dpkg-buildpackage sets parallel=<nproc> in DEB_BUILD_OPTIONS by default (that is, --jobs=auto is the default) and --jobs=1 is needed to restore the serial execution. When dpkg-buildpackage is invoked from Kbuild, the number of jobs is inherited from the top level Makefile. Passing --jobs=1 to dpkg-buildpackage allows debian/rules to skip parsing DEB_BUILD_OPTIONS.
[1] https://salsa.debian.org/dpkg-team/dpkg/-/commit/1d0ea9b2ba3f6a2de5b1a6ff55f3df7b71f73db6 [2] https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options
Reported-by: Bastian Germann <bage@linutronix.de> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|