Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions files/Aboot/boot0.j2
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ installer_image_path="$image_path/$installer_image"

boot_config="$target_path/boot-config"

cmdline_allowlist="crashkernel hwaddr_ma1 sonic_fips docker_inram"
kernel_cmdline_allowlist="crashkernel hwaddr_ma1 sonic_fips docker_inram"
default_cmdline_blacklist="crashkernel"

# for backward compatibility with the sonic_upgrade= behavior
install="${install:-${sonic_upgrade:-}}"
Expand Down Expand Up @@ -204,6 +205,11 @@ cmdline_add() {
echo "$@" >> /tmp/append
}

cmdline_remove() {
# remove all occurences of parameter and its value from the cmdline
sed -i "s/\b${1}=[^ ]*\s*//g" /tmp/append
}

cmdline_has() {
grep -q "$1" /tmp/append
}
Expand Down Expand Up @@ -479,6 +485,17 @@ get_eeprom_value() {
sed -n "s#^$key: *##p" "$target_path/.system-prefdl" || :
}

write_kdump_cmdline() {
local sid="$(cmdline_get sid | sed 's/Ssd$//')"
case "$sid" in
Wolverine*|Clearwater2*|OtterLake*|QuartzDd*|Redstart8Mk2Quartz4*|CitrineDd*)
if ! cmdline_has crashkernel; then
cmdline_add crashkernel=0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-16G:448M,16G-32G:768M,32G-:1G
fi
;;
esac
}

write_platform_specific_cmdline() {
local platform="$(cmdline_get platform)"
local sid="$(cmdline_get sid | sed 's/Ssd$//')"
Expand Down Expand Up @@ -802,6 +819,11 @@ write_default_cmdline() {
# for the Aboot part. Take an educated guess at a right delimiter.
# Subject to breakage if EOS or SONiC cmdline change.
cat /proc/cmdline | sed -E 's/^(.*) rw .*$/\1/' | tr ' ' '\n' | cmdline_append

# Remove any parameters that are inadvertently inherited
for field in $default_cmdline_blacklist; do
cmdline_remove "$field"
done
fi

cmdline_add "$delimiter"
Expand All @@ -822,7 +844,7 @@ write_cmdline() {
# this file can be either packaged in the swi or generated from userland
for cpath in "$image_path/kernel-cmdline" "$image_path/kernel-cmdline-append"; do
if [ -f "$cpath" ]; then
for field in $cmdline_allowlist; do
for field in $kernel_cmdline_allowlist; do
cat "$cpath" | tr ' ' '\n' | grep -E "$field" | tail -n 1 | cmdline_append
done
fi
Expand Down Expand Up @@ -852,13 +874,15 @@ write_secureboot_configs() {
# setting panic= has the side effect of disabling the initrd shell on error
cmdline_add panic=0
write_cmdline
write_kdump_cmdline
}

write_regular_configs() {
write_common_configs
cmdline_add "loop=$image_name/fs.squashfs"
cmdline_add loopfstype=squashfs
write_cmdline
write_kdump_cmdline
}

run_kexec() {
Expand Down
Loading