[Arista] Fix boot0 code for docker_inram
Enable docker_inram for all systems with 4GB or less of flash. This is mandatory to allow these systems to store 2 SONiC images. This change also fixes the missing docker_inram attribute when installing a new image from SONiC. Because the SWI image can ship with additional kernel parameters within such as `sonic_fips=` this lead to a conflict. To prevent the conflict, the extra kernel parameters from the SWI are now stored in the file `kernel-cmdline-append` which isn't used anywhere.
This commit is contained in:
parent
37eddd479d
commit
467994c024
@ -202,12 +202,12 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then
|
||||
zip -g $OUTPUT_ABOOT_IMAGE .platforms_asic
|
||||
|
||||
if [ "$ENABLE_FIPS" = "y" ]; then
|
||||
echo "sonic_fips=1" > kernel-cmdline
|
||||
echo "sonic_fips=1" >> kernel-cmdline-append
|
||||
else
|
||||
echo "sonic_fips=0" > kernel-cmdline
|
||||
echo "sonic_fips=0" >> kernel-cmdline-append
|
||||
fi
|
||||
zip -g $OUTPUT_ABOOT_IMAGE kernel-cmdline
|
||||
rm kernel-cmdline
|
||||
zip -g $OUTPUT_ABOOT_IMAGE kernel-cmdline-append
|
||||
rm kernel-cmdline-append
|
||||
|
||||
zip -g $OUTPUT_ABOOT_IMAGE $ABOOT_BOOT_IMAGE
|
||||
rm $ABOOT_BOOT_IMAGE
|
||||
|
@ -67,7 +67,7 @@ fi
|
||||
|
||||
mountpoint_for_file() {
|
||||
local file="$1"
|
||||
df "$file" | tail -1 | tr -s " " | cut -d ' ' -f6
|
||||
df "$file" 2>/dev/null | tail -1 | tr -s " " | cut -d ' ' -f6
|
||||
}
|
||||
|
||||
# extract mount point from the swi path, e.g., /mnt/flash/sonic.swi --> /mnt/flash
|
||||
@ -402,7 +402,7 @@ extract_image() {
|
||||
extract_image_secureboot() {
|
||||
info "Extracting necessary swi content"
|
||||
# NOTE: boot/ is not used by the boot process but only extracted for kdump
|
||||
unzip -oq "$swipath" 'boot/*' .imagehash -d "$image_path"
|
||||
unzip -oq "$swipath" 'boot/*' .imagehash kernel-cmdline-append -d "$image_path"
|
||||
|
||||
## Extract platform.tar.gz
|
||||
info "Extracting platform.tar.gz"
|
||||
@ -442,7 +442,7 @@ write_machine_config() {
|
||||
## Detect SKU and create a hardware description file
|
||||
aboot_version=$(cmdline_get Aboot | sed 's/^.*norcal.-//')
|
||||
if [ -x /bin/sysinit ]; then
|
||||
aboot_build_date=$(stat -c %y /bin/sysinit | sed 's/ /T/')
|
||||
aboot_build_date=$(stat -c %y /bin/sysinit | sed 's/ /T/g')
|
||||
else
|
||||
aboot_build_date="unknown"
|
||||
fi
|
||||
@ -655,10 +655,10 @@ write_platform_specific_cmdline() {
|
||||
else
|
||||
varlog_size=256
|
||||
cmdline_add logs_inram=on
|
||||
cmdline_add docker_inram=on
|
||||
if [ $flash_size -le 2000 ]; then
|
||||
# enable docker_inram for switches with less than 2G of flash
|
||||
varlog_size=128
|
||||
cmdline_add docker_inram=on
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -741,13 +741,19 @@ write_cmdline() {
|
||||
cat "$target_path/$kernel_params" | cmdline_append
|
||||
fi
|
||||
|
||||
# FIXME: sonic sometimes adds extra kernel parameters from user space
|
||||
# this is unsafe but some will be kept as part of the regular boot
|
||||
if [ -f "$image_path/kernel-cmdline" ]; then
|
||||
for field in $cmdline_allowlist; do
|
||||
cat "$image_path/kernel-cmdline" | tr ' ' '\n' | grep -E "$field" | tail -n 1 | cmdline_append
|
||||
done
|
||||
fi
|
||||
# NOTE: SONiC might need to provide some extra kernel parameter to change the
|
||||
# next boot behavior. The following lines lookup allowed parameters and
|
||||
# append them to the cmdline.
|
||||
# - kernel-cmdline is still modified but its usage should ideally be deprecated over time
|
||||
# - kernel-cmdline-append is for the user (SONiC) to use.
|
||||
# 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
|
||||
cat "$cpath" | tr ' ' '\n' | grep -E "$field" | tail -n 1 | cmdline_append
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
# FIXME: legacy configuration files used by fast-reboot and eos2sonic
|
||||
# these should be deprecated over time.
|
||||
@ -830,6 +836,10 @@ regular_install() {
|
||||
info "Installing image under $image_path"
|
||||
extract_image
|
||||
|
||||
# NOTE: this call is necessary to process the kernel-cmdline-append file coming
|
||||
# from the just extracted swi
|
||||
write_cmdline
|
||||
|
||||
run_hooks post-install
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user