File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -415,7 +415,23 @@ function setup_reboot_variables()
415
415
# Handle architectures supporting Device Tree
416
416
elif [ -f /sys/firmware/devicetree/base/chosen/bootargs ]; then
417
417
KERNEL_IMAGE=" $( ls $IMAGE_PATH /boot/vmlinuz-* ) "
418
- BOOT_OPTIONS=" $( cat /sys/firmware/devicetree/base/chosen/bootargs | sed ' s/.$//' ) ${KEXEC_LOAD_EXTRA_CMDLINE_LINUX} SONIC_BOOT_TYPE=${BOOT_TYPE_ARG} "
418
+ # Fetch next_boot variable
419
+ SONIC_IMAGE_NAME=" $( fw_printenv boot_next | cut -d ' =' -f 2- ) "
420
+ SUFFIX=" "
421
+ if [[ ${SONIC_IMAGE_NAME} == " run sonic_image_2" ]]; then
422
+ SUFFIX=" _old"
423
+ fi
424
+ SONIC_BOOTARGS=" $( fw_printenv sonic_bootargs${SUFFIX} | cut -d ' =' -f 2- ) "
425
+ if [[ ! -z " ${SONIC_BOOTARGS} " ]]; then
426
+ LINUX_BOOTARGS=" $( fw_printenv linuxargs${SUFFIX} | cut -d ' =' -f 2- ) "
427
+ BAUDRATE=" $( fw_printenv baudrate | cut -d ' =' -f 2- ) "
428
+ BOOT_OPTIONS=" $( echo $SONIC_BOOTARGS | sed -e " s/\$ {baudrate}/$BAUDRATE /g" ) "
429
+ BOOT_OPTIONS=" $( echo $BOOT_OPTIONS | sed -e " s@\$ {linuxargs$SUFFIX }@$LINUX_BOOTARGS @g" ) "
430
+ BOOT_OPTIONS=" $( echo $BOOT_OPTIONS | sed -e ' s/.$//' ) ${KEXEC_LOAD_EXTRA_CMDLINE_LINUX} SONIC_BOOT_TYPE=${BOOT_TYPE_ARG} "
431
+ else
432
+ # Fetch bootargs from device tree of the current image
433
+ BOOT_OPTIONS=" $( cat /sys/firmware/devicetree/base/chosen/bootargs | sed ' s/.$//' ) ${KEXEC_LOAD_EXTRA_CMDLINE_LINUX} SONIC_BOOT_TYPE=${BOOT_TYPE_ARG} "
434
+ fi
419
435
INITRD=$( echo $KERNEL_IMAGE | sed ' s/vmlinuz/initrd.img/g' )
420
436
421
437
# If initrd is a U-Boot uImage, remove the uImage header
You can’t perform that action at this time.
0 commit comments