23a3faf3f9
Signed-off-by: Antony Rheneus <arheneus@marvell.com>
144 lines
5.0 KiB
Plaintext
144 lines
5.0 KiB
Plaintext
# Copyright (C) Marvell Inc
|
|
|
|
# over ride default behaviour
|
|
|
|
echo "Preparing for installation ... "
|
|
|
|
# global defines
|
|
kernel_addr=0x1100000
|
|
fdt_addr=0x1000000
|
|
|
|
image_name="/boot/zImage"
|
|
fdt_name="/boot/armada-385-ET6448M_4G_Nand.dtb"
|
|
|
|
# global mount defines
|
|
demo_dev=ubi0
|
|
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
|
|
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
|
|
demo_mount=/tmp
|
|
FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 8'
|
|
|
|
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts}'
|
|
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name'
|
|
UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; bootz $kernel_addr - $fdt_addr'
|
|
|
|
et6448m_machine_conf() {
|
|
SYSCTL_CFG=$demo_mount/usr/share/sonic/device/armhf-marvell_et6448m_52x-r0/syncd.conf
|
|
|
|
echo "Configure platform et6448m "
|
|
rm $demo_mount/lib/udev/rules.d/73-usb-net-by-mac.rules
|
|
rm -f $demo_mount/usr/bin/reboot || true
|
|
rm -fr $demo_mount/host/machine.conf
|
|
cp /etc/machine.conf $demo_mount/host/
|
|
|
|
SONIC_VERSION=$(cat $demo_mount/etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d"'")
|
|
FIRST_BOOT_FILE="$demo_mount/host/image-$SONIC_VERSION/platform"
|
|
mkdir -p $FIRST_BOOT_FILE
|
|
touch $FIRST_BOOT_FILE/firsttime
|
|
|
|
MAC_ADDR=$(fw_printenv | grep ^ethaddr= | cut -f2 -d"=")
|
|
sed -i "s/switchMacAddress=.*/switchMacAddress=$MAC_ADDR/g" $demo_mount/usr/share/sonic/device/armhf-marvell_et6448m_52x-r0/et6448m/profile.ini
|
|
|
|
# IPv4 and IPv6 arp cache limits
|
|
echo "sysctl -w net.ipv4.neigh.default.gc_thresh1=16000" >> $SYSCTL_CFG
|
|
echo "sysctl -w net.ipv4.neigh.default.gc_thresh2=32000" >> $SYSCTL_CFG
|
|
echo "sysctl -w net.ipv4.neigh.default.gc_thresh3=48000" >> $SYSCTL_CFG
|
|
echo "sysctl -w net.ipv6.neigh.default.gc_thresh1=8000 " >> $SYSCTL_CFG
|
|
echo "sysctl -w net.ipv6.neigh.default.gc_thresh2=16000" >> $SYSCTL_CFG
|
|
echo "sysctl -w net.ipv6.neigh.default.gc_thresh3=32000" >> $SYSCTL_CFG
|
|
}
|
|
|
|
prepare_uboot() {
|
|
echo "Setting up U-Boot environment..."
|
|
|
|
echo -e $FW_ENV > /etc/fw_env.config
|
|
|
|
fw_setenv -f image_name $image_name > /dev/null
|
|
fw_setenv -f fdt_name $fdt_name > /dev/null
|
|
fw_setenv -f kernel_addr $kernel_addr > /dev/null
|
|
fw_setenv -f fdt_addr $fdt_addr > /dev/null
|
|
|
|
#make sure ubi number (0) and ubi volume name (ubi0) are set correctly in bootargs_root:
|
|
#For example, the below command creates an 3000MiB volume on UBI device 0:
|
|
#setenv bootargs_root root=ubi0:ubi0 rw ubi.mtd=2 rootfstype=ubifs
|
|
|
|
fw_setenv -f mtdids 'nand0=armada-nand' > /dev/null
|
|
fw_setenv -f mtdparts 'mtdparts=armada-nand:10m(U-Boot)ro,20m@10m(ONIE),-(SONIC)' > /dev/null
|
|
fw_setenv -f ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null
|
|
|
|
fw_setenv -f ubi_sonic_boot_bootargs $BOOTARGS > /dev/null
|
|
fw_setenv -f ubi_sonic_boot_load $UBI_LOAD > /dev/null
|
|
fw_setenv -f ubi_sonic_boot $UBIBOOTCMD > /dev/null
|
|
fw_setenv -f bootcmd 'usb start; run ubi_sonic_boot' > /dev/null
|
|
|
|
}
|
|
|
|
install_uimage() {
|
|
|
|
ubidetach /dev/ubi_ctrl -m $mtd_num 2>/dev/null || true
|
|
|
|
echo -en "Format mtd partition '$mtd_dev' "
|
|
ubiformat $mtd_dev -y -q || {
|
|
echo "Failed"
|
|
}
|
|
|
|
#attaches MTD devices (which describe raw flash) to UBI and creates corresponding UBI devices; ('-m 2' --> mtd2)
|
|
echo -en "ubiattach mtd '$mtd_num' "
|
|
ubiattach /dev/ubi_ctrl -m $mtd_num || {
|
|
echo "Failed"
|
|
}
|
|
|
|
#creates UBI volumes on UBI devices
|
|
ubimkvol /dev/$demo_dev -N $demo_dev -s 3900MiB
|
|
|
|
demo_mount=$(mktemp -d) || {
|
|
echo "Error: Unable to create file sstem mount point"
|
|
exit 1
|
|
}
|
|
|
|
echo "Mounting $demo_dev on $demo_mount "
|
|
mount -t ubifs /dev/ubi0_0 $demo_mount || {
|
|
echo "Failed"
|
|
}
|
|
|
|
echo "Extracting NOS "
|
|
|
|
# Decompress the file for the file system directly to the partition
|
|
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mount/
|
|
cd $demo_mount
|
|
|
|
if [ -f fs.cpio ]; then
|
|
cpio -id < fs.cpio
|
|
if [ $? -ne 0 ]; then
|
|
echo "cpio extraction Failed"
|
|
fi
|
|
rm fs.cpio
|
|
elif [ -f fs.squashfs ]; then
|
|
unsquashfs -f -d $demo_mount $FILESYSTEM_SQUASHFS
|
|
if [ $? -ne 0 ]; then
|
|
echo "unsquashfs extraction Failed"
|
|
fi
|
|
rm -f $FILESYSTEM_SQUASHFS
|
|
fi
|
|
|
|
cd -
|
|
TAR_EXTRA_OPTION="--numeric-owner"
|
|
mkdir -p $demo_mount/var/lib/$DOCKERFS_DIR
|
|
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar -xpz $TAR_EXTRA_OPTION -f - -C $demo_mount/var/lib/$DOCKERFS_DIR
|
|
|
|
# Update uboot Environment
|
|
prepare_uboot
|
|
|
|
# Platform configuration
|
|
et6448m_machine_conf
|
|
|
|
# Unmounting mount path
|
|
umount $demo_mount
|
|
|
|
echo "Reboot board to boot from installed OS"
|
|
}
|
|
|
|
hw_load() {
|
|
echo "mtdpart default && ubi part SONIC && ubifsmount 'demo_dev' && ubifsload '$kernel_addr' 'image_name'"
|
|
}
|