-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Build Broadcom Opennsl and SAI
Almost all users could build SONiC image by following guide on Building Guide, except those who has access to Broadcom Opennsl and SAI source code and are working on bringing up a new SAI version.
-
Clone SONiC Build Image Repo
-
Make sure you are using a branch with pull request #1155, follow Building Guide to finish one full build of SONiC image. But when issuing make, make sure provide two options:
KEEP_SLAVE_ON=yes SOURCE_FOLDER=<your source folder, e.g. /home/<username>/src>
. (If you quit the build slave docker, you will have to repeat step 2-4 before each build). -
Inside the socket build slave, issue following command:
sudo apt-get -y install linux-kbuild-3.16 linux-compiler-gcc-4.8-x86
- cd to /sonic/target/debs, install following 2 debian packages into the build slave:
sudo dpkg -i linux-headers-*.deb
- Start the SONiC build slave following instruction in step 2-4 of prepare build environment step.
- cd into /var/src
- You can choose to clone/unzip opennsl repo from inside the docker, or from your base image.
- If you cloned a git repo, make sure you check out the right branch to build. SAI and opennsl are tightly coupled, their versions needs to match.
- cd into the root of your opennsl repo, e.g. /var/src/opennsl/, issue
fakeroot debian/rules -B binary
to build opennsl debian packages. If the build failed with privilege error, usesudo fakeroot debian/rules -B binary
to build. Build will take 30-45 minutes. - When build succeeded, the built debian packages are stored at the folder one level above opennsl repo, in our case, /var/src/
- cd to /var/src, issue
sudo dpkg -i libopennsl*
to install the newly built opennsl debian packages to get ready for SAI compile.
-
Start the SONiC build slave following instruction in step 2-4 of prepare build environment step.
-
If you haven't succeeded in "Build opennsl", please do so first.
-
cd /var/src
-
clone/unzip SAI package here. Checkout the branch matches the opennsl if you cloned the SAI repo.
-
cd into SAI repo root, say /var/log/sai/
-
When building from source code packages directly downloaded from Broadcom, you need to setup environment variable OPENNSL_BASE, if you had to use 'sudo' to build opennsl in step 5, issue
sudo bash
and do everything afterwards as root.6.1 issue
export OPENNSL_BASE=<opennsl source tree root, e.g. /var/log/opennsl>
-
Issue
fakeroot debian/rules -B binary
to build SAI. This build should only take a minute or so. -
The built SAI debian pakcages will be at one level above SAI repo root, in this case /var/src/
- Clone SONiC Build Image Repo
- Follow Building Guide, issue
make init
,make config PLATFORM=broadcom
. - copy the newly built opennsl and SAI debian packages to
<build image repo root>/target/debs/
- Edit
<build image repo root>/platform/broadcom/sdk.mk
, change BRCM_OPENNSL_KERNEL to match the name of the new opennsl package. - Edit
<build image repo root>/platform/broadcom/sai.mk
, change BRCM_SAI and BRCM_SAI_DEV respectively to match the new SAI packages names. - Follow normal build procedure to build SONiC image.
-
For Users
-
For Developers
-
Subgroups/Working Groups
-
Presentations
-
Join Us