diff mbox series

[Unstable,v2,2/5] UBUNTU: [Packaging] buildinfo: Add modinfo data from built-in modules to the ABI

Message ID 20210610080807.25518-3-juergh@canonical.com
State New
Headers show
Series Use modinfo data for the ABI | expand

Commit Message

Juerg Haefliger June 10, 2021, 8:08 a.m. UTC
Collect the modinfo data from the built-in modules and put it in a
modules.builtin subdirectory provided by the buildinfo package.

For Hirsute this adds roughly 1.2MB to the amd64 generic buildinfo package:
  $ du -h /usr/lib/linux/5.11.0-14-generic/modules.builtin/
  1.2M  /usr/lib/linux/5.11.0-14-generic/modules.builtin/

With the previous commit, this results in an amd64 generic buildinfo
package size increase from 440K to 4.8M.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 debian/rules.d/2-binary-arch.mk | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index fbc7ce928587..2b45b1caf925 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -354,6 +354,20 @@  endif
 	 INSTALL_DIR="$(pkgdir)" SOURCE_DIR="$(CURDIR)"			\
 	 run-parts -v $(DROOT)/tests-build
 
+	# Build the final ABI information for built-in modules.
+	# This needs to happen before the next step below which removes
+	# essential files required by modinfo (modules.dep and the likes).
+	if [ -f $(pkgdir)/lib/modules/$(abi_release)-$*/modules.builtin ] ; then \
+		install -d $(abidir)/$*.modules.builtin; \
+		cat $(pkgdir)/lib/modules/$(abi_release)-$*/modules.builtin | \
+		while read ko; do \
+			modname=$${ko##*/}; \
+			modname=$${modname%.ko}; \
+			/sbin/modinfo -b $(pkgdir) -k $(abi_release)-$* "$${modname}" > \
+				$(abidir)/$*.modules.builtin/"$${modname}"; \
+		done; \
+	fi
+
 	#
 	# Remove files which are generated at installation by postinst,
 	# except for modules.order and modules.builtin
@@ -501,6 +515,11 @@  endif
 		$(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/retpoline
 	install -m644 $(abidir)/$*.compiler \
 		$(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/compiler
+	if [ -d $(abidir)/$*.modules.builtin ] ; then \
+		install -d $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/modules.builtin; \
+		install -m644 $(abidir)/$*.modules.builtin/* \
+			$(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/modules.builtin/; \
+	fi
 
 ifneq ($(full_build),false)
 	# Clean out this flavours build directory.