diff --git a/Makefile.work b/Makefile.work index a1ccf8715567..4810afd97da6 100644 --- a/Makefile.work +++ b/Makefile.work @@ -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_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 - SONIC_NATIVE_DOCKERD_FOR_DOCKERFS := rm -fr $(PWD)/dockerfs/; mkdir -p $(PWD)/dockerfs/; sudo dockerd --storage-driver=overlay2 --iptables=false \ - --data-root $(PWD)/dockerfs/var/lib/docker/ --exec-root=$(PWD)/dockerfs/var/run/docker/ \ - -H unix://$(PWD)/dockerfs/var/run/docker.sock -p $(PWD)/dockerfs/var/run/docker.pid & - SONIC_USERFACL_DOCKERD_FOR_DOCKERFS := setfacl -m user:$(USER):rw $(PWD)/dockerfs/var/run/docker.sock - 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);) + # Docker service to load the compiled dockers-*.gz + # docker 19.0 version above has path/length restriction, so replaced it with soft link in /tmp/ + # Also dockerd does mkdir on the provided softlink, so used two level path "d/d" + D_ROOT=/tmp/d/d + 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); \ + 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 diff --git a/build_debian.sh b/build_debian.sh index 57c85e033f58..8bbbd0868e74 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -500,8 +500,8 @@ fi sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc libpython2.7-dev ## 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-mark manual 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 device-tree-compiler ## Update initramfs 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} if [[ $CONFIGURED_ARCH == armhf ]]; then 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 - 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 ## Clean up apt diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index dea58a210f89..65b7f9d537ce 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -56,12 +56,10 @@ RUN apt-get update && \ lua-bitop \ lua-cjson -{% if CONFIGURED_ARCH == "armhf" %} -# ip and ifconfig utility missing in docker for armhf +# ip and ifconfig utility missing in docker for arm arch RUN apt-get -y install \ iproute2 \ net-tools -{% endif %} RUN mkdir -p /etc/supervisor /var/log/supervisor diff --git a/installer/arm64/install.sh b/installer/arm64/install.sh old mode 100644 new mode 100755 index e4a24214da38..280d9f200af9 --- a/installer/arm64/install.sh +++ b/installer/arm64/install.sh @@ -1,9 +1,18 @@ #!/bin/sh -# Copyright (C) 2014,2015 Curt Brune -# Copyright (C) 2015 david_yang +# Copyright (C) Marvell Inc # -# 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 @@ -28,35 +37,124 @@ if [ -r ./onie-image-arm64.conf ]; then . ./onie-image-arm64.conf 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() { - echo "Copying uImage to NOR flash:" - flashcp -v demo-${platform}.itb $mtd_dev -} +if [ -r /etc/machine.conf ]; then + . /etc/machine.conf +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 -install_uimage +image_dir="image-$image_version" + +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 -hw_load_str="$(hw_load)" +# Create target directory or clean it up if exists +if [ -d $demo_mnt/$image_dir ]; then + echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..." + rm -rf $demo_mnt/$image_dir/* +else + mkdir $demo_mnt/$image_dir || { + echo "Error: Unable to create SONiC directory" + exit 1 + } +fi -echo "Updating U-Boot environment variables" -(cat < /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 + + 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 -fw_setenv -f -s /tmp/env.txt -cd / +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 # probably want to skip this step so that the system remains in ONIE diff --git a/onie-image-arm64.conf b/onie-image-arm64.conf index f14e5602c21d..2bbadb3aeac4 100644 --- a/onie-image-arm64.conf +++ b/onie-image-arm64.conf @@ -24,6 +24,9 @@ FILESYSTEM_DOCKERFS=dockerfs.tar.gz ## docker directory on the root filesystem DOCKERFS_DIR=docker +## docker ramfs disk space +DOCKER_RAMFS_SIZE=900M + ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin diff --git a/platform/marvell-arm64/docker-saiserver-mrvl.mk b/platform/marvell-arm64/docker-saiserver-mrvl.mk index 398902961da8..07dac2a4610d 100644 --- a/platform/marvell-arm64/docker-saiserver-mrvl.mk +++ b/platform/marvell-arm64/docker-saiserver-mrvl.mk @@ -3,7 +3,6 @@ DOCKER_SAISERVER_MRVL = docker-saiserver-mrvl.gz $(DOCKER_SAISERVER_MRVL)_PATH = $(PLATFORM_PATH)/docker-saiserver-mrvl $(DOCKER_SAISERVER_MRVL)_DEPENDS += $(SAISERVER) -$(DOCKER_SAISERVER_MRVL)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SAISERVER_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MRVL) diff --git a/platform/marvell-arm64/linux-kernel-arm64.mk b/platform/marvell-arm64/linux-kernel-arm64.mk index ba7638ad108c..2c5438db982d 100644 --- a/platform/marvell-arm64/linux-kernel-arm64.mk +++ b/platform/marvell-arm64/linux-kernel-arm64.mk @@ -1,10 +1,7 @@ # linux kernel package for marvell arm64 -KVERSION = 4.9.168 - - -LINUX_KERNEL = linux-image-4.9.168-arm64.deb -export LINUX_KERNEL - -$(LINUX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/linux -SONIC_MAKE_DEBS += $(LINUX_KERNEL) +# 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) +SONIC_ONLINE_DEBS += $(LINUX_KERNEL_DTB) +SONIC_STRETCH_DEBS += $(LINUX_KERNEL_DTB) diff --git a/platform/marvell-arm64/linux/Makefile b/platform/marvell-arm64/linux/Makefile index 3b43f181dc71..89415f493c0b 100644 --- a/platform/marvell-arm64/linux/Makefile +++ b/platform/marvell-arm64/linux/Makefile @@ -2,9 +2,9 @@ SHELL = /bin/bash .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 - wget -O $(DEST)/$(LINUX_KERNEL) $(LINUX_KERNEL_MRVL_URL) + wget -O $(DEST)/$(LINUX_KERNEL_DTB) $(LINUX_KERNEL_MRVL_URL) diff --git a/platform/marvell-arm64/one-image.mk b/platform/marvell-arm64/one-image.mk index 3a68f54fcdf7..3d916be4e852 100644 --- a/platform/marvell-arm64/one-image.mk +++ b/platform/marvell-arm64/one-image.mk @@ -4,6 +4,7 @@ SONIC_ONE_IMAGE = sonic-marvell-arm64.bin $(SONIC_ONE_IMAGE)_MACHINE = marvell-arm64 $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) +$(SONIC_ONE_IMAGE)_INSTALLS += $(LINUX_KERNEL_DTB) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(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)) diff --git a/platform/marvell-arm64/platform.conf b/platform/marvell-arm64/platform.conf index e69de29bb2d1..15f25a27b6b9 100644 --- a/platform/marvell-arm64/platform.conf +++ b/platform/marvell-arm64/platform.conf @@ -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 +} + diff --git a/platform/marvell-arm64/rules.mk b/platform/marvell-arm64/rules.mk index b61a7a87c3c6..bf4667a46d41 100644 --- a/platform/marvell-arm64/rules.mk +++ b/platform/marvell-arm64/rules.mk @@ -8,15 +8,18 @@ include $(PLATFORM_PATH)/docker-ptf-mrvl.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/linux-kernel-arm64.mk ENABLE_SYSTEM_TELEMETRY = "" -ENABLE_SYNCD_RPC = "" SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM) - #$(DOCKER_SYNCD_MRVL_RPC) + $(DOCKER_FPM) \ + $(DOCKER_PTF_MRVL) \ + $(DOCKER_SYNCD_MRVL_RPC) # 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 $(SYNCD)_RDEPENDS += $(MRVL_SAI) diff --git a/platform/marvell-arm64/sai.mk b/platform/marvell-arm64/sai.mk index ad8ff329ba6c..d5f044c6cb71 100644 --- a/platform/marvell-arm64/sai.mk +++ b/platform/marvell-arm64/sai.mk @@ -1,6 +1,6 @@ # 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 = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb diff --git a/platform/marvell-armhf/rules.mk b/platform/marvell-armhf/rules.mk index fb46b261fa06..05ca4788069e 100644 --- a/platform/marvell-armhf/rules.mk +++ b/platform/marvell-armhf/rules.mk @@ -17,7 +17,10 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ #$(DOCKER_SYNCD_MRVL_RPC) # 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 $(SYNCD)_RDEPENDS += $(MRVL_SAI) diff --git a/platform/marvell/rules.mk b/platform/marvell/rules.mk index d819cfb67dae..c01e1e491803 100644 --- a/platform/marvell/rules.mk +++ b/platform/marvell/rules.mk @@ -11,7 +11,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ # Inject mrvl sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) ifeq ($(ENABLE_SYNCD_RPC),y) -$(LIBSAIREDIS)_DEPENDS += $(LIBSAITHRIFT_DEV_MRVL) +$(LIBSAIREDIS)_DEPENDS += $(LIBSAITHRIFT_DEV) endif # Runtime dependency on mrvl sai is set only for syncd diff --git a/sonic-slave-jessie/Dockerfile.j2 b/sonic-slave-jessie/Dockerfile.j2 index dce30193420c..0e59310fc30c 100644 --- a/sonic-slave-jessie/Dockerfile.j2 +++ b/sonic-slave-jessie/Dockerfile.j2 @@ -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 # For linux build +{% if CONFIGURED_ARCH != "arm64" %} RUN apt-get -y build-dep linux +{%- endif %} # For gobgp and telemetry build RUN export VERSION=1.11.5 \ @@ -356,7 +358,9 @@ RUN add-apt-repository \ RUN apt-get update {%- if CONFIGURED_ARCH == "amd64" %} 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 {%- endif %} RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker