Package: initramfs-tools Version: 0.120 Severity: normal Tags: patch Dear Maintainer,
Currently there're a few issues on netconsole support in initramfs-tools: - netconsole setting (param to kernel module) can only be set in /etc/initramfs-tools/modules, but not from the expected kernel command line - debug info of initramfs-tools can be outputed to local console or saved to local file, which is inconvient for embeded system when the boot fails and there's neither console or serial console So here's the two patches to fix them. Please help to merge. Thank you! Cheers, Roger -- Package-specific info: -- /proc/cmdline console=ttyS0,115200 earlyprintk netconsole=@192.168.11.150/,6666@192.168.11.1/ root=/dev/md2 initrd=0x00800040,12M panic=5 BOOTVER=0.21 mtdparts=nand_mtd:0x1000000(boot),0xfe800000(rootfs),0x800000(reserve) debug -- System Information: Debian Release: 8.1 APT prefers stable APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'unstable'), (1, 'experimental') Architecture: armel (armv5tel) Kernel: Linux 4.0.0-2-kirkwood Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) Versions of packages initramfs-tools depends on: ii cpio 2.11+dfsg-4.1 ii klibc-utils 2.0.4-2 ii kmod 18-3 ii udev 215-17+deb8u1 Versions of packages initramfs-tools recommends: pn busybox | busybox-initramfs | busybox-static <none> Versions of packages initramfs-tools suggests: ii bash-completion 1:2.1-4 -- no debconf information
>From 28ed0a7df830882641c0984bf78b442b120f822d Mon Sep 17 00:00:00 2001 From: Roger Shimizu <rogershim...@gmail.com> Date: Mon, 27 Jul 2015 22:19:20 +0900 Subject: [PATCH 1/2] advance the timing of insmod netconsole Insmod netconsole before calling "load_modules" routine, which loads all specified modules. Because "load_modules" merely uses the module param in /etc/initramfs-tools/modules. This makes it possible to set netconsole param in command line options. Signed-off-by: Roger Shimizu <rogershim...@gmail.com> --- init | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init b/init index abf7f25..0497c67 100755 --- a/init +++ b/init @@ -200,11 +200,10 @@ run_scripts /scripts/init-top maybe_break modules [ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers" +[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}" load_modules [ "$quiet" != "y" ] && log_end_msg -[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}" - maybe_break premount [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount" run_scripts /scripts/init-premount -- 2.1.4
>From 06af4e4a7f547d36add461496be1387eca5f7200 Mon Sep 17 00:00:00 2001 From: Roger Shimizu <rogershim...@gmail.com> Date: Mon, 27 Jul 2015 22:44:46 +0900 Subject: [PATCH 2/2] redirect debug info to netconsole Redirect if debug and netconsole are both set in command line options. The redirecting code is added in both debug and netconsole entry to make the redirection as early as possible. Debug info saving to file feature is still available if not set netconsole in command line options. Signed-off-by: Roger Shimizu <rogershim...@gmail.com> --- init | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init b/init index 0497c67..96f1635 100755 --- a/init +++ b/init @@ -146,7 +146,11 @@ for x in $(cat /proc/cmdline); do debug) debug=y quiet=n - exec >/run/initramfs/initramfs.debug 2>&1 + if [ -n "${netconsole}" ]; then + exec >/dev/kmsg 2>&1 + else + exec >/run/initramfs/initramfs.debug 2>&1 + fi set -x ;; debug=*) @@ -165,6 +169,7 @@ for x in $(cat /proc/cmdline); do ;; netconsole=*) netconsole=${x#netconsole=} + [ "x$debug" = "xy" ] && exec >/dev/kmsg 2>&1 ;; BOOTIF=*) BOOTIF=${x#BOOTIF=} -- 2.1.4