]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
log to kmsg, as syslog is not available early to notice the errors
authorElan Ruusamäe <glen@delfi.ee>
Thu, 27 Mar 2014 22:56:00 +0000 (00:56 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Thu, 27 Mar 2014 22:56:03 +0000 (00:56 +0200)
firmware-loader.sh

index 0e0a74cb5f2d4e28b3fc08cff2f8e524dd9b427d..82232a8dbf9b868b2168ae7250dd93246de28cd4 100755 (executable)
@@ -1,11 +1,31 @@
-#!/bin/sh -e
+#!/bin/sh
+set -e
 
 FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \
                /lib/firmware/$(uname -r) /lib/firmware"
 
+# add initrd code to print to kmsg
+# @param string message
+# @param int loglevel. defaults to "6" (info)
+# Log levels can be:
+# Name      String  Meaning
+# KERN_EMERG    "0" Emergency messages, system is about to crash or is unstable
+# KERN_ALERT    "1" Something bad happened and action must be taken immediately
+# KERN_CRIT "2" A critical condition occurred like a serious hardware/software failure
+# KERN_ERR  "3" An error condition, often used by drivers to indicate difficulties with the hardware
+# KERN_WARNING  "4" A warning, meaning nothing serious by itself but might indicate problems
+# KERN_NOTICE   "5" Nothing serious, but notably nevertheless. Often used to report security events.
+# KERN_INFO "6" Informational message e.g. startup information at driver initialization
+# KERN_DEBUG    "7" Debug messages
+# KERN_CONT "c" "continued" line of log printout (only done after a line that had no enclosing \n)
+kmsg() {
+    local msg="$1" level=${2:-3}
+    echo "<$level>$msg" > /dev/kmsg
+}
+
 err() {
-       echo "$@" >&2
-       logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true
+       echo >&2 "$*"
+       kmsg "${0##*/}[$$] $*"
 }
 
 if [ ! -e /sys$DEVPATH/loading ]; then
This page took 0.094713 seconds and 4 git commands to generate.