# Copyright (C) Centec Inc # over ride default behaviour echo "Preparing for installation ... " create_partition() { echo y | mkfs.ext4 -L CTC-SYSTEM /dev/mmcblk0p1 } mount_partition() { echo "mount flash partition" demo_mnt=/mnt mount -t ext4 /dev/mmcblk0p1 $demo_mnt } bootloader_menu_config() { if [ "$install_env" = "onie" ]; then fw_setenv -f nos_bootcmd "test -n \$boot_once && setenv do_boot_once \$boot_once && setenv boot_once && saveenv && run do_boot_once; run boot_next" fw_setenv -f sonic_image_1 "ext4load mmc 0:1 \$loadaddr \$sonic_dir_1/boot/sonic_arm64.fit && setenv bootargs quiet console=\$consoledev,\$baudrate root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 loopfstype=squashfs loop=\$sonic_dir_1/fs.squashfs systemd.unified_cgroup_hierarchy=0 && bootm \$loadaddr" fw_setenv -f sonic_image_2 "NONE" fw_setenv -f sonic_dir_1 $image_dir fw_setenv -f sonic_dir_2 "NONE" fw_setenv -f sonic_version_1 `echo $image_dir | sed "s/^image-/SONiC-OS-/g"` fw_setenv -f sonic_version_2 "NONE" fw_setenv -f boot_next "run sonic_image_1" else running_sonic_revision=`cat /etc/sonic/sonic_version.yml | grep build_version | awk -F \' '{print $2}'` SONIC_IMAGE_MAX=2 idx=0 for i in $(seq 1 $SONIC_IMAGE_MAX); do if [ "`fw_printenv sonic_version_$i 2>/dev/null | awk -F = '{print $2}'`" != "SONiC-OS-$running_sonic_revision" ]; then idx=$i break fi done fw_setenv nos_bootcmd "test -n \$boot_once && setenv do_boot_once \$boot_once && setenv boot_once && saveenv && run do_boot_once; run boot_next" fw_setenv sonic_image_$idx "ext4load mmc 0:1 \$loadaddr \$sonic_dir_$idx/boot/sonic_arm64.fit && setenv bootargs quiet console=\$consoledev,\$baudrate root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 loopfstype=squashfs loop=\$sonic_dir_$idx/fs.squashfs systemd.unified_cgroup_hierarchy=0 && bootm \$loadaddr" fw_setenv sonic_dir_$idx $image_dir fw_setenv sonic_version_$idx `echo $image_dir | sed "s/^image-/SONiC-OS-/g"` fw_setenv boot_next "run sonic_image_$idx" fi }