import CS kexec-tools-2.0.27-8.el9
This commit is contained in:
parent
9a3b640ab1
commit
576349899b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
SOURCES/eppic-e8844d3.tar.gz
|
||||
SOURCES/kexec-tools-2.0.26.tar.xz
|
||||
SOURCES/makedumpfile-1.7.3.tar.gz
|
||||
SOURCES/kexec-tools-2.0.27.tar.xz
|
||||
SOURCES/makedumpfile-1.7.4.tar.gz
|
||||
|
@ -1,3 +1,3 @@
|
||||
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
||||
27cea5d032ec1e93506b8110222420abf754df2d SOURCES/kexec-tools-2.0.26.tar.xz
|
||||
2815949d81c11cd2f97f184153448d6e8ddff256 SOURCES/makedumpfile-1.7.3.tar.gz
|
||||
ed15f191adee22ab0721ba62af1cae67eb981670 SOURCES/kexec-tools-2.0.27.tar.xz
|
||||
98cae2b1062871905795918c32b6d46ccd115074 SOURCES/makedumpfile-1.7.4.tar.gz
|
||||
|
@ -17,6 +17,6 @@ GOTO="kdump_reload_end"
|
||||
|
||||
LABEL="kdump_reload_cpu"
|
||||
|
||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump_enabled || cat /sys/kernel/fadump_enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump/enabled || cat /sys/kernel/fadump/enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||
|
||||
LABEL="kdump_reload_end"
|
||||
|
@ -38,7 +38,7 @@ early_kdump_load()
|
||||
return 1
|
||||
fi
|
||||
|
||||
if check_current_kdump_status; then
|
||||
if is_kernel_loaded "kdump"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -46,11 +46,6 @@ early_kdump_load()
|
||||
|
||||
EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||
|
||||
if is_secure_boot_enforced; then
|
||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||
EARLY_KEXEC_ARGS="$EARLY_KEXEC_ARGS -s"
|
||||
fi
|
||||
|
||||
# Here, only output the messages, but do not save these messages
|
||||
# to a file because the target disk may not be mounted yet, the
|
||||
# earlykdump is too early.
|
||||
|
@ -576,6 +576,33 @@ kdump_collect_netif_usage() {
|
||||
fi
|
||||
}
|
||||
|
||||
kdump_install_resolv_conf() {
|
||||
local _resolv_conf=/etc/resolv.conf _nm_conf_dir=/etc/NetworkManager/conf.d
|
||||
|
||||
# Some users may choose to manage /etc/resolve.conf manually [1]
|
||||
# by setting dns=none or use a symbolic link resolve.conf [2].
|
||||
# So resolve.conf should be installed to kdump initrd as well. To prevent
|
||||
# NM frome overwritting the user-configured resolve.conf in kdump initrd,
|
||||
# also set dns=none for NM.
|
||||
#
|
||||
# Note:
|
||||
# 1. When resolv.conf is managed by systemd-resolved.service, it could also be a
|
||||
# symbolic link. So exclude this case by teling if systemd-resolved is enabled.
|
||||
#
|
||||
# 2. It's harmless to blindly copy /etc/resolve.conf to the initrd because
|
||||
# by default in initramfs this file will be overwritten by
|
||||
# NetworkManager. If user manages it via a symbolic link, it's still
|
||||
# preserved because NM won't touch a symbolic link file.
|
||||
#
|
||||
# [1] https://bugzilla.gnome.org/show_bug.cgi?id=690404
|
||||
# [2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/manually-configuring-the-etc-resolv-conf-file_configuring-and-managing-networking
|
||||
systemctl -q is-enabled systemd-resolved 2> /dev/null && return 0
|
||||
inst "$_resolv_conf"
|
||||
if NetworkManager --print-config | grep -qs "^dns=none"; then
|
||||
printf "[main]\ndns=none\n" > "${initdir}/${_nm_conf_dir}"/90-dns-none.conf
|
||||
fi
|
||||
}
|
||||
|
||||
# Setup dracut to bring up network interface that enable
|
||||
# initramfs accessing giving destination
|
||||
kdump_install_net() {
|
||||
@ -588,6 +615,7 @@ kdump_install_net() {
|
||||
kdump_setup_znet
|
||||
kdump_install_nm_netif_allowlist "$_netifs"
|
||||
kdump_install_nic_driver "$_netifs"
|
||||
kdump_install_resolv_conf
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1072,6 +1100,15 @@ install() {
|
||||
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
|
||||
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
|
||||
|
||||
# Skip initrd-cleanup.service and initrd-parse-etc.service becasue we don't
|
||||
# need to switch root. Instead of removing them, we use ConditionPathExists
|
||||
# to check if /proc/vmcore exists to determine if we are in kdump.
|
||||
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
||||
"${initdir}/${systemdsystemunitdir}/initrd-cleanup.service" &> /dev/null
|
||||
|
||||
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
||||
"${initdir}/${systemdsystemunitdir}/initrd-parse-etc.service" &> /dev/null
|
||||
|
||||
# Save more memory by dropping switch root capability
|
||||
dracut_no_switch_root
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ Then, start up kdump as well:
|
||||
# systemctl start kdump.service
|
||||
|
||||
This should turn on the firmware assisted functionality in kernel by
|
||||
echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
|
||||
echo'ing 1 to /sys/kernel/fadump/registered, leaving the system ready
|
||||
to capture a vmcore upon crashing. For journaling filesystems like XFS an
|
||||
additional step is required to ensure bootloader does not pick the
|
||||
older initrd (without vmcore capture scripts):
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
. /usr/lib/kdump/kdump-lib-initramfs.sh
|
||||
|
||||
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
||||
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump/enabled"
|
||||
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump/registered"
|
||||
|
||||
is_uki()
|
||||
{
|
||||
@ -29,6 +30,11 @@ is_fadump_capable()
|
||||
return 1
|
||||
}
|
||||
|
||||
is_sme_or_sev_active()
|
||||
{
|
||||
journalctl -q --dmesg --grep "^Memory Encryption Features active: AMD (SME|SEV)$" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
is_squash_available()
|
||||
{
|
||||
local _version kmodule
|
||||
@ -478,11 +484,24 @@ is_mount_in_dracut_args()
|
||||
[[ " $(kdump_get_conf_val dracut_args)" =~ .*[[:space:]]--mount[=[:space:]].* ]]
|
||||
}
|
||||
|
||||
get_reserved_mem_size()
|
||||
{
|
||||
local reserved_mem_size=0
|
||||
|
||||
if is_fadump_capable; then
|
||||
reserved_mem_size=$(< /sys/kernel/fadump/mem_reserved)
|
||||
else
|
||||
reserved_mem_size=$(< /sys/kernel/kexec_crash_size)
|
||||
fi
|
||||
|
||||
echo "$reserved_mem_size"
|
||||
}
|
||||
|
||||
check_crash_mem_reserved()
|
||||
{
|
||||
local mem_reserved
|
||||
|
||||
mem_reserved=$(< /sys/kernel/kexec_crash_size)
|
||||
mem_reserved=$(get_reserved_mem_size)
|
||||
if [[ $mem_reserved -eq 0 ]]; then
|
||||
derror "No memory reserved for crash kernel"
|
||||
return 1
|
||||
@ -501,19 +520,31 @@ check_kdump_feasibility()
|
||||
return $?
|
||||
}
|
||||
|
||||
check_current_kdump_status()
|
||||
is_kernel_loaded()
|
||||
{
|
||||
if [[ ! -f /sys/kernel/kexec_crash_loaded ]]; then
|
||||
derror "Perhaps CONFIG_CRASH_DUMP is not enabled in kernel"
|
||||
local _sysfs _mode
|
||||
|
||||
_mode=$1
|
||||
|
||||
case "$_mode" in
|
||||
kdump)
|
||||
_sysfs="/sys/kernel/kexec_crash_loaded"
|
||||
;;
|
||||
fadump)
|
||||
_sysfs="$FADUMP_REGISTER_SYS_NODE"
|
||||
;;
|
||||
*)
|
||||
derror "Unknown dump mode '$_mode' provided"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f $_sysfs ]]; then
|
||||
derror "$_mode is not supported on this kernel"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rc=$(< /sys/kernel/kexec_crash_loaded)
|
||||
if [[ $rc == 1 ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
[[ $(< $_sysfs) -eq 1 ]]
|
||||
}
|
||||
|
||||
#
|
||||
@ -610,6 +641,15 @@ prepare_kexec_args()
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# For secureboot enabled machines, use new kexec file based syscall.
|
||||
# Old syscall will always fail as it does not have capability to do
|
||||
# kernel signature verification.
|
||||
if is_secure_boot_enforced; then
|
||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||
kexec_args="$kexec_args -s"
|
||||
fi
|
||||
|
||||
echo "$kexec_args"
|
||||
}
|
||||
|
||||
@ -958,62 +998,137 @@ has_aarch64_smmu()
|
||||
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
|
||||
}
|
||||
|
||||
# $1 crashkernel=""
|
||||
# $2 delta in unit of MB
|
||||
_crashkernel_add()
|
||||
is_memsize() { [[ "$1" =~ ^[+-]?[0-9]+[KkMmGgTtPbEe]?$ ]]; }
|
||||
|
||||
# range defined for crashkernel parameter
|
||||
# i.e. <start>-[<end>]
|
||||
is_memrange()
|
||||
{
|
||||
local _ck _add _entry _ret
|
||||
local _range _size _offset
|
||||
is_memsize "${1%-*}" || return 1
|
||||
[[ -n ${1#*-} ]] || return 0
|
||||
is_memsize "${1#*-}"
|
||||
}
|
||||
|
||||
_ck="$1"
|
||||
_add="$2"
|
||||
_ret=""
|
||||
to_bytes()
|
||||
{
|
||||
local _s
|
||||
|
||||
if [[ "$_ck" == *@* ]]; then
|
||||
_offset="@${_ck##*@}"
|
||||
_ck=${_ck%@*}
|
||||
elif [[ "$_ck" == *,high ]] || [[ "$_ck" == *,low ]]; then
|
||||
_offset=",${_ck##*,}"
|
||||
_ck=${_ck%,*}
|
||||
else
|
||||
_offset=''
|
||||
fi
|
||||
_s="$1"
|
||||
is_memsize "$_s" || return 1
|
||||
|
||||
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"
|
||||
case "${_s: -1}" in
|
||||
K|k)
|
||||
_s=${_s::-1}
|
||||
_s="$((_s * 1024))"
|
||||
;;
|
||||
M)
|
||||
_size=${_size::-1}
|
||||
_size="$((_size + _add))M"
|
||||
M|m)
|
||||
_s=${_s::-1}
|
||||
_s="$((_s * 1024 * 1024))"
|
||||
;;
|
||||
G)
|
||||
_size=${_size::-1}
|
||||
_size="$((_size * 1024 + _add))M"
|
||||
G|g)
|
||||
_s=${_s::-1}
|
||||
_s="$((_s * 1024 * 1024 * 1024))"
|
||||
;;
|
||||
T|t)
|
||||
_s=${_s::-1}
|
||||
_s="$((_s * 1024 * 1024 * 1024 * 1024))"
|
||||
;;
|
||||
P|p)
|
||||
_s=${_s::-1}
|
||||
_s="$((_s * 1024 * 1024 * 1024 * 1024 * 1024))"
|
||||
;;
|
||||
E|e)
|
||||
_s=${_s::-1}
|
||||
_s="$((_s * 1024 * 1024 * 1024 * 1024 * 1024 * 1024))"
|
||||
;;
|
||||
*)
|
||||
_size="$((_size + (_add * 1024 * 1024)))"
|
||||
;;
|
||||
esac
|
||||
echo "$_s"
|
||||
}
|
||||
|
||||
[[ -n "$_range" ]] && _ret+="$_range:"
|
||||
_ret+="$_size,"
|
||||
done <<< "$_ck,"
|
||||
memsize_add()
|
||||
{
|
||||
local -a units=("" "K" "M" "G" "T" "P" "E")
|
||||
local i a b
|
||||
|
||||
_ret=${_ret%,}
|
||||
[[ -n "$_offset" ]] && _ret+=$_offset
|
||||
echo "$_ret"
|
||||
a=$(to_bytes "$1") || return 1
|
||||
b=$(to_bytes "$2") || return 1
|
||||
i=0
|
||||
|
||||
(( a += b ))
|
||||
while :; do
|
||||
[[ $(( a / 1024 )) -eq 0 ]] && break
|
||||
[[ $(( a % 1024 )) -ne 0 ]] && break
|
||||
[[ $(( ${#units[@]} - 1 )) -eq $i ]] && break
|
||||
|
||||
(( a /= 1024 ))
|
||||
(( i += 1 ))
|
||||
done
|
||||
|
||||
echo "${a}${units[$i]}"
|
||||
}
|
||||
|
||||
_crashkernel_parse()
|
||||
{
|
||||
local ck entry
|
||||
local range size offset
|
||||
|
||||
ck="$1"
|
||||
|
||||
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
|
||||
|
||||
echo "$size;$range;"
|
||||
done <<< "$ck,"
|
||||
echo ";;$offset"
|
||||
}
|
||||
|
||||
# $1 crashkernel command line parameter
|
||||
# $2 size to be added
|
||||
_crashkernel_add()
|
||||
{
|
||||
local ck delta ret
|
||||
local range size offset
|
||||
|
||||
ck="$1"
|
||||
delta="$2"
|
||||
ret=""
|
||||
|
||||
while IFS=';' read -r size range offset; do
|
||||
if [[ -n "$offset" ]]; then
|
||||
ret="${ret%,}$offset"
|
||||
break
|
||||
fi
|
||||
|
||||
[[ -n "$size" ]] || continue
|
||||
if [[ -n "$range" ]]; then
|
||||
is_memrange "$range" || return 1
|
||||
ret+="$range:"
|
||||
fi
|
||||
|
||||
size=$(memsize_add "$size" "$delta") || return 1
|
||||
ret+="$size,"
|
||||
done < <( _crashkernel_parse "$ck")
|
||||
|
||||
echo "${ret%,}"
|
||||
}
|
||||
|
||||
# get default crashkernel
|
||||
@ -1022,6 +1137,7 @@ _crashkernel_add()
|
||||
kdump_get_arch_recommend_crashkernel()
|
||||
{
|
||||
local _arch _ck_cmdline _dump_mode
|
||||
local _delta=0
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
if is_fadump_capable; then
|
||||
@ -1037,9 +1153,9 @@ kdump_get_arch_recommend_crashkernel()
|
||||
|
||||
if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then
|
||||
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
|
||||
is_sme_or_sev_active && ((_delta += 64))
|
||||
elif [[ $_arch == "aarch64" ]]; then
|
||||
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"
|
||||
@ -1063,7 +1179,6 @@ kdump_get_arch_recommend_crashkernel()
|
||||
#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
|
||||
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"
|
||||
@ -1072,7 +1187,7 @@ kdump_get_arch_recommend_crashkernel()
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "$_ck_cmdline"
|
||||
echo -n "$(_crashkernel_add "$_ck_cmdline" "${_delta}M")"
|
||||
}
|
||||
|
||||
# return recommended size based on current system RAM size
|
||||
|
@ -29,7 +29,20 @@ understand how this configuration file affects the behavior of kdump.
|
||||
.B auto_reset_crashkernel <yes|no>
|
||||
.RS
|
||||
determine whether to reset kernel crashkernel parameter to the default value
|
||||
or not when kexec-tools is updated or a new kernel is installed.
|
||||
or not when kexec-tools is updated or a new kernel is installed. The default
|
||||
crashkernel values are different for different architectures and also take the
|
||||
following factors into consideration,
|
||||
- AMD Secure Memory Encryption (SME) and Secure Encrypted Virtualization (SEV)
|
||||
- Mellanox 5th generation network driver
|
||||
- aarch64 64k kernel
|
||||
- Firmware-assisted dump (FADump)
|
||||
|
||||
Since the kernel crasherkernel parameter will be only reset when kexec-tools is
|
||||
updated or a new kernel is installed, you need to call "kdumpctl
|
||||
reset-crashkernel [--kernel=path_to_kernel]" if you want to use the default
|
||||
value set after having enabled features like SME/SEV for a specific kernel. And
|
||||
you should also reboot the system for the new crashkernel value to take effect.
|
||||
Also see kdumpctl(8).
|
||||
|
||||
.B raw <partition>
|
||||
.RS
|
||||
|
113
SOURCES/kdumpctl
113
SOURCES/kdumpctl
@ -17,7 +17,6 @@ DEFAULT_INITRD_BAK=""
|
||||
INITRD_CHECKSUM_LOCATION=""
|
||||
KDUMP_INITRD=""
|
||||
TARGET_INITRD=""
|
||||
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
|
||||
#kdump shall be the default dump mode
|
||||
DEFAULT_DUMP_MODE="kdump"
|
||||
image_time=0
|
||||
@ -125,7 +124,6 @@ rebuild_fadump_initrd()
|
||||
check_earlykdump_is_enabled()
|
||||
{
|
||||
grep -q -w "rd.earlykdump" /proc/cmdline
|
||||
return $?
|
||||
}
|
||||
|
||||
rebuild_kdump_initrd()
|
||||
@ -155,8 +153,6 @@ rebuild_initrd()
|
||||
else
|
||||
rebuild_kdump_initrd
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
#$1: the files to be checked with IFS=' '
|
||||
@ -536,28 +532,22 @@ check_fs_modified()
|
||||
check_system_modified()
|
||||
{
|
||||
local ret
|
||||
local CONF_ERROR=2
|
||||
local CONF_MODIFY=1
|
||||
local CONF_NO_MODIFY=0
|
||||
local conf_status=$CONF_NO_MODIFY
|
||||
|
||||
[[ -f $TARGET_INITRD ]] || return 1
|
||||
|
||||
check_files_modified
|
||||
for _func in check_files_modified check_fs_modified check_drivers_modified; do
|
||||
$_func
|
||||
ret=$?
|
||||
if [[ $ret -ne 0 ]]; then
|
||||
return $ret
|
||||
fi
|
||||
# return immediately if an error occurred.
|
||||
[[ $ret -eq "$CONF_ERROR" ]] && return "$ret"
|
||||
[[ $ret -eq "$CONF_MODIFY" ]] && { conf_status="$CONF_MODIFY"; }
|
||||
done
|
||||
|
||||
check_fs_modified
|
||||
ret=$?
|
||||
if [[ $ret -ne 0 ]]; then
|
||||
return $ret
|
||||
fi
|
||||
|
||||
check_drivers_modified
|
||||
ret=$?
|
||||
if [[ $ret -ne 0 ]]; then
|
||||
return $ret
|
||||
fi
|
||||
|
||||
return 0
|
||||
return $conf_status
|
||||
}
|
||||
|
||||
check_rebuild()
|
||||
@ -626,7 +616,6 @@ check_rebuild()
|
||||
|
||||
dinfo "Rebuilding $TARGET_INITRD"
|
||||
rebuild_initrd
|
||||
return $?
|
||||
}
|
||||
|
||||
# On ppc64le LPARs, the keys trusted by firmware do not end up in
|
||||
@ -642,19 +631,7 @@ function load_kdump_kernel_key()
|
||||
return
|
||||
fi
|
||||
|
||||
KDUMP_KEY_ID=$(keyctl padd asymmetric kernelkey-$RANDOM %:.ima < "/usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer")
|
||||
}
|
||||
|
||||
# remove a previously loaded key. There's no real security implication
|
||||
# to leaving it around, we choose to do this because it makes it easier
|
||||
# to be idempotent and so as to reduce the potential for confusion.
|
||||
function remove_kdump_kernel_key()
|
||||
{
|
||||
if [[ -z $KDUMP_KEY_ID ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
keyctl unlink "$KDUMP_KEY_ID" %:.ima
|
||||
keyctl padd asymmetric "" %:.ima < "/usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer"
|
||||
}
|
||||
|
||||
# Load the kdump kernel specified in /etc/sysconfig/kdump
|
||||
@ -667,15 +644,6 @@ load_kdump()
|
||||
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
||||
|
||||
# For secureboot enabled machines, use new kexec file based syscall.
|
||||
# Old syscall will always fail as it does not have capability to
|
||||
# to kernel signature verification.
|
||||
if is_secure_boot_enforced; then
|
||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||
KEXEC_ARGS="$KEXEC_ARGS -s"
|
||||
load_kdump_kernel_key
|
||||
fi
|
||||
|
||||
if is_uki "$KDUMP_KERNEL"; then
|
||||
uki=$KDUMP_KERNEL
|
||||
KDUMP_KERNEL=$KDUMP_TMPDIR/vmlinuz
|
||||
@ -707,8 +675,6 @@ load_kdump()
|
||||
set +x
|
||||
exec 2>&12 12>&-
|
||||
|
||||
remove_kdump_kernel_key
|
||||
|
||||
if [[ $ret == 0 ]]; then
|
||||
dinfo "kexec: loaded kdump kernel"
|
||||
return 0
|
||||
@ -847,31 +813,12 @@ show_reserved_mem()
|
||||
local mem
|
||||
local mem_mb
|
||||
|
||||
mem=$(< /sys/kernel/kexec_crash_size)
|
||||
mem=$(get_reserved_mem_size)
|
||||
mem_mb=$((mem / 1024 / 1024))
|
||||
|
||||
dinfo "Reserved ${mem_mb}MB memory for crash kernel"
|
||||
}
|
||||
|
||||
check_current_fadump_status()
|
||||
{
|
||||
# Check if firmware-assisted dump has been registered.
|
||||
rc=$(< $FADUMP_REGISTER_SYS_NODE)
|
||||
[[ $rc -eq 1 ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
check_current_status()
|
||||
{
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
check_current_fadump_status
|
||||
else
|
||||
check_current_kdump_status
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
save_raw()
|
||||
{
|
||||
local kdump_dir
|
||||
@ -998,13 +945,12 @@ check_dump_feasibility()
|
||||
fi
|
||||
|
||||
check_kdump_feasibility
|
||||
return $?
|
||||
}
|
||||
|
||||
start_fadump()
|
||||
{
|
||||
echo 1 > $FADUMP_REGISTER_SYS_NODE
|
||||
if ! check_current_fadump_status; then
|
||||
echo 1 > "$FADUMP_REGISTER_SYS_NODE"
|
||||
if ! is_kernel_loaded "fadump"; then
|
||||
derror "fadump: failed to register"
|
||||
return 1
|
||||
fi
|
||||
@ -1015,13 +961,17 @@ start_fadump()
|
||||
|
||||
start_dump()
|
||||
{
|
||||
# On secure boot enabled Power systems, load kernel signing key on .ima for signature
|
||||
# verification using kexec file based syscall.
|
||||
if [[ "$(uname -m)" == ppc64le ]] && is_secure_boot_enforced; then
|
||||
load_kdump_kernel_key
|
||||
fi
|
||||
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
start_fadump
|
||||
else
|
||||
load_kdump
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
check_failure_action_config()
|
||||
@ -1097,7 +1047,7 @@ start()
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $DEFAULT_DUMP_MODE == "kdump" ]] && check_current_kdump_status; then
|
||||
if [[ $DEFAULT_DUMP_MODE == "kdump" ]] && is_kernel_loaded "kdump"; then
|
||||
dwarn "Kdump already running: [WARNING]"
|
||||
return 0
|
||||
fi
|
||||
@ -1124,13 +1074,13 @@ start()
|
||||
|
||||
reload()
|
||||
{
|
||||
if ! check_current_status; then
|
||||
if ! is_kernel_loaded "$DEFAULT_DUMP_MODE"; then
|
||||
dwarn "Kdump was not running: [WARNING]"
|
||||
fi
|
||||
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
reload_fadump
|
||||
return $?
|
||||
return
|
||||
else
|
||||
if ! stop_kdump; then
|
||||
derror "Stopping kdump: [FAILED]"
|
||||
@ -1155,8 +1105,8 @@ reload()
|
||||
|
||||
stop_fadump()
|
||||
{
|
||||
echo 0 > $FADUMP_REGISTER_SYS_NODE
|
||||
if check_current_fadump_status; then
|
||||
echo 0 > "$FADUMP_REGISTER_SYS_NODE"
|
||||
if is_kernel_loaded "fadump"; then
|
||||
derror "fadump: failed to unregister"
|
||||
return 1
|
||||
fi
|
||||
@ -1185,7 +1135,7 @@ stop_kdump()
|
||||
|
||||
reload_fadump()
|
||||
{
|
||||
if echo 1 > $FADUMP_REGISTER_SYS_NODE; then
|
||||
if echo 1 > "$FADUMP_REGISTER_SYS_NODE"; then
|
||||
dinfo "fadump: re-registered successfully"
|
||||
return 0
|
||||
else
|
||||
@ -1194,7 +1144,7 @@ reload_fadump()
|
||||
# to handle such scenario.
|
||||
if stop_fadump; then
|
||||
start_fadump
|
||||
return $?
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1233,7 +1183,6 @@ rebuild()
|
||||
|
||||
dinfo "Rebuilding $TARGET_INITRD"
|
||||
rebuild_initrd
|
||||
return $?
|
||||
}
|
||||
|
||||
check_vmlinux()
|
||||
@ -1334,7 +1283,7 @@ do_estimate()
|
||||
# The default pre-reserved crashkernel value
|
||||
baseline_size=$((baseline * size_mb))
|
||||
# Current reserved crashkernel size
|
||||
reserved_size=$(< /sys/kernel/kexec_crash_size)
|
||||
reserved_size=$(get_reserved_mem_size)
|
||||
# A pre-estimated value for userspace usage and kernel
|
||||
# runtime allocation, 64M should good for most cases
|
||||
runtime_size=$((64 * size_mb))
|
||||
@ -1840,7 +1789,7 @@ main()
|
||||
;;
|
||||
status)
|
||||
EXIT_CODE=0
|
||||
check_current_status
|
||||
is_kernel_loaded "$DEFAULT_DUMP_MODE"
|
||||
case "$?" in
|
||||
0)
|
||||
dinfo "Kdump is operational"
|
||||
@ -1907,5 +1856,3 @@ single_instance_lock
|
||||
exec 9<&-
|
||||
main "$@"
|
||||
)
|
||||
|
||||
exit $?
|
||||
|
@ -1,147 +0,0 @@
|
||||
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
|
||||
|
@ -1,108 +0,0 @@
|
||||
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
|
||||
|
@ -1,211 +0,0 @@
|
||||
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
|
||||
|
@ -1,68 +0,0 @@
|
||||
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
|
||||
|
@ -0,0 +1,39 @@
|
||||
From bd0200c47c45dd420244b39ddabcecdab1fb9a8e Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Wed, 20 Sep 2023 17:29:27 +0530
|
||||
Subject: [PATCH] kexec: update manpage with explicit mention of clean kexec
|
||||
|
||||
While the manpage does mention about kexec boot with a clean shutdown,
|
||||
it is not explicit about it. Make it explicit.
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||
---
|
||||
kexec/kexec.8 | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||
index 3a344c5..179dcf2 100644
|
||||
--- a/kexec/kexec.8
|
||||
+++ b/kexec/kexec.8
|
||||
@@ -95,8 +95,15 @@ then you would use the following command to load the kernel:
|
||||
.RB "\-\-append=" "root=/dev/hda1" "\ \-\-initrd=" /boot/initrd
|
||||
.RE
|
||||
.PP
|
||||
-After this kernel is loaded, it can be booted to at any time using the
|
||||
-command:
|
||||
+After this kernel is loaded, assuming the user-space supports kexec-based
|
||||
+rebooting, it can be booted to, with a clean shutdown, using the command:
|
||||
+
|
||||
+.RS
|
||||
+.BR reboot
|
||||
+.RE
|
||||
+.PP
|
||||
+Alternatively, it can also be booted to, without calling shutdown(8), with
|
||||
+the command:
|
||||
|
||||
.RS
|
||||
.BR kexec \ \-e
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,10 +1,10 @@
|
||||
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
|
||||
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
||||
%global mkdf_ver 1.7.3
|
||||
%global mkdf_ver 1.7.4
|
||||
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
|
||||
|
||||
Name: kexec-tools
|
||||
Version: 2.0.26
|
||||
Version: 2.0.27
|
||||
Release: 8%{?dist}
|
||||
License: GPLv2
|
||||
Summary: The kexec/kdump userspace component
|
||||
@ -113,10 +113,7 @@ Requires: systemd-udev%{?_isa}
|
||||
#
|
||||
# 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
|
||||
Patch601: kexec-update-manpage-with-explicit-mention-of-clean-.patch
|
||||
|
||||
%description
|
||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||
@ -133,9 +130,6 @@ tar -z -x -v -f %{SOURCE9}
|
||||
tar -z -x -v -f %{SOURCE19}
|
||||
|
||||
%patch601 -p1
|
||||
%patch602 -p1
|
||||
%patch603 -p1
|
||||
%patch604 -p1
|
||||
|
||||
%ifarch ppc
|
||||
%define archdef ARCH=ppc
|
||||
@ -414,6 +408,38 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Jan 30 2024 Tao Liu <ltao@redhat.com> - 2.0.27-8
|
||||
- dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
|
||||
|
||||
* Wed Jan 3 2024 Tao Liu <ltao@redhat.com> - 2.0.27-7
|
||||
- Explain the auto_reset_crashkernel option in more details
|
||||
- Use the same /etc/resolve.conf in kdump initrd if it's managed manually
|
||||
|
||||
* Wed Dec 20 2023 Tao Liu <ltao@redhat.com> - 2.0.27-6
|
||||
- Use the same /etc/resolve.conf in kdump initrd if it's managed manually
|
||||
|
||||
* Fri Nov 24 2023 Tao Liu <ltao@redhat.com> - 2.0.27-5
|
||||
- kdumpctl: Only returns immediately after an error occurs in check_*_modified
|
||||
|
||||
* Thu Nov 16 2023 Tao Liu <ltao@redhat.com> - 2.0.27-4
|
||||
- kdump-lib.sh: add extra 64M to default crashkernel if sme/sev is active
|
||||
- Allow _crashkernel_add to address larger memory ranges
|
||||
- kdump-lib: Harden _crashkernel_add
|
||||
|
||||
* Wed Nov 8 2023 Tao Liu <ltao@redhat.com> - 2.0.27-3
|
||||
- Rebase makedumpfile to v1.7.4
|
||||
- powerpc: update kdumpctl to load kernel signing key for fadump
|
||||
- powerpc: update kdumpctl to remove deletion of kernel signing key once loaded
|
||||
|
||||
* Mon Nov 6 2023 Tao Liu <ltao@redhat.com> - 2.0.27-2
|
||||
- kexec: update manpage with explicit mention of clean kexec
|
||||
|
||||
* Tue Sep 26 2023 Tao Liu <ltao@redhat.com> - 2.0.26-9
|
||||
- Introduce a function to get reserved memory size
|
||||
- powerpc: update fadump sysfs node path
|
||||
- kdumpctl: merge check_current_{kdump,fadump}_status
|
||||
- kdumpctl: remove unnecessary uses of $?
|
||||
|
||||
* 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user