Skip to content

Commit 2abe628

Browse files
committed
fix(os): strip production kernel module debug data
1 parent b6dfefd commit 2abe628

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

os/mkosi/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ build_one() {
2727
rm -rf "$work" "$out"; mkdir -p "$stage" "$kstage" "$out"
2828
"$SELF/scripts/build-components.sh" "${component_cache_args[@]}" \
2929
"$work" "$stage" "$kstage" "$flavor"
30+
if [[ $flavor == prod ]]; then
31+
# Yocto splits module DWARF into debug packages which are not shipped in
32+
# the production image. Keep BTF and loadable ELF metadata, but do not put
33+
# hundreds of MiB of host-side DWARF into the immutable guest root.
34+
find "$kstage/usr/lib/modules" -type f -name '*.ko' -exec objcopy --strip-debug {} +
35+
fi
3036
# ExtraTrees is copied over Debian's usr-merged root where /bin, /sbin and
3137
# /lib are symlinks. Normalize build systems (notably OpenZFS) that install
3238
# into the legacy physical directories before handing the tree to mkosi.

os/mkosi/tests/acceptance.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ grep -q 'image/assemble.sh' "$D/build.sh"
2424
grep -q 'build-ovmf.sh' "$D/scripts/build-components.sh"
2525
grep -q 'fbe0805b2091393406952e84724188f8c1941837' "$D/scripts/build-ovmf.sh"
2626
grep -q 'AmdSev/AmdSevX64.dsc' "$D/scripts/build-ovmf.sh"
27+
grep -q 'objcopy --strip-debug' "$D/build.sh"
2728
grep -q '"firmware_sev":"files/ovmf-sev.fd"' "$D/scripts/make-release-artifacts.sh"
2829
grep -q 'measurement.snp.cbor' "$D/tests/check-output.sh"
2930
grep -q '0001-validate-ocsp-response-freshness.patch' "$D/scripts/build-nvattest.sh"

0 commit comments

Comments
 (0)