2018-04-05 14:22:29 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
|
|
|
|
#
|
|
|
|
# Simple script to generate a debian/ directory for a Linux kernel.
|
|
|
|
|
2024-07-03 03:02:42 +09:00
|
|
|
set -eu
|
2018-04-05 14:22:29 +03:00
|
|
|
|
2018-07-26 11:21:01 +01:00
|
|
|
is_enabled() {
|
2019-03-08 18:56:25 +09:00
|
|
|
grep -q "^$1=y" include/config/auto.conf
|
2018-07-26 11:21:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if_enabled_echo() {
|
|
|
|
if is_enabled "$1"; then
|
|
|
|
echo -n "$2"
|
|
|
|
elif [ $# -ge 3 ]; then
|
|
|
|
echo -n "$3"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-04-05 14:22:29 +03:00
|
|
|
set_debarch() {
|
2024-07-03 03:02:42 +09:00
|
|
|
if [ "${KBUILD_DEBARCH:+set}" ]; then
|
2018-07-26 11:20:28 +01:00
|
|
|
debarch="$KBUILD_DEBARCH"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-04-05 14:22:29 +03:00
|
|
|
# Attempt to find the correct Debian architecture
|
|
|
|
case "$UTS_MACHINE" in
|
2023-11-24 23:09:08 +09:00
|
|
|
i386|alpha|m68k|riscv*)
|
2018-04-05 14:22:29 +03:00
|
|
|
debarch="$UTS_MACHINE" ;;
|
|
|
|
x86_64)
|
|
|
|
debarch=amd64 ;;
|
|
|
|
sparc*)
|
2019-03-08 18:56:23 +09:00
|
|
|
debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
|
2018-04-05 14:22:29 +03:00
|
|
|
s390*)
|
2018-07-26 11:20:54 +01:00
|
|
|
debarch=s390x ;;
|
2018-04-05 14:22:29 +03:00
|
|
|
ppc*)
|
2019-03-08 18:56:23 +09:00
|
|
|
if is_enabled CONFIG_64BIT; then
|
|
|
|
debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
|
2018-07-26 11:21:09 +01:00
|
|
|
else
|
2019-03-08 18:56:23 +09:00
|
|
|
debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
|
2018-07-26 11:21:09 +01:00
|
|
|
fi
|
|
|
|
;;
|
2018-04-05 14:22:29 +03:00
|
|
|
parisc*)
|
|
|
|
debarch=hppa ;;
|
|
|
|
mips*)
|
2019-03-08 18:56:23 +09:00
|
|
|
if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
|
|
|
|
debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
|
|
|
|
elif is_enabled CONFIG_CPU_MIPSR6; then
|
|
|
|
debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
|
2018-07-26 11:21:16 +01:00
|
|
|
else
|
|
|
|
debarch=mips
|
|
|
|
fi
|
|
|
|
;;
|
2018-04-05 14:22:29 +03:00
|
|
|
aarch64|arm64)
|
|
|
|
debarch=arm64 ;;
|
|
|
|
arm*)
|
2019-03-08 18:56:23 +09:00
|
|
|
if is_enabled CONFIG_AEABI; then
|
|
|
|
debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
|
2018-04-05 14:22:29 +03:00
|
|
|
else
|
2018-07-26 11:21:01 +01:00
|
|
|
debarch=arm
|
2018-04-05 14:22:29 +03:00
|
|
|
fi
|
|
|
|
;;
|
2018-07-26 11:22:34 +01:00
|
|
|
openrisc)
|
|
|
|
debarch=or1k ;;
|
2018-07-26 11:22:54 +01:00
|
|
|
sh)
|
2019-03-08 18:56:23 +09:00
|
|
|
if is_enabled CONFIG_CPU_SH3; then
|
|
|
|
debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
|
|
|
|
elif is_enabled CONFIG_CPU_SH4; then
|
|
|
|
debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
|
2018-07-26 11:22:54 +01:00
|
|
|
fi
|
|
|
|
;;
|
2024-12-03 20:14:45 +09:00
|
|
|
um)
|
|
|
|
if is_enabled CONFIG_64BIT; then
|
|
|
|
debarch=amd64
|
|
|
|
else
|
|
|
|
debarch=i386
|
|
|
|
fi
|
|
|
|
;;
|
2018-07-26 11:22:54 +01:00
|
|
|
esac
|
|
|
|
if [ -z "$debarch" ]; then
|
2018-07-26 11:20:45 +01:00
|
|
|
debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
|
2018-04-05 14:22:29 +03:00
|
|
|
echo "" >&2
|
|
|
|
echo "** ** ** WARNING ** ** **" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "Your architecture doesn't have its equivalent" >&2
|
|
|
|
echo "Debian userspace architecture defined!" >&2
|
2018-07-26 11:20:45 +01:00
|
|
|
echo "Falling back to the current host architecture ($debarch)." >&2
|
2018-04-05 14:22:29 +03:00
|
|
|
echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
|
|
|
|
echo "" >&2
|
2018-07-26 11:22:54 +01:00
|
|
|
fi
|
2018-04-05 14:22:29 +03:00
|
|
|
}
|
|
|
|
|
kbuild: give up untracked files for source package builds
When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.
Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.
To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.
[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch
Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-04-10 21:09:07 +09:00
|
|
|
# Create debian/source/ if it is a source package build
|
|
|
|
gen_source ()
|
|
|
|
{
|
|
|
|
mkdir -p debian/source
|
|
|
|
|
|
|
|
echo "3.0 (quilt)" > debian/source/format
|
|
|
|
|
|
|
|
{
|
|
|
|
echo "diff-ignore"
|
|
|
|
echo "extend-diff-ignore = .*"
|
|
|
|
} > debian/source/local-options
|
|
|
|
|
|
|
|
# Add .config as a patch
|
|
|
|
mkdir -p debian/patches
|
|
|
|
{
|
|
|
|
echo "Subject: Add .config"
|
|
|
|
echo "Author: ${maintainer}"
|
|
|
|
echo
|
|
|
|
echo "--- /dev/null"
|
|
|
|
echo "+++ linux/.config"
|
|
|
|
diff -u /dev/null "${KCONFIG_CONFIG}" | tail -n +3
|
|
|
|
} > debian/patches/config.patch
|
|
|
|
echo config.patch > debian/patches/series
|
|
|
|
|
|
|
|
"${srctree}/scripts/package/gen-diff-patch" debian/patches/diff.patch
|
|
|
|
if [ -s debian/patches/diff.patch ]; then
|
|
|
|
sed -i "
|
|
|
|
1iSubject: Add local diff
|
|
|
|
1iAuthor: ${maintainer}
|
|
|
|
1i
|
|
|
|
" debian/patches/diff.patch
|
|
|
|
|
|
|
|
echo diff.patch >> debian/patches/series
|
|
|
|
else
|
|
|
|
rm -f debian/patches/diff.patch
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-02-15 10:20:24 +09:00
|
|
|
rm -rf debian
|
kbuild: give up untracked files for source package builds
When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.
Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.
To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.
[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch
Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-04-10 21:09:07 +09:00
|
|
|
mkdir debian
|
|
|
|
|
2024-07-05 00:23:32 +09:00
|
|
|
user=${KBUILD_BUILD_USER:-$(id -nu)}
|
|
|
|
name=${DEBFULLNAME:-${user}}
|
kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL
Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address
generation") supported the "name <email>" form for DEBEMAIL, with
behavior slightly different from devscripts.
In Kbuild, if DEBEMAIL is given in the form "name <email>", it is used
as-is, and DEBFULLNAME is ignored.
In contrast, debchange takes the name from DEBFULLNAME (or NAME) if set,
as described in 'man debchange':
If this variable has the form "name <email>", then the maintainer name
will also be taken from here if neither DEBFULLNAME nor NAME is set.
This commit removes support for the "name <email> form for DEBEMAIL,
as the current behavior is already different from debchange, and the
Debian manual suggests setting the email address and name separately in
DEBEMAIL and DEBFULLNAME. [1]
If there are any complaints about this removal, we can re-add it,
with better alignment with the debchange implementation. [2]
[1]: https://www.debian.org/doc/manuals/debmake-doc/ch03.en.html#email-setup
[2]: https://salsa.debian.org/debian/devscripts/-/blob/v2.23.7/scripts/debchange.pl#L802
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-07-03 03:02:41 +09:00
|
|
|
if [ "${DEBEMAIL:+set}" ]; then
|
|
|
|
email=${DEBEMAIL}
|
kbuild: give up untracked files for source package builds
When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.
Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.
To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.
[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch
Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-04-10 21:09:07 +09:00
|
|
|
else
|
2024-07-05 00:23:32 +09:00
|
|
|
buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
|
kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL
Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address
generation") supported the "name <email>" form for DEBEMAIL, with
behavior slightly different from devscripts.
In Kbuild, if DEBEMAIL is given in the form "name <email>", it is used
as-is, and DEBFULLNAME is ignored.
In contrast, debchange takes the name from DEBFULLNAME (or NAME) if set,
as described in 'man debchange':
If this variable has the form "name <email>", then the maintainer name
will also be taken from here if neither DEBFULLNAME nor NAME is set.
This commit removes support for the "name <email> form for DEBEMAIL,
as the current behavior is already different from debchange, and the
Debian manual suggests setting the email address and name separately in
DEBEMAIL and DEBFULLNAME. [1]
If there are any complaints about this removal, we can re-add it,
with better alignment with the debchange implementation. [2]
[1]: https://www.debian.org/doc/manuals/debmake-doc/ch03.en.html#email-setup
[2]: https://salsa.debian.org/debian/devscripts/-/blob/v2.23.7/scripts/debchange.pl#L802
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-07-03 03:02:41 +09:00
|
|
|
email="${user}@${buildhost}"
|
kbuild: give up untracked files for source package builds
When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.
Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.
To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.
[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch
Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-04-10 21:09:07 +09:00
|
|
|
fi
|
kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL
Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address
generation") supported the "name <email>" form for DEBEMAIL, with
behavior slightly different from devscripts.
In Kbuild, if DEBEMAIL is given in the form "name <email>", it is used
as-is, and DEBFULLNAME is ignored.
In contrast, debchange takes the name from DEBFULLNAME (or NAME) if set,
as described in 'man debchange':
If this variable has the form "name <email>", then the maintainer name
will also be taken from here if neither DEBFULLNAME nor NAME is set.
This commit removes support for the "name <email> form for DEBEMAIL,
as the current behavior is already different from debchange, and the
Debian manual suggests setting the email address and name separately in
DEBEMAIL and DEBFULLNAME. [1]
If there are any complaints about this removal, we can re-add it,
with better alignment with the debchange implementation. [2]
[1]: https://www.debian.org/doc/manuals/debmake-doc/ch03.en.html#email-setup
[2]: https://salsa.debian.org/debian/devscripts/-/blob/v2.23.7/scripts/debchange.pl#L802
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-07-03 03:02:41 +09:00
|
|
|
maintainer="${name} <${email}>"
|
kbuild: give up untracked files for source package builds
When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.
Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.
To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.
[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch
Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-04-10 21:09:07 +09:00
|
|
|
|
2024-07-03 03:02:42 +09:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
--need-source)
|
|
|
|
gen_source
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2023-02-15 10:20:24 +09:00
|
|
|
|
2018-04-05 14:22:29 +03:00
|
|
|
# Some variables and settings used throughout the script
|
|
|
|
version=$KERNELRELEASE
|
2024-07-03 03:02:42 +09:00
|
|
|
if [ "${KDEB_PKGVERSION:+set}" ]; then
|
2018-04-05 14:22:29 +03:00
|
|
|
packageversion=$KDEB_PKGVERSION
|
|
|
|
else
|
2024-06-12 03:24:47 +09:00
|
|
|
packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/scripts/build-version)
|
2018-04-05 14:22:29 +03:00
|
|
|
fi
|
2023-02-15 10:20:27 +09:00
|
|
|
sourcename=${KDEB_SOURCENAME:-linux-upstream}
|
2018-04-05 14:22:29 +03:00
|
|
|
|
|
|
|
if [ "$ARCH" = "um" ] ; then
|
2020-10-14 03:38:20 +09:00
|
|
|
packagename=user-mode-linux
|
|
|
|
else
|
|
|
|
packagename=linux-image
|
2018-04-05 14:22:29 +03:00
|
|
|
fi
|
|
|
|
|
2020-10-14 03:38:20 +09:00
|
|
|
debarch=
|
|
|
|
set_debarch
|
|
|
|
|
2018-04-05 14:22:29 +03:00
|
|
|
# Try to determine distribution
|
2024-07-03 03:02:42 +09:00
|
|
|
if [ "${KDEB_CHANGELOG_DIST:+set}" ]; then
|
2018-04-05 14:22:29 +03:00
|
|
|
distribution=$KDEB_CHANGELOG_DIST
|
|
|
|
# In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
|
|
|
|
elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
|
|
|
|
: # nothing to do in this case
|
|
|
|
else
|
|
|
|
distribution="unstable"
|
|
|
|
echo >&2 "Using default distribution of 'unstable' in the changelog"
|
|
|
|
echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $debarch > debian/arch
|
|
|
|
|
kbuild: deb-pkg: add pkg.linux-upstream.nokernelheaders build profile
Since commit f1d87664b82a ("kbuild: cross-compile linux-headers package
when possible"), 'make bindeb-pkg' may attempt to cross-compile the
linux-headers package, but it fails under certain circumstances.
For example, when CONFIG_MODULE_SIG_FORMAT is enabled on Debian, the
following command fails:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
[ snip ]
Rebuilding host programs with aarch64-linux-gnu-gcc...
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/kallsyms
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sorttable
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/asn1_compiler
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file
In file included from /usr/include/openssl/opensslv.h:109,
from debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file.c:25:
/usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
14 | #include <openssl/opensslconf.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
This commit adds a new profile, pkg.linux-upstream.nokernelheaders, to
guard the linux-headers package.
There are two options to fix the above issue.
Option 1: Set the pkg.linux-upstream.nokernelheaders build profile
$ DEB_BUILD_PROFILES=pkg.linux-upstream.nokernelheaders \
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
This skips the building of the linux-headers package.
Option 2: Install the necessary build dependencies
If you want to cross-compile the linux-headers package, you need to
install additional packages.
For example, on Debian, the packages necessary for cross-compiling it
to arm64 can be installed with the following commands:
# dpkg --add-architecture arm64
# apt update
# apt install gcc-aarch64-linux-gnu libssl-dev:arm64
Fixes: f1d87664b82a ("kbuild: cross-compile linux-headers package when possible")
Reported-by: Ron Economos <re@w6rz.net>
Closes: https://lore.kernel.org/all/b3d4f49e-7ddb-29ba-0967-689232329b53@w6rz.net/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Ron Economos <re@w6rz.net>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-10-23 03:16:58 +09:00
|
|
|
host_gnu=$(dpkg-architecture -a "${debarch}" -q DEB_HOST_GNU_TYPE | sed 's/_/-/g')
|
|
|
|
|
2018-04-05 14:22:29 +03:00
|
|
|
# Generate a simple changelog template
|
|
|
|
cat <<EOF > debian/changelog
|
|
|
|
$sourcename ($packageversion) $distribution; urgency=low
|
|
|
|
|
|
|
|
* Custom built Linux kernel.
|
|
|
|
|
|
|
|
-- $maintainer $(date -R)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Generate a control file
|
|
|
|
cat <<EOF > debian/control
|
|
|
|
Source: $sourcename
|
|
|
|
Section: kernel
|
|
|
|
Priority: optional
|
|
|
|
Maintainer: $maintainer
|
2020-09-21 00:25:54 +02:00
|
|
|
Rules-Requires-Root: no
|
2023-12-26 22:52:43 +09:00
|
|
|
Build-Depends: debhelper-compat (= 12)
|
kbuild: deb-pkg: add pkg.linux-upstream.nokernelheaders build profile
Since commit f1d87664b82a ("kbuild: cross-compile linux-headers package
when possible"), 'make bindeb-pkg' may attempt to cross-compile the
linux-headers package, but it fails under certain circumstances.
For example, when CONFIG_MODULE_SIG_FORMAT is enabled on Debian, the
following command fails:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
[ snip ]
Rebuilding host programs with aarch64-linux-gnu-gcc...
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/kallsyms
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sorttable
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/asn1_compiler
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file
In file included from /usr/include/openssl/opensslv.h:109,
from debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file.c:25:
/usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
14 | #include <openssl/opensslconf.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
This commit adds a new profile, pkg.linux-upstream.nokernelheaders, to
guard the linux-headers package.
There are two options to fix the above issue.
Option 1: Set the pkg.linux-upstream.nokernelheaders build profile
$ DEB_BUILD_PROFILES=pkg.linux-upstream.nokernelheaders \
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
This skips the building of the linux-headers package.
Option 2: Install the necessary build dependencies
If you want to cross-compile the linux-headers package, you need to
install additional packages.
For example, on Debian, the packages necessary for cross-compiling it
to arm64 can be installed with the following commands:
# dpkg --add-architecture arm64
# apt update
# apt install gcc-aarch64-linux-gnu libssl-dev:arm64
Fixes: f1d87664b82a ("kbuild: cross-compile linux-headers package when possible")
Reported-by: Ron Economos <re@w6rz.net>
Closes: https://lore.kernel.org/all/b3d4f49e-7ddb-29ba-0967-689232329b53@w6rz.net/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Ron Economos <re@w6rz.net>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-10-23 03:16:58 +09:00
|
|
|
Build-Depends-Arch: bc, bison, cpio, flex,
|
|
|
|
gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,
|
|
|
|
kmod, libelf-dev:native,
|
|
|
|
libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,
|
2024-11-23 17:26:45 +09:00
|
|
|
python3:native, rsync
|
2020-07-19 21:46:02 +02:00
|
|
|
Homepage: https://www.kernel.org/
|
2018-04-05 14:22:29 +03:00
|
|
|
|
2020-10-14 03:38:20 +09:00
|
|
|
Package: $packagename-$version
|
2018-04-05 14:22:29 +03:00
|
|
|
Architecture: $debarch
|
|
|
|
Description: Linux kernel, version $version
|
|
|
|
This package contains the Linux kernel, modules and corresponding other
|
|
|
|
files, version: $version.
|
2023-03-13 05:07:30 +09:00
|
|
|
EOF
|
|
|
|
|
|
|
|
if [ "${SRCARCH}" != um ]; then
|
|
|
|
cat <<EOF >> debian/control
|
2018-04-05 14:22:29 +03:00
|
|
|
|
|
|
|
Package: linux-libc-dev
|
|
|
|
Section: devel
|
|
|
|
Provides: linux-kernel-headers
|
|
|
|
Architecture: $debarch
|
|
|
|
Description: Linux support headers for userspace development
|
|
|
|
This package provides userspaces headers from the Linux kernel. These headers
|
|
|
|
are used by the installed headers for GNU glibc and other system libraries.
|
2019-07-09 09:43:35 +02:00
|
|
|
Multi-Arch: same
|
2020-03-24 11:24:47 +01:00
|
|
|
EOF
|
|
|
|
|
2020-10-14 03:38:19 +09:00
|
|
|
if is_enabled CONFIG_MODULES; then
|
|
|
|
cat <<EOF >> debian/control
|
|
|
|
|
2020-10-14 03:38:20 +09:00
|
|
|
Package: linux-headers-$version
|
2020-10-14 03:38:19 +09:00
|
|
|
Architecture: $debarch
|
kbuild: deb-pkg: add pkg.linux-upstream.nokernelheaders build profile
Since commit f1d87664b82a ("kbuild: cross-compile linux-headers package
when possible"), 'make bindeb-pkg' may attempt to cross-compile the
linux-headers package, but it fails under certain circumstances.
For example, when CONFIG_MODULE_SIG_FORMAT is enabled on Debian, the
following command fails:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
[ snip ]
Rebuilding host programs with aarch64-linux-gnu-gcc...
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/kallsyms
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sorttable
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/asn1_compiler
HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file
In file included from /usr/include/openssl/opensslv.h:109,
from debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file.c:25:
/usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
14 | #include <openssl/opensslconf.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
This commit adds a new profile, pkg.linux-upstream.nokernelheaders, to
guard the linux-headers package.
There are two options to fix the above issue.
Option 1: Set the pkg.linux-upstream.nokernelheaders build profile
$ DEB_BUILD_PROFILES=pkg.linux-upstream.nokernelheaders \
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
This skips the building of the linux-headers package.
Option 2: Install the necessary build dependencies
If you want to cross-compile the linux-headers package, you need to
install additional packages.
For example, on Debian, the packages necessary for cross-compiling it
to arm64 can be installed with the following commands:
# dpkg --add-architecture arm64
# apt update
# apt install gcc-aarch64-linux-gnu libssl-dev:arm64
Fixes: f1d87664b82a ("kbuild: cross-compile linux-headers package when possible")
Reported-by: Ron Economos <re@w6rz.net>
Closes: https://lore.kernel.org/all/b3d4f49e-7ddb-29ba-0967-689232329b53@w6rz.net/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Ron Economos <re@w6rz.net>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-10-23 03:16:58 +09:00
|
|
|
Build-Profiles: <!pkg.${sourcename}.nokernelheaders>
|
2020-10-14 03:38:19 +09:00
|
|
|
Description: Linux kernel headers for $version on $debarch
|
|
|
|
This package provides kernel header files for $version on $debarch
|
|
|
|
.
|
|
|
|
This is useful for people who need to build external modules
|
|
|
|
EOF
|
|
|
|
fi
|
2023-03-13 05:07:30 +09:00
|
|
|
fi
|
2020-10-14 03:38:19 +09:00
|
|
|
|
2020-03-24 11:24:47 +01:00
|
|
|
if is_enabled CONFIG_DEBUG_INFO; then
|
|
|
|
cat <<EOF >> debian/control
|
2018-04-05 14:22:29 +03:00
|
|
|
|
2020-10-14 03:38:20 +09:00
|
|
|
Package: linux-image-$version-dbg
|
2018-04-05 14:22:29 +03:00
|
|
|
Section: debug
|
|
|
|
Architecture: $debarch
|
2024-10-23 03:16:59 +09:00
|
|
|
Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
|
2018-04-05 14:22:29 +03:00
|
|
|
Description: Linux kernel debugging symbols for $version
|
|
|
|
This package will come in handy if you need to debug the kernel. It provides
|
|
|
|
all the necessary debug symbols for the kernel and its modules.
|
|
|
|
EOF
|
2020-03-24 11:24:47 +01:00
|
|
|
fi
|
2018-04-05 14:22:29 +03:00
|
|
|
|
2023-08-01 21:19:26 +09:00
|
|
|
cat <<EOF > debian/rules.vars
|
|
|
|
ARCH := ${ARCH}
|
|
|
|
KERNELRELEASE := ${KERNELRELEASE}
|
2018-04-05 14:22:29 +03:00
|
|
|
EOF
|
2023-08-01 21:19:26 +09:00
|
|
|
|
2023-12-20 00:40:49 +09:00
|
|
|
cp "${srctree}/scripts/package/debian/copyright" debian/
|
2023-08-01 21:19:26 +09:00
|
|
|
cp "${srctree}/scripts/package/debian/rules" debian/
|
2018-04-05 14:22:29 +03:00
|
|
|
|
|
|
|
exit 0
|