[pve-devel] [PATCH kernel] add pve-kernel-X.Y-libc-dev package

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 27 19:03:19 CEST 2020


This was long overdue, allows to access the full feature set of our
kernel for some tools using the Linux API directly.

Packaging mostly taken from Debian[0]

[0]: https://salsa.debian.org/kernel-team/linux/-/blob/debian/4.19.118-2/debian/rules.real#L367

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

Package name could be probably better, just took the first thing coming to my
mind. Also, the approach of butting Kernel MAJ.MIN version in there or using
the kernel package version, or none at all, should be evaluated.

I'd guess none could be preferred as it should be backwards compatible anyway
(never break userspace™) so the newest one is always wanted.

note: This was working really quick, almost suspicious... Tested by building
QEMU (which inspired my doing this now in the first place due to the sizeof bug
we have with Debian's plin linux-libc-dev package on build)

 debian/control.in | 12 ++++++++++++
 debian/rules      | 22 ++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/debian/control.in b/debian/control.in
index 9b807c1d40c5..c457564eafe9 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -69,3 +69,15 @@ Depends: busybox,
 Recommends: grub-pc | grub-efi-amd64 | grub-efi-ia32 | grub-efi-arm64,
 Description: The Proxmox PVE Kernel Image
  This package contains the linux kernel and initial ramdisk used for booting
+
+Package: pve-kernel- at KVMAJMIN@-libc-dev
+Section: devel
+Priority: optional
+Architecture: any
+Provides: linux-libc-dev,
+Conflicts: linux-libc-dev,
+Replaces: linux-libc-dev,
+Depends: ${misc:Depends}
+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 libc and other system libraries.
diff --git a/debian/rules b/debian/rules
index e530eb548707..dc839b127507 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,6 +15,7 @@ CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate)
 
 PVE_KERNEL_PKG=pve-kernel-${KVNAME}
 PVE_HEADER_PKG=pve-headers-${KVNAME}
+PVE_USR_HEADER_PKG=pve-kernel-${KERNEL_MAJMIN}-libc-dev
 LINUX_TOOLS_PKG=linux-tools-${KERNEL_MAJMIN}
 KERNEL_SRC_COPY=${KERNEL_SRC}_tmp
 
@@ -87,7 +88,7 @@ debian/control: $(wildcard debian/*.in)
 
 build: .compile_mark .tools_compile_mark .modules_compile_mark
 
-install: .install_mark .tools_install_mark .headers_install_mark
+install: .install_mark .tools_install_mark .headers_install_mark .usr_headers_install_mark
 	dh_installdocs -A debian/copyright debian/SOURCE
 	dh_installchangelogs
 	dh_installman
@@ -97,7 +98,7 @@ install: .install_mark .tools_install_mark .headers_install_mark
 
 binary: install
 	debian/rules fwcheck abicheck
-	dh_strip -N${PVE_HEADER_PKG}
+	dh_strip -N${PVE_HEADER_PKG} -N${PVE_USR_HEADER_PKG}
 	dh_makeshlibs
 	dh_shlibdeps
 	dh_installdeb
@@ -207,6 +208,23 @@ binary: install
 	ln -sf /usr/src/linux-headers-${KVNAME} debian/${PVE_HEADER_PKG}/lib/modules/${KVNAME}/build
 	touch $@
 
+.usr_headers_install_mark: PKG_DIR = debian/${PVE_USR_HEADER_PKG}
+.usr_headers_install_mark: OUT_DIR = ${PKG_DIR}/usr
+.usr_headers_install_mark: .config_mark
+	rm -rf '${PKG_DIR}'
+	mkdir -p  '${PKG_DIR}'
+	$(MAKE) -C ${KERNEL_SRC} headers_check ARCH=$(KERNEL_HEADER_ARCH)
+	$(MAKE) -C ${KERNEL_SRC} headers_install ARCH=$(KERNEL_HEADER_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
+	rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
+	find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} +
+
+# Move include/asm to arch-specific directory
+	mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)
+	mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
+	test ! -d $(OUT_DIR)/include/arch || \
+		mv $(OUT_DIR)/include/arch $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
+	touch $@
+
 .modules_compile_mark: ${MODULES}/zfs.ko
 	touch $@
 
-- 
2.20.1





More information about the pve-devel mailing list