import CS kexec-tools-2.0.26-8.el9
This commit is contained in:
parent
6cc94873f3
commit
9a3b640ab1
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
SOURCES/eppic-e8844d3.tar.gz
|
SOURCES/eppic-e8844d3.tar.gz
|
||||||
SOURCES/kexec-tools-2.0.25.tar.xz
|
SOURCES/kexec-tools-2.0.26.tar.xz
|
||||||
SOURCES/makedumpfile-1.7.2.tar.gz
|
SOURCES/makedumpfile-1.7.3.tar.gz
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
||||||
78d5d4f7e9d358ca234db9c84a551d9d411eb0b5 SOURCES/kexec-tools-2.0.25.tar.xz
|
27cea5d032ec1e93506b8110222420abf754df2d SOURCES/kexec-tools-2.0.26.tar.xz
|
||||||
24bce02cd42cdbb960ada4d9e733355582e35784 SOURCES/makedumpfile-1.7.2.tar.gz
|
2815949d81c11cd2f97f184153448d6e8ddff256 SOURCES/makedumpfile-1.7.3.tar.gz
|
||||||
|
@ -491,6 +491,8 @@ wait_online_network()
|
|||||||
if _route=$(kdump_get_ip_route "$1" 2> /dev/null); then
|
if _route=$(kdump_get_ip_route "$1" 2> /dev/null); then
|
||||||
printf "%s" "$_route"
|
printf "%s" "$_route"
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
dwarn "Waiting for network to be ready (${_loop}s / 10min)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -315,7 +315,9 @@ clone_and_modify_nmconnection() {
|
|||||||
# connection profile based on MAC address
|
# connection profile based on MAC address
|
||||||
_match_nmconnection_by_mac "$_uuid" "$_dev"
|
_match_nmconnection_by_mac "$_uuid" "$_dev"
|
||||||
|
|
||||||
_cloned_nmconnection_file_path=$(nmcli --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
|
# If a value contain ":", nmcli by default escape it with "\:" because it
|
||||||
|
# also uses ":" as the delimiter to separate values. In our case, escaping is not needed.
|
||||||
|
_cloned_nmconnection_file_path=$(nmcli --escape no --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
|
||||||
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
|
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
|
||||||
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
|
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
|
||||||
# change uuid back to old value in case it's refered by other connection
|
# change uuid back to old value in case it's refered by other connection
|
||||||
@ -538,7 +540,12 @@ kdump_collect_netif_usage() {
|
|||||||
local _destaddr _srcaddr _route _netdev
|
local _destaddr _srcaddr _route _netdev
|
||||||
|
|
||||||
_destaddr=$(kdump_get_remote_ip "$1")
|
_destaddr=$(kdump_get_remote_ip "$1")
|
||||||
_route=$(kdump_get_ip_route "$_destaddr")
|
|
||||||
|
if ! _route=$(kdump_get_ip_route "$_destaddr"); then
|
||||||
|
derror "Bad kdump network destination: $_destaddr"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
||||||
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
||||||
|
|
||||||
|
@ -166,7 +166,6 @@ is_lvm2_thinp_device()
|
|||||||
kdump_get_ip_route()
|
kdump_get_ip_route()
|
||||||
{
|
{
|
||||||
if ! _route=$(/sbin/ip -o route get to "$1" 2>&1); then
|
if ! _route=$(/sbin/ip -o route get to "$1" 2>&1); then
|
||||||
derror "Bad kdump network destination: $1"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "$_route"
|
echo "$_route"
|
||||||
|
@ -7,6 +7,17 @@
|
|||||||
|
|
||||||
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
||||||
|
|
||||||
|
is_uki()
|
||||||
|
{
|
||||||
|
local img
|
||||||
|
|
||||||
|
img="$1"
|
||||||
|
|
||||||
|
[[ -f "$img" ]] || return
|
||||||
|
[[ "$(file -b --mime-type "$img")" == application/x-dosexec ]] || return
|
||||||
|
objdump -h -j .linux "$img" &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
is_fadump_capable()
|
is_fadump_capable()
|
||||||
{
|
{
|
||||||
# Check if firmware-assisted dump is enabled
|
# Check if firmware-assisted dump is enabled
|
||||||
@ -20,12 +31,11 @@ is_fadump_capable()
|
|||||||
|
|
||||||
is_squash_available()
|
is_squash_available()
|
||||||
{
|
{
|
||||||
|
local _version kmodule
|
||||||
|
|
||||||
|
_version=$(_get_kdump_kernel_version)
|
||||||
for kmodule in squashfs overlay loop; do
|
for kmodule in squashfs overlay loop; do
|
||||||
if [[ -z $KDUMP_KERNELVER ]]; then
|
modprobe -S "$_version" --dry-run $kmodule &> /dev/null || return 1
|
||||||
modprobe --dry-run $kmodule &> /dev/null || return 1
|
|
||||||
else
|
|
||||||
modprobe -S "$KDUMP_KERNELVER" --dry-run $kmodule &> /dev/null || return 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,9 +264,9 @@ kdump_get_persistent_dev()
|
|||||||
echo $(get_persistent_dev "$dev")
|
echo $(get_persistent_dev "$dev")
|
||||||
}
|
}
|
||||||
|
|
||||||
is_atomic()
|
is_ostree()
|
||||||
{
|
{
|
||||||
grep -q "ostree" /proc/cmdline
|
test -f /run/ostree-booted
|
||||||
}
|
}
|
||||||
|
|
||||||
# get ip address or hostname from nfs/ssh config value
|
# get ip address or hostname from nfs/ssh config value
|
||||||
@ -506,24 +516,6 @@ check_current_kdump_status()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
|
|
||||||
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
|
|
||||||
# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
|
|
||||||
remove_cmdline_param()
|
|
||||||
{
|
|
||||||
local cmdline=$1
|
|
||||||
shift
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
|
||||||
cmdline=$(echo "$cmdline" |
|
|
||||||
sed -e "s/\b$arg=[^ ]*//g" \
|
|
||||||
-e "s/^$arg\b//g" \
|
|
||||||
-e "s/[[:space:]]$arg\b//g" \
|
|
||||||
-e "s/\s\+/ /g")
|
|
||||||
done
|
|
||||||
echo "$cmdline"
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# This function returns the "apicid" of the boot
|
# This function returns the "apicid" of the boot
|
||||||
# cpu (cpu 0) if present.
|
# cpu (cpu 0) if present.
|
||||||
@ -538,23 +530,6 @@ get_bootcpu_apicid()
|
|||||||
/proc/cpuinfo
|
/proc/cpuinfo
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# append_cmdline <kernel cmdline> <parameter name> <parameter value>
|
|
||||||
# This function appends argument "$2=$3" to string ($1) if not already present.
|
|
||||||
#
|
|
||||||
append_cmdline()
|
|
||||||
{
|
|
||||||
local cmdline=$1
|
|
||||||
local newstr=${cmdline/$2/""}
|
|
||||||
|
|
||||||
# unchanged str implies argument wasn't there
|
|
||||||
if [[ $cmdline == "$newstr" ]]; then
|
|
||||||
cmdline="${cmdline} ${2}=${3}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$cmdline"
|
|
||||||
}
|
|
||||||
|
|
||||||
# This function check iomem and determines if we have more than
|
# This function check iomem and determines if we have more than
|
||||||
# 4GB of ram available. Returns 1 if we do, 0 if we dont
|
# 4GB of ram available. Returns 1 if we do, 0 if we dont
|
||||||
need_64bit_headers()
|
need_64bit_headers()
|
||||||
@ -647,10 +622,17 @@ prepare_kdump_kernel()
|
|||||||
read -r machine_id < /etc/machine-id
|
read -r machine_id < /etc/machine-id
|
||||||
|
|
||||||
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
||||||
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT $machine_id/$kdump_kernelver/$KDUMP_IMG"
|
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT \
|
||||||
|
$machine_id/$kdump_kernelver/$KDUMP_IMG \
|
||||||
|
EFI/Linux/$machine_id-$kdump_kernelver.efi"
|
||||||
|
|
||||||
|
# The kernel of OSTree based systems is not in the standard locations.
|
||||||
|
if is_ostree; then
|
||||||
|
boot_dirlist="$(echo /boot/ostree/*) $boot_dirlist"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
|
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
|
||||||
boot_img="$(sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/" /proc/cmdline)"
|
boot_img="$(grep -P -o '^BOOT_IMAGE=(\S+)' /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\)/\2/")"
|
||||||
if [[ "$boot_img" == *"$kdump_kernelver" ]]; then
|
if [[ "$boot_img" == *"$kdump_kernelver" ]]; then
|
||||||
boot_imglist="$boot_img $boot_imglist"
|
boot_imglist="$boot_img $boot_imglist"
|
||||||
fi
|
fi
|
||||||
@ -666,6 +648,75 @@ prepare_kdump_kernel()
|
|||||||
echo "$kdump_kernel"
|
echo "$kdump_kernel"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_is_valid_kver()
|
||||||
|
{
|
||||||
|
[[ -f /usr/lib/modules/$1/modules.dep ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function is introduced since 64k variant may be installed on 4k or vice versa
|
||||||
|
# $1 the kernel path name.
|
||||||
|
parse_kver_from_path()
|
||||||
|
{
|
||||||
|
local _img _kver
|
||||||
|
|
||||||
|
[[ -z "$1" ]] && return
|
||||||
|
|
||||||
|
_img=$1
|
||||||
|
BLS_ENTRY_TOKEN=$(</etc/machine-id)
|
||||||
|
|
||||||
|
# Fedora standard installation, i.e. $BOOT/vmlinuz-<version>
|
||||||
|
_kver=${_img##*/vmlinuz-}
|
||||||
|
_kver=${_kver%"$KDUMP_IMG_EXT"}
|
||||||
|
if _is_valid_kver "$_kver"; then
|
||||||
|
echo "$_kver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# BLS recommended image names, i.e. $BOOT/<token>/<version>/linux
|
||||||
|
_kver=${_img##*/"$BLS_ENTRY_TOKEN"/}
|
||||||
|
_kver=${_kver%%/*}
|
||||||
|
if _is_valid_kver "$_kver"; then
|
||||||
|
echo "$_kver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fedora UKI installation, i.e. $BOOT/efi/EFI/Linux/<token>-<version>.efi
|
||||||
|
_kver=${_img##*/"$BLS_ENTRY_TOKEN"-}
|
||||||
|
_kver=${_kver%.efi}
|
||||||
|
if _is_valid_kver "$_kver"; then
|
||||||
|
echo "$_kver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
ddebug "Could not parse version from $_img"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_kdump_kernel_version()
|
||||||
|
{
|
||||||
|
local _version _version_nondebug
|
||||||
|
|
||||||
|
if [[ -n "$KDUMP_KERNELVER" ]]; then
|
||||||
|
echo "$KDUMP_KERNELVER"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
_version=$(uname -r)
|
||||||
|
if [[ ! "$_version" =~ [+|-]debug$ ]]; then
|
||||||
|
echo "$_version"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
_version_nondebug=${_version%+debug}
|
||||||
|
_version_nondebug=${_version_nondebug%-debug}
|
||||||
|
if [[ -f "$(prepare_kdump_kernel "$_version_nondebug")" ]]; then
|
||||||
|
dinfo "Use of debug kernel detected. Trying to use $_version_nondebug"
|
||||||
|
echo "$_version_nondebug"
|
||||||
|
else
|
||||||
|
dinfo "Use of debug kernel detected but cannot find $_version_nondebug. Falling back to $_version"
|
||||||
|
echo "$_version"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Detect initrd and kernel location, results are stored in global environmental variables:
|
# Detect initrd and kernel location, results are stored in global environmental variables:
|
||||||
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
||||||
@ -675,48 +726,27 @@ prepare_kdump_kernel()
|
|||||||
#
|
#
|
||||||
prepare_kdump_bootinfo()
|
prepare_kdump_bootinfo()
|
||||||
{
|
{
|
||||||
local boot_initrdlist nondebug_kernelver debug_kernelver
|
local boot_initrdlist default_initrd_base var_target_initrd_dir
|
||||||
local default_initrd_base var_target_initrd_dir
|
|
||||||
|
|
||||||
if [[ -z $KDUMP_KERNELVER ]]; then
|
|
||||||
KDUMP_KERNELVER=$(uname -r)
|
|
||||||
|
|
||||||
# Fadump uses the regular bootloader, unlike kdump. So, use the same version
|
|
||||||
# for default kernel and capture kernel unless specified explicitly with
|
|
||||||
# KDUMP_KERNELVER option.
|
|
||||||
if ! is_fadump_capable; then
|
|
||||||
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use nondebug kernel if possible, because debug kernel will consume more memory and may oom.
|
|
||||||
if [[ -n $nondebug_kernelver ]]; then
|
|
||||||
dinfo "Trying to use $nondebug_kernelver."
|
|
||||||
debug_kernelver=$KDUMP_KERNELVER
|
|
||||||
KDUMP_KERNELVER=$nondebug_kernelver
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
KDUMP_KERNELVER=$(_get_kdump_kernel_version)
|
||||||
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
||||||
|
|
||||||
if ! [[ -e $KDUMP_KERNEL ]]; then
|
|
||||||
if [[ -n $debug_kernelver ]]; then
|
|
||||||
dinfo "Fallback to using debug kernel"
|
|
||||||
KDUMP_KERNELVER=$debug_kernelver
|
|
||||||
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [[ -e $KDUMP_KERNEL ]]; then
|
if ! [[ -e $KDUMP_KERNEL ]]; then
|
||||||
derror "Failed to detect kdump kernel location"
|
derror "Failed to detect kdump kernel location"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$KDUMP_KERNEL" == *"+debug" ]]; then
|
# For 64k variant, e.g. vmlinuz-5.14.0-327.el9.aarch64+64k-debug
|
||||||
|
if [[ "$KDUMP_KERNEL" == *"+debug" || "$KDUMP_KERNEL" == *"64k-debug" ]]; then
|
||||||
dwarn "Using debug kernel, you may need to set a larger crashkernel than the default value."
|
dwarn "Using debug kernel, you may need to set a larger crashkernel than the default value."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set KDUMP_BOOTDIR to where kernel image is stored
|
# Set KDUMP_BOOTDIR to where kernel image is stored
|
||||||
KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL")
|
if is_uki "$KDUMP_KERNEL"; then
|
||||||
|
KDUMP_BOOTDIR=/boot
|
||||||
|
else
|
||||||
|
KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL")
|
||||||
|
fi
|
||||||
|
|
||||||
# Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
|
# Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
|
||||||
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
|
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
|
||||||
@ -768,26 +798,46 @@ get_watchdog_drvs()
|
|||||||
echo "$_wdtdrvs"
|
echo "$_wdtdrvs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cmdline_parse()
|
||||||
|
{
|
||||||
|
local opt val
|
||||||
|
|
||||||
|
while read -r opt; do
|
||||||
|
if [[ $opt =~ = ]]; then
|
||||||
|
val=${opt#*=}
|
||||||
|
opt=${opt%%=*}
|
||||||
|
# ignore options like 'foo='
|
||||||
|
[[ -z $val ]] && continue
|
||||||
|
# xargs removes quotes, add them again
|
||||||
|
[[ $val =~ [[:space:]] ]] && val="\"$val\""
|
||||||
|
else
|
||||||
|
val=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$opt $val"
|
||||||
|
done <<< "$(echo "$1" | xargs -n 1 echo)"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# prepare_cmdline <commandline> <commandline remove> <commandline append>
|
# prepare_cmdline <commandline> <commandline remove> <commandline append>
|
||||||
# This function performs a series of edits on the command line.
|
# This function performs a series of edits on the command line.
|
||||||
# Store the final result in global $KDUMP_COMMANDLINE.
|
# Store the final result in global $KDUMP_COMMANDLINE.
|
||||||
prepare_cmdline()
|
prepare_cmdline()
|
||||||
{
|
{
|
||||||
local cmdline id arg
|
local in out append opt val id drv
|
||||||
|
local -A remove
|
||||||
|
|
||||||
|
in=${1:-$(< /proc/cmdline)}
|
||||||
|
while read -r opt val; do
|
||||||
|
[[ -n "$opt" ]] || continue
|
||||||
|
remove[$opt]=1
|
||||||
|
done <<< "$(_cmdline_parse "$2")"
|
||||||
|
append=$3
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
|
||||||
cmdline=$(< /proc/cmdline)
|
|
||||||
else
|
|
||||||
cmdline="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# These params should always be removed
|
# These params should always be removed
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn)
|
remove[crashkernel]=1
|
||||||
# These params can be removed configurably
|
remove[panic_on_warn]=1
|
||||||
while read -r arg; do
|
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" "$arg")
|
|
||||||
done <<< "$(echo "$2" | xargs -n 1 echo)"
|
|
||||||
|
|
||||||
# Always remove "root=X", as we now explicitly generate all kinds
|
# Always remove "root=X", as we now explicitly generate all kinds
|
||||||
# of dump target mount information including root fs.
|
# of dump target mount information including root fs.
|
||||||
@ -795,39 +845,63 @@ prepare_cmdline()
|
|||||||
# We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
|
# We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
|
||||||
# about it(e.g. for debug purpose), then can pass "root=X" using
|
# about it(e.g. for debug purpose), then can pass "root=X" using
|
||||||
# KDUMP_COMMANDLINE_APPEND.
|
# KDUMP_COMMANDLINE_APPEND.
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" root)
|
remove[root]=1
|
||||||
|
|
||||||
# With the help of "--hostonly-cmdline", we can avoid some interitage.
|
# With the help of "--hostonly-cmdline", we can avoid some interitage.
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" rd.lvm.lv rd.luks.uuid rd.dm.uuid rd.md.uuid fcoe)
|
remove[rd.lvm.lv]=1
|
||||||
|
remove[rd.luks.uuid]=1
|
||||||
|
remove[rd.dm.uuid]=1
|
||||||
|
remove[rd.md.uuid]=1
|
||||||
|
remove[fcoe]=1
|
||||||
|
|
||||||
# Remove netroot, rd.iscsi.initiator and iscsi_initiator since
|
# Remove netroot, rd.iscsi.initiator and iscsi_initiator since
|
||||||
# we get duplicate entries for the same in case iscsi code adds
|
# we get duplicate entries for the same in case iscsi code adds
|
||||||
# it as well.
|
# it as well.
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" netroot rd.iscsi.initiator iscsi_initiator)
|
remove[netroot]=1
|
||||||
|
remove[rd.iscsi.initiator]=1
|
||||||
|
remove[iscsi_initiator]=1
|
||||||
|
|
||||||
cmdline="${cmdline} $3"
|
while read -r opt val; do
|
||||||
|
[[ -n "$opt" ]] || continue
|
||||||
|
[[ -n "${remove[$opt]}" ]] && continue
|
||||||
|
|
||||||
|
if [[ -n "$val" ]]; then
|
||||||
|
out+="$opt=$val "
|
||||||
|
else
|
||||||
|
out+="$opt "
|
||||||
|
fi
|
||||||
|
done <<< "$(_cmdline_parse "$in")"
|
||||||
|
|
||||||
|
out+="$append "
|
||||||
|
|
||||||
id=$(get_bootcpu_apicid)
|
id=$(get_bootcpu_apicid)
|
||||||
if [[ -n ${id} ]]; then
|
if [[ -n "${id}" ]]; then
|
||||||
cmdline=$(append_cmdline "$cmdline" disable_cpu_apicid "$id")
|
out+="disable_cpu_apicid=$id "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If any watchdog is used, set it's pretimeout to 0. pretimeout let
|
# If any watchdog is used, set it's pretimeout to 0. pretimeout let
|
||||||
# watchdog panic the kernel first, and reset the system after the
|
# watchdog panic the kernel first, and reset the system after the
|
||||||
# panic. If the system is already in kdump, panic is not helpful
|
# panic. If the system is already in kdump, panic is not helpful
|
||||||
# and only increase the chance of watchdog failure.
|
# and only increase the chance of watchdog failure.
|
||||||
for i in $(get_watchdog_drvs); do
|
for drv in $(get_watchdog_drvs); do
|
||||||
cmdline+=" $i.pretimeout=0"
|
out+="$drv.pretimeout=0 "
|
||||||
|
|
||||||
if [[ $i == hpwdt ]]; then
|
if [[ $drv == hpwdt ]]; then
|
||||||
# hpwdt have a special parameter kdumptimeout, is's only suppose
|
# hpwdt have a special parameter kdumptimeout, it is
|
||||||
# to be set to non-zero in first kernel. In kdump, non-zero
|
# only supposed to be set to non-zero in first kernel.
|
||||||
# value could prevent the watchdog from resetting the system.
|
# In kdump, non-zero value could prevent the watchdog
|
||||||
cmdline+=" $i.kdumptimeout=0"
|
# from resetting the system.
|
||||||
|
out+="$drv.kdumptimeout=0 "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$cmdline"
|
# Always disable gpt-auto-generator as it hangs during boot of the
|
||||||
|
# crash kernel. Furthermore we know which disk will be used for dumping
|
||||||
|
# (if at all) and add it explicitly.
|
||||||
|
is_uki "$KDUMP_KERNEL" && out+="rd.systemd.gpt_auto=no "
|
||||||
|
|
||||||
|
# Trim unnecessary whitespaces
|
||||||
|
echo "$out" | sed -e "s/^ *//g" -e "s/ *$//g" -e "s/ \+/ /g"
|
||||||
}
|
}
|
||||||
|
|
||||||
PROC_IOMEM=/proc/iomem
|
PROC_IOMEM=/proc/iomem
|
||||||
@ -874,8 +948,77 @@ get_recommend_size()
|
|||||||
echo "0M"
|
echo "0M"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has_mlx5()
|
||||||
|
{
|
||||||
|
[[ -d /sys/bus/pci/drivers/mlx5_core ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
has_aarch64_smmu()
|
||||||
|
{
|
||||||
|
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1 crashkernel=""
|
||||||
|
# $2 delta in unit of MB
|
||||||
|
_crashkernel_add()
|
||||||
|
{
|
||||||
|
local _ck _add _entry _ret
|
||||||
|
local _range _size _offset
|
||||||
|
|
||||||
|
_ck="$1"
|
||||||
|
_add="$2"
|
||||||
|
_ret=""
|
||||||
|
|
||||||
|
if [[ "$_ck" == *@* ]]; then
|
||||||
|
_offset="@${_ck##*@}"
|
||||||
|
_ck=${_ck%@*}
|
||||||
|
elif [[ "$_ck" == *,high ]] || [[ "$_ck" == *,low ]]; then
|
||||||
|
_offset=",${_ck##*,}"
|
||||||
|
_ck=${_ck%,*}
|
||||||
|
else
|
||||||
|
_offset=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -d , -r _entry; do
|
||||||
|
[[ -n "$_entry" ]] || continue
|
||||||
|
if [[ "$_entry" == *:* ]]; then
|
||||||
|
_range=${_entry%:*}
|
||||||
|
_size=${_entry#*:}
|
||||||
|
else
|
||||||
|
_range=""
|
||||||
|
_size=${_entry}
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${_size: -1}" in
|
||||||
|
K)
|
||||||
|
_size=${_size::-1}
|
||||||
|
_size="$((_size + (_add * 1024)))K"
|
||||||
|
;;
|
||||||
|
M)
|
||||||
|
_size=${_size::-1}
|
||||||
|
_size="$((_size + _add))M"
|
||||||
|
;;
|
||||||
|
G)
|
||||||
|
_size=${_size::-1}
|
||||||
|
_size="$((_size * 1024 + _add))M"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_size="$((_size + (_add * 1024 * 1024)))"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[[ -n "$_range" ]] && _ret+="$_range:"
|
||||||
|
_ret+="$_size,"
|
||||||
|
done <<< "$_ck,"
|
||||||
|
|
||||||
|
_ret=${_ret%,}
|
||||||
|
[[ -n "$_offset" ]] && _ret+=$_offset
|
||||||
|
echo "$_ret"
|
||||||
|
}
|
||||||
|
|
||||||
# get default crashkernel
|
# get default crashkernel
|
||||||
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
|
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
|
||||||
|
# $2 kernel-release, if not specified, got by _get_kdump_kernel_version
|
||||||
kdump_get_arch_recommend_crashkernel()
|
kdump_get_arch_recommend_crashkernel()
|
||||||
{
|
{
|
||||||
local _arch _ck_cmdline _dump_mode
|
local _arch _ck_cmdline _dump_mode
|
||||||
@ -895,8 +1038,32 @@ kdump_get_arch_recommend_crashkernel()
|
|||||||
if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then
|
if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then
|
||||||
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
|
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
|
||||||
elif [[ $_arch == "aarch64" ]]; then
|
elif [[ $_arch == "aarch64" ]]; then
|
||||||
# For 4KB page size, the formula is based on x86 plus extra = 64M
|
local _running_kernel
|
||||||
|
local _delta=0
|
||||||
|
|
||||||
|
# Base line for 4K variant kernel. The formula is based on x86 plus extra = 64M
|
||||||
_ck_cmdline="1G-4G:256M,4G-64G:320M,64G-:576M"
|
_ck_cmdline="1G-4G:256M,4G-64G:320M,64G-:576M"
|
||||||
|
if [[ -z "$2" ]]; then
|
||||||
|
_running_kernel=$(_get_kdump_kernel_version)
|
||||||
|
else
|
||||||
|
_running_kernel=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# the naming convention of 64k variant suffixes with +64k, e.g. "vmlinuz-5.14.0-312.el9.aarch64+64k"
|
||||||
|
if echo "$_running_kernel" | grep -q 64k; then
|
||||||
|
# Without smmu, the diff of MemFree between 4K and 64K measured on a high end aarch64 machine is 82M.
|
||||||
|
# Picking up 100M to cover this diff. And finally, we have "1G-4G:356M;4G-64G:420M;64G-:676M"
|
||||||
|
((_delta += 100))
|
||||||
|
# On a 64K system, the extra 384MB is calculated by: cmdq_num * 16 bytes + evtq_num * 32B + priq_num * 16B
|
||||||
|
# While on a 4K system, it is negligible
|
||||||
|
has_aarch64_smmu && ((_delta += 384))
|
||||||
|
#64k kernel, mlx5 consumes extra 188M memory, and choose 200M
|
||||||
|
has_mlx5 && ((_delta += 200))
|
||||||
|
else
|
||||||
|
#4k kernel, mlx5 consumes extra 124M memory, and choose 150M
|
||||||
|
has_mlx5 && ((_delta += 150))
|
||||||
|
fi
|
||||||
|
_ck_cmdline=$(_crashkernel_add "$_ck_cmdline" "$_delta")
|
||||||
elif [[ $_arch == "ppc64le" ]]; then
|
elif [[ $_arch == "ppc64le" ]]; then
|
||||||
if [[ $_dump_mode == "fadump" ]]; then
|
if [[ $_dump_mode == "fadump" ]]; then
|
||||||
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
||||||
@ -964,75 +1131,3 @@ get_all_kdump_crypt_dev()
|
|||||||
get_luks_crypt_dev "$(kdump_get_maj_min "$_dev")"
|
get_luks_crypt_dev "$(kdump_get_maj_min "$_dev")"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
check_vmlinux()
|
|
||||||
{
|
|
||||||
# Use readelf to check if it's a valid ELF
|
|
||||||
readelf -h "$1" &> /dev/null || return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_vmlinux_size()
|
|
||||||
{
|
|
||||||
local size=0 _msize
|
|
||||||
|
|
||||||
while read -r _msize; do
|
|
||||||
size=$((size + _msize))
|
|
||||||
done <<< "$(readelf -l -W "$1" | awk '/^ LOAD/{print $6}' 2> /dev/stderr)"
|
|
||||||
|
|
||||||
echo $size
|
|
||||||
}
|
|
||||||
|
|
||||||
try_decompress()
|
|
||||||
{
|
|
||||||
# The obscure use of the "tr" filter is to work around older versions of
|
|
||||||
# "grep" that report the byte offset of the line instead of the pattern.
|
|
||||||
|
|
||||||
# Try to find the header ($1) and decompress from here
|
|
||||||
for pos in $(tr "$1\n$2" "\n$2=" < "$4" | grep -abo "^$2"); do
|
|
||||||
if ! type -P "$3" > /dev/null; then
|
|
||||||
ddebug "Signiature detected but '$3' is missing, skip this decompressor"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
pos=${pos%%:*}
|
|
||||||
tail "-c+$pos" "$img" | $3 > "$5" 2> /dev/null
|
|
||||||
if check_vmlinux "$5"; then
|
|
||||||
ddebug "Kernel is extracted with '$3'"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Borrowed from linux/scripts/extract-vmlinux
|
|
||||||
get_kernel_size()
|
|
||||||
{
|
|
||||||
# Prepare temp files:
|
|
||||||
local tmp img=$1
|
|
||||||
|
|
||||||
tmp=$(mktemp /tmp/vmlinux-XXX)
|
|
||||||
trap 'rm -f "$tmp"' 0
|
|
||||||
|
|
||||||
# Try to check if it's a vmlinux already
|
|
||||||
check_vmlinux "$img" && get_vmlinux_size "$img" && return 0
|
|
||||||
|
|
||||||
# That didn't work, so retry after decompression.
|
|
||||||
try_decompress '\037\213\010' xy gunzip "$img" "$tmp" ||
|
|
||||||
try_decompress '\3757zXZ\000' abcde unxz "$img" "$tmp" ||
|
|
||||||
try_decompress 'BZh' xy bunzip2 "$img" "$tmp" ||
|
|
||||||
try_decompress '\135\0\0\0' xxx unlzma "$img" "$tmp" ||
|
|
||||||
try_decompress '\211\114\132' xy 'lzop -d' "$img" "$tmp" ||
|
|
||||||
try_decompress '\002!L\030' xxx 'lz4 -d' "$img" "$tmp" ||
|
|
||||||
try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"
|
|
||||||
|
|
||||||
# Finally check for uncompressed images or objects:
|
|
||||||
[[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0
|
|
||||||
|
|
||||||
# Fallback to use iomem
|
|
||||||
local _size=0 _seg
|
|
||||||
while read -r _seg; do
|
|
||||||
_size=$((_size + 0x${_seg#*-} - 0x${_seg%-*}))
|
|
||||||
done <<< "$(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1)"
|
|
||||||
echo $_size
|
|
||||||
}
|
|
||||||
|
@ -28,9 +28,8 @@ understand how this configuration file affects the behavior of kdump.
|
|||||||
|
|
||||||
.B auto_reset_crashkernel <yes|no>
|
.B auto_reset_crashkernel <yes|no>
|
||||||
.RS
|
.RS
|
||||||
determine whether to reset kernel crashkernel to new default value
|
determine whether to reset kernel crashkernel parameter to the default value
|
||||||
or not when kexec-tools updates the default crashkernel value and
|
or not when kexec-tools is updated or a new kernel is installed.
|
||||||
existing kernels using the old default kernel crashkernel value
|
|
||||||
|
|
||||||
.B raw <partition>
|
.B raw <partition>
|
||||||
.RS
|
.RS
|
||||||
|
@ -11,6 +11,7 @@ ExecStop=/usr/bin/kdumpctl stop
|
|||||||
ExecReload=/usr/bin/kdumpctl reload
|
ExecReload=/usr/bin/kdumpctl reload
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
StartLimitInterval=0
|
StartLimitInterval=0
|
||||||
|
PrivateTmp=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
|
|||||||
|
|
||||||
# This variable lets us append arguments to the current kdump commandline
|
# This variable lets us append arguments to the current kdump commandline
|
||||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||||
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 srcutree.big_cpu_lim=0"
|
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
|
||||||
|
|
||||||
# Any additional kexec arguments required. In most situations, this should
|
# Any additional kexec arguments required. In most situations, this should
|
||||||
# be left empty
|
# be left empty
|
||||||
|
@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
|
|||||||
|
|
||||||
# This variable lets us append arguments to the current kdump commandline
|
# This variable lets us append arguments to the current kdump commandline
|
||||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||||
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 srcutree.big_cpu_lim=0"
|
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
|
||||||
|
|
||||||
# Any additional kexec arguments required. In most situations, this should
|
# Any additional kexec arguments required. In most situations, this should
|
||||||
# be left empty
|
# be left empty
|
||||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
|||||||
# This variable lets us remove arguments from the current kdump commandline
|
# This variable lets us remove arguments from the current kdump commandline
|
||||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||||
# NOTE: some arguments such as crashkernel will always be removed
|
# NOTE: some arguments such as crashkernel will always be removed
|
||||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot"
|
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot zfcp.allow_lun_scan"
|
||||||
|
|
||||||
# This variable lets us append arguments to the current kdump commandline
|
# This variable lets us append arguments to the current kdump commandline
|
||||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||||
|
197
SOURCES/kdumpctl
197
SOURCES/kdumpctl
@ -42,6 +42,13 @@ if ! dlog_init; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
KDUMP_TMPDIR=$(mktemp --tmpdir -d kdump.XXXX)
|
||||||
|
trap '
|
||||||
|
ret=$?;
|
||||||
|
rm -rf "$KDUMP_TMPDIR"
|
||||||
|
exit $ret;
|
||||||
|
' EXIT
|
||||||
|
|
||||||
single_instance_lock()
|
single_instance_lock()
|
||||||
{
|
{
|
||||||
local rc timeout=5 lockfile
|
local rc timeout=5 lockfile
|
||||||
@ -655,7 +662,7 @@ function remove_kdump_kernel_key()
|
|||||||
# as the currently running kernel.
|
# as the currently running kernel.
|
||||||
load_kdump()
|
load_kdump()
|
||||||
{
|
{
|
||||||
local ret
|
local ret uki
|
||||||
|
|
||||||
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||||
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
||||||
@ -669,6 +676,16 @@ load_kdump()
|
|||||||
load_kdump_kernel_key
|
load_kdump_kernel_key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if is_uki "$KDUMP_KERNEL"; then
|
||||||
|
uki=$KDUMP_KERNEL
|
||||||
|
KDUMP_KERNEL=$KDUMP_TMPDIR/vmlinuz
|
||||||
|
objcopy -O binary --only-section .linux "$uki" "$KDUMP_KERNEL"
|
||||||
|
sync -f "$KDUMP_KERNEL"
|
||||||
|
# Make sure the temp file has the correct SELinux label.
|
||||||
|
# Otherwise starting the kdump.service will fail.
|
||||||
|
chcon -t boot_t "$KDUMP_KERNEL"
|
||||||
|
fi
|
||||||
|
|
||||||
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
|
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
|
||||||
|
|
||||||
# The '12' represents an intermediate temporary file descriptor
|
# The '12' represents an intermediate temporary file descriptor
|
||||||
@ -1219,6 +1236,77 @@ rebuild()
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_vmlinux()
|
||||||
|
{
|
||||||
|
# Use readelf to check if it's a valid ELF
|
||||||
|
readelf -h "$1" &> /dev/null || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_vmlinux_size()
|
||||||
|
{
|
||||||
|
local size=0 _msize
|
||||||
|
|
||||||
|
while read -r _msize; do
|
||||||
|
size=$((size + _msize))
|
||||||
|
done <<< "$(readelf -l -W "$1" | awk '/^ LOAD/{print $6}' 2> /dev/stderr)"
|
||||||
|
|
||||||
|
echo $size
|
||||||
|
}
|
||||||
|
|
||||||
|
try_decompress()
|
||||||
|
{
|
||||||
|
# The obscure use of the "tr" filter is to work around older versions of
|
||||||
|
# "grep" that report the byte offset of the line instead of the pattern.
|
||||||
|
|
||||||
|
# Try to find the header ($1) and decompress from here
|
||||||
|
for pos in $(tr "$1\n$2" "\n$2=" < "$4" | grep -abo "^$2"); do
|
||||||
|
if ! type -P "$3" > /dev/null; then
|
||||||
|
ddebug "Signiature detected but '$3' is missing, skip this decompressor"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
pos=${pos%%:*}
|
||||||
|
tail "-c+$pos" "$img" | $3 > "$5" 2> /dev/null
|
||||||
|
if check_vmlinux "$5"; then
|
||||||
|
ddebug "Kernel is extracted with '$3'"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Borrowed from linux/scripts/extract-vmlinux
|
||||||
|
get_kernel_size()
|
||||||
|
{
|
||||||
|
# Prepare temp files:
|
||||||
|
local tmp img=$1
|
||||||
|
|
||||||
|
tmp="$KDUMP_TMPDIR/vmlinux"
|
||||||
|
|
||||||
|
# Try to check if it's a vmlinux already
|
||||||
|
check_vmlinux "$img" && get_vmlinux_size "$img" && return 0
|
||||||
|
|
||||||
|
# That didn't work, so retry after decompression.
|
||||||
|
try_decompress '\037\213\010' xy gunzip "$img" "$tmp" ||
|
||||||
|
try_decompress '\3757zXZ\000' abcde unxz "$img" "$tmp" ||
|
||||||
|
try_decompress 'BZh' xy bunzip2 "$img" "$tmp" ||
|
||||||
|
try_decompress '\135\0\0\0' xxx unlzma "$img" "$tmp" ||
|
||||||
|
try_decompress '\211\114\132' xy 'lzop -d' "$img" "$tmp" ||
|
||||||
|
try_decompress '\002!L\030' xxx 'lz4 -d' "$img" "$tmp" ||
|
||||||
|
try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"
|
||||||
|
|
||||||
|
# Finally check for uncompressed images or objects:
|
||||||
|
[[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0
|
||||||
|
|
||||||
|
# Fallback to use iomem
|
||||||
|
local _size=0 _seg
|
||||||
|
while read -r _seg; do
|
||||||
|
_size=$((_size + 0x${_seg#*-} - 0x${_seg%-*}))
|
||||||
|
done <<< "$(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1)"
|
||||||
|
echo $_size
|
||||||
|
}
|
||||||
|
|
||||||
do_estimate()
|
do_estimate()
|
||||||
{
|
{
|
||||||
local kdump_mods
|
local kdump_mods
|
||||||
@ -1382,10 +1470,13 @@ _filter_grubby_kernel_str()
|
|||||||
_find_kernel_path_by_release()
|
_find_kernel_path_by_release()
|
||||||
{
|
{
|
||||||
local _release="$1" _grubby_kernel_str _kernel_path
|
local _release="$1" _grubby_kernel_str _kernel_path
|
||||||
_grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release\"$")
|
|
||||||
|
# Insert '/' before '+' to cope with grep's EREs
|
||||||
|
_release=${_release//+/\\+}
|
||||||
|
_grubby_kernel_str=$(grubby --info ALL | grep -E "^kernel=.*$_release(\/\w+)?\"$")
|
||||||
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
|
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
|
||||||
if [[ -z $_kernel_path ]]; then
|
if [[ -z $_kernel_path ]]; then
|
||||||
derror "kernel $_release doesn't exist"
|
ddebug "kernel $_release doesn't exist"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo -n "$_kernel_path"
|
echo -n "$_kernel_path"
|
||||||
@ -1407,7 +1498,7 @@ _update_kernel_cmdline()
|
|||||||
{
|
{
|
||||||
local _kernel_path=$1 _crashkernel=$2 _dump_mode=$3 _fadump_val=$4
|
local _kernel_path=$1 _crashkernel=$2 _dump_mode=$3 _fadump_val=$4
|
||||||
|
|
||||||
if is_atomic; then
|
if is_ostree; then
|
||||||
if rpm-ostree kargs | grep -q "crashkernel="; then
|
if rpm-ostree kargs | grep -q "crashkernel="; then
|
||||||
rpm-ostree kargs --replace="crashkernel=$_crashkernel"
|
rpm-ostree kargs --replace="crashkernel=$_crashkernel"
|
||||||
else
|
else
|
||||||
@ -1540,13 +1631,13 @@ reset_crashkernel()
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# 1. CoreOS uses "rpm-ostree kargs" instead of grubby to manage kernel command
|
# 1. OSTree systems use "rpm-ostree kargs" instead of grubby to manage kernel command
|
||||||
# line. --kernel=ALL doesn't make sense for CoreOS.
|
# line. --kernel=ALL doesn't make sense for OStree.
|
||||||
# 2. CoreOS doesn't support POWER so the dump mode is always kdump.
|
# 2. We don't have any OSTree POWER systems so the dump mode is always kdump.
|
||||||
# 3. "rpm-ostree kargs" would prompt the user to reboot the system after
|
# 3. "rpm-ostree kargs" would prompt the user to reboot the system after
|
||||||
# modifying the kernel command line so there is no need for kexec-tools
|
# modifying the kernel command line so there is no need for kexec-tools
|
||||||
# to repeat it.
|
# to repeat it.
|
||||||
if is_atomic; then
|
if is_ostree; then
|
||||||
_old_crashkernel=$(rpm-ostree kargs | sed -n -E 's/.*(^|\s)crashkernel=(\S*).*/\2/p')
|
_old_crashkernel=$(rpm-ostree kargs | sed -n -E 's/.*(^|\s)crashkernel=(\S*).*/\2/p')
|
||||||
_new_dump_mode=kdump
|
_new_dump_mode=kdump
|
||||||
_new_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_new_dump_mode")
|
_new_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_new_dump_mode")
|
||||||
@ -1647,72 +1738,39 @@ _is_bootloader_installed()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# update the crashkernel value in GRUB_ETC_DEFAULT if necessary
|
_update_crashkernel()
|
||||||
#
|
|
||||||
# called by reset_crashkernel_after_update and inherit its array variable
|
|
||||||
# _crashkernel_vals
|
|
||||||
update_crashkernel_in_grub_etc_default_after_update()
|
|
||||||
{
|
{
|
||||||
local _crashkernel _fadump_val
|
local _kernel _kver _dump_mode _old_default_crashkernel _new_default_crashkernel _fadump_val _msg
|
||||||
local _dump_mode _old_default_crashkernel _new_default_crashkernel
|
|
||||||
|
|
||||||
if [[ $(uname -m) == s390x ]]; then
|
_kernel=$1
|
||||||
return
|
_dump_mode=$(get_dump_mode_by_kernel "$_kernel")
|
||||||
fi
|
_old_default_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel)
|
||||||
|
_kver=$(parse_kver_from_path "$_kernel")
|
||||||
_crashkernel=$(_read_kernel_arg_in_grub_etc_default crashkernel)
|
# The second argument is for the case of aarch64, where installing a 64k variant on a 4k kernel, or vice versa
|
||||||
|
_new_default_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode" "$_kver")
|
||||||
if [[ -z $_crashkernel ]]; then
|
if [[ $_old_default_crashkernel != "$_new_default_crashkernel" ]]; then
|
||||||
return
|
_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
|
||||||
fi
|
if _update_kernel_cmdline "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then
|
||||||
|
_msg="For kernel=$_kernel, crashkernel=$_new_default_crashkernel now. Please reboot the system for the change to take effet."
|
||||||
_fadump_val=$(_read_kernel_arg_in_grub_etc_default fadump)
|
_msg+=" Note if you don't want kexec-tools to manage the crashkernel kernel parameter, please set auto_reset_crashkernel=no in /etc/kdump.conf."
|
||||||
_dump_mode=$(get_dump_mode_by_fadump_val "$_fadump_val")
|
dinfo "$_msg"
|
||||||
|
fi
|
||||||
_old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]}
|
|
||||||
_new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]}
|
|
||||||
|
|
||||||
if [[ $_crashkernel == auto ]] ||
|
|
||||||
[[ $_crashkernel == "$_old_default_crashkernel" &&
|
|
||||||
$_new_default_crashkernel != "$_old_default_crashkernel" ]]; then
|
|
||||||
_update_kernel_arg_in_grub_etc_default crashkernel "$_new_default_crashkernel"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# shellcheck disable=SC2154 # false positive when dereferencing an array
|
# shellcheck disable=SC2154 # false positive when dereferencing an array
|
||||||
reset_crashkernel_after_update()
|
reset_crashkernel_after_update()
|
||||||
{
|
{
|
||||||
local _kernel _crashkernel _dump_mode _fadump_val _old_default_crashkernel _new_default_crashkernel
|
local _kernel
|
||||||
declare -A _crashkernel_vals
|
|
||||||
|
|
||||||
if ! _is_bootloader_installed; then
|
if ! _is_bootloader_installed; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_crashkernel_vals[old_kdump]=$(cat /tmp/old_default_crashkernel 2> /dev/null)
|
|
||||||
_crashkernel_vals[old_fadump]=$(cat /tmp/old_default_crashkernel_fadump 2> /dev/null)
|
|
||||||
_crashkernel_vals[new_kdump]=$(get_default_crashkernel kdump)
|
|
||||||
_crashkernel_vals[new_fadump]=$(get_default_crashkernel fadump)
|
|
||||||
|
|
||||||
for _kernel in $(_get_all_kernels_from_grubby ALL); do
|
for _kernel in $(_get_all_kernels_from_grubby ALL); do
|
||||||
_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel)
|
_update_crashkernel "$_kernel"
|
||||||
if [[ $_crashkernel == auto ]]; then
|
|
||||||
reset_crashkernel "--kernel=$_kernel"
|
|
||||||
elif [[ -n $_crashkernel ]]; then
|
|
||||||
_dump_mode=$(get_dump_mode_by_kernel "$_kernel")
|
|
||||||
_old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]}
|
|
||||||
_new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]}
|
|
||||||
if [[ $_crashkernel == "$_old_default_crashkernel" ]] &&
|
|
||||||
[[ $_new_default_crashkernel != "$_old_default_crashkernel" ]]; then
|
|
||||||
_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
|
|
||||||
if _update_kernel_cmdline "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then
|
|
||||||
echo "For kernel=$_kernel, crashkernel=$_new_default_crashkernel now."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
update_crashkernel_in_grub_etc_default_after_update
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# read the value of an environ variable from given environ file path
|
# read the value of an environ variable from given environ file path
|
||||||
@ -1736,8 +1794,7 @@ _is_osbuild()
|
|||||||
|
|
||||||
reset_crashkernel_for_installed_kernel()
|
reset_crashkernel_for_installed_kernel()
|
||||||
{
|
{
|
||||||
local _installed_kernel _running_kernel _crashkernel _crashkernel_running
|
local _installed_kernel
|
||||||
local _dump_mode_running _fadump_val_running
|
|
||||||
|
|
||||||
# During package install, only try to reset crashkernel for osbuild
|
# During package install, only try to reset crashkernel for osbuild
|
||||||
# thus to avoid calling grubby when installing os via anaconda
|
# thus to avoid calling grubby when installing os via anaconda
|
||||||
@ -1756,23 +1813,7 @@ reset_crashkernel_for_installed_kernel()
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! _running_kernel=$(_get_current_running_kernel_path); then
|
_update_crashkernel "$_installed_kernel"
|
||||||
derror "Couldn't find current running kernel"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
_crashkernel=$(get_grub_kernel_boot_parameter "$_installed_kernel" crashkernel)
|
|
||||||
_crashkernel_running=$(get_grub_kernel_boot_parameter "$_running_kernel" crashkernel)
|
|
||||||
_dump_mode_running=$(get_dump_mode_by_kernel "$_running_kernel")
|
|
||||||
_fadump_val_running=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
|
|
||||||
|
|
||||||
if [[ $_crashkernel != "$_crashkernel_running" ]]; then
|
|
||||||
if _update_kernel_cmdline "$_installed_kernel" "$_crashkernel_running" "$_dump_mode_running" "$_fadump_val_running"; then
|
|
||||||
echo "kexec-tools has reset $_installed_kernel to use the new default crashkernel value $_crashkernel_running"
|
|
||||||
fi
|
|
||||||
elif [[ $_crashkernel == auto ]]; then
|
|
||||||
reset_crashkernel "--kernel=$_installed_kernel"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then
|
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
From 6b6187f546f0ddad8ea84d22c3f7ad72133dcfe3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sourabh Jain <sourabhjain@linux.ibm.com>
|
|
||||||
Date: Thu, 15 Sep 2022 14:12:40 +0530
|
|
||||||
Subject: [PATCH] ppc64: remove rma_top limit
|
|
||||||
|
|
||||||
Restricting kexec tool to allocate hole for kexec segments below 768MB
|
|
||||||
may not be relavent now since first memory block size can be 1024MB and
|
|
||||||
more.
|
|
||||||
|
|
||||||
Removing rma_top restriction will give more space to find holes for
|
|
||||||
kexec segments and existing in-place checks make sure that kexec segment
|
|
||||||
allocation doesn't cross the first memory block because every kexec segment
|
|
||||||
has to be within first memory block for kdump kernel to boot properly.
|
|
||||||
|
|
||||||
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
|
|
||||||
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
|
|
||||||
Signed-off-by: Simon Horman <horms@kernel.org>
|
|
||||||
---
|
|
||||||
kexec/arch/ppc64/kexec-ppc64.c | 2 --
|
|
||||||
1 file changed, 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
index 5b17740..611809f 100644
|
|
||||||
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
@@ -717,8 +717,6 @@ static int get_devtree_details(unsigned long kexec_flags)
|
|
||||||
if (base < rma_base) {
|
|
||||||
rma_base = base;
|
|
||||||
rma_top = base + be64_to_cpu(((uint64_t *)buf)[1]);
|
|
||||||
- if (rma_top > 0x30000000UL)
|
|
||||||
- rma_top = 0x30000000UL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
@ -0,0 +1,147 @@
|
|||||||
|
From e63fefd4fc355f29d839ca47484b0f8070e38ccb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sourabh Jain <sourabhjain@linux.ibm.com>
|
||||||
|
Date: Wed, 1 Feb 2023 14:23:31 +0530
|
||||||
|
Subject: [PATCH 1/6] ppc64: add --reuse-cmdline parameter support
|
||||||
|
|
||||||
|
An option to copy the command line arguments from running kernel
|
||||||
|
to kexec'd kernel. This option works for both kexec and kdump.
|
||||||
|
|
||||||
|
In case --append=<args> or --command-line=<args> is provided along
|
||||||
|
with --reuse-cmdline parameter then args listed against append and
|
||||||
|
command-line parameter will be combined with command line argument
|
||||||
|
from running kernel.
|
||||||
|
|
||||||
|
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/include/arch/options.h | 4 +++-
|
||||||
|
kexec/arch/ppc64/kexec-elf-ppc64.c | 25 +++++++++++++++++++++++--
|
||||||
|
2 files changed, 26 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc64/include/arch/options.h b/kexec/arch/ppc64/include/arch/options.h
|
||||||
|
index 71632ec..2bca96a 100644
|
||||||
|
--- a/kexec/arch/ppc64/include/arch/options.h
|
||||||
|
+++ b/kexec/arch/ppc64/include/arch/options.h
|
||||||
|
@@ -10,6 +10,7 @@
|
||||||
|
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
||||||
|
#define OPT_DEVICETREEBLOB (OPT_ARCH_MAX+2)
|
||||||
|
#define OPT_ARGS_IGNORE (OPT_ARCH_MAX+3)
|
||||||
|
+#define OPT_REUSE_CMDLINE (OPT_ARCH_MAX+4)
|
||||||
|
|
||||||
|
/* Options relevant to the architecture (excluding loader-specific ones): */
|
||||||
|
#define KEXEC_ARCH_OPTIONS \
|
||||||
|
@@ -41,7 +42,8 @@
|
||||||
|
{ "initrd", 1, NULL, OPT_RAMDISK }, \
|
||||||
|
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB }, \
|
||||||
|
{ "dtb", 1, NULL, OPT_DEVICETREEBLOB }, \
|
||||||
|
- { "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
||||||
|
+ { "args-linux", 0, NULL, OPT_ARGS_IGNORE }, \
|
||||||
|
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE },
|
||||||
|
|
||||||
|
#define KEXEC_ALL_OPT_STR KEXEC_OPT_STR
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||||
|
index 695b8b0..01d045f 100644
|
||||||
|
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||||
|
@@ -95,6 +95,8 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
char *cmdline, *dtb;
|
||||||
|
+ char *append_cmdline = NULL;
|
||||||
|
+ char *reuse_cmdline = NULL;
|
||||||
|
int opt, cmdline_len = 0;
|
||||||
|
|
||||||
|
/* See options.h -- add any more there, too. */
|
||||||
|
@@ -107,6 +109,7 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "dtb", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
||||||
|
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE},
|
||||||
|
{ 0, 0, NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -125,7 +128,7 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
if (opt < OPT_ARCH_MAX)
|
||||||
|
break;
|
||||||
|
case OPT_APPEND:
|
||||||
|
- cmdline = optarg;
|
||||||
|
+ append_cmdline = optarg;
|
||||||
|
break;
|
||||||
|
case OPT_RAMDISK:
|
||||||
|
ramdisk = optarg;
|
||||||
|
@@ -135,6 +138,9 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
break;
|
||||||
|
case OPT_ARGS_IGNORE:
|
||||||
|
break;
|
||||||
|
+ case OPT_REUSE_CMDLINE:
|
||||||
|
+ reuse_cmdline = get_command_line();
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -144,6 +150,10 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
if (reuse_initrd)
|
||||||
|
die("--reuseinitrd not supported with --kexec-file-syscall.\n");
|
||||||
|
|
||||||
|
+ cmdline = concat_cmdline(reuse_cmdline, append_cmdline);
|
||||||
|
+ if (!reuse_cmdline)
|
||||||
|
+ free(reuse_cmdline);
|
||||||
|
+
|
||||||
|
if (cmdline) {
|
||||||
|
cmdline_len = strlen(cmdline) + 1;
|
||||||
|
} else {
|
||||||
|
@@ -175,6 +185,8 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{
|
||||||
|
struct mem_ehdr ehdr;
|
||||||
|
char *cmdline, *modified_cmdline = NULL;
|
||||||
|
+ char *reuse_cmdline = NULL;
|
||||||
|
+ char *append_cmdline = NULL;
|
||||||
|
const char *devicetreeblob;
|
||||||
|
uint64_t max_addr, hole_addr;
|
||||||
|
char *seg_buf = NULL;
|
||||||
|
@@ -204,6 +216,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "dtb", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
||||||
|
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE},
|
||||||
|
{ 0, 0, NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -229,7 +242,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
if (opt < OPT_ARCH_MAX)
|
||||||
|
break;
|
||||||
|
case OPT_APPEND:
|
||||||
|
- cmdline = optarg;
|
||||||
|
+ append_cmdline = optarg;
|
||||||
|
break;
|
||||||
|
case OPT_RAMDISK:
|
||||||
|
ramdisk = optarg;
|
||||||
|
@@ -239,9 +252,16 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
break;
|
||||||
|
case OPT_ARGS_IGNORE:
|
||||||
|
break;
|
||||||
|
+ case OPT_REUSE_CMDLINE:
|
||||||
|
+ reuse_cmdline = get_command_line();
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ cmdline = concat_cmdline(reuse_cmdline, append_cmdline);
|
||||||
|
+ if (!reuse_cmdline)
|
||||||
|
+ free(reuse_cmdline);
|
||||||
|
+
|
||||||
|
if (!cmdline)
|
||||||
|
fprintf(stdout, "Warning: append= option is not passed. Using the first kernel root partition\n");
|
||||||
|
|
||||||
|
@@ -469,6 +489,7 @@ void elf_ppc64_usage(void)
|
||||||
|
fprintf(stderr, " --devicetreeblob=<filename> Specify device tree blob file.\n");
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
fprintf(stderr, "Not applicable while using --kexec-file-syscall.\n");
|
||||||
|
+ fprintf(stderr, " --reuse-cmdline Use kernel command line from running system.\n");
|
||||||
|
fprintf(stderr, " --dtb=<filename> same as --devicetreeblob.\n");
|
||||||
|
|
||||||
|
fprintf(stderr, "elf support is still broken\n");
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
108
SOURCES/kexec-tools-2.0.26-0002-kexec-make-a-the-default.patch
Normal file
108
SOURCES/kexec-tools-2.0.26-0002-kexec-make-a-the-default.patch
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
From 29fe5067ed07452bcbbbe5fcd0b4e4215f598014 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Ahelenia=20Ziemia=C5=84ska?=
|
||||||
|
<nabijaczleweli@nabijaczleweli.xyz>
|
||||||
|
Date: Fri, 3 Feb 2023 00:10:18 +0100
|
||||||
|
Subject: [PATCH 2/6] kexec: make -a the default
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
AFAICT, there's no downside to this, and running into this each time
|
||||||
|
I want to kexec (and, presumably, a significant chunk of the population,
|
||||||
|
since lockdown is quite popular) on some machines,
|
||||||
|
then going to the manual, then finding out I want the /auto/ flag(!)
|
||||||
|
is quite annoying:
|
||||||
|
# kexec -l /boot/vmlinuz-6.1.0-3-amd64 --initrd /boot/initrd.img-6.1.0-3-amd64 --reuse-cmdline
|
||||||
|
kexec_load failed: Operation not permitted
|
||||||
|
entry = 0x46eff7760 flags = 0x3e0000
|
||||||
|
nr_segments = 7
|
||||||
|
segment[0].buf = 0x557cd303efa0
|
||||||
|
segment[0].bufsz = 0x70
|
||||||
|
segment[0].mem = 0x100000
|
||||||
|
segment[0].memsz = 0x1000
|
||||||
|
segment[1].buf = 0x557cd3046fe0
|
||||||
|
segment[1].bufsz = 0x190
|
||||||
|
segment[1].mem = 0x101000
|
||||||
|
segment[1].memsz = 0x1000
|
||||||
|
segment[2].buf = 0x557cd303f6e0
|
||||||
|
segment[2].bufsz = 0x30
|
||||||
|
segment[2].mem = 0x102000
|
||||||
|
segment[2].memsz = 0x1000
|
||||||
|
segment[3].buf = 0x7f658fa37010
|
||||||
|
segment[3].bufsz = 0x12a51b5
|
||||||
|
segment[3].mem = 0x46a55a000
|
||||||
|
segment[3].memsz = 0x12a6000
|
||||||
|
segment[4].buf = 0x7f6590ce1210
|
||||||
|
segment[4].bufsz = 0x7e99e0
|
||||||
|
segment[4].mem = 0x46b800000
|
||||||
|
segment[4].memsz = 0x377c000
|
||||||
|
segment[5].buf = 0x557cd3039350
|
||||||
|
segment[5].bufsz = 0x42fa
|
||||||
|
segment[5].mem = 0x46eff2000
|
||||||
|
segment[5].memsz = 0x5000
|
||||||
|
segment[6].buf = 0x557cd3032000
|
||||||
|
segment[6].bufsz = 0x70e0
|
||||||
|
segment[6].mem = 0x46eff7000
|
||||||
|
segment[6].memsz = 0x9000
|
||||||
|
|
||||||
|
Closes: https://bugs.debian.org/1030248
|
||||||
|
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/kexec.8 | 4 ++--
|
||||||
|
kexec/kexec.c | 8 ++++----
|
||||||
|
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index 3ebede6..66453b8 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -151,14 +151,14 @@ Specify that the new kernel is of this
|
||||||
|
Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively.
|
||||||
|
.TP
|
||||||
|
.BI \-c\ (\-\-kexec-syscall)
|
||||||
|
-Specify that the old KEXEC_LOAD syscall should be used exclusively (the default).
|
||||||
|
+Specify that the old KEXEC_LOAD syscall should be used exclusively.
|
||||||
|
.TP
|
||||||
|
.BI \-a\ (\-\-kexec-syscall-auto)
|
||||||
|
Try the new KEXEC_FILE_LOAD syscall first and when it is not supported or the
|
||||||
|
kernel does not understand the supplied image fall back to the old KEXEC_LOAD
|
||||||
|
interface.
|
||||||
|
|
||||||
|
-There is no one single interface that always works.
|
||||||
|
+There is no one single interface that always works, so this is the default.
|
||||||
|
|
||||||
|
KEXEC_FILE_LOAD is required on systems that use locked-down secure boot to
|
||||||
|
verify the kernel signature. KEXEC_LOAD may be also disabled in the kernel
|
||||||
|
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||||
|
index 0e92d96..36bb2ad 100644
|
||||||
|
--- a/kexec/kexec.c
|
||||||
|
+++ b/kexec/kexec.c
|
||||||
|
@@ -1049,11 +1049,11 @@ void usage(void)
|
||||||
|
" to original kernel.\n"
|
||||||
|
" -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
|
||||||
|
" -c, --kexec-syscall Use the kexec_load syscall for for compatibility\n"
|
||||||
|
- " with systems that don't support -s (default)\n"
|
||||||
|
+ " with systems that don't support -s\n"
|
||||||
|
" -a, --kexec-syscall-auto Use file based syscall for kexec and fall\n"
|
||||||
|
" back to the compatibility syscall when file based\n"
|
||||||
|
" syscall is not supported or the kernel did not\n"
|
||||||
|
- " understand the image\n"
|
||||||
|
+ " understand the image (default)\n"
|
||||||
|
" -d, --debug Enable debugging to help spot a failure.\n"
|
||||||
|
" -S, --status Return 1 if the type (by default crash) is loaded,\n"
|
||||||
|
" 0 if not.\n"
|
||||||
|
@@ -1407,8 +1407,8 @@ int main(int argc, char *argv[])
|
||||||
|
int do_ifdown = 0, skip_ifdown = 0;
|
||||||
|
int do_unload = 0;
|
||||||
|
int do_reuse_initrd = 0;
|
||||||
|
- int do_kexec_file_syscall = 0;
|
||||||
|
- int do_kexec_fallback = 0;
|
||||||
|
+ int do_kexec_file_syscall = 1;
|
||||||
|
+ int do_kexec_fallback = 1;
|
||||||
|
int skip_checks = 0;
|
||||||
|
int do_status = 0;
|
||||||
|
void *entry = 0;
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
211
SOURCES/kexec-tools-2.0.26-0003-x86-add-devicetree-support.patch
Normal file
211
SOURCES/kexec-tools-2.0.26-0003-x86-add-devicetree-support.patch
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
From 806711fca9e9d52a677bf090565c32c858f2b12e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Julian Winkler <julian.winkler1@web.de>
|
||||||
|
Date: Thu, 23 Feb 2023 07:01:07 +0100
|
||||||
|
Subject: [PATCH 3/6] x86: add devicetree support
|
||||||
|
|
||||||
|
Since linux kernel has dropped support for simple firmware interface
|
||||||
|
(SFI), the only way of boot newer versions on intel MID platform is
|
||||||
|
using devicetree
|
||||||
|
|
||||||
|
Signed-off-by: Julian Winkler <julian.winkler1@web.de>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/arch/i386/include/arch/options.h | 4 +++-
|
||||||
|
kexec/arch/i386/kexec-beoboot-x86.c | 2 +-
|
||||||
|
kexec/arch/i386/kexec-bzImage.c | 21 ++++++++++++++++++++-
|
||||||
|
kexec/arch/i386/kexec-x86.h | 1 +
|
||||||
|
kexec/arch/i386/x86-linux-setup.c | 15 +++++++++++++++
|
||||||
|
kexec/arch/i386/x86-linux-setup.h | 2 ++
|
||||||
|
kexec/arch/x86_64/kexec-bzImage64.c | 2 +-
|
||||||
|
7 files changed, 43 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/include/arch/options.h b/kexec/arch/i386/include/arch/options.h
|
||||||
|
index 0e57951..89e0a95 100644
|
||||||
|
--- a/kexec/arch/i386/include/arch/options.h
|
||||||
|
+++ b/kexec/arch/i386/include/arch/options.h
|
||||||
|
@@ -33,6 +33,7 @@
|
||||||
|
#define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11)
|
||||||
|
#define OPT_NOEFI (OPT_ARCH_MAX+12)
|
||||||
|
#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13)
|
||||||
|
+#define OPT_DTB (OPT_ARCH_MAX+14)
|
||||||
|
|
||||||
|
/* Options relevant to the architecture (excluding loader-specific ones): */
|
||||||
|
#define KEXEC_ARCH_OPTIONS \
|
||||||
|
@@ -76,7 +77,8 @@
|
||||||
|
{ "args-none", 0, NULL, OPT_ARGS_NONE }, \
|
||||||
|
{ "module", 1, 0, OPT_MOD }, \
|
||||||
|
{ "real-mode", 0, NULL, OPT_REAL_MODE }, \
|
||||||
|
- { "entry-32bit", 0, NULL, OPT_ENTRY_32BIT },
|
||||||
|
+ { "entry-32bit", 0, NULL, OPT_ENTRY_32BIT }, \
|
||||||
|
+ { "dtb", 1, NULL, OPT_DTB },
|
||||||
|
|
||||||
|
#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/kexec-beoboot-x86.c b/kexec/arch/i386/kexec-beoboot-x86.c
|
||||||
|
index b121834..d949ab8 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-beoboot-x86.c
|
||||||
|
+++ b/kexec/arch/i386/kexec-beoboot-x86.c
|
||||||
|
@@ -125,7 +125,7 @@ int beoboot_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
|
||||||
|
kernel, bb_header.kernel_size,
|
||||||
|
command_line, bb_header.cmdline_size,
|
||||||
|
initrd, bb_header.initrd_size,
|
||||||
|
- real_mode_entry);
|
||||||
|
+ 0, 0, real_mode_entry);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
|
||||||
|
index df8985d..1b8f20c 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-bzImage.c
|
||||||
|
+++ b/kexec/arch/i386/kexec-bzImage.c
|
||||||
|
@@ -95,6 +95,7 @@ void bzImage_usage(void)
|
||||||
|
" --reuse-cmdline Use kernel command line from running system.\n"
|
||||||
|
" --initrd=FILE Use FILE as the kernel's initial ramdisk.\n"
|
||||||
|
" --ramdisk=FILE Use FILE as the kernel's initial ramdisk.\n"
|
||||||
|
+ " --dtb=FILE Use FILE as devicetree.\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -103,6 +104,7 @@ int do_bzImage_load(struct kexec_info *info,
|
||||||
|
const char *kernel, off_t kernel_len,
|
||||||
|
const char *command_line, off_t command_line_len,
|
||||||
|
const char *initrd, off_t initrd_len,
|
||||||
|
+ const char *dtb, off_t dtb_len,
|
||||||
|
int real_mode_entry)
|
||||||
|
{
|
||||||
|
struct x86_linux_header setup_header;
|
||||||
|
@@ -373,6 +375,10 @@ int do_bzImage_load(struct kexec_info *info,
|
||||||
|
setup_linux_system_parameters(info, real_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (dtb) {
|
||||||
|
+ setup_linux_dtb(info, real_mode, dtb, dtb_len);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -381,13 +387,15 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{
|
||||||
|
char *command_line = NULL;
|
||||||
|
char *tmp_cmdline = NULL;
|
||||||
|
- const char *ramdisk, *append = NULL;
|
||||||
|
+ const char *ramdisk, *append = NULL, *dtb;
|
||||||
|
char *ramdisk_buf;
|
||||||
|
off_t ramdisk_length;
|
||||||
|
int command_line_len;
|
||||||
|
int real_mode_entry;
|
||||||
|
int opt;
|
||||||
|
int result;
|
||||||
|
+ char *dtb_buf;
|
||||||
|
+ off_t dtb_length;
|
||||||
|
|
||||||
|
/* See options.h -- add any more there, too. */
|
||||||
|
static const struct option options[] = {
|
||||||
|
@@ -398,6 +406,7 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{ "initrd", 1, 0, OPT_RAMDISK },
|
||||||
|
{ "ramdisk", 1, 0, OPT_RAMDISK },
|
||||||
|
{ "real-mode", 0, 0, OPT_REAL_MODE },
|
||||||
|
+ { "dtb", 1, 0, OPT_DTB },
|
||||||
|
{ 0, 0, 0, 0 },
|
||||||
|
};
|
||||||
|
static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
|
||||||
|
@@ -405,6 +414,8 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
real_mode_entry = 0;
|
||||||
|
ramdisk = 0;
|
||||||
|
ramdisk_length = 0;
|
||||||
|
+ dtb = 0;
|
||||||
|
+ dtb_length = 0;
|
||||||
|
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
|
||||||
|
switch(opt) {
|
||||||
|
default:
|
||||||
|
@@ -424,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
case OPT_REAL_MODE:
|
||||||
|
real_mode_entry = 1;
|
||||||
|
break;
|
||||||
|
+ case OPT_DTB:
|
||||||
|
+ dtb = optarg;
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
command_line = concat_cmdline(tmp_cmdline, append);
|
||||||
|
@@ -441,10 +455,15 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
if (ramdisk) {
|
||||||
|
ramdisk_buf = slurp_file(ramdisk, &ramdisk_length);
|
||||||
|
}
|
||||||
|
+ dtb_buf = 0;
|
||||||
|
+ if (dtb) {
|
||||||
|
+ dtb_buf = slurp_file(dtb, &dtb_length);
|
||||||
|
+ }
|
||||||
|
result = do_bzImage_load(info,
|
||||||
|
buf, len,
|
||||||
|
command_line, command_line_len,
|
||||||
|
ramdisk_buf, ramdisk_length,
|
||||||
|
+ dtb_buf, dtb_length,
|
||||||
|
real_mode_entry);
|
||||||
|
|
||||||
|
free(command_line);
|
||||||
|
diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
|
||||||
|
index 71e4329..46e2898 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-x86.h
|
||||||
|
+++ b/kexec/arch/i386/kexec-x86.h
|
||||||
|
@@ -79,6 +79,7 @@ int do_bzImage_load(struct kexec_info *info,
|
||||||
|
const char *kernel, off_t kernel_len,
|
||||||
|
const char *command_line, off_t command_line_len,
|
||||||
|
const char *initrd, off_t initrd_len,
|
||||||
|
+ const char *dtb, off_t dtb_len,
|
||||||
|
int real_mode_entry);
|
||||||
|
|
||||||
|
int beoboot_probe(const char *buf, off_t len);
|
||||||
|
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
|
||||||
|
index 14263b0..9a281dc 100644
|
||||||
|
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||||
|
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||||
|
@@ -954,3 +954,18 @@ void setup_linux_system_parameters(struct kexec_info *info,
|
||||||
|
/* Always try to fill acpi_rsdp_addr */
|
||||||
|
real_mode->acpi_rsdp_addr = get_acpi_rsdp();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+void setup_linux_dtb(struct kexec_info *info, struct x86_linux_param_header *real_mode,
|
||||||
|
+ const char *dtb_buf, int dtb_len)
|
||||||
|
+{
|
||||||
|
+ struct setup_data *sd;
|
||||||
|
+
|
||||||
|
+ sd = xmalloc(sizeof(struct setup_data) + dtb_len);
|
||||||
|
+ sd->next = 0;
|
||||||
|
+ sd->len = dtb_len;
|
||||||
|
+ sd->type = SETUP_DTB;
|
||||||
|
+ memcpy(sd->data, dtb_buf, dtb_len);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ add_setup_data(info, real_mode, sd);
|
||||||
|
+}
|
||||||
|
diff --git a/kexec/arch/i386/x86-linux-setup.h b/kexec/arch/i386/x86-linux-setup.h
|
||||||
|
index 0c651e5..b5e1ad5 100644
|
||||||
|
--- a/kexec/arch/i386/x86-linux-setup.h
|
||||||
|
+++ b/kexec/arch/i386/x86-linux-setup.h
|
||||||
|
@@ -21,6 +21,8 @@ static inline void setup_linux_bootloader_parameters(
|
||||||
|
}
|
||||||
|
void setup_linux_system_parameters(struct kexec_info *info,
|
||||||
|
struct x86_linux_param_header *real_mode);
|
||||||
|
+void setup_linux_dtb(struct kexec_info *info, struct x86_linux_param_header *real_mode,
|
||||||
|
+ const char *dtb_buf, int dtb_len);
|
||||||
|
int get_bootparam(void *buf, off_t offset, size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||||
|
index ba8dc48..aba4e3b 100644
|
||||||
|
--- a/kexec/arch/x86_64/kexec-bzImage64.c
|
||||||
|
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||||
|
@@ -386,7 +386,7 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
if (entry_16bit || entry_32bit)
|
||||||
|
result = do_bzImage_load(info, buf, len, command_line,
|
||||||
|
command_line_len, ramdisk_buf,
|
||||||
|
- ramdisk_length, entry_16bit);
|
||||||
|
+ ramdisk_length, 0, 0, entry_16bit);
|
||||||
|
else
|
||||||
|
result = do_bzImage64_load(info, buf, len, command_line,
|
||||||
|
command_line_len, ramdisk_buf,
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
From 63e9a012112e418876413bf45440118d69d85189 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gautam Menghani <gautam@linux.vnet.ibm.com>
|
||||||
|
Date: Wed, 1 Mar 2023 03:58:19 -0500
|
||||||
|
Subject: [PATCH 4/6] ppc64: Add elf-ppc64 file types/options and an arch
|
||||||
|
specific flag to man page
|
||||||
|
|
||||||
|
Document the elf-ppc64 file options and the "--dt-no-old-root" arch
|
||||||
|
specific flag in the man page.
|
||||||
|
|
||||||
|
Signed-off-by: Gautam Menghani <gautam@linux.vnet.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/kexec.8 | 35 +++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 35 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index 66453b8..3a344c5 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -335,6 +335,37 @@ with command-line arguments
|
||||||
|
.I "arg1 arg2 ..."
|
||||||
|
This parameter can be specified multiple times.
|
||||||
|
.RE
|
||||||
|
+.PP
|
||||||
|
+.B elf-ppc64
|
||||||
|
+.RS
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-reuse-cmdline
|
||||||
|
+Use the kernel command line from the running system.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-command\-line= string
|
||||||
|
+Set the kernel command line to
|
||||||
|
+.IR string.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-append= string
|
||||||
|
+Set the kernel command line to
|
||||||
|
+.IR string.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-ramdisk= file
|
||||||
|
+Use
|
||||||
|
+.IR file
|
||||||
|
+as the initial RAM disk.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-initrd= file
|
||||||
|
+Use
|
||||||
|
+.IR file
|
||||||
|
+as the initial RAM disk.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-devicetreeblob= file
|
||||||
|
+Specify device tree blob file. Not applicable while using --kexec-file-syscall.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-dtb= file
|
||||||
|
+Specify device tree blob file. Not applicable while using --kexec-file-syscall.
|
||||||
|
+.RE
|
||||||
|
|
||||||
|
.SH ARCHITECTURE OPTIONS
|
||||||
|
.TP
|
||||||
|
@@ -362,3 +393,7 @@ for debug output.
|
||||||
|
Specify the
|
||||||
|
.I baud rate
|
||||||
|
of the serial port.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-dt\-no\-old\-root
|
||||||
|
+Do not reuse old kernel root=<device>
|
||||||
|
+param while creating flatten device tree.
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
@ -420,6 +420,15 @@ while read -r config_opt config_val; do
|
|||||||
verify_core_collector "$config_val"
|
verify_core_collector "$config_val"
|
||||||
;;
|
;;
|
||||||
dracut_args)
|
dracut_args)
|
||||||
|
|
||||||
|
# When users specify nfs dumping via dracut_args, kexec-tools won't
|
||||||
|
# mount nfs fs beforehand thus nfsv4-related drivers won't be installed
|
||||||
|
# because we call dracut with --hostonly-mode strict. So manually install
|
||||||
|
# nfsv4-related drivers.
|
||||||
|
if [[ $(get_dracut_args_fstype "$config_val") == nfs* ]]; then
|
||||||
|
add_dracut_arg "--add-drivers" nfs_layout_nfsv41_files
|
||||||
|
fi
|
||||||
|
|
||||||
while read -r dracut_arg; do
|
while read -r dracut_arg; do
|
||||||
add_dracut_arg "$dracut_arg"
|
add_dracut_arg "$dracut_arg"
|
||||||
done <<< "$(echo "$config_val" | xargs -n 1 echo)"
|
done <<< "$(echo "$config_val" | xargs -n 1 echo)"
|
||||||
@ -454,6 +463,10 @@ if ! is_fadump_capable; then
|
|||||||
is_dump_to_rootfs && add_mount "$(to_dev_name "$(get_root_fs_device)")"
|
is_dump_to_rootfs && add_mount "$(to_dev_name "$(get_root_fs_device)")"
|
||||||
|
|
||||||
add_dracut_arg "--no-hostonly-default-device"
|
add_dracut_arg "--no-hostonly-default-device"
|
||||||
|
|
||||||
|
if fips-mode-setup --is-enabled 2> /dev/null; then
|
||||||
|
add_dracut_arg --add-device "$(findmnt -n -o SOURCE --target /boot)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This is RHEL-only to work around nvme problem, then real fix should go to dracut
|
# This is RHEL-only to work around nvme problem, then real fix should go to dracut
|
||||||
|
@ -35,7 +35,8 @@ updating lists accordingly.
|
|||||||
Supported Dump targets
|
Supported Dump targets
|
||||||
----------------------
|
----------------------
|
||||||
storage:
|
storage:
|
||||||
LVM volume (no thinp)
|
LVM volume
|
||||||
|
Thin provisioning volume
|
||||||
FC disks (qla2xxx, lpfc, bnx2fc, bfa)
|
FC disks (qla2xxx, lpfc, bnx2fc, bfa)
|
||||||
software initiator based iSCSI
|
software initiator based iSCSI
|
||||||
software RAID (mdraid)
|
software RAID (mdraid)
|
||||||
@ -82,7 +83,6 @@ Unsupported Dump targets
|
|||||||
------------------------
|
------------------------
|
||||||
storage:
|
storage:
|
||||||
BIOS RAID
|
BIOS RAID
|
||||||
Thin provisioning volume
|
|
||||||
Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i)
|
Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i)
|
||||||
Software iSCSI with hybrid (be2iscsi)
|
Software iSCSI with hybrid (be2iscsi)
|
||||||
FCoE
|
FCoE
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
|
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
|
||||||
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
||||||
%global mkdf_ver 1.7.2
|
%global mkdf_ver 1.7.3
|
||||||
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
|
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
|
||||||
|
|
||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 2.0.25
|
Version: 2.0.26
|
||||||
Release: 12%{?dist}
|
Release: 8%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Summary: The kexec/kdump userspace component
|
Summary: The kexec/kdump userspace component
|
||||||
|
|
||||||
@ -72,6 +72,7 @@ Requires: dracut >= 050
|
|||||||
Requires: dracut-network >= 050
|
Requires: dracut-network >= 050
|
||||||
Requires: dracut-squash >= 050
|
Requires: dracut-squash >= 050
|
||||||
Requires: ethtool
|
Requires: ethtool
|
||||||
|
Requires: binutils
|
||||||
Recommends: grubby
|
Recommends: grubby
|
||||||
Recommends: hostname
|
Recommends: hostname
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
@ -100,7 +101,6 @@ Requires: systemd-udev%{?_isa}
|
|||||||
#
|
#
|
||||||
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
|
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
|
||||||
#
|
#
|
||||||
Patch301: kexec-tools-2.0.25-ppc64-ppc64-remove-rma_top-limit.patch
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
||||||
@ -113,6 +113,10 @@ Patch301: kexec-tools-2.0.25-ppc64-ppc64-remove-rma_top-limit.patch
|
|||||||
#
|
#
|
||||||
# Patches 601 onward are generic patches
|
# Patches 601 onward are generic patches
|
||||||
#
|
#
|
||||||
|
Patch601: kexec-tools-2.0.26-0001-ppc64-add-reuse-cmdline-parameter-support.patch
|
||||||
|
Patch602: kexec-tools-2.0.26-0002-kexec-make-a-the-default.patch
|
||||||
|
Patch603: kexec-tools-2.0.26-0003-x86-add-devicetree-support.patch
|
||||||
|
Patch604: kexec-tools-2.0.26-0004-ppc64-Add-elf-ppc64-file-types-options-and-an-arch-s.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||||
@ -128,7 +132,10 @@ mkdir -p -m755 kcp
|
|||||||
tar -z -x -v -f %{SOURCE9}
|
tar -z -x -v -f %{SOURCE9}
|
||||||
tar -z -x -v -f %{SOURCE19}
|
tar -z -x -v -f %{SOURCE19}
|
||||||
|
|
||||||
%patch301 -p1
|
%patch601 -p1
|
||||||
|
%patch602 -p1
|
||||||
|
%patch603 -p1
|
||||||
|
%patch604 -p1
|
||||||
|
|
||||||
%ifarch ppc
|
%ifarch ppc
|
||||||
%define archdef ARCH=ppc
|
%define archdef ARCH=ppc
|
||||||
@ -271,21 +278,6 @@ chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpini
|
|||||||
mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
||||||
mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
||||||
|
|
||||||
%pre
|
|
||||||
# Save the old default crashkernel values to /tmp/ when upgrading the package
|
|
||||||
# so kdumpctl later can tell if it should update the kernel crashkernel
|
|
||||||
# parameter in the posttrans scriptlet. Note this feauture of auto-updating
|
|
||||||
# the kernel crashkernel parameter currently doesn't support ostree, so skip it
|
|
||||||
# for ostree.
|
|
||||||
if [ ! -f /run/ostree-booted ] && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then
|
|
||||||
kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null
|
|
||||||
%ifarch ppc64 ppc64le
|
|
||||||
kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null
|
|
||||||
%endif
|
|
||||||
fi
|
|
||||||
# don't block package update
|
|
||||||
:
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
# Initial installation
|
# Initial installation
|
||||||
%systemd_post kdump.service
|
%systemd_post kdump.service
|
||||||
@ -294,7 +286,7 @@ touch /etc/kdump.conf
|
|||||||
|
|
||||||
%ifarch ppc64 ppc64le
|
%ifarch ppc64 ppc64le
|
||||||
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
|
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
|
||||||
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
|
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# This portion of the script is temporary. Its only here
|
# This portion of the script is temporary. Its only here
|
||||||
@ -325,7 +317,7 @@ fi
|
|||||||
|
|
||||||
%preun
|
%preun
|
||||||
%ifarch ppc64 ppc64le
|
%ifarch ppc64 ppc64le
|
||||||
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
|
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh >/dev/null
|
||||||
%endif
|
%endif
|
||||||
%systemd_preun kdump.service
|
%systemd_preun kdump.service
|
||||||
|
|
||||||
@ -352,21 +344,15 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
%posttrans
|
%posttrans
|
||||||
# Try to reset kernel crashkernel value to new default value based on the old
|
# Try to reset kernel crashkernel value to new default value or set up
|
||||||
# default value or set up crasherkernel value for osbuild
|
# crasherkernel value for new install
|
||||||
#
|
#
|
||||||
# Note
|
# Note
|
||||||
# 1. Skip ostree systems as they are not supported.
|
# 1. Skip ostree systems as they are not supported.
|
||||||
# 2. "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade. The
|
# 2. For Fedora 36 and RHEL9, "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade;
|
||||||
# former case is used to set up crashkernel for osbuild
|
# For Fedora > 36, "[ $1 == 1 ]" only means install and "[ $1 == 2 ]" means upgrade
|
||||||
if [ ! -f /run/ostree-booted ] && [ $1 == 1 ]; then
|
if [ ! -f /run/ostree-booted ] && [ $1 == 1 -o $1 == 2 ]; then
|
||||||
kdumpctl _reset-crashkernel-after-update
|
kdumpctl _reset-crashkernel-after-update
|
||||||
rm /tmp/old_default_crashkernel 2>/dev/null
|
|
||||||
%ifarch ppc64 ppc64le
|
|
||||||
rm /tmp/old_default_crashkernel_fadump 2>/dev/null
|
|
||||||
%endif
|
|
||||||
# dnf would complain about the exit code not being 0. To keep it happy,
|
|
||||||
# always return 0
|
|
||||||
:
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -428,6 +414,57 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jul 4 2023 Tao Liu <ltao@redhat.com> - 2.0.26-8
|
||||||
|
- spec: kdump/ppc64: make servicelog_notify silent when there are no errors
|
||||||
|
|
||||||
|
* Wed Jun 21 2023 Tao Liu <ltao@redhat.com> - 2.0.26-7
|
||||||
|
- kdumpctl: Fix temporary directory location
|
||||||
|
- kdump-lib: Match 64k debug kernel in prepare_kdump_bootinfo()
|
||||||
|
|
||||||
|
* Thu Jun 15 2023 Tao Liu <ltao@redhat.com> - 2.0.26-6
|
||||||
|
- kdumpctl: Fix the matching of plus symbol by grep's EREs
|
||||||
|
- kdump-lib: Evaluate the memory consumption by smmu and mlx5 separately
|
||||||
|
- kdump-lib: add support for 64K aarch64
|
||||||
|
- kdump-lib: Introduce parse_kver_from_path() to get kernel version from its path name
|
||||||
|
- kdump-lib: Introduce a help function _crashkernel_add()
|
||||||
|
- Simplify the management of the kernel parameter crashkernel
|
||||||
|
- kdump-lib: fix the matching pattern for debug-kernel
|
||||||
|
- kdump-lib: always specify version in is_squash_available
|
||||||
|
|
||||||
|
* Thu Jun 1 2023 Tao Liu <ltao@redhat.com> - 2.0.26-5
|
||||||
|
- Add lvm thin provision to kdump supported-kdump-targets.txt
|
||||||
|
- mkdumprd: Use the correct syntax to redirect the stderr to null
|
||||||
|
|
||||||
|
* Wed May 31 2023 Tao Liu <ltao@redhat.com> - 2.0.26-4
|
||||||
|
- kdumpctl: Add basic UKI support
|
||||||
|
- kdumpctl: Move temp file in get_kernel_size to global temp dir
|
||||||
|
- kdumpctl: Move get_kernel_size to kdumpctl
|
||||||
|
- kdump-lib: fix prepare_cmdline
|
||||||
|
- mkdumprd: call dracut with --add-device to install the drivers needed by /boot partition automatically for FIPS
|
||||||
|
|
||||||
|
* Tue May 9 2023 Tao Liu <ltao@redhat.com> - 2.0.26-3
|
||||||
|
- Rebase makedumpfile to v1.7.3
|
||||||
|
- kdumpctl: lower the log level in reset_crashkernel_for_installed_kernel
|
||||||
|
|
||||||
|
* Fri Apr 21 2023 Tao Liu <ltao@redhat.com> - 2.0.26-2
|
||||||
|
- Rebase makedumpfile to upstream latest(8e8b8814be1)
|
||||||
|
- Show how much time kdump has waited for the network to be ready
|
||||||
|
- Tell nmcli to not escape colon when getting the path of connection profile
|
||||||
|
|
||||||
|
* Fri Apr 7 2023 Tao Liu <ltao@redhat.com> - 2.0.26-1
|
||||||
|
- Rebase kexec-tools to v2.0.26
|
||||||
|
|
||||||
|
* Tue Mar 21 2023 Tao Liu <ltao@redhat.com> - 2.0.25-14
|
||||||
|
- Install nfsv4-related drivers when users specify nfs dumping via dracut_args
|
||||||
|
- Revert "ppc64: tackle SRCU hang issue"
|
||||||
|
- sysconfig: add zfcp.allow_lun_scan to KDUMP_COMMANDLINE_REMOVE on s390
|
||||||
|
|
||||||
|
* Fri Mar 10 2023 Tao Liu <ltao@redhat.com> - 2.0.25-13
|
||||||
|
- kdump-lib: Add the CoreOS kernel dir to the boot_dirlist
|
||||||
|
- kdump-lib: attempt to fix BOOT_IMAGE detection
|
||||||
|
- kdump-lib: change how ostree based systems are detected
|
||||||
|
- kdump-lib: clear up references to Atomic/CoreOS
|
||||||
|
|
||||||
* Fri Feb 24 2023 Tao Liu <ltao@redhat.com> - 2.0.25-12
|
* Fri Feb 24 2023 Tao Liu <ltao@redhat.com> - 2.0.25-12
|
||||||
- Reset crashkernel to default value if newly installed kernel has crashkernel=auto
|
- Reset crashkernel to default value if newly installed kernel has crashkernel=auto
|
||||||
- Use the correct command to get architecture
|
- Use the correct command to get architecture
|
||||||
|
Loading…
Reference in New Issue
Block a user