fix: ship unstripped kernel image and modules in the -dbg package - #74
Conversation
a142e01 to
5f2708f
Compare
5e375a8 to
b1c4348
Compare
|
appears to include the missing segments now ! :D |
b1c4348 to
1f7d61e
Compare
1f7d61e to
6ea6ef6
Compare
97f2dec to
8a6c539
Compare
33e0fe2 to
a2318ae
Compare
a2318ae to
3497229
Compare
|
Thanks for pulling the dead debug profile in here, that covers my note on #83. The last build on this branch failed on your own new guard: Related: #84 drops resolute because iris-vpu and camx fail to build, which is a different failure from this one. Dropping it would hide the kgsl case rather than fix it, keep them separate? On Also this and #86 both rewrite the |
There is no longer any need to apply a separate configuration when building the package with the debug build profile. Remove all mention of it from the repository, along with the README sections and examples describing them. --profiles is kept as a generic DEB_BUILD_PROFILES pass-through; only the debug-specific example goes. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
dh_strip does not exempt /usr/lib/debug/; its only debug-path exclusions are .../debug/.build-id/ directories and debug/*.so. The vmlinux staged into linux-image-<KVER>-dbg is an ordinary ELF executable so dh_strip stripped it, removing the DWARF and the symbol table. Nothing was saved first: the package name already ends in -dbg, so dh_strip's automatic dbgsym extraction is skipped. The result was a -dbg package useless for crash, kdump and systemtap. dh_dwz, which runs immediately before, would also run dwz over that same multi-gigabyte vmlinux. Exclude by path rather than by package name. -X is a substring match against the full path, so it covers everything the -dbg package ships and needs no lookup of the kernel release to build the package name. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
Debug symbols for this source package are shipped by the declared linux-image-<KVER>-dbg package. The -dbgsym package debhelper generated alongside it duplicated that role for the headers tree without being declared or documented in debian/control.in. Drop it from the documented outputs at the same time: a build now publishes five binary packages per variant, all declared in debian/control.in. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
modules.order lists build-tree-relative paths, but modules_install puts in-tree modules under $MODLIB/kernel/. The debug files were written without that level, so the debug tree did not mirror the module tree. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
The DKMS modules in linux-image-<KVER>-dbg carried no debug information.
The extraction itself was fine: dkms had already stripped the module before
bundle-dkms-modules.sh ever saw it.
dkms strips by default. read_conf resolves an unset STRIP[index] to
${strip[0]:-yes} and build_module then runs:
strip -g "$built_module"
which is --strip-debug: the same operation as Stage 3 here, but applied
before Stage 2 has extracted anything. objcopy --only-keep-debug therefore
copied out an ELF with no .debug_* sections, and the shipped module had no
debug information to lose either.
Pass --directive 'STRIP=no' to dkms build to stop stripping the modules
after building.
Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
objcopy --only-keep-debug succeeds whether or not the module it reads carries DWARF, so a module built without debug information yields a debug file with no symbols and the -dbg package ships it. Assert that the extracted file has a .debug_info section, and fail if it does not. Match against readelf's captured output rather than piping it into `grep -q`. grep -q exits at the first match, readelf dies of SIGPIPE on its next write, and under this script's `set -o pipefail` the pipeline reports that failure instead of grep's success - firing the assertion on a file that does carry DWARF. Whether readelf gets far enough to be killed depends on stdio flush timing against grep's startup, so the pipeline form would fail only sometimes, which is worse than failing always. Read readelf's stderr into the same variable rather than discarding it, so a readelf that cannot read the file reports why instead of being indistinguishable from a file with no DWARF, and print the section list when the assertion fires: that is the evidence needed to tell "built without debug information" from "something stripped it". Report a failing objcopy the same way. Falling back to a full copy keeps the -dbg package usable when extraction fails, but it is a degradation and should not happen silently. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
dkms hardcodes where it reads configuration from: /etc/dkms/framework.conf and /etc/dkms/framework.conf.d/*.conf in read_framework_conf and the /etc/dkms/<module>*.conf overrides in read_conf. Neither set can be redirected by an option or an environment variable, so a build cannot opt out of whatever the host ships; it can only be explicit about it. Most of the exposure is already closed. framework.conf accepts a fixed variable list; it is sourced before the command line is parsed, so --dkmstree and --kernelsourcedir win over it; and --directive is applied after every conf file. What remains is tmp_location, parallel_jobs, the compress_*_opts and post_transaction, the last being an arbitrary command dkms will run. Print whatever config is present, once for the framework configuration and again per module for the overrides that apply to it, so a surprising host setting appears in the build log instead of acting silently. Deliberately not fatal: a build host is allowed to have dkms configured; this is diagnostic rather than a policy. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
make.log was printed only when the build failed, and then only its last 300 lines. A module that builds is not necessarily a module built correctly: the debug information check exists precisely because the result can be wrong while dkms reports success, and when it fires the compiler command lines are the first thing wanted. They were gone by then - the private dkms tree is deleted on EXIT, so nothing survives the build to look at. Print make.log for every module, before the outcome is judged, so it is in the log whether the build succeeded or not. debian/rules exports KBUILD_VERBOSE, so the full compiler command lines are there. A failed build still hard-fails, and the BUILD_EXCLUSIVE gate analysis for the "dkms attempted no build" case is unchanged; the failure path now refers to the log above rather than printing a tail of it a second time. Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
3497229 to
0841cf3
Compare
|
I wrote a small script to compare two packages, it's useless to me now this PR has been satisfied, but attaching here in case it's useful in future: compare-debug-artifacts-stripped.sh All of the binaries built in CI appear to now have:
Running the script above against the last CI run on this branch: |
763f851
into
qcom/debian/latest
The vmlinux in
linux-image-<KVER>-dbgwas unusable for crash/kdump/systemtap. Fix it.Verification