summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-04-04 13:05:18 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-04-07 11:49:08 +0800
commitae3c354e844698bdb4ed35a6845aa9dca1e9205f (patch)
treeb741aa698f1b48d4bf3a42ac696cb1a6d6920465 /utils
parent3fa256bb478f2b3e6316c561169190457b21e616 (diff)
downloadtalos-petitboot-ae3c354e844698bdb4ed35a6845aa9dca1e9205f.tar.gz
talos-petitboot-ae3c354e844698bdb4ed35a6845aa9dca1e9205f.zip
log: Allow runtime selection of 'debug' log level
Currently, we need to compile with -DDEBUG to implement debug-level logging in the UIs and discover server. Since we may not be able to easily replace a system's petitboot binaries, this change introduces a -v|--verbose option to the discver server and ncurses UI, which enables debug at runtime. We also move some of the udev debug code out of an #ifdef DEBUG block. Since petitboot is generally started on boot, we also add a little infrastructure to pass -v to petitboot on certain system contitions: either petitboot.debug on the kernel command line, or a petitboot,debug? NVRAM property containing the value 'true'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'utils')
-rw-r--r--utils/pb-console9
-rwxr-xr-xutils/pb-sysinfo6
2 files changed, 14 insertions, 1 deletions
diff --git a/utils/pb-console b/utils/pb-console
index d846ea7..9da899f 100644
--- a/utils/pb-console
+++ b/utils/pb-console
@@ -96,9 +96,16 @@ do
fi
done
+verbose_opt=
+sysinfo_bin=$(dirname $0)/pb-sysinfo
+if [ -x $sysinfo_bin ] && $sysinfo_bin --debug-enabled
+then
+ verbose_opt=--verbose
+fi
+
while :
do
- $ui
+ $ui $verbose_opt
reset
echo "Exiting petitboot. Type 'exit' to return."
$shell
diff --git a/utils/pb-sysinfo b/utils/pb-sysinfo
index bd2f0fe..001535a 100755
--- a/utils/pb-sysinfo
+++ b/utils/pb-sysinfo
@@ -7,4 +7,10 @@ case "$1" in
'--id')
tr -d '\0' < /proc/device-tree/system-id
;;
+'--debug-enabled')
+ exec >/dev/null 2>&1
+ nvram --print-config=petitboot,debug? | grep -q true && exit 0
+ grep -Fq petitboot.debug /proc/cmdline && exit 0
+ exit 1
+ ;;
esac
OpenPOWER on IntegriCloud