mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-31 08:25:37 +00:00
kexec-boot: Only capture kexec -d output to log, not console/kmsg
LOG() is added to log to the log only (not kmsg, more verbose than TRACE). DO_WITH_DEBUG only captures stdout/stderr to the log with LOG(). kexec-boot silences stderr from kexec, we don't want it on the console. No need to repeat the kexec command when asking in debug to continue boot, it's no longer hidden behind verbose output from kexec. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
d3656bbe65
commit
a767347afd
@ -151,13 +151,12 @@ if [ "$dryrun" = "y" ]; then exit 0; fi
|
|||||||
|
|
||||||
echo "Loading the new kernel:"
|
echo "Loading the new kernel:"
|
||||||
echo "$kexeccmd"
|
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"
|
|| die "Failed to load the new kernel"
|
||||||
|
|
||||||
if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then
|
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)
|
#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
|
read -s -n 1 -p "[DEBUG] Continue booting? [Y/n]: " debug_boot_confirm
|
||||||
echo
|
echo
|
||||||
|
@ -37,6 +37,11 @@ TRACE() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Write directly to the debug log (but not kmsg), never appears on console
|
||||||
|
LOG() {
|
||||||
|
echo "LOG: $*" >>/tmp/debug.log
|
||||||
|
}
|
||||||
|
|
||||||
preserve_rom() {
|
preserve_rom() {
|
||||||
TRACE "Under /etc/ash_functions:preserve_rom"
|
TRACE "Under /etc/ash_functions:preserve_rom"
|
||||||
new_rom="$1"
|
new_rom="$1"
|
||||||
|
@ -17,8 +17,8 @@ mask_param() {
|
|||||||
# readily visible in logs.
|
# readily visible in logs.
|
||||||
#
|
#
|
||||||
# For example:
|
# For example:
|
||||||
# ls /boot/vmlinux* | SINK_DEBUG "/boot kernels"
|
# ls /boot/vmlinux* | SINK_LOG "/boot kernels"
|
||||||
SINK_DEBUG() {
|
SINK_LOG() {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
local line haveblank
|
local line haveblank
|
||||||
# If the input doesn't end with a line break, read won't give us the
|
# If the input doesn't end with a line break, read won't give us the
|
||||||
@ -31,7 +31,7 @@ SINK_DEBUG() {
|
|||||||
haveblank=y
|
haveblank=y
|
||||||
else
|
else
|
||||||
haveblank=
|
haveblank=
|
||||||
DEBUG "$name: $line"
|
LOG "$name: $line"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ DO_WITH_DEBUG() {
|
|||||||
# - We capture PIPESTATUS[0] whether the command succeeds or fails,
|
# - We capture PIPESTATUS[0] whether the command succeeds or fails,
|
||||||
# since we don't know whether the pipeline status will be that of the
|
# since we don't know whether the pipeline status will be that of the
|
||||||
# command or 'tee' (depends on set -o pipefail).
|
# 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]}"
|
exit_status="${PIPESTATUS[0]}"
|
||||||
else
|
else
|
||||||
exit_status="${PIPESTATUS[0]}"
|
exit_status="${PIPESTATUS[0]}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user