-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Build Broadcom Opennsl and SAI
Ying Xie edited this page Aug 30, 2019
·
16 revisions
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.
- NOTE: building opennsl is no longer needed for SAI 3.3
-
Clone SONiC Build Image Repo
-
Build 201803 branch:
git checkout 201803; make init; make configure PLATFORM=broadcom; KEEP_SLAVE_ON=yes SOURCE_FOLDER=<your source folder, e.g. /var/<username>/src>
. (Following Building Guide). -
Inside the socket build slave, save following script and run it from inside the slave docker to build:
#!/bin/bash -x
function set_kernel_version()
{
COMMON=`ls /sonic/target/debs/linux-headers*common*.deb`
TMP=${COMMON//\/sonic\/target\/debs\/linux-headers-/}
VERSION=${TMP//-common*/}
echo "Version: $VERSION"
}
function fix_build_symbolic_links()
{
# Fix source code symbolic links until Broadcom fix build issue.
sudo rm -rf /lib/modules/$VERSION-amd64/build
sudo rm -rf /lib/modules/$VERSION-amd64/source
sudo ln -s /usr/src/linux-headers-$VERSION-common/ /lib/modules/$VERSION-amd64/source
sudo ln -s /usr/src/linux-headers-$VERSION-amd64/ /lib/modules/$VERSION-amd64/build
sudo ln -s /usr/src/linux-headers-$VERSION-amd64/include/generated/ /usr/src/linux-headers-$VERSION-common/include/generated
sudo ln -s /usr/src/linux-headers-$VERSION-amd64/arch/x86/include/generated/ /usr/src/linux-headers-$VERSION-common/arch/x86/include/generated
sudo ln -s /usr/src/linux-headers-$VERSION-amd64/include/config/ /usr/src/linux-headers-$VERSION-common/include/config
sudo cp /usr/src/linux-headers-$VERSION-amd64/Module.symvers /usr/src/linux-headers-$VERSION-common/Module.symvers
ls /lib/modules
}
sudo apt-get -y install linux-kbuild-3.16 linux-compiler-gcc-4.8-x86
sudo dpkg -i /sonic/target/debs/linux-headers-*.deb
set_kernel_version
fix_build_symbolic_links
export KERNEL_SRC=/usr/src/linux-headers-$VERSION-common
fakeroot debian/rules -j20 -B binary'
- With current SAI 3.3. You are unable to clean and rebuilt. To rebuild:
rm -rf output
git checkout output
# and run the above script again.
- 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