Add support for cavium SAI (#5)

This commit is contained in:
Denys Haryachyy 2016-09-26 07:48:25 +03:00 committed by lguohan
parent 146c88100b
commit 9c3b7ccaf7
11 changed files with 97 additions and 4 deletions

View File

@ -10,6 +10,7 @@ SHELL := /bin/bash
## Capture all the files in SDK directories
MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb))
BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb))
CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb))
## Function: build_docker, image_name save_file
## build a docker image and save to a file
@ -20,7 +21,7 @@ define build_docker
endef
## Rules
.phony : brcm-all mlnx-all
.phony : brcm-all mlnx-all cavm-all
src/%:
$(MAKE) -C src $(subst src/,,$@)
@ -42,30 +43,48 @@ dockers/docker-orchagent/deps/%.deb: src/%.deb
dockers/docker-orchagent/deps/%: src/brcm/%
mkdir -p `dirname $@` && cp $< $@
dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-orchagent-cavm/deps/%: src/cavm/%
mkdir -p `dirname $@` && cp $< $@
dockers/docker-%-mlnx/deps/syncd_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-%/deps/syncd_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-%-cavm/deps/syncd_1.0.0_amd64.deb: src/cavm/syncd_1.0.0_amd64.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-%-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-%/deps/libsairedis_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-%-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb
mkdir -p `dirname $@` && cp $< $@
$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb
mkdir -p `dirname $@` && cp $< $@
$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb
mkdir -p `dirname $@` && cp $< $@
$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-syncd/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $@
dockers/docker-syncd-cavm/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $@
deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb
mkdir -p `dirname $@` && cp $< $@
@ -85,6 +104,10 @@ target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/d
target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb)
docker load < $<
@ -93,6 +116,10 @@ target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orc
target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd)
docker load < $<
@ -113,3 +140,6 @@ brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-or
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-database.gz)
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
cavm-all: $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-database.gz)

View File

@ -69,6 +69,7 @@ sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://f
## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...'
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 $HOSTNAME' >> /etc/hosts"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 localhost' >> /etc/hosts"
## Config basic fstab
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "proc /proc proc defaults 0 0" >> /etc/fstab'

View File

@ -0,0 +1 @@
docker-orchagent

View File

@ -32,9 +32,17 @@ if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then
PORTSYNCD_ARGS+="-p /etc/ssw/ACS-S6000/port_config.ini"
elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then
PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini"
elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
PORTSYNCD_ARGS+="-p /etc/ssw/AS7512/port_config.ini"
fi
service rsyslog start
if [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then
swssconfig /etc/ssw/AS7512/copp.json
fi
while true; do
# Check if syncd starts
result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p`

View File

@ -0,0 +1,26 @@
FROM docker-base
RUN apt-get update
COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"]
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/libhiredis0.13*.deb \
&& dpkg_apt /deps/libswsscommon_*.deb \
&& dpkg_apt /deps/sai*.deb \
&& dpkg_apt /deps/libsai*.deb \
&& dpkg_apt /deps/xp-tools*.deb \
&& dpkg_apt /deps/xpshell*.deb \
&& dpkg_apt /deps/libsairedis_*.deb \
&& dpkg_apt /deps/syncd_*.deb
RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev
COPY ["start.sh", "/usr/bin/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT /usr/bin/start.sh \
&& /bin/bash

View File

@ -0,0 +1,6 @@
#!/bin/bash
export XP_ROOT=/usr/bin/
service rsyslog start
syncd -p /etc/ssw/AS7512/profile.ini -N

View File

@ -43,6 +43,12 @@ mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev
$(call build_project, sonic-sairedis)
mkdir -p mlnx
cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb mlnx/
cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb cavm-sdk/libsai.deb cavm-sdk/xp-tools.deb cavm-sdk/xpshell.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-sairedis)
mkdir -p cavm
cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb cavm/
## Note: fpmsyncd is one implicit target
brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/portsyncd brcm/routeresync brcm/swssconfig: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb
@ -59,6 +65,14 @@ mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/por
cp swss_1.0.0_amd64.deb mlnx/
cp sonic-swss/debian/swss/usr/bin/* mlnx/
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
## Note: fpmsyncd is one implicit target
cavm/swss_1.0.0_amd64.deb cavm/intfsyncd cavm/neighsyncd cavm/orchagent cavm/portsyncd cavm/routeresync cavm/swssconfig: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss)
cp swss_1.0.0_amd64.deb cavm/
cp sonic-swss/debian/swss/usr/bin/* cavm/
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
$(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb):
pushd sonic-linux-kernel; sudo ./build.sh; popd

View File

@ -0,0 +1,7 @@
## Get vendor SAI SDK
## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk
libsai.deb
sai.deb
xp-tools.deb
xpshell.deb

@ -1 +1 @@
Subproject commit 68b0a9b914c3a3816c809d7951de70136d09dc27
Subproject commit 74fa427ab6a70f293c0d487904bc06db3339fa84

@ -1 +1 @@
Subproject commit b56c9cc507cdfc473d6d0d1159f134dfd83a96df
Subproject commit 60b0fb279551ad3447b802ec602e28902245b4f2

@ -1 +1 @@
Subproject commit 38b461a168a6154aad978d3a97f08c2c933e943a
Subproject commit efd594d51da6d2dcc8a494bf43d3aadf3bdd71d2