diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2023-02-15 10:20:33 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-02-26 15:23:30 +0900 |
commit | 3ab18a625ce42163da91ee4096460218d11bed36 (patch) | |
tree | 5a25fc4aa5f88b640c186e1053defdf7f58c63a2 /scripts/package/deb-build-option | |
parent | c5bf2efb058d841bf8993b9a9b4522abda804d39 (diff) |
kbuild: deb-pkg: improve the usability of source package
Improve the source package support in case the dpkg-buildpackage is
directly used to build binary packages.
For cross-compiling, you can set CROSS_COMPILE via the environment
variable, but it is better to set it automatically - set it to
${DEB_HOST_GNU_TYPE}- if we are cross-compiling but not from the top
Makefile.
The generated source package may be carried to a different build
environment, which may have a different compiler installed.
Run olddefconfig first to set new CONFIG options to their default
values without prompting.
Take KERNELRELEASE and KBUILD_BUILD_VERSION from the version field of
debian/changelog in case it is updated afterwards.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/package/deb-build-option')
-rwxr-xr-x | scripts/package/deb-build-option | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/package/deb-build-option b/scripts/package/deb-build-option new file mode 100755 index 000000000000..b079b0d121d4 --- /dev/null +++ b/scripts/package/deb-build-option @@ -0,0 +1,16 @@ +#!/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 + echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- +fi + +version=$(dpkg-parsechangelog -S Version) +version_upstream="${version%-*}" +debian_revision="${version#${version_upstream}}" +debian_revision="${debian_revision#*-}" + +echo KERNELRELEASE=${version_upstream} +echo KBUILD_BUILD_VERSION=${debian_revision} |