add: support Ubuntu/Debian kernel config sources - #567
Conversation
|
|
||
| if [ ! -r /proc/config.gz ]; then | ||
| log_fail "Kernel config source /proc/config.gz is not available" | ||
| if [ -r /proc/config.gz ]; then |
There was a problem hiding this comment.
Do not select /proc/config.gz solely because it is readable. On a minimal image it can exist while neither zgrep nor gzip is available, even when /boot/config-$(uname -r) is readable.
This reports every requested config as missing instead of trying the new fallback sources. Validate compressed-config readability with an available decompressor, otherwise continue to plain-text candidates.
| config_name="$1" | ||
| [ -n "$config_name" ] || return 3 | ||
|
|
||
| kcv_kver="$(uname -r 2>/dev/null)" |
There was a problem hiding this comment.
Factor kernel-config discovery into one shared helper. This repeats the same source-selection chain added to check_kernel_config(), so precedence and decompressor handling can drift.
Add a small shared kernel_config_source helper in functestlib.sh, returning path and format machine-readably, and compose both public APIs from it.
check_kernel_config() previously only read /proc/config.gz.
- utils/functestlib.sh:
- check_kernel_config(): probe a fallback chain of config sources:
/proc/config.gz -> /boot/config-$(uname -r) ->
/lib/modules/$(uname -r)/build/.config ->
/usr/src/linux-headers-$(uname -r)/.config.
- Updated detect_platform(): classifies the running OS as
ubuntu/debian/yocto/unknown from /etc/os-release
Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
c4e178e to
cc8325f
Compare
| kcs_kver="$(uname -r 2>/dev/null)" | ||
|
|
||
| if [ -r /proc/config.gz ]; then | ||
| if command -v zgrep >/dev/null 2>&1 || command -v gzip >/dev/null 2>&1; then |
There was a problem hiding this comment.
Readability plus the presence of zgrep or gzip does not prove /proc/config.gz is usable. A corrupt, truncated, or runtime-unreadable compressed config will still be selected here, causing check_kernel_config() and kernel_config_value() to fail without trying a valid /boot or headers fallback. Validate decompression before returning this source, for example with gzip -t /proc/config.gz when gzip is available, and continue the fallback chain when validation fails.
check_kernel_config() previously only read /proc/config.gz.