From 93796b31316b2dae374b5d108de5b113ed4b724b Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 2 Mar 2018 10:50:08 -0800 Subject: [PATCH] Add fast-reboot support for Aboot based images (#214) --- scripts/fast-reboot | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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)