summaryrefslogtreecommitdiff
path: root/scripts/package/builddeb
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-03-13 05:07:30 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2023-03-15 15:15:07 +0900
commit36862e14e31611f9786622db366327209a7aede7 (patch)
treebcc9678dd5ba408b1b20b85f01461054ccd542d0 /scripts/package/builddeb
parentb611daae5efc64e817171a54021d3b334cc1bc41 (diff)
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: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/package/builddeb')
-rwxr-xr-xscripts/package/builddeb61
1 files changed, 33 insertions, 28 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 906889b304a4..c5ae57167d7c 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -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