-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Sonic installer script for armhf #3303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lguohan
merged 11 commits into
sonic-net:master
from
antony-rheneus:sonic_arm_installer
Sep 11, 2019
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
615363c
[Platform] Updated onie installer script to fetchc platform specific
antony-rheneus c77f11c
Platform fixes
antony-rheneus d2bb254
Platform conf script fixes
antony-rheneus 8238603
platform script typo error fixes
antony-rheneus 2f1f976
Platform script fixes
antony-rheneus 82bd735
[README] updated readme
antony-rheneus b9e0d46
[Platform] ARM platform specific configuration for mac
antony-rheneus ab9cbe8
[installer] uboot env settings removed from generic install.sh as it
antony-rheneus f8148b0
Added et6448m threshold limits
antony-rheneus 1b3963a
[Platform] Added IPv6 arp limits
antony-rheneus dfbf791
[Readme] Updated readme for docker version in ARM
antony-rheneus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (C) 2014,2015 Curt Brune <[email protected]> | ||
# Copyright (C) 2015 david_yang <[email protected]> | ||
# Copyright (C) Marvell Inc | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
set -e | ||
|
||
|
@@ -42,88 +40,13 @@ hw_load() { | |
|
||
. ./platform.conf | ||
|
||
#install_uimage | ||
|
||
#hw_load_str="$(hw_load)" | ||
|
||
echo "Copying uImage to NAND flash:" | ||
# 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 | ||
onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') | ||
|
||
echo "Format mtd partition '$mtd_dev'" | ||
ubiformat $mtd_dev | ||
#attaches MTD devices (which describe raw flash) to UBI and creates corresponding UBI devices; ('-m 2' --> mtd2) | ||
echo "ubiattach mtd '$mtd_num'" | ||
ubiattach /dev/ubi_ctrl -m $mtd_num | ||
#creates UBI volumes on UBI devices | ||
ubimkvol /dev/$demo_dev -N $demo_dev -s 3700MiB | ||
|
||
demo_mount=$(mktemp -d) | ||
mkdir -p $demo_mount | ||
echo "Mounting ubifs partition" | ||
mount -t ubifs /dev/ubi0_0 $demo_mount | ||
echo "Mounting $demo_dev on $demo_mount..." | ||
echo "sonic extract image starts ..." | ||
# 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 | ||
rm fs.cpio | ||
elif [ -f fs.squashfs ] | ||
then | ||
unsquashfs -f -d $demo_mount fs.squashfs | ||
rm -f fs.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 | ||
install_uimage | ||
|
||
echo "unmounting nand partition" | ||
umount $demo_mount | ||
hw_load_str="$(hw_load)" | ||
|
||
echo "Updating U-Boot environment variables" | ||
#global uboot enviroment settings | ||
FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 8' | ||
|
||
kernel_addr=0x1100000 | ||
fdt_addr=0x1000000 | ||
|
||
image_name="/boot/zImage" | ||
fdt_name="/boot/armada-385-ET6448M_4G_Nand.dtb" | ||
|
||
#BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs debug panic=1 ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off console=ttyS0,115200 ${othbootargs} ${mtdparts}' | ||
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' | ||
|
||
|
||
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,208m@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 | ||
|
||
fw_setenv -f -s /tmp/env.txt | ||
|
||
cd / | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# 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() { | ||
|
||
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 | ||
} | ||
|
||
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'" | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.