From 759be24d2762c2332dc52785303bdd2f5a0f9699 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Fri, 16 Dec 2016 18:23:43 +0200 Subject: [PATCH 1/6] Cavium support in the new build infrastructure --- platform/cavium/cavm-sai.mk | 12 +++++++++ platform/cavium/docker-orchagent-cavm.mk | 7 +++++ platform/cavium/docker-syncd-cavm.mk | 7 +++++ .../docker-syncd-cavm/Dockerfile.template | 18 +++++++++++++ platform/cavium/docker-syncd-cavm/start.sh | 23 ++++++++++++++++ platform/cavium/rules.mk | 26 +++++++------------ 6 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 platform/cavium/cavm-sai.mk create mode 100644 platform/cavium/docker-orchagent-cavm.mk create mode 100644 platform/cavium/docker-syncd-cavm.mk create mode 100755 platform/cavium/docker-syncd-cavm/Dockerfile.template create mode 100755 platform/cavium/docker-syncd-cavm/start.sh diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk new file mode 100644 index 000000000000..9f537c50f37c --- /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/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk new file mode 100644 index 000000000000..b66c7dbf0395 --- /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 000000000000..eec324e9c7c1 --- /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) +$(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 000000000000..6ba34aac22f5 --- /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 redis-tools + +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 000000000000..21d61e707344 --- /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 7d8ef49177d3..634588c1112c 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,21 +1,13 @@ -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) From a0e5d3a36fd3a67636d4b090626379d156c1118c Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Fri, 16 Dec 2016 18:33:16 +0200 Subject: [PATCH 2/6] Added a file with a list of cavium debian packages --- platform/cavium/cavm_sdk/filelist.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 platform/cavium/cavm_sdk/filelist.txt diff --git a/platform/cavium/cavm_sdk/filelist.txt b/platform/cavium/cavm_sdk/filelist.txt new file mode 100644 index 000000000000..bc40295dfbdc --- /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 From b46a8f1a4c6da1755dddf062cb446aa62bbb0274 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Wed, 21 Dec 2016 17:22:17 +0200 Subject: [PATCH 3/6] docker-syncd-cavm : Added SAI and XDK libraries --- platform/cavium/docker-syncd-cavm.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index eec324e9c7c1..92010ba8d44b 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -2,6 +2,6 @@ DOCKER_SYNCD_CAVM = docker-syncd-cavm.gz $(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm -$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(XPSHELL) $(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) From f9873fc495599fe6a2ccbaa1f08954e766812d69 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Thu, 22 Dec 2016 19:04:56 +0200 Subject: [PATCH 4/6] docker-syncd-cavm : Removed redis-tools from docker template --- platform/cavium/docker-syncd-cavm.mk | 2 +- platform/cavium/docker-syncd-cavm/Dockerfile.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index 92010ba8d44b..fb0893df1eaf 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -2,6 +2,6 @@ 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) +$(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 index 6ba34aac22f5..d40051e2858d 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.template +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.template @@ -4,7 +4,7 @@ RUN apt-get update COPY deps /deps -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev redis-tools +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev SED_DPKG From 660178c318547a6cad68b6daef145150ecbe17f8 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Mon, 26 Dec 2016 10:59:02 +0200 Subject: [PATCH 5/6] docker-syncd-cavm : Changed templating method to jinja2 --- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) rename platform/cavium/docker-syncd-cavm/{Dockerfile.template => Dockerfile.j2} (67%) diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.template b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 similarity index 67% rename from platform/cavium/docker-syncd-cavm/Dockerfile.template rename to platform/cavium/docker-syncd-cavm/Dockerfile.j2 index d40051e2858d..1222f39ff8d6 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.template +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -2,17 +2,20 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY debs /debs RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_syncd_cavm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} COPY ["start.sh", "/usr/bin/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] From 9db3f10af62ddf7ed083dd5e5b7baa4b5ad68108 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Mon, 26 Dec 2016 18:40:08 +0200 Subject: [PATCH 6/6] docker-syncd-cavm : Install libjemalloc1 --- platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 1222f39ff8d6..f8e48259e8be 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -4,7 +4,7 @@ RUN apt-get update COPY debs /debs -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libjemalloc1 RUN dpkg -i \ {% for deb in docker_syncd_cavm_debs.split(' ') -%}