Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cavium customization for docker containers #5

Merged
merged 40 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
627601b
Makefile: Added Cavium platform
Aug 22, 2016
a2e5392
dockers : Added containers skeletons
Aug 23, 2016
812386c
Makefile, dockers : Introduced Cavium SDK packages
Aug 25, 2016
c579148
dockers : Introduced SAI headers package
Aug 26, 2016
3696be4
docker : Introduce profile config file for syncd
Aug 26, 2016
3758f4a
introduced target for Cavium platform
Aug 29, 2016
4d25304
Fixed port config path.
Aug 29, 2016
0d206ce
temporary remove 'git status' check from build_image.sh
Aug 29, 2016
a84d9ee
Merge remote-tracking branch 'upstream/cavm_build' into cavm_build
Aug 29, 2016
9cf983a
change linux kernel repository
Aug 30, 2016
2ecc885
orchagent : Provide MAC address in command line
Aug 31, 2016
91ece10
sonic-swss : Updated to the latest and greatest
Aug 31, 2016
a8f5de7
sonic-swss-common : Updated to the latest and greatest
Aug 31, 2016
3bcf0a1
Added localhost entry into /etc/hosts
Aug 31, 2016
c41491f
Introduced BGP docker target
Aug 31, 2016
25343a0
Revert "Introduced BGP docker target"
Sep 1, 2016
cdb4d87
Introduced copp config file
Sep 1, 2016
f204471
Introduced quagga config files
Sep 1, 2016
c902f7f
Rearranged custom debian packages
Sep 2, 2016
0f95042
Modified port config file to support 40G
Sep 7, 2016
4628780
Changed XP_ROOT variable for xpShell support
Sep 7, 2016
aacc331
Modified XP_ROOT var
Sep 9, 2016
2b4447b
Changed ports default mode to 100G
Sep 9, 2016
1b84594
Modified BGP configuration
Sep 9, 2016
c7400f3
Merge pull request #1 from rspolyak/cavm_build
garyachy Sep 13, 2016
d755335
Revert "change linux kernel repository"
garyachy Sep 14, 2016
2159d36
Revert "temporary remove 'git status' check from build_image.sh"
garyachy Sep 14, 2016
f14be7e
Revert "introduced target for Cavium platform"
garyachy Sep 14, 2016
64c8c08
Merge branch 'master' into cavm_build
garyachy Sep 14, 2016
01b2b8a
Makefile: fixed conflicts with master branch
Sep 14, 2016
5c894bd
docker-fpm : Removed Quagga config files
Sep 15, 2016
d3f1ffb
docker-syncd-cavm : Use 40G port speed for all ports by default
Sep 15, 2016
4d07d62
Moved to 40G speed
Sep 16, 2016
df63535
Merge branch 'cavm_build' into cavm_build_private
Sep 21, 2016
8c56068
orchagent-cavm : Removed custom docker container
Sep 21, 2016
6f0dd41
docker-syncd-cavm : Removed profile config file from docker
Sep 21, 2016
3783e42
Merge pull request #2 from garyachy/cavm_build_private
garyachy Sep 22, 2016
b16e0a3
Merge branch 'master' into cavm_build
garyachy Sep 23, 2016
958ce61
Makefile : Fixed libsairedis step
Sep 25, 2016
f196059
Merge branch 'cavm_build_private' into cavm_build
Sep 25, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/,,$@)
Expand All @@ -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 $< $@
Expand All @@ -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 < $<
Expand All @@ -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 < $<
Expand All @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need 'target/sonic-generic.bin'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are adding it in different PR - #4

1 change: 1 addition & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Collaborator

@qiluo-msft qiluo-msft Sep 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be in default /etc/hosts, no need to add.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please advise how to add it to default /etc/hosts because when we deploy Linux image there is no such entry inside /etc/hosts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the debootstrap will create a default /etc/hosts, with content "127.0.0.1 localhost". Could you double check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use PR - #4 to create a distributive and it has no such entry in /etc/hosts
Please advise what should I check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. There is no such file after debootstrap. Please ignore the previous comment.


## Config basic fstab
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "proc /proc proc defaults 0 0" >> /etc/fstab'
Expand Down
1 change: 1 addition & 0 deletions dockers/docker-orchagent-cavm
8 changes: 8 additions & 0 deletions dockers/docker-orchagent/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
26 changes: 26 additions & 0 deletions dockers/docker-syncd-cavm/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions dockers/docker-syncd-cavm/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

export XP_ROOT=/usr/bin/

service rsyslog start
syncd -p /etc/ssw/AS7512/profile.ini -N
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you enable the counter collecting thread on your platform? It is important for sonic to get those counters from asic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, please give me more time

14 changes: 14 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/cavm-sdk/filelist.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/sonic-sairedis
2 changes: 1 addition & 1 deletion src/sonic-swss
2 changes: 1 addition & 1 deletion src/sonic-swss-common