From becb93c2bff141f85786f404dac268e782d0aeb7 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 5 Oct 2021 23:16:01 +0200 Subject: [PATCH] scripts/diagnostic: Add support for collecting kernel configs --- scripts/diagnostics.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/diagnostics.sh b/scripts/diagnostics.sh index 9f36efc26..24be399bb 100755 --- a/scripts/diagnostics.sh +++ b/scripts/diagnostics.sh @@ -10,6 +10,7 @@ all_components=( "platform" "serial" "sam" + "kconfig" ) @@ -191,6 +192,32 @@ if [[ " ${components[*]} " =~ " sam " ]]; then fi fi +# collect kernel config +if [[ " ${components[*]} " =~ " kconfig " ]]; then + echo " - kernel configuration" + + # attempt to load module for accessing current kernel config + if modinfo configs > /dev/null 2>&1; then + sudo modprobe configs + fi + + # try to get current config from /proc, if available + if [[ -f "/proc/config.gz" ]]; then + zcat "/proc/config.gz" > "${tmpdir}/kernel-$(uname -r).conf" + fi + + # try to get current config from /boot, if available + if [[ -f "/boot/config" ]]; then + cp "/boot/config" "${tmpdir}/kernel-$(uname -r).conf" + fi + + # try to get any config from /boot + find "/boot" -name 'config-*' -print0 | while IFS= read -r -d '' file; do + name="$(basename "${file}")" + cp "${file}" "${tmpdir}/kernel-${name#"config-"}.conf" + done; +fi + # bundle to archive echo " ==> generating archive..."