Skip to content

Marvell® Switchdev Slim (Single CPU) mode guide

eladnachman edited this page Jun 30, 2022 · 3 revisions

Marvell® Switchdev Slim (Single CPU) Mode Guide

User Guide

Revision 1.0

Document Purpose

Describes how to start up using the Switchdev Slim (Single CPU) mode from the software point of view for the AlleyCat5X SoC/Switching ASIC for the DENT NOS.

Switchdev Slim mode getting started

Getting started

Preparing the Linux build host

DENT requires a Linux based host which can run docker in order to build. DENT is a Debian-based Linux distribution. This document provides instructions on building DENT using Ubuntu or Debian as the build host.

sudo apt-get update -y
sudo apt-get install build-essential git libtool pkg-config intltool-debian flex bison unzip python 

Follow the Docker package installation instructions here: https://docs.docker.com/engine/install/ubuntu/

Getting the files

To get the files, enter the following commands:

mkdir slim && cd slim
git clone https://github.com/Marvell-switching/dentOS
cd dentOS
git checkout slim

Updating the files (needed if taken from "dentproject" repository instead of Marvell-switching)

In case the files were taken from "dentproject" instead lf Marvell-switching github repository, the files needs to be updated as follows:

cd tools

Create the file flat-image-tree.conf in tools/ with the following content (for best results use common Linux Editors such as vi, vim, nano, emacs or gedit ):

<<<<<<<<<<< Start File Content >>>>>>>>>>>>>>>>>>

kernel_powerpc_load=<0x0>  
kernel_powerpc_entry=<0x0>  
kernel_arm32_load=<0x61008000>  
kernel_arm32_entry=<0x61008000>  
kernel_arm64_load=<0x2>,<0x02000000>  
kernel_arm64_entry=<0x2>,<0x02000000>  
initrd_powerpc_load=<0x1000000>  
initrd_powerpc_entry=<0x1000000>  
initrd_arm32_load=<0x0000000>  
initrd_arm32_entry=<0x0000000>  
initrd_arm64_load=<0x0000000>  
initrd_arm64_entry=<0x0000000>  
dtb_arm64_load=<0x2>,<0x01000000>  
dtb_arm64_entry=<0x2>,<0x01000000>  

<<<<<<<<<<< End File Content >>>>>>>>>>>>>>>>>>

The string "sw-agentd" needs to be added to the file builds/any/rootfs/stretch/common/arm64-base-packages.yml

The next step is to clone the SW agent-d from github and copy it to the destination folder:

cd ../..
git clone https://github.com/Marvell-switching/dent-artifacts
cd dent-artifacts
git checkout slim

cd ../dentOS/sm/dent-artifacts
cp -r ../../../dent-artifacts/* .

cd ../..

Defining a new platform (board)

Defining a new board requires modification of several files, in a sub-folder of the platforms sub-folder:

An example for Marvell AlleyCat5X DB is available here:

https://github.com/Marvell-switching/dentOS/tree/slim/packages/platforms/marvell/arm64/ac5x-db

All mentioned files are sub-folders of slim/dentOS.

We recommend taking the above example, copying it under a new folder name, and modifying it according to the following instructions.

The following modifications need to be done on the new folder copied from the above reference platform (ac5x-db) :

Selecting platform name:

The DENT platform name must be identical to the ONIE platform name. Also the platform name referred from init.py must match it. The platform naming convention is also important and follows the format: arch-vendor-board-revision,
for example:
arm64-marvell-ac5x-db-r0

Names must match the ONIE platform name, and be uniform across all folders naming and file content. Care must be taken not to mix underscores (_) and dashes (-) .

File content refers to the content of the following files:

modules/PKG.yml
modules/builds/Makefile
platform-config/r0/PKG.yml
platform-config/r0/src/python/$PLATFORM/__init__.py (PLATFORM)
platform-config/r0/src/lib/$PLATFORM.yml
onlp/PKG.yml
onlp/builds/onlpdump/Makefile
onlp/builds/lib/Makefile

Adding platform name to the setup file

Append the platform name to ONLPM_OPTION_PLATFORM_ALLOWLIST="\ in the file setup.env

Adding the platform patch filenames

Append the name of the patch filenames required for the platform based drivers (e.g. CPLD, SFPs, PSU, thermal, etc.) to packages/base/any/kernels/5.10-lts/patches/series.arm64

The following fields in the file platform-config/r0/src/python/$PLATFORM/__init__.py (PLATFORM) should be assigned new, appropriate values:

Customization of the platform configuration file

Customize dentOS/packages/platforms/$VENDOR/$ARCH/$BOARD/platform-config/$REVISION/src/lib/$platform.yml :

The boldface parts need to be customized – platform name and device tree binary name… If the u-boot SPI environment location was changed, also need to modify the environment section below

platform name:  
  flat_image_tree:  
    kernel:  
      <<: *arm64-kernel-5-10  
    dtb:  
      =: platform-dtb-name.dtb  
      <<: *arm64-kernel-5-10-package  
    itb:  
      <<: *arm64-itb  
 
  loader:
    device: /dev/mmcblk0
    ##partition: /dev/mmcblk0p1
    loadaddr: 0x220000000
    nos_bootcmds: *mmc_bootcmds
 
    setenv:
    - bootargs: >-
        $console
        onl_platform=$onl_platform
        arm-smmu.disable_bypass=n
        maxcpus=4
        pci=pcie_bus_safe
        cpuidle.off=1
 
    environment:
    - device: /dev/mtd1
      env_offset: 0x00000000
      env_size: 0x00010000
      sector_size: 0x00010000
 
  network:
    interfaces:
      eth2:
        name: eth2
 
    installer:
  - ONL-BOOT:
      =: 128MiB
      format: ext2
      ##format: raw
  - ONL-CONFIG:
      =: 128MiB
      format: ext4
  - ONL-IMAGES:
      =: 1GiB
      format: ext4
  - ONL-DATA:
      =: 2GiB
      format: ext4

Add the dtb name to the end of packages/base/any/kernels/5.10-lts/configs/arm64-all/Makefile

Building DENT

Once all files are updated, DENT can be built from source:

sudo docker/tools/onlbuilder -9  
source setup.env  
apt-cacher-ng  
make rebuild  
make arm64  

Output ONIE installer is created in the following directory: RELEASE/stretch/arm64/DENTOS-…ARM64_INSTALLED_INSTALLER From the ONIE, scp the file and install it using the following command:

onie-nos-install DENTOS-…ARM64_INSTALLED_INSTALLER

Rebuilding DENT

Normally, rebuilding DENT from scratch requires full folder erase, clone and file download. In order to quickly force DENT platform and kernel rebuild without the above long process,

Run the following commands before executing the “Building DENT” procedure above:

rm make/modules/modules.*  
rm packages/.PKGs.cache.stretch  
rm builds/.PKGs.cache.stretch  
rm builds/arm64/rootfs/builds/stretch/rootfs-arm64.d/var/cache/apt/pkgcache.bin  
rm builds/arm64/rootfs/builds/stretch/rootfs-arm64.d/var/cache/apt/srcpkgcache.bin  
rm REPO/stretch/packages/binary-arm64/Packages  
rm -rf builds/arm64/rootfs/builds/stretch/  

sudo find REPO/stretch/packages/ packages/ -name *.deb -exec rm {} \;  
sudo rm -rf REPO/stretch/extracts/ RELEASE/ builds/arm64/rootfs/builds/stretch/ packages/base/arm64/kernels/kernel-5.10-lts-arm64-all/builds/stretch  

Clone this wiki locally