etc/ash_function's warn/die/TRACE/DEBUG now output also under /dev/kmsg when DEBUG is enabled

This commit is contained in:
Thierry Laurion 2023-10-10 12:28:15 -04:00
parent 4ff955918f
commit 0416896b82
No known key found for this signature in database
GPG Key ID: E7B4A71658E36A93

View File

@ -4,26 +4,34 @@
# busybox ash on legacy-flash boards, and with bash on all other boards.
die() {
echo >&2 " !!! ERROR: $* !!!";
if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then
echo " !!! ERROR: $* !!!" | tee -a /tmp/debug.log /dev/kmsg > /dev/null;
else
echo >&2 "!!! ERROR: $* !!!";
fi
sleep 2;
exit 1;
}
warn() {
echo >&2 " *** WARNING: $* ***";
if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then
echo " *** WARNING: $* ***" | tee -a /tmp/debug.log /dev/kmsg > /dev/null;
else
echo >&2 " *** WARNING: $* ***";
fi
sleep 1;
}
DEBUG() {
if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then
echo "DEBUG: $*" | tee -a /tmp/debug.log >&2;
echo "DEBUG: $*" | tee -a /tmp/debug.log /dev/kmsg > /dev/null;
fi
}
TRACE() {
if [ "$CONFIG_ENABLE_FUNCTION_TRACING_OUTPUT" = "y" ];then
echo "TRACE: $*" | tee -a /tmp/debug.log >&2;
fi
if [ "$CONFIG_ENABLE_FUNCTION_TRACING_OUTPUT" = "y" ];then
echo "TRACE: $*" | tee -a /tmp/debug.log /dev/kmsg > /dev/null;
fi
}
preserve_rom() {