diff --git a/Makefile b/Makefile index 7694de6a41d4..d66e198ec0e6 100644 --- a/Makefile +++ b/Makefile @@ -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 orchagent swssconfig portsyncd intfsyncd neighsyncd) 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 orchagent swssconfig portsyncd intfsyncd neighsyncd) 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) diff --git a/build_debian.sh b/build_debian.sh index b1cf2e67d8d8..95d80f5a03d5 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -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' diff --git a/dockers/docker-orchagent-cavm b/dockers/docker-orchagent-cavm new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/dockers/docker-orchagent-cavm @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 1fdee5117f89..46376c4ea55d 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -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` diff --git a/dockers/docker-syncd-cavm/Dockerfile b/dockers/docker-syncd-cavm/Dockerfile new file mode 100755 index 000000000000..bbb5195901b7 --- /dev/null +++ b/dockers/docker-syncd-cavm/Dockerfile @@ -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 diff --git a/dockers/docker-syncd-cavm/start.sh b/dockers/docker-syncd-cavm/start.sh new file mode 100755 index 000000000000..04c5a3a1835f --- /dev/null +++ b/dockers/docker-syncd-cavm/start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +export XP_ROOT=/usr/bin/ + +service rsyslog start +syncd -p /etc/ssw/AS7512/profile.ini -N diff --git a/src/Makefile b/src/Makefile index 09e1152dec48..d310f069d438 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/cavm-sdk/filelist.txt b/src/cavm-sdk/filelist.txt new file mode 100644 index 000000000000..bc40295dfbdc --- /dev/null +++ b/src/cavm-sdk/filelist.txt @@ -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 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 68b0a9b914c3..74fa427ab6a7 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 68b0a9b914c3a3816c809d7951de70136d09dc27 +Subproject commit 74fa427ab6a70f293c0d487904bc06db3339fa84 diff --git a/src/sonic-swss b/src/sonic-swss index b56c9cc507cd..60b0fb279551 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit b56c9cc507cdfc473d6d0d1159f134dfd83a96df +Subproject commit 60b0fb279551ad3447b802ec602e28902245b4f2 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 38b461a168a6..efd594d51da6 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 38b461a168a6154aad978d3a97f08c2c933e943a +Subproject commit efd594d51da6d2dcc8a494bf43d3aadf3bdd71d2