Build SONIC image

Build SONIC image for arm platform

prepare the environment:

sudo apt install make
sudo apt install -y python3-pip
pip3 install --user j2cli

clone and build the sonic-buildimage:

git clone git@gitlab.larch:openlan/sonic-buildimage.git
cd sonic-buildimage
make init
make configure PLATFORM=marvell PLATFORM_ARCH=arm64
make target/sonic-marvell-arm64.bin

for SONiC < 202411 use

make configure PLATFORM=marvell-arm64 PLATFORM_ARCH=arm64

Use additional make options: SONIC_BUILD_JOBS=N - Allow N jobs at once to speed up the build process. This is limited by how many physical CPUs and RAM your system has. INCLUDE_OLS_UCENTRAL_CLIENT=n - Exclude ucentral-related features from the sonic image. Included by default.

make SONIC_BUILD_JOBS=40 INCLUDE_OLS_UCENTRAL_CLIENT=n target/sonic-marvell-arm64.bin

Build SONIC Virtual Machine image with marvell simulation

cd sonic-buildimage
make init
make configure PLATFORM=marvell-amd64 PLATFORM_ARCH=amd64
make SONIC_BUILD_JOBS=4 target/sonic-vs.img.gz

Start vm:

gzip -d target/sonic-vs.img.gz
cd platform/marvell-amd64/utils

Set variables MGMT_BR_IP and MGMT_VM_IP in run_qemu.sh and start vm:

./run_qemu.sh ../../../target/sonic-vs.img

Connect to vm:

ssh MGMT_VM_IP

Start qemu with internet:

sudo qemu-system-x86_64 -machine q35 -m 2048 -smp 4 -hda sonic-vs.img -nographic -netdev user,id=sonic0,hostfwd=tcp::5555-:22 -device e1000,netdev=sonic0 -cpu host -accel kvm