[marvell-arm64] Update platform.conf (#15163)

Update platform.conf to have a successful marvell-arm64 target image.
This commit is contained in:
Pavan-Nokia 2023-06-01 11:49:01 -04:00 committed by GitHub
parent 076e03b1ab
commit 70d637d904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,30 +4,131 @@
echo "Preparing for installation ... "
IS_MASS=0
# global defines
kernel_addr=0x1100000
fdt_addr=0x1000000
fit_addr=0x1000000
initrd_addr=0x2000000
VAR_LOG=512
DISK_SIZE=9
UBOOT_FW_DEFAULT=1
kernel_fname="/boot/vmlinuz-4.9.0-9-2-arm64"
initrd_fname="/boot/initrd.img-4.9.0-9-2-arm64"
fdt_fname="/boot/armada-7020-comexpress.dtb"
kernel_addr=0x1100000
kernel_version=5.10.0-18-2-arm64
kernel_fname="/boot/vmlinuz-$kernel_version"
initrd_fname="/boot/initrd.img-$kernel_version"
fit_fname="/boot/sonic_arm64.fit"
demo_volume_label=SONiC-OS
# global mount defines
#demo_dev=/dev/sda1
demo_mnt=/tmp
#mtd_dev=/dev/$(cat /proc/mtd | grep "ENV" | grep -o "mtd[0-9]")
FW_ENV_DEFAULT='/dev/mtd1 0x0 0x10000 0x100000'
UBOOT_FW_DEFAULT=1
if [ "$install_env" = "onie" ]; then
MACH_FILE="/etc/machine.conf"
else
MACH_FILE="/host/machine.conf"
fi
PLATFORM=`sed -n 's/^onie_platform=\(.*\)/\1/p' $MACH_FILE`
echo "Intalling SONiC from $install_env on Platform $PLATFORM"
case $PLATFORM in
arm64-nokia_ixs7215_52xb-r0) PLATFORM_AC5X=1 ;;
*) PLATFORM_AC5X=0;;
esac
if [ $PLATFORM_AC5X -eq 1 ]; then
fdt_addr=0x201000000
fit_addr=0x210000000
initrd_addr=0x206000000
fdt_fname="/boot/ac5x.dtb"
FW_ENV_DEFAULT='/dev/mtd0 0x400000 0x10000 0x10000'
demo_part=2
fit_conf_name="#conf_ac5x"
mmc_bus="mmc0:0001"
else
fdt_addr=0x1000000
fit_addr=0x8000000
initrd_addr=0x2000000
fdt_fname="/boot/armada-7020-comexpress.dtb"
FW_ENV_DEFAULT='/dev/mtd1 0x0 0x10000 0x100000'
demo_part=1
mmc_bus="mmc0:aaaa"
fi
# Skip VID Header in UBIFS
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
#Get block device
#Default block device is eMMC, if not look for usb storage
get_install_device()
{
for i in 0 1 2 ; do
if $(ls -l /sys/block/mmcblk$i/device 2>/dev/null | grep -q "$mmc_bus") ; then
echo "/dev/mmcblk$i"
blk_dev=/dev/mmcblk$i
echo "Selected mmc $blk_dev"
return 0
fi
done
echo "ERROR storage not found"
return 1
}
get_install_device
if [ $? -ne 0 ]; then
echo "Error: Unable to detect $blk_dev $demo_dev"
exit 1
fi
demo_dev=${blk_dev}p${demo_part}
remove_dev_partitions() {
echo "Remove all existing partitions starting partnum: ${demo_part} from ${blk_dev}"
local dev_to_install=${blk_dev}p
for p in $(seq ${demo_part} 9) ; do
if [[ -e ${dev_to_install}${p} ]]; then
echo "Removing partition ${dev_to_install}${p}"
sgdisk -d ${p} ${blk_dev} || true
fi
done
partprobe ${blk_dev}
}
create_demo_partition() {
# SD CARD
remove_dev_partitions
# Create sonic partition
sgdisk --new ${demo_part}:: \
--change-name=${demo_part}:${demo_volume_label} \
--typecode=${demo_part}:8300 -p ${blk_dev}
partprobe
}
create_partition() {
get_install_device
if [ $? -ne 0 ]; then
echo "Error: Unable to detect $blk_dev $demo_dev"
exit 1
fi
# Platform specific partition
create_demo_partition
}
mount_partition() {
# Make filesystem
echo "demo label: $demo_volume_label. $demo_dev..."
mkfs.ext4 -L $demo_volume_label $demo_dev
mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || {
echo "Error: Unable to mount $demo_dev on $demo_mnt"
exit 1
}
}
prepare_boot_menu() {
echo "Sync up cache ..."
sync
@ -72,21 +173,6 @@ prepare_boot_menu() {
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)
if [ -z "$demo_dev" ]
then
get_install_device
if [ $? -ne 0 ]; then
echo "Error: Unable to detect $blk_dev $demo_dev"
exit 1
fi
if [ ${IS_MASS} -eq 1 ]
then
demo_dev=${blk_dev}1
else
#demo_dev=$(echo $blk_dev | sed -e 's/\(mmcblk[0-9]\)/\1p/')$demo_part
demo_dev=/dev/mmcblk0p1
fi
fi
fi
# Set boot variables
@ -104,37 +190,27 @@ prepare_boot_menu() {
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-nand-boot";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} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${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" > /dev/null
sonic_bootargs_old='setenv bootargs root='$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${extra_cmdline_linux} loglevel=4" > /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 loglevel=4" > /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_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
fw_setenv ${FW_ARG} sonic_boot_load_old "$sonic_boot_load_old$old_str" > /dev/null || true
fw_setenv ${FW_ARG} kernel_addr $kernel_addr > /dev/null
fw_setenv ${FW_ARG} fdt_addr $fdt_addr > /dev/null
fw_setenv ${FW_ARG} fit_addr $fit_addr > /dev/null
fw_setenv ${FW_ARG} initrd_addr $initrd_addr > /dev/null
# Set boot configs
if [ ${IS_MASS} -eq 1 ]
then
#USB_LOAD='ext4load usb 0 $kernel_addr $image_name; ext4load usb 0 $fdt_addr $fdt_name; ext4load usb 0 $initrd_addr $initrd_name'
USB_LOAD='ext4load usb 0 $fit_addr $fit_name'
fw_setenv ${FW_ARG} sonic_boot_load $USB_LOAD > /dev/null
else
#MMC_LOAD='ext4load mmc 0:'$demo_part' $kernel_addr $image_name; ext4load mmc 0:'$demo_part' $fdt_addr $fdt_name; ext4load mmc 0:'$demo_part' $initrd_addr $initrd_name'
MMC_LOAD='ext4load mmc 0:'$demo_part' $fit_addr $fit_name'
fw_setenv ${FW_ARG} sonic_boot_load $MMC_LOAD > /dev/null
fi
#SONIC_BOOT_CMD='run sonic_bootargs; run sonic_boot_load; booti $kernel_addr $initrd_addr $fdt_addr'
SONIC_BOOT_CMD='run sonic_bootargs; run sonic_boot_load; bootm $fit_addr'
SONIC_BOOT_CMD_OLD='run sonic_bootargs_old; run sonic_boot_load_old; bootm $fit_addr'
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
MMC_LOAD='ext4load mmc 0:'$demo_part' $fit_addr $fit_name'
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
@ -144,81 +220,6 @@ prepare_boot_menu() {
}
#Get block device
#Default block device is eMMC, if not look for usb storage
get_install_device()
{
mass_bus="target0:0:0"
for i in a b c ; do
if $(ls -l /sys/block/sd$i/device 2>/dev/null | grep -q "$mass_bus") ; then
echo "/dev/sd$i"
blk_dev=/dev/sd$i
IS_MASS=1
echo "Selected Mass storage $blk_dev"
return 0
fi
done
mmc_bus="mmc0:aaaa"
for i in 0 1 2 ; do
if $(ls -l /sys/block/mmcblk$i/device 2>/dev/null | grep -q "$mmc_bus") ; then
echo "/dev/mmcblk$i"
blk_dev=/dev/mmcblk$i
echo "Selected mmc $blk_dev"
return 0
fi
done
echo "ERROR storage not found"
return 1
}
create_demo_partition() {
if [ ${IS_MASS} -eq 1 ]
then
# USB drive
parted -s $blk_dev rm 1 || true
partprobe || true
parted -s --align optimal $blk_dev unit gb mkpart primary 1 $DISK_SIZE || true
partprobe || true
else
# SD CARD
parted -s /dev/mmcblk0 rm 1
partprobe
parted -s --align optimal /dev/mmcblk0 unit gb mkpart primary 1 $DISK_SIZE
partprobe
fi
}
create_partition() {
get_install_device
if [ $? -ne 0 ]; then
echo "Error: Unable to detect $blk_dev $demo_dev"
exit 1
fi
# Platform specific partition
create_demo_partition
}
mount_partition() {
if [ ${IS_MASS} -eq 1 ]
then
demo_dev=${blk_dev}1
else
#demo_dev=$(echo $blk_dev | sed -e 's/\(mmcblk[0-9]\)/\1p/')$demo_part
demo_dev=/dev/mmcblk0p1
fi
# Make filesystem
echo "demo label: $demo_volume_label. $demo_dev..."
mkfs.ext4 -L $demo_volume_label $demo_dev
mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || {
echo "Error: Unable to mount $demo_dev on $demo_mnt"
exit 1
}
}
bootloader_menu_config() {
# Update uboot Environment
prepare_boot_menu