Skip to content

add: support Ubuntu/Debian kernel config sources - #567

Open
vnarapar wants to merge 1 commit into
qualcomm-linux:mainfrom
vnarapar:ubuntu_config_enable
Open

add: support Ubuntu/Debian kernel config sources#567
vnarapar wants to merge 1 commit into
qualcomm-linux:mainfrom
vnarapar:ubuntu_config_enable

Conversation

@vnarapar

@vnarapar vnarapar commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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


if [ ! -r /proc/config.gz ]; then
log_fail "Kernel config source /proc/config.gz is not available"
if [ -r /proc/config.gz ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment thread Runner/utils/functestlib.sh Outdated
config_name="$1"
[ -n "$config_name" ] || return 3

kcv_kver="$(uname -r 2>/dev/null)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment thread Runner/utils/functestlib.sh Outdated
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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split this into two commits:

  1. utils: discover running kernel config sources
  2. utils: classify distro families

cfg_matched=0

if [ "$cfg_is_gz" -eq 1 ]; then
if command -v zgrep >/dev/null 2>&1; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source may have been validated with gzip -t, but this consumer switches to zgrep based only on command presence. A present but incompatible zgrep then causes false missing-config failures even though the validated gzip reader works.

Please return the validated reader from kernel_config_source() or centralize config queries in one helper and use that reader consistently in both consumers.

"/lib/modules/${kcs_kver}/build/.config" \
"/usr/src/linux-headers-${kcs_kver}/.config"
do
if [ -n "$kcs_kver" ] && [ -r "$kcs_cand" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runner/utils/functestlib.sh:961 — Readability alone does not make a plain-text candidate usable. An empty or malformed /boot/config-* is selected permanently and blocks valid build/header fallbacks, causing every requested option to appear missing.

Please validate that each candidate contains recognizable kernel-config records before returning it.

;;
*)
case "$_os_like_lc" in
*debian*)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An Ubuntu derivative commonly reports ID_LIKE="ubuntu debian", but this ordering classifies it as Debian.

Please check for the Ubuntu token before the Debian fallback so Ubuntu-compatible package policy remains accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants