diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk new file mode 100644 index 0000000000..9f537c50f3 --- /dev/null +++ b/platform/cavium/cavm-sai.mk @@ -0,0 +1,12 @@ +# Cavium SAI + +CAVM_LIBSAI = libsai.deb +$(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk +CAVM_SAI = sai.deb +$(CAVM_SAI)_PATH = $(PLATFORM_PATH)/cavm_sdk +XP_TOOLS = xp-tools.deb +$(XP_TOOLS)_PATH = $(PLATFORM_PATH)/cavm_sdk +XPSHELL = xpshell.deb +$(XPSHELL)_PATH = $(PLATFORM_PATH)/cavm_sdk + +SONIC_COPY_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) $(XPSHELL) diff --git a/platform/cavium/cavm_sdk/filelist.txt b/platform/cavium/cavm_sdk/filelist.txt new file mode 100644 index 0000000000..bc40295dfb --- /dev/null +++ b/platform/cavium/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/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk new file mode 100644 index 0000000000..b66c7dbf03 --- /dev/null +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -0,0 +1,7 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz +$(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk new file mode 100644 index 0000000000..fb0893df1e --- /dev/null +++ b/platform/cavium/docker-syncd-cavm.mk @@ -0,0 +1,7 @@ +# docker image for cavium syncd + +DOCKER_SYNCD_CAVM = docker-syncd-cavm.gz +$(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm +$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(XPSHELL) $(REDIS_TOOLS) +$(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.template b/platform/cavium/docker-syncd-cavm/Dockerfile.template new file mode 100755 index 0000000000..d40051e285 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.template @@ -0,0 +1,18 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev + +SED_DPKG + +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 ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/cavium/docker-syncd-cavm/start.sh b/platform/cavium/docker-syncd-cavm/start.sh new file mode 100755 index 0000000000..21d61e7073 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/start.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +export XP_ROOT=/usr/bin/ + +service rsyslog start + +while true; do + + # Check if redis-server starts + + result=$(redis-cli ping) + + if [ "$result" == "PONG" ]; then + + redis-cli FLUSHALL + syncd -p /etc/ssw/AS7512/profile.ini -N + break + + fi + + sleep 1 + +done diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 93f89f7382..efb9159c34 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,23 +1,15 @@ include $(PLATFORM_GENERIC_PATH)/rules.mk -CAVM_LIBSAI = libsai.deb -$(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk -CAVM_SAI = sai.deb -$(CAVM_SAI)_PATH = $(PLATFORM_PATH)/cavm_sdk -XP_TOOLS = xp-tools.deb -$(XP_TOOLS)_PATH = $(PLATFORM_PATH)/cavm_sdk -XPSHELL = xpshell.deb -$(XPSHELL)_PATH = $(PLATFORM_PATH)/cavm_sdk +include $(PLATFORM_PATH)/cavm-sai.mk +include $(PLATFORM_PATH)/docker-syncd-cavm.mk +include $(PLATFORM_PATH)/docker-orchagent-cavm.mk -SONIC_COPY_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) $(XPSHELL) +SONIC_ALL += $(DOCKER_SYNCD_CAVM) \ + $(DOCKER_ORCHAGENT_CAVM) -# TODO: Put dependencies for SDK packages +# Inject cavium sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) -SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD_CAVM) $(DOCKER_ORCHAGENT) \ - $(DOCKER_FPM) +# Runtime dependency on cavium sai is set only for syncd +$(SYNCD)_RDEPENDS += $(CAVM_SAI) -# Inject cavm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(CAVM_LIBSAI) - -# Runtime dependency on cavm sai is set only for syncd -$(SYNCD)_RDEPENDS += $(CAVM_LIBSAI)