Skip to content

Commit

Permalink
[ARM64][Warm-Reboot]: Get boot arguments from uboot environment
Browse files Browse the repository at this point in the history
Fetch boot arguments from the next boot image by reading it from
uboot environment variables.

Signed-off-by: Parthiv Shah <parthiv@marvell.com>
  • Loading branch information
marvellparthiv committed Nov 12, 2024
1 parent 093ed4a commit 146bab1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,22 @@ function setup_reboot_variables()
# Handle architectures supporting Device Tree
elif [ -f /sys/firmware/devicetree/base/chosen/bootargs ]; then
KERNEL_IMAGE="$(ls $IMAGE_PATH/boot/vmlinuz-*)"
BOOT_OPTIONS="$(cat /sys/firmware/devicetree/base/chosen/bootargs | sed 's/.$//') SONIC_BOOT_TYPE=${BOOT_TYPE_ARG}"
# Fetch next_boot variable
SONIC_IMAGE_NAME="$( fw_printenv boot_next | cut -d '=' -f 2- )"
SUFFIX=""
if [[ ${SONIC_IMAGE_NAME} == "run sonic_image_2" ]]; then
SUFFIX="_old"
fi
SONIC_BOOTARGS="$(fw_printenv sonic_bootargs${SUFFIX} | cut -d '=' -f 2- )"
if [[ ! -z "${SONIC_BOOTARGS}" ]]; then
LINUX_BOOTARGS="$( fw_printenv linuxargs${SUFFIX} | cut -d '=' -f 2- )"
BAUDRATE="$( fw_printenv baudrate | cut -d '=' -f 2- )"
BOOT_OPTIONS="$(echo $SONIC_BOOTARGS | sed -e "s/\${baudrate}/$BAUDRATE/g")"
BOOT_OPTIONS="$(echo $BOOT_OPTIONS | sed -e "s@\${linuxargs$SUFFIX}@$LINUX_BOOTARGS@g")"
BOOT_OPTIONS="$(echo $BOOT_OPTIONS | sed -e 's/.$//') SONIC_BOOT_TYPE=${BOOT_TYPE_ARG}"
else
BOOT_OPTIONS="$(cat /sys/firmware/devicetree/base/chosen/bootargs | sed 's/.$//') SONIC_BOOT_TYPE=${BOOT_TYPE_ARG}"
fi
INITRD=$(echo $KERNEL_IMAGE | sed 's/vmlinuz/initrd.img/g')
# If initrd is a U-Boot uImage, remove the uImage header
Expand Down

0 comments on commit 146bab1

Please sign in to comment.