diff --git a/initrd/bin/kexec-boot b/initrd/bin/kexec-boot index ccc59a01..14478879 100755 --- a/initrd/bin/kexec-boot +++ b/initrd/bin/kexec-boot @@ -151,13 +151,12 @@ if [ "$dryrun" = "y" ]; then exit 0; fi echo "Loading the new kernel:" echo "$kexeccmd" -DO_WITH_DEBUG eval "$kexeccmd" \ +# DO_WITH_DEBUG captures the debug output from stderr to the log, we don't need +# it on the console as well +DO_WITH_DEBUG eval "$kexeccmd" 2>/dev/null \ || die "Failed to load the new kernel" if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then - #Repeat kexec command that will be executed since in debug - DEBUG "kexeccmd= $kexeccmd" - #Ask user if they want to continue booting without echoing back the input (-s) read -s -n 1 -p "[DEBUG] Continue booting? [Y/n]: " debug_boot_confirm echo diff --git a/initrd/etc/ash_functions b/initrd/etc/ash_functions index 627f93d6..db591a55 100644 --- a/initrd/etc/ash_functions +++ b/initrd/etc/ash_functions @@ -37,6 +37,11 @@ TRACE() { fi } +# Write directly to the debug log (but not kmsg), never appears on console +LOG() { + echo "LOG: $*" >>/tmp/debug.log +} + preserve_rom() { TRACE "Under /etc/ash_functions:preserve_rom" new_rom="$1" diff --git a/initrd/etc/functions b/initrd/etc/functions index 7ad0d794..94f77d3e 100755 --- a/initrd/etc/functions +++ b/initrd/etc/functions @@ -17,8 +17,8 @@ mask_param() { # readily visible in logs. # # For example: -# ls /boot/vmlinux* | SINK_DEBUG "/boot kernels" -SINK_DEBUG() { +# ls /boot/vmlinux* | SINK_LOG "/boot kernels" +SINK_LOG() { local name="$1" local line haveblank # If the input doesn't end with a line break, read won't give us the @@ -31,7 +31,7 @@ SINK_DEBUG() { haveblank=y else haveblank= - DEBUG "$name: $line" + LOG "$name: $line" fi done } @@ -94,7 +94,7 @@ DO_WITH_DEBUG() { # - We capture PIPESTATUS[0] whether the command succeeds or fails, # since we don't know whether the pipeline status will be that of the # command or 'tee' (depends on set -o pipefail). - if ! "$@" 2> >(tee /dev/stderr | SINK_DEBUG "$1 stderr") | tee >(SINK_DEBUG "$1 stdout"); then + if ! "$@" 2> >(tee /dev/stderr | SINK_LOG "$1 stderr") | tee >(SINK_LOG "$1 stdout"); then exit_status="${PIPESTATUS[0]}" else exit_status="${PIPESTATUS[0]}"