[PATCH 1/1][SRU][Jammy/Focal] UBUNTU: [Packaging] distribute sources list generation in parallel
You-Sheng Yang
vicamo.yang at canonical.com
Fri Mar 28 18:48:05 UTC 2025
Let `find` output only kernel module paths and use `xargs -P $(nproc)`
to invoke dwarfdump pipelines in parallel. This shorten the time for the
whole process to 13 minutes.
Then pre-sort output from each of the dwarfdump pipeline, this shorten
the time to 6 and half minutes.
Finally, use `flock` to guard output control.
BugLink: https://bugs.launchpad.net/bugs/2104911
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
debian/rules.d/2-binary-arch.mk | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index ff6a26e915999..9997f9802f8ba 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -66,8 +66,13 @@ endif
# Collect the list of kernel source files used for this build. Need to do this early
# before modules are stripped. Fail if the resulting file is empty.
- find $(builddir)/build-$* -name vmlinux -o -name \*.ko -exec dwarfdump -i {} \; | \
- grep -E 'DW_AT_(call|decl)_file' | sed -n 's|.*\s/|/|p' | sort -u > \
+ find $(builddir)/build-$* -name vmlinux -o -name \*.ko -print0 | \
+ xargs -0 -P $$(nproc) -I % sh -c " \
+ dwarfdump -i % | \
+ sed -n '/DW_AT_\(call\|decl\)_file.*\//s|.*\s/|/|p' | \
+ sort -u | \
+ flock -x $(builddir)/build-$*/sources.list.lock cat \
+ " | sort -u > \
$(builddir)/build-$*/sources.list
test -s $(builddir)/build-$*/sources.list
--
2.48.1
More information about the kernel-team
mailing list