diff --git a/scripts/fast-reboot b/scripts/fast-reboot index a3a05661ff50..d16af72fd48d 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -16,9 +16,18 @@ fi # Kernel and initrd image NEXT_SONIC_IMAGE=$(sonic_installer list | grep "Next: " | cut -d ' ' -f 2) -KERNEL_OPTIONS=$(cat /host/grub/grub.cfg | sed "/$NEXT_SONIC_IMAGE'/,/}/"'!'"g" | grep linux) -KERNEL_IMAGE="/host$(echo $KERNEL_OPTIONS | cut -d ' ' -f 2)" -BOOT_OPTIONS="$(echo $KERNEL_OPTIONS | sed -e 's/\s*linux\s*/BOOT_IMAGE=/') fast-reboot" +if grep -q aboot_platform= /host/machine.conf; then + IMAGE_PATH="/host/image-${NEXT_SONIC_IMAGE#SONiC-OS-}" + KERNEL_IMAGE="$(ls $IMAGE_PATH/boot/vmlinuz-*)" + BOOT_OPTIONS="$(cat "$IMAGE_PATH/kernel-cmdline" | tr '\n' ' ') fast-reboot" +elif grep -q onie_platform= /host/machine.conf; then + KERNEL_OPTIONS=$(cat /host/grub/grub.cfg | sed "/$NEXT_SONIC_IMAGE'/,/}/"'!'"g" | grep linux) + KERNEL_IMAGE="/host$(echo $KERNEL_OPTIONS | cut -d ' ' -f 2)" + BOOT_OPTIONS="$(echo $KERNEL_OPTIONS | sed -e 's/\s*linux\s*/BOOT_IMAGE=/') fast-reboot" +else + echo "Unknown bootloader. fast-reboot is not supported." + exit 1 +fi INITRD=$(echo $KERNEL_IMAGE | sed 's/vmlinuz/initrd.img/g') sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)