Skip to content

Commit

Permalink
[Marvell-arm64]: Fix sonic-installer (sonic-net#18683)
Browse files Browse the repository at this point in the history
* Fix illegal character error

Signed-off-by: Pavan Naregundi <[email protected]>

* Set second image based on current image

Signed-off-by: Pavan Naregundi <[email protected]>

* Fix boot_once

boot_once needs to be cleared during the boot of boot_once.

Signed-off-by: Pavan Naregundi <[email protected]>

* Fix print boot menu

Signed-off-by: Pavan Naregundi <[email protected]>

---------

Signed-off-by: Pavan Naregundi <[email protected]>
  • Loading branch information
pavannaregundi authored Apr 23, 2024
1 parent e15a1aa commit d3b18c4
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions platform/marvell/platform_arm64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,32 @@ prepare_boot_menu() {

if [ "$install_env" = "onie" ]; then
FW_ARG="-f"
image_dir_old=""
image_name_old=""
initrd_name_old=""
fdt_name_old=""
fit_name_old=""
sonic_version_2="None"
fw_setenv ${FW_ARG} image_dir_old "" > /dev/null
fw_setenv ${FW_ARG} image_name_old "" > /dev/null
fw_setenv ${FW_ARG} initrd_name_old "" > /dev/null
fw_setenv ${FW_ARG} fdt_name_old "" > /dev/null
fw_setenv ${FW_ARG} fit_name_old "" > /dev/null
fw_setenv ${FW_ARG} sonic_version_2 "None" > /dev/null
fw_setenv ${FW_ARG} linuxargs_old "" > /dev/null
else
image_dir_old=$(fw_printenv -n image_dir || true)
image_name_old=$(fw_printenv -n image_name || true)
initrd_name_old=$(fw_printenv -n initrd_name || true)
fdt_name_old=$(fw_printenv -n fdt_name || true)
fit_name_old=$(fw_printenv -n fit_name || true)
sonic_version_2=$(fw_printenv -n sonic_version_1 || true)
CURR_SONIC_IMAGE="$(sonic-installer list | grep "Current: " | cut -f2 -d' ')"
FIRST_SONIC_IMAGE="$(fw_printenv sonic_version_1 | cut -f2 -d'=')"
if [ "$CURR_SONIC_IMAGE" = "$FIRST_SONIC_IMAGE" ]; then
image_dir_old=$(fw_printenv -n image_dir || true)
image_name_old=$(fw_printenv -n image_name || true)
initrd_name_old=$(fw_printenv -n initrd_name || true)
fdt_name_old=$(fw_printenv -n fdt_name || true)
fit_name_old=$(fw_printenv -n fit_name || true)
sonic_version_2=$(fw_printenv -n sonic_version_1 || true)
linuxargs_old=$(fw_printenv -n linuxargs || true)
fw_setenv ${FW_ARG} image_dir_old "$image_dir_old" > /dev/null
fw_setenv ${FW_ARG} image_name_old "$image_name_old" > /dev/null
fw_setenv ${FW_ARG} initrd_name_old "$initrd_name_old" > /dev/null
fw_setenv ${FW_ARG} fdt_name_old "$fdt_name_old" > /dev/null
fw_setenv ${FW_ARG} fit_name_old "$fit_name_old" > /dev/null
fw_setenv ${FW_ARG} sonic_version_2 "$sonic_version_2" > /dev/null
fw_setenv ${FW_ARG} linuxargs_old "$linuxargs_old" > /dev/null
fi
fi

# Set boot variables
Expand All @@ -202,22 +215,15 @@ prepare_boot_menu() {
fw_setenv ${FW_ARG} fdt_name $fdt_name > /dev/null
fw_setenv ${FW_ARG} fit_name $fit_name > /dev/null
fw_setenv ${FW_ARG} sonic_version_1 $demo_volume_revision_label > /dev/null
fw_setenv ${FW_ARG} image_dir_old $image_dir_old > /dev/null
fw_setenv ${FW_ARG} image_name_old $image_name_old > /dev/null
fw_setenv ${FW_ARG} initrd_name_old $initrd_name_old > /dev/null
fw_setenv ${FW_ARG} fdt_name_old $fdt_name_old > /dev/null
fw_setenv ${FW_ARG} fit_name_old $fit_name_old > /dev/null
fw_setenv ${FW_ARG} sonic_version_2 $sonic_version_2 > /dev/null
BOOT1='echo " > Boot1: $sonic_version_1 - run sonic_image_1";echo;'
BOOT2='echo " > Boot2: $sonic_version_2 - run sonic_image_2";echo;'
BOOT3='echo " > Boot3: ONIE - run onie_boot";echo;'
BORDER='echo "---------------------------------------------------";echo;'
fw_setenv ${FW_ARG} print_menu $BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER > /dev/null
fw_setenv ${FW_ARG} print_menu "$BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER" > /dev/null

fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${ONIE_PLATFORM_EXTRA_CMDLINE_LINUX}" > /dev/null
fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${ONIE_PLATFORM_EXTRA_CMDLINE_LINUX}" > /dev/null
sonic_bootargs_old='setenv bootargs root='$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs_old}'
fw_setenv ${FW_ARG} sonic_bootargs_old $sonic_bootargs_old > /dev/null || true
sonic_bootargs_old='setenv bootargs root='$demo_dev' rw rootwait panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs_old}'
fw_setenv ${FW_ARG} sonic_bootargs_old "$sonic_bootargs_old" > /dev/null || true
sonic_boot_load_old=$(fw_printenv -n sonic_boot_load || true)
old_str="_old"
fw_setenv ${FW_ARG} sonic_boot_load_old "$sonic_boot_load_old$old_str" > /dev/null || true
Expand All @@ -231,14 +237,14 @@ prepare_boot_menu() {
fw_setenv ${FW_ARG} sonic_boot_load "$MMC_LOAD" > /dev/null
SONIC_BOOT_CMD='run sonic_bootargs; run sonic_boot_load; bootm $fit_addr${fit_conf_name}'
SONIC_BOOT_CMD_OLD='run sonic_bootargs_old; run sonic_boot_load_old; bootm $fit_addr${fit_conf_name}'
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs}'
fw_setenv ${FW_ARG} sonic_bootargs $BOOTARGS > /dev/null
fw_setenv ${FW_ARG} sonic_bootcmd $SONIC_BOOT_CMD > /dev/null
fw_setenv ${FW_ARG} sonic_image_2 $SONIC_BOOT_CMD_OLD > /dev/null
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs}'
fw_setenv ${FW_ARG} sonic_bootargs "$BOOTARGS" > /dev/null
fw_setenv ${FW_ARG} sonic_image_2 "$SONIC_BOOT_CMD_OLD" > /dev/null
fw_setenv ${FW_ARG} sonic_image_1 "$SONIC_BOOT_CMD" > /dev/null
fw_setenv ${FW_ARG} boot_next 'run sonic_image_1'> /dev/null
fw_setenv ${FW_ARG} bootcmd 'run print_menu; usb start; test -n "$boot_once" && run boot_once; run boot_next' > /dev/null
fw_setenv ${FW_ARG} bootcmd 'run print_menu; usb start; test -n "$boot_once" && setenv do_boot_once "$boot_once" && setenv boot_once "" && saveenv && run do_boot_once; run boot_next' > /dev/null

echo "Installed SONiC base image SONiC-OS successfully"
}

bootloader_menu_config() {
Expand Down

0 comments on commit d3b18c4

Please sign in to comment.