From: Philippe Seewer Date: Tue, 16 Jun 2009 16:03:59 +0000 (+0200) Subject: Log error messages to /dev/kmsg X-Git-Tag: 0.1~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fd1ab9d8701daca4aca6399651e9ba1ad1c8f43;p=platform%2Fupstream%2Fdracut.git Log error messages to /dev/kmsg When die()'ing inside scripts that are udev run, a simple echo isn't good, udev usually swallows that. Routing messages to /dev/kmsg ensures they appear on screen and in addition are easily saved through dmesg. --- diff --git a/modules.d/99base/dracut-lib b/modules.d/99base/dracut-lib index 336b235..9cd515b 100644 --- a/modules.d/99base/dracut-lib +++ b/modules.d/99base/dracut-lib @@ -22,8 +22,8 @@ source_all() { } die() { - printf "FATAL: $1\n" - printf "Refusing to continue\n" + printf "<1>FATAL: $1\n" > /dev/kmsg + printf "<1>Refusing to continue\n" > /dev/kmsg exit 1 } diff --git a/modules.d/99base/init b/modules.d/99base/init index 8a5eac0..7ecf03a 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -7,11 +7,11 @@ emergency_shell() { + source_all emergency echo ; echo echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!" echo sh -i - source_all emergency } export PATH=/sbin:/bin:/usr/sbin:/usr/bin @@ -34,6 +34,7 @@ getarg rdinitdebug && set -x mknod /dev/null c 1 3 mknod /dev/ptmx c 5 2 mknod /dev/console c 5 1 +mknod /dev/kmsg c 1 11 mkdir /dev/pts mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1 @@ -41,16 +42,8 @@ mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1 getarg 'rdbreak=cmdline' && emergency_shell source_all cmdline -if [ -z "$rootok" -a -n "${root%%error:*}" ]; then - root="error: No handler for root=${root}" -fi - -if [ -n "$root" -a -z "${root%%error:*}" ]; then - case "${root%%:*}" in - '') die "No root= option specified, and no network support" ;; - error) die "${root#error:}" ;; - esac -fi +[ -z "$root" ] && die "No or empty root= argument" +[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'" # Network root scripts may need updated root= options, # so deposit them where they can see them (udev purges the env)