[Platform] ARM64 support for Marvell ARM platform (#4043)
[Makefile] Fix for multi docker issue on 19 version above Signed-off-by: Antony Rheneus <arheneus@marvell.com>
This commit is contained in:
parent
70e8c5e29e
commit
fd6df31b5b
@ -130,12 +130,16 @@ ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64))
|
|||||||
DOCKER_SERVICE_SAFE_KILLER := (MARCH_PID=`ps -eo pid,cmd | grep "[0-9] dockerd.*march" | awk '{print $$1}'`; echo "Killing march docker $$MARCH_PID"; [ -z "$$MARCH_PID" ] || sudo kill -9 "$$MARCH_PID";)
|
DOCKER_SERVICE_SAFE_KILLER := (MARCH_PID=`ps -eo pid,cmd | grep "[0-9] dockerd.*march" | awk '{print $$1}'`; echo "Killing march docker $$MARCH_PID"; [ -z "$$MARCH_PID" ] || sudo kill -9 "$$MARCH_PID";)
|
||||||
DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
|
DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
|
||||||
|
|
||||||
# Docker service to load the compiled dockers-*.gz
|
# Docker service to load the compiled dockers-*.gz
|
||||||
SONIC_NATIVE_DOCKERD_FOR_DOCKERFS := rm -fr $(PWD)/dockerfs/; mkdir -p $(PWD)/dockerfs/; sudo dockerd --storage-driver=overlay2 --iptables=false \
|
# docker 19.0 version above has path/length restriction, so replaced it with soft link in /tmp/
|
||||||
--data-root $(PWD)/dockerfs/var/lib/docker/ --exec-root=$(PWD)/dockerfs/var/run/docker/ \
|
# Also dockerd does mkdir on the provided softlink, so used two level path "d/d"
|
||||||
-H unix://$(PWD)/dockerfs/var/run/docker.sock -p $(PWD)/dockerfs/var/run/docker.pid &
|
D_ROOT=/tmp/d/d
|
||||||
SONIC_USERFACL_DOCKERD_FOR_DOCKERFS := setfacl -m user:$(USER):rw $(PWD)/dockerfs/var/run/docker.sock
|
SONIC_NATIVE_DOCKERD_FOR_DOCKERFS := rm -fr $(PWD)/dockerfs; mkdir -p $(PWD)/dockerfs; sudo rm -fr /tmp/d; mkdir -p /tmp/d; ln -s -f $(PWD)/dockerfs $(D_ROOT); \
|
||||||
DOCKER_SERVICE_DOCKERFS_CHECK := (sudo docker -H unix://$(PWD)/dockerfs/var/run/docker.sock info &> /dev/null && sudo kill -9 `sudo cat $(PWD)/dockerfs/var/run/docker.pid` && false) || (echo "Starting docker build service..."; (sudo $(SONIC_NATIVE_DOCKERD_FOR_DOCKERFS) ) &>/dev/null ; sleep 1; sudo $(SONIC_USERFACL_DOCKERD_FOR_DOCKERFS);)
|
sudo dockerd --storage-driver=overlay2 --iptables=false \
|
||||||
|
--data-root $(D_ROOT)/var/lib/docker/ --exec-root=$(D_ROOT)/var/run/docker/ \
|
||||||
|
-H unix://$(D_ROOT)/var/run/docker.sock -p $(D_ROOT)/var/run/docker.pid &
|
||||||
|
SONIC_USERFACL_DOCKERD_FOR_DOCKERFS := setfacl -m user:$(USER):rw $(D_ROOT)/var/run/docker.sock
|
||||||
|
DOCKER_SERVICE_DOCKERFS_CHECK := (sudo docker -H unix://$(D_ROOT)/var/run/docker.sock info &> /dev/null && sudo kill -9 `sudo cat $(D_ROOT)/var/run/docker.pid` && false) || (echo "Starting docker build service..."; (sudo $(SONIC_NATIVE_DOCKERD_FOR_DOCKERFS) ) &> /tmp/dockerfs.log ; sleep 1; sudo $(SONIC_USERFACL_DOCKERD_FOR_DOCKERFS);)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -500,8 +500,8 @@ fi
|
|||||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc libpython2.7-dev
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc libpython2.7-dev
|
||||||
|
|
||||||
## Add mtd and uboot firmware tools package
|
## Add mtd and uboot firmware tools package
|
||||||
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install u-boot-tools mtd-utils
|
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install u-boot-tools mtd-utils device-tree-compiler
|
||||||
sudo LANG=C chroot $FILESYSTEM_ROOT apt-mark manual u-boot-tools mtd-utils
|
sudo LANG=C chroot $FILESYSTEM_ROOT apt-mark manual u-boot-tools mtd-utils device-tree-compiler
|
||||||
|
|
||||||
## Update initramfs
|
## Update initramfs
|
||||||
sudo chroot $FILESYSTEM_ROOT update-initramfs -u
|
sudo chroot $FILESYSTEM_ROOT update-initramfs -u
|
||||||
@ -510,10 +510,13 @@ if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
|
|||||||
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH}
|
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH}
|
||||||
if [[ $CONFIGURED_ARCH == armhf ]]; then
|
if [[ $CONFIGURED_ARCH == armhf ]]; then
|
||||||
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-armmp
|
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-armmp
|
||||||
|
sudo LANG=C chroot $FILESYSTEM_ROOT mkimage -A arm -O linux -T ramdisk -C gzip -d /boot/$INITRD_FILE /boot/u${INITRD_FILE}
|
||||||
|
## Overwriting the initrd image with uInitrd
|
||||||
|
sudo LANG=C chroot $FILESYSTEM_ROOT mv /boot/u${INITRD_FILE} /boot/$INITRD_FILE
|
||||||
|
elif [[ $CONFIGURED_ARCH == arm64 ]]; then
|
||||||
|
sudo cp -v $PLATFORM_DIR/${sonic_asic_platform}-${CONFIGURED_ARCH}/sonic_fit.its $FILESYSTEM_ROOT/boot/
|
||||||
|
sudo LANG=C chroot $FILESYSTEM_ROOT mkimage -f /boot/sonic_fit.its /boot/sonic_${CONFIGURED_ARCH}.fit
|
||||||
fi
|
fi
|
||||||
sudo LANG=C chroot $FILESYSTEM_ROOT mkimage -A arm -O linux -T ramdisk -C gzip -d /boot/$INITRD_FILE /boot/u${INITRD_FILE}
|
|
||||||
## Overwriting the initrd image with uInitrd
|
|
||||||
sudo LANG=C chroot $FILESYSTEM_ROOT mv /boot/u${INITRD_FILE} /boot/$INITRD_FILE
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Clean up apt
|
## Clean up apt
|
||||||
|
@ -56,12 +56,10 @@ RUN apt-get update && \
|
|||||||
lua-bitop \
|
lua-bitop \
|
||||||
lua-cjson
|
lua-cjson
|
||||||
|
|
||||||
{% if CONFIGURED_ARCH == "armhf" %}
|
# ip and ifconfig utility missing in docker for arm arch
|
||||||
# ip and ifconfig utility missing in docker for armhf
|
|
||||||
RUN apt-get -y install \
|
RUN apt-get -y install \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
net-tools
|
net-tools
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
RUN mkdir -p /etc/supervisor /var/log/supervisor
|
RUN mkdir -p /etc/supervisor /var/log/supervisor
|
||||||
|
|
||||||
|
142
installer/arm64/install.sh
Normal file → Executable file
142
installer/arm64/install.sh
Normal file → Executable file
@ -1,9 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2014,2015 Curt Brune <curt@cumulusnetworks.com>
|
# Copyright (C) Marvell Inc
|
||||||
# Copyright (C) 2015 david_yang <david_yang@accton.com>
|
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
_trap_push() {
|
||||||
|
local next="$1"
|
||||||
|
eval "trap_push() {
|
||||||
|
local oldcmd='$(echo "$next" | sed -e s/\'/\'\\\\\'\'/g)'
|
||||||
|
local newcmd=\"\$1; \$oldcmd\"
|
||||||
|
trap -- \"\$newcmd\" EXIT INT TERM HUP
|
||||||
|
_trap_push \"\$newcmd\"
|
||||||
|
}"
|
||||||
|
}
|
||||||
|
_trap_push true
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -28,35 +37,124 @@ if [ -r ./onie-image-arm64.conf ]; then
|
|||||||
. ./onie-image-arm64.conf
|
. ./onie-image-arm64.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "ONIE Installer: platform: $platform"
|
||||||
|
|
||||||
echo "Installer: platform: $platform"
|
# Make sure run as root or under 'sudo'
|
||||||
|
if [ $(id -u) -ne 0 ]
|
||||||
|
then echo "Please run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
install_uimage() {
|
if [ -r /etc/machine.conf ]; then
|
||||||
echo "Copying uImage to NOR flash:"
|
. /etc/machine.conf
|
||||||
flashcp -v demo-${platform}.itb $mtd_dev
|
elif [ -r /host/machine.conf ]; then
|
||||||
}
|
. /host/machine.conf
|
||||||
|
elif [ "$install_env" != "build" ]; then
|
||||||
|
echo "cannot find machine.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "onie_platform: $onie_platform"
|
||||||
|
|
||||||
|
# Get platform specific linux kernel command line arguments
|
||||||
|
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX=""
|
||||||
|
|
||||||
|
# Default var/log device size in MB
|
||||||
|
VAR_LOG_SIZE=4096
|
||||||
|
|
||||||
|
[ -r platforms/$onie_platform ] && . platforms/$onie_platform
|
||||||
|
|
||||||
|
|
||||||
|
# If running in ONIE
|
||||||
|
if [ "$install_env" = "onie" ]; then
|
||||||
|
# The onie bin tool prefix
|
||||||
|
onie_bin=
|
||||||
|
# The persistent ONIE directory location
|
||||||
|
onie_root_dir=/mnt/onie-boot/onie
|
||||||
|
# The onie file system root
|
||||||
|
onie_initrd_tmp=/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The build system prepares this script by replacing %%DEMO-TYPE%%
|
||||||
|
# with "OS" or "DIAG".
|
||||||
|
demo_type="%%DEMO_TYPE%%"
|
||||||
|
|
||||||
|
# The build system prepares this script by replacing %%IMAGE_VERSION%%
|
||||||
|
# with git revision hash as a version identifier
|
||||||
|
image_version="%%IMAGE_VERSION%%"
|
||||||
|
timestamp="$(date -u +%Y%m%d)"
|
||||||
|
|
||||||
|
demo_volume_label="SONiC-${demo_type}"
|
||||||
|
demo_volume_revision_label="SONiC-${demo_type}-${image_version}"
|
||||||
|
|
||||||
hw_load() {
|
|
||||||
echo "cp.b $img_start \$loadaddr $img_sz"
|
|
||||||
}
|
|
||||||
|
|
||||||
. ./platform.conf
|
. ./platform.conf
|
||||||
|
|
||||||
install_uimage
|
image_dir="image-$image_version"
|
||||||
|
|
||||||
hw_load_str="$(hw_load)"
|
if [ "$install_env" = "onie" ]; then
|
||||||
|
# Create/format the flash
|
||||||
|
create_partition
|
||||||
|
mount_partition
|
||||||
|
elif [ "$install_env" = "sonic" ]; then
|
||||||
|
demo_mnt="/host"
|
||||||
|
eval running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ")
|
||||||
|
# Prevent installing existing SONiC if it is running
|
||||||
|
if [ "$image_dir" = "image-$running_sonic_revision" ]; then
|
||||||
|
echo "Not installing SONiC version $running_sonic_revision, as current running SONiC has the same version"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# Remove extra SONiC images if any
|
||||||
|
for f in $demo_mnt/image-* ; do
|
||||||
|
if [ -d $f ] && [ "$f" != "$demo_mnt/image-$running_sonic_revision" ] && [ "$f" != "$demo_mnt/$image_dir" ]; then
|
||||||
|
echo "Removing old SONiC installation $f"
|
||||||
|
rm -rf $f
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Updating U-Boot environment variables"
|
# Create target directory or clean it up if exists
|
||||||
(cat <<EOF
|
if [ -d $demo_mnt/$image_dir ]; then
|
||||||
hw_load $hw_load_str
|
echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..."
|
||||||
copy_img echo "Loading Demo $platform image..." && run hw_load
|
rm -rf $demo_mnt/$image_dir/*
|
||||||
nos_bootcmd run copy_img && setenv bootargs quiet console=\$consoledev,\$baudrate && bootm \$loadaddr
|
else
|
||||||
EOF
|
mkdir $demo_mnt/$image_dir || {
|
||||||
) > /tmp/env.txt
|
echo "Error: Unable to create SONiC directory"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
fw_setenv -f -s /tmp/env.txt
|
# Decompress the file for the file system directly to the partition
|
||||||
|
if [ x"$docker_inram" = x"on" ]; then
|
||||||
|
# when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd
|
||||||
|
unzip -o $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir
|
||||||
|
else
|
||||||
|
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir
|
||||||
|
|
||||||
cd /
|
if [ "$install_env" = "onie" ]; then
|
||||||
|
TAR_EXTRA_OPTION="--numeric-owner"
|
||||||
|
else
|
||||||
|
TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
|
||||||
|
fi
|
||||||
|
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
|
||||||
|
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$install_env" = "onie" ]; then
|
||||||
|
# Store machine description in target file system
|
||||||
|
if [ -f /etc/machine-build.conf ]; then
|
||||||
|
# onie_ variable are generate at runtime.
|
||||||
|
# they are no longer hardcoded in /etc/machine.conf
|
||||||
|
# also remove single quotes around the value
|
||||||
|
set | grep ^onie | sed -e "s/='/=/" -e "s/'$//" > $demo_mnt/machine.conf
|
||||||
|
else
|
||||||
|
cp /etc/machine.conf $demo_mnt
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update Bootloader Menu with installed image
|
||||||
|
bootloader_menu_config
|
||||||
|
|
||||||
# Set NOS mode if available. For manufacturing diag installers, you
|
# Set NOS mode if available. For manufacturing diag installers, you
|
||||||
# probably want to skip this step so that the system remains in ONIE
|
# probably want to skip this step so that the system remains in ONIE
|
||||||
|
@ -24,6 +24,9 @@ FILESYSTEM_DOCKERFS=dockerfs.tar.gz
|
|||||||
## docker directory on the root filesystem
|
## docker directory on the root filesystem
|
||||||
DOCKERFS_DIR=docker
|
DOCKERFS_DIR=docker
|
||||||
|
|
||||||
|
## docker ramfs disk space
|
||||||
|
DOCKER_RAMFS_SIZE=900M
|
||||||
|
|
||||||
## Output file name for onie installer
|
## Output file name for onie installer
|
||||||
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin
|
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
DOCKER_SAISERVER_MRVL = docker-saiserver-mrvl.gz
|
DOCKER_SAISERVER_MRVL = docker-saiserver-mrvl.gz
|
||||||
$(DOCKER_SAISERVER_MRVL)_PATH = $(PLATFORM_PATH)/docker-saiserver-mrvl
|
$(DOCKER_SAISERVER_MRVL)_PATH = $(PLATFORM_PATH)/docker-saiserver-mrvl
|
||||||
$(DOCKER_SAISERVER_MRVL)_DEPENDS += $(SAISERVER)
|
$(DOCKER_SAISERVER_MRVL)_DEPENDS += $(SAISERVER)
|
||||||
$(DOCKER_SAISERVER_MRVL)_FILES += $(DSSERVE) $(BCMCMD)
|
|
||||||
$(DOCKER_SAISERVER_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
|
$(DOCKER_SAISERVER_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
|
||||||
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MRVL)
|
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MRVL)
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
# linux kernel package for marvell arm64
|
# linux kernel package for marvell arm64
|
||||||
|
|
||||||
KVERSION = 4.9.168
|
# Add platform specific DTB
|
||||||
|
LINUX_KERNEL_DTB = linux-image-4.9.168-arm64.deb
|
||||||
|
$(LINUX_KERNEL_DTB)_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/arm64/kernel/$(LINUX_KERNEL_DTB)
|
||||||
LINUX_KERNEL = linux-image-4.9.168-arm64.deb
|
SONIC_ONLINE_DEBS += $(LINUX_KERNEL_DTB)
|
||||||
export LINUX_KERNEL
|
SONIC_STRETCH_DEBS += $(LINUX_KERNEL_DTB)
|
||||||
|
|
||||||
$(LINUX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/linux
|
|
||||||
SONIC_MAKE_DEBS += $(LINUX_KERNEL)
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
SHELL = /bin/bash
|
SHELL = /bin/bash
|
||||||
.SHELLFLAGS += -e
|
.SHELLFLAGS += -e
|
||||||
|
|
||||||
LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/arm64/kernel/$(LINUX_KERNEL)
|
LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/arm64/kernel/$(LINUX_KERNEL_DTB)
|
||||||
|
|
||||||
$(addprefix $(DEST)/, $(LINUX_KERNEL)): $(DEST)/% :
|
$(addprefix $(DEST)/, $(LINUX_KERNEL_DTB)): $(DEST)/% :
|
||||||
# get deb package
|
# get deb package
|
||||||
wget -O $(DEST)/$(LINUX_KERNEL) $(LINUX_KERNEL_MRVL_URL)
|
wget -O $(DEST)/$(LINUX_KERNEL_DTB) $(LINUX_KERNEL_MRVL_URL)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ SONIC_ONE_IMAGE = sonic-marvell-arm64.bin
|
|||||||
$(SONIC_ONE_IMAGE)_MACHINE = marvell-arm64
|
$(SONIC_ONE_IMAGE)_MACHINE = marvell-arm64
|
||||||
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
||||||
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
||||||
|
$(SONIC_ONE_IMAGE)_INSTALLS += $(LINUX_KERNEL_DTB)
|
||||||
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
||||||
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)
|
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)
|
||||||
$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES))
|
$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES))
|
||||||
|
@ -0,0 +1,226 @@
|
|||||||
|
# Copyright (C) Marvell Inc
|
||||||
|
|
||||||
|
# over ride default behaviour
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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"
|
||||||
|
fit_fname="/boot/sonic_arm64.fit"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Skip VID Header in UBIFS
|
||||||
|
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
|
||||||
|
|
||||||
|
prepare_boot_menu() {
|
||||||
|
echo "Sync up cache ..."
|
||||||
|
sync
|
||||||
|
echo "Setting up U-Boot environment..."
|
||||||
|
|
||||||
|
DTB_HAS_ENV_BLK=$(grep uboot-env /proc/mtd | sed -e 's/:.*$//')
|
||||||
|
if [ -c "/dev/$DTB_HAS_ENV_BLK" ]; then
|
||||||
|
PROC_ENV_FILE=$(find /proc/device-tree/ -name env_size)
|
||||||
|
if [ -n "$PROC_ENV_FILE" ]
|
||||||
|
then
|
||||||
|
UBOOT_ENV_SIZ="0x$(hd $PROC_ENV_FILE | awk 'FNR==1 {print $2 $3 $4 $5}')"
|
||||||
|
UBOOT_ENV_ERASE_SIZ="0x$(grep uboot-env /proc/mtd | awk '{print $3}')"
|
||||||
|
if [[ -n "$UBOOT_ENV_SIZ" && -n "$UBOOT_ENV_ERASE_SIZ" ]]
|
||||||
|
then
|
||||||
|
# Env info from DTB
|
||||||
|
FW_ENV_DTB="/dev/$DTB_HAS_ENV_BLK 0x00000000 $UBOOT_ENV_SIZ $UBOOT_ENV_ERASE_SIZ"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ $UBOOT_FW_DEFAULT -eq 1 ]
|
||||||
|
then
|
||||||
|
echo $FW_ENV_DEFAULT > /etc/fw_env.config
|
||||||
|
echo "Using pre-configured uboot env"
|
||||||
|
fi
|
||||||
|
image_name=${image_dir}${kernel_fname}
|
||||||
|
initrd_name=${image_dir}${initrd_fname}
|
||||||
|
fdt_name=${image_dir}${fdt_fname}
|
||||||
|
fit_name=${image_dir}${fit_fname}
|
||||||
|
|
||||||
|
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"
|
||||||
|
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)
|
||||||
|
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
|
||||||
|
fw_setenv ${FW_ARG} image_dir $image_dir > /dev/null
|
||||||
|
fw_setenv ${FW_ARG} image_name $image_name > /dev/null
|
||||||
|
fw_setenv ${FW_ARG} initrd_name $initrd_name > /dev/null
|
||||||
|
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-nand-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 varlog_size=$VAR_LOG" > /dev/null
|
||||||
|
fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS 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} 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} 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}'
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
}
|
||||||
|
|
@ -8,15 +8,18 @@ include $(PLATFORM_PATH)/docker-ptf-mrvl.mk
|
|||||||
include $(PLATFORM_PATH)/one-image.mk
|
include $(PLATFORM_PATH)/one-image.mk
|
||||||
include $(PLATFORM_PATH)/linux-kernel-arm64.mk
|
include $(PLATFORM_PATH)/linux-kernel-arm64.mk
|
||||||
ENABLE_SYSTEM_TELEMETRY = ""
|
ENABLE_SYSTEM_TELEMETRY = ""
|
||||||
ENABLE_SYNCD_RPC = ""
|
|
||||||
|
|
||||||
|
|
||||||
SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
||||||
$(DOCKER_FPM)
|
$(DOCKER_FPM) \
|
||||||
#$(DOCKER_SYNCD_MRVL_RPC)
|
$(DOCKER_PTF_MRVL) \
|
||||||
|
$(DOCKER_SYNCD_MRVL_RPC)
|
||||||
|
|
||||||
# Inject mrvl sai into sairedis
|
# Inject mrvl sai into sairedis
|
||||||
$(LIBSAIREDIS)_DEPENDS += $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL)
|
$(LIBSAIREDIS)_DEPENDS += $(MRVL_SAI)
|
||||||
|
ifeq ($(ENABLE_SYNCD_RPC),y)
|
||||||
|
$(LIBSAIREDIS)_DEPENDS += $(LIBSAITHRIFT_DEV)
|
||||||
|
endif
|
||||||
|
|
||||||
# Runtime dependency on mrvl sai is set only for syncd
|
# Runtime dependency on mrvl sai is set only for syncd
|
||||||
$(SYNCD)_RDEPENDS += $(MRVL_SAI)
|
$(SYNCD)_RDEPENDS += $(MRVL_SAI)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Marvell SAI
|
# Marvell SAI
|
||||||
|
|
||||||
export MRVL_SAI_VERSION = 1.4.1
|
export MRVL_SAI_VERSION = 1.5.1
|
||||||
export MRVL_SAI_TAG = SONiC.201904
|
export MRVL_SAI_TAG = SONiC.201904
|
||||||
export MRVL_SAI = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb
|
export MRVL_SAI = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb
|
||||||
|
|
||||||
|
@ -17,7 +17,10 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
|||||||
#$(DOCKER_SYNCD_MRVL_RPC)
|
#$(DOCKER_SYNCD_MRVL_RPC)
|
||||||
|
|
||||||
# Inject mrvl sai into sairedis
|
# Inject mrvl sai into sairedis
|
||||||
$(LIBSAIREDIS)_DEPENDS += $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL)
|
$(LIBSAIREDIS)_DEPENDS += $(MRVL_SAI)
|
||||||
|
ifeq ($(ENABLE_SYNCD_RPC),y)
|
||||||
|
$(LIBSAIREDIS)_DEPENDS += $(LIBSAITHRIFT_DEV)
|
||||||
|
endif
|
||||||
|
|
||||||
# Runtime dependency on mrvl sai is set only for syncd
|
# Runtime dependency on mrvl sai is set only for syncd
|
||||||
$(SYNCD)_RDEPENDS += $(MRVL_SAI)
|
$(SYNCD)_RDEPENDS += $(MRVL_SAI)
|
||||||
|
@ -11,7 +11,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
|||||||
# Inject mrvl sai into sairedis
|
# Inject mrvl sai into sairedis
|
||||||
$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI)
|
$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI)
|
||||||
ifeq ($(ENABLE_SYNCD_RPC),y)
|
ifeq ($(ENABLE_SYNCD_RPC),y)
|
||||||
$(LIBSAIREDIS)_DEPENDS += $(LIBSAITHRIFT_DEV_MRVL)
|
$(LIBSAIREDIS)_DEPENDS += $(LIBSAITHRIFT_DEV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Runtime dependency on mrvl sai is set only for syncd
|
# Runtime dependency on mrvl sai is set only for syncd
|
||||||
|
@ -273,7 +273,9 @@ RUN apt-get update && apt-get install -y \
|
|||||||
# RUN apt-get -y install ca-certificates-java=20161107~bpo8+1 openjdk-8-jdk
|
# RUN apt-get -y install ca-certificates-java=20161107~bpo8+1 openjdk-8-jdk
|
||||||
|
|
||||||
# For linux build
|
# For linux build
|
||||||
|
{% if CONFIGURED_ARCH != "arm64" %}
|
||||||
RUN apt-get -y build-dep linux
|
RUN apt-get -y build-dep linux
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
# For gobgp and telemetry build
|
# For gobgp and telemetry build
|
||||||
RUN export VERSION=1.11.5 \
|
RUN export VERSION=1.11.5 \
|
||||||
@ -356,7 +358,9 @@ RUN add-apt-repository \
|
|||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
{%- if CONFIGURED_ARCH == "amd64" %}
|
{%- if CONFIGURED_ARCH == "amd64" %}
|
||||||
RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-jessie
|
RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-jessie
|
||||||
{%- else %}
|
{%- elif CONFIGURED_ARCH == "arm64" %}
|
||||||
|
RUN apt-get install -y docker-ce=18.03.1~ce-0~debian
|
||||||
|
{%- elif CONFIGURED_ARCH == "armhf" %}
|
||||||
RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian
|
RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker
|
RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker
|
||||||
|
Loading…
Reference in New Issue
Block a user