Commit 36862e14 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: deb-pkg: use dh_listpackages to know enabled packages

Use 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.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent b611daae
...@@ -160,7 +160,7 @@ install_linux_image_dbg () { ...@@ -160,7 +160,7 @@ install_linux_image_dbg () {
ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE} ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE}
} }
deploy_kernel_headers () { install_kernel_headers () {
pdir=$1 pdir=$1
rm -rf $pdir rm -rf $pdir
...@@ -198,7 +198,7 @@ deploy_kernel_headers () { ...@@ -198,7 +198,7 @@ deploy_kernel_headers () {
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
} }
deploy_libc_headers () { install_libc_headers () {
pdir=$1 pdir=$1
rm -rf $pdir rm -rf $pdir
...@@ -213,33 +213,38 @@ deploy_libc_headers () { ...@@ -213,33 +213,38 @@ deploy_libc_headers () {
mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ 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 rm -f debian/files
if [ "$ARCH" != "um" ]; then packages_enabled=$(dh_listpackages)
if is_enabled CONFIG_MODULES; then
deploy_kernel_headers debian/linux-headers for package in ${packages_enabled}
create_package linux-headers-$version debian/linux-headers do
fi case ${package} in
*-dbg)
deploy_libc_headers debian/linux-libc-dev # This must be done after linux-image, that is, we expect the
create_package linux-libc-dev debian/linux-libc-dev # debug package appears after linux-image in debian/control.
fi install_linux_image_dbg debian/linux-image-dbg debian/linux-image;;
linux-image-*|user-mode-linux-*)
install_linux_image debian/linux-image "$packagename" install_linux_image debian/linux-image ${package};;
linux-libc-dev)
if is_enabled CONFIG_DEBUG_INFO; then install_libc_headers debian/linux-libc-dev;;
install_linux_image_dbg debian/linux-image-dbg debian/linux-image linux-headers-*)
create_package "$dbg_packagename" debian/linux-image-dbg install_kernel_headers debian/linux-headers;;
fi esac
done
create_package "$packagename" debian/linux-image
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 exit 0
...@@ -192,7 +192,7 @@ Section: kernel ...@@ -192,7 +192,7 @@ Section: kernel
Priority: optional Priority: optional
Maintainer: $maintainer Maintainer: $maintainer
Rules-Requires-Root: no 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/ Homepage: https://www.kernel.org/
Package: $packagename-$version Package: $packagename-$version
...@@ -200,6 +200,10 @@ Architecture: $debarch ...@@ -200,6 +200,10 @@ Architecture: $debarch
Description: Linux kernel, version $version Description: Linux kernel, version $version
This package contains the Linux kernel, modules and corresponding other This package contains the Linux kernel, modules and corresponding other
files, version: $version. files, version: $version.
EOF
if [ "${SRCARCH}" != um ]; then
cat <<EOF >> debian/control
Package: linux-libc-dev Package: linux-libc-dev
Section: devel Section: devel
...@@ -222,6 +226,7 @@ Description: Linux kernel headers for $version on $debarch ...@@ -222,6 +226,7 @@ Description: Linux kernel headers for $version on $debarch
This is useful for people who need to build external modules This is useful for people who need to build external modules
EOF EOF
fi fi
fi
if is_enabled CONFIG_DEBUG_INFO; then if is_enabled CONFIG_DEBUG_INFO; then
cat <<EOF >> debian/control cat <<EOF >> debian/control
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment