From 50db98e2b34f04aafdad934575dd53c193c77a90 Mon Sep 17 00:00:00 2001 From: byu343 Date: Tue, 11 Feb 2020 18:44:25 -0800 Subject: [PATCH] [arista]: Fix convertfs condition for booting from EOS (#4139) Fix the issue of incorrectly skipping the convertfs hook when fast-reboot from EOS, by adding an extra kernel cmdline param "prev_os" to differentiate fast-reboot from EOS and from SONiC. This is because we still do disk conversion for fast reboot from eos to sonic, like format the disk. --- files/Aboot/boot0.j2 | 2 +- files/initramfs-tools/arista-convertfs.j2 | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index dc961a276d..df1b890ba6 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -307,7 +307,7 @@ write_boot_configs() { } run_kexec() { - local cmdline="$(cat $cmdline_image | tr '\n' ' ')" + local cmdline="$(cat $cmdline_image | tr '\n' ' ') $ENV_EXTRA_CMDLINE" local kernel="${KERNEL:-$(find $image_path/boot -name 'vmlinuz-*' -type f | head -n 1)}" local initrd="${INITRD:-$(find $image_path/boot -name 'initrd.img-*' -type f | head -n 1)}" diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 00fe5aa2cf..e55a818626 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -18,6 +18,8 @@ flash_dev='' block_flash='' aboot_flag='' backup_file='' +prev_os='' +sonic_fast_reboot='' # Wait until get the fullpath of flash device, e.g., /dev/sda wait_get_flash_dev() { @@ -133,12 +135,21 @@ for x in "$@"; do docker_inram=*) docker_inram="${x#docker_inram=}" ;; + prev_os=*) + prev_os="${x#prev_os=}" + ;; + SONIC_BOOT_TYPE=warm*|SONIC_BOOT_TYPE=fast*) + sonic_fast_reboot=true + ;; esac done #Check aboot [ -z "$aboot_flag" ] && exit 0 +# Skip this script for warm-reboot/fast-reboot from sonic +[ "$sonic_fast_reboot" == true ] && [ "$prev_os" != eos ] && exit 0 + # Get flash dev name if [ -z "$block_flash" ]; then echo "Error: flash device info is not provided"