Build improvements (#80)

* Build improvements

Fix dependencies
Add configuration options
Automatically build sonic-slave

* Set default number of jobs to 1

* Auto generate target/debs directory

Signed-off-by: marian-pritsak <marianp@mellanox.com>

* Automatically remove sonic-slave container after exit

* Silence clean-logs

* Add SONIC_CLEAN_TARGETS to clean

* Use second expansion for clean dependencies

* Avoid creating empty log files

Remove log file on flush instead of writing empty string

* Put dpkg install inside lock

Use same lock as debian install targets do to avoid
race condition in dpkg installation

* Remove redirect to log from docker save

* Add .platform dependency to all and clean targets

* Remove header and footer from clean targets

* Disable messages for SONIC_CLEAN_TARGETS

* Exit with error if dpkg-buildpackage fails

* Set new location for debs in build_debian.sh

* Add recipe for docker-database

* Update redis version to 3.2.4

* Add support for p4 platform

* Add recipe for snmpd

* Add slave targets to phony and make all target default

* Remove build.sh from thrift

* Add versioning to team, nl, hiredis and initramfs

* Change sonic-slave to support snmpd build from sources

* Remove src/tenjin

* Add recipe for lldpd

* Add recipe for mpdecimal

* Remove hiredis directory on rebuild

* Add recipe for Mellanox hw management

* Remove generic image from all targets for Mellanox

* Add support for python wheels

* Add lldp and snmp dockers

* Sync docker-database to include libjemalloc

* Fix asyncsnmp variable name

* Change default build configuration

Redirect output to log files by default
Set number of jobs to nproc value
Do not print dependencies
Fix logging to print log of failed job into console

* Use docker inspect to check if sonic-slave image exists

* Use config in slave.mk directly

* Disable color output by default

* Remove sswsdk dependency from lldp and snmp dockers

* Fix comment in py wheels install targets

* Add dependency between two versions of sswsdk

* Add containers to mellanox platform

lldp, snmp and database containers

* Add recipe for team docker

* Add team docker to mellanox platform

* Encrypt password passed to build_debian.sh

* Update mellanox SAI version

Make version and revision setting only in main recipe

* Fix error handling in makefiles

As makefiles use .ONESHELL we should add -e
option to shell options in order to exit after any command fails

* Add recipe for platform monitor image

* Add platfotm monitor to mellanox targets

* Ignore submodules when building base image
This commit is contained in:
Marian Pritsak 2016-12-05 21:12:19 +02:00 committed by lguohan
parent 154b281cfb
commit e9098b99fb
108 changed files with 1675 additions and 819 deletions

8
.gitmodules vendored
View File

@ -14,16 +14,16 @@
path = src/sonic-swss
url = https://github.com/Azure/sonic-swss
[submodule "src/p4-switch/switch"]
path = src/p4-switch/switch
path = platform/p4/p4-switch/switch
url = https://github.com/lguohan/switch
[submodule "src/p4-bmv2/behavioral-model"]
path = src/p4-bmv2/behavioral-model
path = platform/p4/p4-bmv/behavioral-model
url = https://github.com/lguohan/behavioral-model
[submodule "src/p4c-bm/p4c-bm"]
path = src/p4c-bm/p4c-bm
path = platform/p4/p4c-bm/p4c-bm
url = https://github.com/krambn/p4c-bm
[submodule "src/p4-hlir/p4-hlir"]
path = src/p4-hlir/p4-hlir
path = platform/p4/p4-hlir/p4-hlir
url = https://github.com/p4lang/p4-hlir
[submodule "quagga"]
path = src/sonic-quagga

216
Makefile
View File

@ -1,197 +1,39 @@
## TODO: if install dev package really happens, rebuild the depending project
###############################################################################
## Wrapper for starting make inside sonic-slave container
###############################################################################
## Arguments from make command line
USERNAME=
PASSWORD_ENCRYPTED=
SHELL = /bin/bash
## Redis server/tools version
REDIS_VERSION=3.2.4-1~bpo8+1_amd64
USER := $(shell id -un)
PWD := $(shell pwd)
## Select bash for commands
SHELL := /bin/bash
MAKEFLAGS += -B
## 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))
DOCKER_RUN := docker run --rm=true --privileged \
-v $(PWD):/sonic \
-it sonic-slave-$(USER)
LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb
DOCKER_BUILD = docker build --no-cache \
--build-arg user=$(USER) \
--build-arg uid=$(shell id -u) \
--build-arg guid=$(shell id -g) \
-t sonic-slave-$(USER) \
sonic-slave
LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb
.PHONY: sonic-slave-build sonic-slave-bash
## Function: build_docker, image_name save_file
## build a docker image and save to a file
define build_docker
docker build --no-cache -t $(1) dockers/$(1)
mkdir -p `dirname $(2)`
docker save $(1) | gzip -c > $(2)
endef
.DEFAULT_GOAL := all
## Rules: phony targets
.phony : brcm-all mlnx-all cavm-all p4-all
%::
@docker inspect --type image sonic-slave-$(USER) &> /dev/null || $(DOCKER_BUILD)
@$(DOCKER_RUN) make \
-C sonic \
-f slave.mk \
PLATFORM=$(PLATFORM) \
$@
## Rules: redirect to sub directory
src/%:
$(MAKE) \
REDIS_VERSION=$(REDIS_VERSION) \
LIBNL-DEBS="$(LIBNL-DEBS)" \
LIBTEAM-DEBS="$(LIBTEAM-DEBS)" \
-C src $(subst src/,,$@)
sonic-slave-build :
@$(DOCKER_BUILD)
## Rules: docker-snmp-sv2
dockers/docker-snmp-sv2/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-snmp-sv2/deps/python3/%.whl: src/%.whl
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-lldp-sv2
dockers/docker-lldp-sv2/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-lldp-sv2/deps/%.whl: src/%.whl
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-fpm
dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-fpm/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-team
dockers/docker-team/deps/teamsyncd: src/teamsyncd
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-team/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-orchagent-mlnx
$(addprefix dockers/docker-orchagent-mlnx/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-mlnx/deps/%.deb : src/mlnx/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-orchagent-cavm
$(addprefix dockers/docker-orchagent-cavm/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-cavm/deps/%.deb : src/cavm/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-orchagent (brcm)
$(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent/deps/%.deb : src/brcm/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-orchagent/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-syncd-mlnx
$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
$(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-syncd-mlnx/deps/fw-SPC.mfa: src/mlnx-sdk/fw-SPC.mfa
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-syncd-cavm
$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
$(addprefix dockers/docker-syncd-cavm/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-syncd-cavm/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-syncd (brcm)
$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
$(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb): dockers/docker-syncd/deps/%.deb : src/brcm/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-syncd/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-database
dockers/docker-database/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-sonic (p4)
$(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-sonic-p4/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker images
target/docker-base.gz:
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-snmp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-snmp-sv2/deps/,python3/sswsdk-2.0.1-py3-none-any.whl python3/asyncsnmp-2.1.0-py3-none-any.whl libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb snmpd_5.7.3+dfsg-1.5_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-lldp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-lldp-sv2/deps/,sswsdk-2.0.1-py2-none-any.whl sonic_d-2.0.0-py2-none-any.whl lldpd_0.9.5-0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS))
## TODO: remove placeholders for the dependencies
touch dockers/docker-syncd/deps/{dsserve,bcmcmd}
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-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 libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa
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 libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS))
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 libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
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 libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS))
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 libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS))
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.1_amd64.deb fpmsyncd $(LIBNL-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS) teamsyncd)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-database.gz: target/docker-base.gz $(addprefix dockers/docker-database/deps/,redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-platform-monitor.gz: target/docker-base.gz
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
## Rules: linux image content
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 $< $(dir $@)
deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
target/sonic-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb
./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh
target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb
./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz)
## 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-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz)
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz)
p4-all: $(addprefix target/,docker-sonic-p4.gz)
sonic-slave-bash :
@$(DOCKER_RUN) bash

View File

@ -112,9 +112,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'cd /dev && MAKEDEV generic'
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install busybox
echo '[INFO] Install SONiC linux kernel image'
## Note: duplicate apt-get command to ensure every line return zero
sudo dpkg --root=$FILESYSTEM_ROOT -i deps/initramfs-tools_*.deb || \
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo dpkg --root=$FILESYSTEM_ROOT -i deps/linux-image-3.16.0-4-amd64_*.deb || \
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-4-amd64_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
## Update initramfs for booting with squashfs+aufs

View File

@ -13,7 +13,7 @@
}
## Retrieval short version of Git revision hash for partition metadata
[ -z "$(git status --untracked-files=no -s)" ] || {
[ -z "$(git status --untracked-files=no -s --ignore-submodules)" ] || {
echo "Error: There is local changes not committed to git repo. Cannot get a revision hash for partition metadata."
exit 1
}

@ -1 +1 @@
Subproject commit dfb5c2f46bf982207c8dbc2c5af589a0ba1b3ddc
Subproject commit 73b5fcee2840adcc64bee5e6ffb226a9928959e4

View File

@ -1,19 +0,0 @@
FROM docker-base
COPY ["deps/redis-tools_*.deb", "deps/redis-server_*.deb", "/deps/"]
## Install packages
## Clean up
RUN apt-get update && \
dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/redis-tools_*.deb && \
dpkg_apt /deps/redis-server_*.deb && \
apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y
RUN sed -ri 's/^daemonize yes$/daemonize no/; \
s/^logfile .*$/logfile ""/; \
s/^# syslog-enabled no$/syslog-enabled no/; \
s/^# unixsocket/unixsocket/ \
' /etc/redis/redis.conf
ENTRYPOINT service redis-server start

View File

@ -0,0 +1,19 @@
FROM docker-base
RUN apt-get update
COPY deps/ deps
SED_DPKG
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
RUN sed -ri 's/^daemonize yes$/daemonize no/; \
s/^logfile .*$/logfile ""/; \
s/^# syslog-enabled no$/syslog-enabled no/; \
s/^# unixsocket/unixsocket/ \
' /etc/redis/redis.conf
ENTRYPOINT service redis-server start

View File

@ -1,24 +0,0 @@
FROM docker-base
RUN apt-get update
COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/quagga_*", "/deps/"]
## Get fpmsyncd
## Get Quagga
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/libhiredis0.13*.deb \
&& dpkg_apt /deps/libnl-3-200_*.deb \
&& dpkg_apt /deps/libnl-genl-3-200_*.deb \
&& dpkg_apt /deps/libnl-route-3-200_*.deb \
&& dpkg_apt /deps/libswsscommon_*.deb \
&& dpkg_apt /deps/quagga_*.deb
COPY ["deps/fpmsyncd", "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,16 @@
FROM docker-base
RUN apt-get update
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4
COPY deps/ deps
SED_DPKG
## 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

@ -1,23 +0,0 @@
FROM docker-base
COPY deps/sswsdk*.whl deps/sonic_d*.whl deps/lldpd_*.deb /deps/
## Pre-install the fundamental packages
## Install Python SSWSDK
## Install LLDP Sync Daemon
## Note: dpkg_apt function has the benefit to detect missing .deb file
## Clean up
RUN apt-get update && \
dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \
dpkg_apt /deps/lldpd_*.deb && \
apt-get install -y python-pip supervisor && \
pip install /deps/sswsdk*.whl && \
pip install /deps/sonic_d*.whl && \
apt-get remove -y python-pip && \
apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \
rm -rf /deps ~/.cache
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY reconfigure.sh /opt/reconfigure.sh
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -0,0 +1,23 @@
FROM docker-base
COPY deps /deps
COPY python-wheels /python-wheels
RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20
## Pre-install the fundamental packages
## Install Python SSWSDK
## Install LLDP Sync Daemon
SED_DPKG
RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \
pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \
apt-get remove -y python-pip && \
apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \
rm -rf /deps /python-wheels ~/.cache
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY reconfigure.sh /opt/reconfigure.sh
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,29 +0,0 @@
FROM docker-base
RUN apt-get update
COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/libteam5_*.deb", "deps/swss_*.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/libnl-3-200_*.deb \
&& dpkg_apt /deps/libnl-genl-3-200_*.deb \
&& dpkg_apt /deps/libnl-route-3-200_*.deb \
&& dpkg_apt /deps/libnl-nf-3-200_*.deb \
&& dpkg_apt /deps/libnl-cli-3-200_*.deb \
&& dpkg_apt /deps/libswsscommon_*.deb \
&& dpkg_apt /deps/libsairedis_*.deb \
&& dpkg_apt /deps/libsaimetadata_*.deb \
&& dpkg_apt /deps/libteam5_*.deb \
&& dpkg_apt /deps/swss_*.deb
RUN apt-get install -f -y ifupdown bridge-utils redis-tools
COPY start.sh /usr/bin/start.sh
## 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"]

View File

@ -0,0 +1,18 @@
FROM docker-base
RUN apt-get update
RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansson4
COPY deps /deps
SED_DPKG
COPY start.sh /usr/bin/start.sh
## 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"]

View File

@ -1,7 +1,7 @@
FROM docker-base
COPY deps/snmp_*.deb deps/snmpd_*.deb deps/libsnmp-base_*.deb deps/libsnmp30_*.deb /deps/
COPY deps/python3/*.whl /python3/
COPY deps /deps
COPY python-wheels /python-wheels
# enable -O for all Python calls
ENV PYTHONOPTIMIZE 1
@ -9,15 +9,12 @@ ENV PYTHONOPTIMIZE 1
## Pre-install the fundamental packages
## Install Python SSWSDK (SNMP subagent dependency)
## Install SNMP subagent
## Note: dpkg_apt function has the benefit to detect missing .deb file
## Clean up
RUN apt-get update && \
dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \
dpkg_apt /deps/libsnmp-base_*.deb && \
dpkg_apt /deps/libsnmp30_*.deb && \
dpkg_apt /deps/snmp_*.deb && \
dpkg_apt /deps/snmpd_*.deb && \
rm -rf /deps
RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev
SED_DPKG
RUN rm -rf /deps
# install subagent
RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \
@ -28,8 +25,8 @@ RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \
make && make install && \
ldconfig && \
cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \
pip3 install --no-cache-dir /python3/*py3*.whl hiredis && \
rm -rf /python3 && \
pip3 install --no-cache-dir /python-wheels/*py3*.whl hiredis && \
rm -rf /python-wheels && \
python3 -m sonic_ax_impl install && \
python3 -m pip uninstall -y pip setuptools && \
/bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \

View File

@ -1,33 +0,0 @@
FROM docker-base
RUN apt-get update
RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils
COPY ["deps/libthrift-0.9.3_*.deb", "deps/libhiredis0.13*.deb", "deps/redis-tools_*.deb", "deps/redis-server_*.deb", "deps/libswsscommon_*.deb", "deps/p4-bmv2_*.deb", "deps/p4-switch_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/swss_*.deb", "deps/quagga_*.deb", "/deps/"]
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libthrift-0.9.3_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/redis-tools_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/redis-server_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-bmv2_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-switch_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaimetadata_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/swss_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb
ADD port_config.ini /port_config.ini
ADD startup.sh /scripts/startup.sh
ADD rsyslog.conf /etc/rsyslog.conf
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT /bin/bash

View File

@ -1,23 +0,0 @@
FROM docker-base
COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"]
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/libnl-3-200_*.deb \
&& dpkg_apt /deps/libnl-genl-3-200_*.deb \
&& dpkg_apt /deps/libnl-route-3-200_*.deb \
&& dpkg_apt /deps/libnl-nf-3-200_*.deb \
&& dpkg_apt /deps/libnl-cli-3-200_*.deb \
&& dpkg_apt /deps/libteam5_*.deb \
&& dpkg_apt /deps/libteam-utils_*.deb \
&& dpkg_apt /deps/libteamdctl0_*.deb \
&& dpkg_apt /deps/libhiredis0.13_*.deb \
&& dpkg_apt /deps/libswsscommon_*.deb
COPY ["deps/teamsyncd", "start.sh", "/usr/bin/"]
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"]

View File

@ -0,0 +1,15 @@
FROM docker-base
RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4
COPY deps /deps
SED_DPKG
COPY start.sh /usr/bin/start.sh
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"]

View File

@ -0,0 +1,20 @@
OPENNSL = libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb
$(OPENNSL)_PATH = $(PLATFORM_PATH)/brcm_sdk
BRCM_SAI = libsaibcm_1.0.2~20160727172452.52_amd64.deb
$(BRCM_SAI)_PATH = $(PLATFORM_PATH)/brcm_sdk
BRCM_SAI_DBG = libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb
$(BRCM_SAI_DEV)_PATH = $(PLATFORM_PATH)/brcm_sdk
BRCM_SAI_DEV = libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb
$(BRCM_SAI_DBG)_PATH = $(PLATFORM_PATH)/brcm_sdk
SONIC_COPY_DEBS += $(OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DBG) $(BRCM_SAI_DEV)
# TODO: Put dependencies for SDK packages
SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD) $(DOCKER_ORCHAGENT) $(DOCKER_FPM)
# Inject brcm sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(BRCM_LIBSAI)
# Runtime dependency on brcm sai is set only for syncd
$(SYNCD)_RDEPENDS += $(BRCM_LIBSAI)

21
platform/cavium/rules.mk Normal file
View File

@ -0,0 +1,21 @@
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)
# TODO: Put dependencies for SDK packages
SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD_CAVM) $(DOCKER_ORCHAGENT) \
$(DOCKER_FPM)
# Inject cavm sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(CAVM_LIBSAI)
# Runtime dependency on cavm sai is set only for syncd
$(SYNCD)_RDEPENDS += $(CAVM_LIBSAI)

View File

@ -0,0 +1,8 @@
# docker image for mlnx syncd
DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz
$(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx
$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT)
$(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW)
$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)

View File

@ -0,0 +1,20 @@
FROM docker-base
RUN apt-get update
COPY deps /deps
RUN apt-get install -y libxml2
SED_DPKG
COPY ["start.sh", "/usr/bin/"]
COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"]
COPY ["/deps/fw-SPC.mfa", "/etc/mlnx/"]
## 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"]

View File

@ -0,0 +1,53 @@
#!/bin/bash
query_retry_count_max="10"
required_fw_version="13.1130.0010"
fw_file=/etc/mlnx/fw-SPC.mfa
run_or_fail() {
$1
if [[ $? != 0 ]]; then
echo $1 failed
exit 1
fi
}
# wait until devices will be available
query_retry_count="0"
mlxfwmanager --query > /dev/null
while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do
sleep 1
query_retry_count=$[${query_retry_count}+1]
mlxfwmanager --query > /dev/null
done
run_or_fail "mlxfwmanager --query" > /tmp/mlnxfwmanager-query.txt
# get current firmware version
found_fw=false
for word in `cat /tmp/mlnxfwmanager-query.txt`
do
if [[ ${found_fw} == true ]]; then
fw_version=${word}
break
fi
if [[ ${word} == FW ]]; then
found_fw=true
fi
done
if [[ -z ${fw_version} ]]; then
echo "Could not retreive current FW version."
exit 1
fi
if [[ ${required_fw_version} == ${fw_version} ]]; then
echo "Mellanox firmware is up to date."
else
echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..."
run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y"
# exit from here so that syncd service will restart
exit 0
fi

View File

@ -0,0 +1,21 @@
#!/bin/bash
function clean_up {
service syncd stop
service rsyslog stop
exit
}
trap clean_up SIGTERM SIGKILL
# fw-upgrade will exit if firmware was actually upgraded or if some error
# occures
. mlnx-fw-upgrade.sh
# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up
# Remove rsyslogd.pid file manually so that to start the rsyslog instantly
[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid
service rsyslog start
service syncd start
read

5
platform/mellanox/fw.mk Normal file
View File

@ -0,0 +1,5 @@
# mellanox firmware
MLNX_FW = fw-SPC.mfa
$(MLNX_FW)_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonic/sdk/fw-SPC.mfa
SONIC_ONLINE_FILES += $(MLNX_FW)

View File

@ -0,0 +1,9 @@
# Mellanox HW Management
MLNX_HW_MANAGEMENT_VERSION = 20.7.2016
export MLNX_HW_MANAGEMENT_VERSION
MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb
$(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management
SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT)

View File

@ -0,0 +1,17 @@
.ONESHELL:
SHELL = /bin/bash
MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# get sources
sudo rm -rf hw-management
wget -N -O mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz https://github.com/Mellanox/mellanox-openswitch/raw/master/hw-mgmt/mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz
tar xzf mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz
# build
pushd hw-management
sudo debian/rules binary KVERSION=$(KVERSION)
popd
mv $* $(DEST)/

8
platform/mellanox/mft.mk Normal file
View File

@ -0,0 +1,8 @@
# Mellanox SAI
MFT = mft-4.5.0-31.amd64.deb
$(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft
SONIC_MAKE_DEBS += $(MFT)
KERNEL_MFT = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb
$(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT)))

View File

@ -0,0 +1,32 @@
.ONESHELL:
SHELL = /bin/bash
MFT_NAME = mft-4.5.0-31-x86_64-deb
MFT_TGZ = $(MFT_NAME).tgz
KERNELVER = 3.16.0-4-amd64
SRC_DEB = kernel-mft-dkms_4.5.0-31_all.deb
MAIN_TARGET = mft-4.5.0-31.amd64.deb
DERIVED_TARGETS = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf $(MFT_NAME)
wget -O $(MFT_TGZ) http://www.mellanox.com/downloads/MFT/$(MFT_TGZ)
tar xzf $(MFT_TGZ)
pushd $(MFT_NAME)/SDEBS
# put a lock here because dpkg does not allow installing packages in parallel
while true; do
if mkdir $(DEST)/dpkg_lock &> /dev/null; then
{ echo here && sudo dpkg -i $(SRC_DEB) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; }
fi
done
tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k $(KERNELVER) --media tar | grep "Disk image location" | cut -d':' -f2`
popd
# fix timestamp because we do not actually build tools, only kernel
touch $(MFT_NAME)/DEBS/$*
mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/$(DERIVED_TARGETS) $(MFT_NAME)/DEBS/$* $(DEST)
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

View File

@ -0,0 +1,12 @@
# Mellanox SAI
MLNX_SAI_VERSION = 161120
MLNX_SAI_REVISION = c7ccc8a8ba9864b62b0c038ad57d6dd94771f5ee
export MLNX_SAI_VERSION MLNX_SAI_REVISION
MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb
$(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai
$(MLNX_SAI)_DEPENDS += $(MLNX_SDK_DEBS)
$(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS)
SONIC_MAKE_DEBS += $(MLNX_SAI)

View File

@ -0,0 +1,21 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# get sources
rm -rf SAI-Implementation
git clone https://github.com/Mellanox/SAI-Implementation.git
# build
pushd SAI-Implementation
git checkout $(MLNX_SAI_REVISION)
pushd mlnx_sai
chmod a+x autogen.sh
debuild -e 'make_extra_flags="DEFS=-DACS_OS"' -us -uc -d -b
popd
mv $* $(DEST)/
popd

View File

@ -0,0 +1,21 @@
include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/fw.mk
include $(PLATFORM_PATH)/mft.mk
include $(PLATFORM_PATH)/mlnx-sai.mk
include $(PLATFORM_PATH)/hw-management.mk
include $(PLATFORM_PATH)/docker-syncd-mlnx.mk
SONIC_ALL += $(DOCKER_SYNCD_MLNX) \
$(DOCKER_ORCHAGENT) \
$(DOCKER_FPM) \
$(DOCKER_DATABASE) \
$(DOCKER_LLDP_SV2) \
$(DOCKER_SNMP_SV2) \
$(DOCKER_TEAM) \
$(DOCKER_PLATFORM_MONITOR)
# Inject mlnx sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI)
# Runtime dependency on mlnx sai is set only for syncd
$(SYNCD)_RDEPENDS += $(MLNX_SAI)

49
platform/mellanox/sdk.mk Normal file
View File

@ -0,0 +1,49 @@
MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonic/sdk
MLNX_SDK_VERSION = 4.2.3002
MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \
$(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \
$(SXD_LIBS) $(TESTX)
MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_DEV) $(SX_ACL_RM_DEV) \
$(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \
$(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \
$(SX_SDN_HAL_DEV) $(SX_SDN_HAL_DEV_STATIC) $(SXD_LIBS_DEV) \
$(SXD_LIBS_DEV_STATIC) $(TESTX_DEV)
APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV)))
IPROUTE2 = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
IPROUTE2_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV)))
SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV)))
SX_COMPLIB_DEV_STATIC = sx-complib-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV_STATIC)))
SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DEV)))
SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV)))
SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV)))
SX_SCEW_DEV_STATIC = sx-scew-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV_STATIC)))
SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV)))
SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC)))
define make_url
$(1)_URL = $(MLNX_SDK_BASE_URL)/$(1)
endef
$(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_url,$(deb))))
$(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_url,$(deb))))
SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS)

View File

@ -0,0 +1,7 @@
# docker image for p4 sonic docker image
DOCKER_SONIC_P4 = docker-sonic-p4.gz
$(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4
$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH)
$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4)

View File

@ -0,0 +1,20 @@
FROM docker-base
RUN apt-get update
RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils
COPY deps /deps
SED_DPKG
ADD port_config.ini /port_config.ini
ADD startup.sh /scripts/startup.sh
ADD rsyslog.conf /etc/rsyslog.conf
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT /bin/bash

7
platform/p4/p4-bmv.mk Normal file
View File

@ -0,0 +1,7 @@
# p4 bmv package
P4_BMV = p4-bmv2_1.0.0_amd64.deb
$(P4_BMV)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER)
$(P4_BMV)_RDEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(THRIFT_COMPILER)
$(P4_BMV)_SRC_PATH = $(PLATFORM_PATH)/p4-bmv/behavioral-model
SONIC_DPKG_DEBS += $(P4_BMV)

5
platform/p4/p4-hlir.mk Normal file
View File

@ -0,0 +1,5 @@
# p4 bmv package
P4_HLIR = python-p4-hlir_0.9.36-1_all.deb
$(P4_HLIR)_SRC_PATH = $(PLATFORM_PATH)/p4-hlir/p4-hlir
SONIC_PYTHON_STDEB_DEBS += $(P4_HLIR)

7
platform/p4/p4-switch.mk Normal file
View File

@ -0,0 +1,7 @@
# p4 switch package
P4_SWITCH = p4-switch_1.0.0_amd64.deb
$(P4_SWITCH)_DEPENDS += $(P4C_BM) $(P4_BMV)
$(P4_SWITCH)_RDEPENDS += $(P4C_BM) $(P4_BMV)
$(P4_SWITCH)_SRC_PATH = $(PLATFORM_PATH)/p4-switch
SONIC_MAKE_DEBS += $(P4_SWITCH)

View File

@ -0,0 +1,17 @@
SHELL = /bin/bash
.ONESHELL:
MAIN_TARGET = p4-switch_1.0.0_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
pushd switch
mkdir -p p4-build/bmv2/switch
mkdir -p p4-build/bmv2/pd_thrift_gen
./autogen.sh
dpkg-buildpackage -us -uc -b -j4
popd
mv $* $(DEST)/

7
platform/p4/p4c-bm.mk Normal file
View File

@ -0,0 +1,7 @@
# p4c bm package
P4C_BM = python-p4c-bm_1.0.0-5415c416-1_all.deb
$(P4C_BM)_SRC_PATH = $(PLATFORM_PATH)/p4c-bm/p4c-bm
$(P4C_BM)_DEPENDS += $(TENJIN) $(P4_HLIR)
$(P4C_BM)_RDEPENDS += $(TENJIN) $(P4_HLIR)
SONIC_PYTHON_STDEB_DEBS += $(P4C_BM)

6
platform/p4/rules.mk Normal file
View File

@ -0,0 +1,6 @@
include $(PLATFORM_PATH)/p4-switch.mk
include $(PLATFORM_PATH)/p4-bmv.mk
include $(PLATFORM_PATH)/p4-hlir.mk
include $(PLATFORM_PATH)/p4c-bm.mk
include $(PLATFORM_PATH)/tenjin.mk
include $(PLATFORM_PATH)/docker-sonic-p4.mk

5
platform/p4/tenjin.mk Normal file
View File

@ -0,0 +1,5 @@
# tenjin package
TENJIN = python-tenjin_1.1.1-1_all.deb
$(TENJIN)_SRC_PATH = $(PLATFORM_PATH)/tenjin
SONIC_MAKE_DEBS += $(TENJIN)

View File

@ -0,0 +1,19 @@
SHELL = /bin/bash
.ONESHELL:
TENJIN_VERSION = 1.1.1
TENJIN_VERSION_FULL = $(TENJIN_VERSION)-1
MAIN_TARGET = python-tenjin_$(TENJIN_VERSION_FULL)_all.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf Tenjin-$(TENJIN_VERSION)
wget -nc http://pypi.python.org/packages/source/T/Tenjin/Tenjin-$(TENJIN_VERSION).tar.gz
tar xzf Tenjin-$(TENJIN_VERSION).tar.gz
pushd Tenjin-$(TENJIN_VERSION)
python setup.py --command-packages=stdeb.command bdist_deb
popd
mv Tenjin-$(TENJIN_VERSION)/deb_dist/$* $(DEST)/

7
rules/asyncsnmp-py3.mk Normal file
View File

@ -0,0 +1,7 @@
# asyncsnmp python2 wheel
ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl
$(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent
$(ASYNCSNMP_PY3)_PYTHON_VERSION = 3
$(ASYNCSNMP_PY3)_DEPENDS += $(SSWSDK_PY3)
SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3)

33
rules/config Normal file
View File

@ -0,0 +1,33 @@
###############################################################################
## Configuration parameters for SONiC build system
###############################################################################
# SONIC_CONFIG_VERBOSE - enable echoing for rules commands.
# Uncomment next line to enable:
# SONIC_CONFIG_VERBOSE = y
# SONIC_CONFIG_PRINT_DEPENDENCIES - show dependencies for each invoked target.
# Before executing rule for each target its dependencies are printed to console.
# Uncomment next line to enable:
# SONIC_CONFIG_PRINT_DEPENDENCIES = y
# SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build.
# Corresponding -j argument will be passed to make command inside docker
# container.
SONIC_CONFIG_BUILD_JOBS = $(shell nproc)
# SONIC_CONFIG_LOG_TO_FILES - print output from execution of rule for each
# target into separate log file under target/log/.
# Useful when executing parallel build
# Uncomment next line to enable:
SONIC_CONFIG_LOG_TO_FILES = y
# SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system.
# Comment next line to disable:
# SONIC_CONFIG_ENABLE_COLORS = y
# USERNAME - username for installer build
USERNAME = admin
# PASSWORD - password for installer build
PASSWORD = admin

7
rules/dbsyncd-py2.mk Normal file
View File

@ -0,0 +1,7 @@
# sonic-dbsyncd python2 wheel
DBSYNCD_PY2 = sonic_d-2.0.0-py2-none-any.whl
$(DBSYNCD_PY2)_SRC_PATH = $(SRC_PATH)/sonic-dbsyncd
$(DBSYNCD_PY2)_PYTHON_VERSION = 2
$(DBSYNCD_PY2)_DEPENDS += $(SSWSDK_PY2)
SONIC_PYTHON_WHEELS += $(DBSYNCD_PY2)

6
rules/docker-base.mk Normal file
View File

@ -0,0 +1,6 @@
# docker base image
DOCKER_BASE = docker-base.gz
$(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base
SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_BASE)

7
rules/docker-database.mk Normal file
View File

@ -0,0 +1,7 @@
# docker image for database
DOCKER_DATABASE = docker-database.gz
$(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database
$(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS)
$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE)

7
rules/docker-fpm.mk Normal file
View File

@ -0,0 +1,7 @@
# docker image for fpm
DOCKER_FPM = docker-fpm.gz
$(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm
$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS)
$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_FPM)

8
rules/docker-lldp-sv2.mk Normal file
View File

@ -0,0 +1,8 @@
# docker image for lldp agent
DOCKER_LLDP_SV2 = docker-lldp-sv2.gz
$(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2
$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD)
$(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2)
$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)

View File

@ -0,0 +1,7 @@
# docker image for orchagent
DOCKER_ORCHAGENT = docker-orchagent.gz
$(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/docker-orchagent
$(DOCKER_ORCHAGENT)_DEPENDS += $(SWSS)
$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT)

View File

@ -0,0 +1,7 @@
# docker platform monitor image
DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz
$(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor
$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_BASE)
SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)

8
rules/docker-snmp-sv2.mk Normal file
View File

@ -0,0 +1,8 @@
# docker image for snmp agent
DOCKER_SNMP_SV2 = docker-snmp-sv2.gz
$(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2
$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD)
$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3)
$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)

7
rules/docker-team.mk Normal file
View File

@ -0,0 +1,7 @@
# docker image for team agent
DOCKER_TEAM = docker-team.gz
$(DOCKER_TEAM)_PATH = $(DOCKERS_PATH)/docker-team
$(DOCKER_TEAM)_DEPENDS += $(SWSS)
$(DOCKER_TEAM)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_TEAM)

103
rules/functions Normal file
View File

@ -0,0 +1,103 @@
###############################################################################
## FUNCTIONS
###############################################################################
###############################################################################
## Colored output
###############################################################################
# Enable colored output
ifeq ($(SONIC_CONFIG_ENABLE_COLORS),y)
ifeq ($(MAKE_TERMOUT),)
RED=\033[1;31m
PURPLE=\033[1;35m
CYAN=\033[1;36m
GREEN=\033[1;32m
GRAY=\033[0m
endif
endif
# Print red colored output
# call:
# log_red message
log_red = echo -e "$(RED)$(1)$(GRAY)"
# Print purple colored output
# call:
# log_purple message
log_purple = echo -e "$(PURPLE)$(1)$(GRAY)"
# Print blue colored output
# call:
# log_blue message
log_blue = echo -e "$(CYAN)$(1)$(GRAY)"
# Print green colored output
# call:
# log_green message
log_green = echo -e "$(GREEN)$(1)$(GRAY)"
###############################################################################
## Logging
###############################################################################
ifeq ($(SONIC_CONFIG_LOG_TO_FILES),y)
FLUSH_LOG = rm -f $@.log
LOG = &>> $(PROJECT_ROOT)/$@.log || { [ $$? -eq 0 ] || cat $(PROJECT_ROOT)/$@.log ; false ; }
endif
###############################################################################
## Header and footer for each target
###############################################################################
# Print name of target being built
PRINT_TARGET = $(call log_purple,Executing rules for $@)
# Print name of target that finished build
PRINT_END_TARGET = $(call log_green,Finished $@)
# Dump targets taht current depends on
ifeq ($(SONIC_CONFIG_PRINT_DEPENDENCIES),y)
PRINT_DEPENDENCIES = $(call log_blue,Dependencies for $@ are $^)
endif
# Enable verbose mode
ifneq ($(SONIC_CONFIG_VERBOSE),y)
ENABLE_VERBOSE = @
endif
# header for each rule
define HEADER
$(ENABLE_VERBOSE)
$(PRINT_TARGET)
$(PRINT_DEPENDENCIES)
$(FLUSH_LOG)
endef
# footer for each rule
define FOOTER
$(PRINT_END_TARGET)
endef
###############################################################################
## Definition of derived target
###############################################################################
# call:
# add_derived_package some_deb.deb, some_derived_deb
define add_derived_package
$(2)_DEPENDS += $(1)
$(2)_RDEPENDS += $($(1)_RDEPENDS)
$(2)_DERIVED_FROM = $(1)
$(1)_DERIVED_DEBS += $(2)
$(2)_URL = $($(1)_URL)
$(2)_SRC_PATH = $($(1)_SRC_PATH)
SONIC_DERIVED_DEBS += $(2)
endef
###############################################################################
## Utility functions
###############################################################################
expand = $(foreach d,$(1),$(call expand,$($(d)_$(2)),$(2))) $(1)

18
rules/hiredis.mk Normal file
View File

@ -0,0 +1,18 @@
# libhiredis package
HIREDIS_VERSION = 0.13.3
HIREDIS_VERSION_FULL = $(HIREDIS_VERSION)-2
export HIREDIS_VERSION HIREDIS_VERSION_FULL
LIBHIREDIS = libhiredis0.13_$(HIREDIS_VERSION_FULL)_amd64.deb
$(LIBHIREDIS)_SRC_PATH = $(SRC_PATH)/hiredis
$(LIBHIREDIS)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(REDIS_SENTINEL)
$(LIBHIREDIS)_RDEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(REDIS_SENTINEL)
SONIC_MAKE_DEBS += $(LIBHIREDIS)
LIBHIREDIS_DEV = libhiredis-dev_$(HIREDIS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBHIREDIS),$(LIBHIREDIS_DEV)))
LIBHIREDIS_DBG = libhiredis-dbg_$(HIREDIS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBHIREDIS),$(LIBHIREDIS_DBG)))

8
rules/initramfs-tools.mk Normal file
View File

@ -0,0 +1,8 @@
# initramfs-tools package
INITRAMFS_TOOLS_VERSION = 0.120
export INITRAMFS_TOOLS_VERSION
INITRAMFS_TOOLS = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb
$(INITRAMFS_TOOLS)_SRC_PATH = $(SRC_PATH)/initramfs-tools
SONIC_MAKE_DEBS += $(INITRAMFS_TOOLS)

44
rules/libnl3.mk Normal file
View File

@ -0,0 +1,44 @@
# libnl3
LIBNL3_VERSION = 3.2.27-1
export LIBNL3_VERSION
LIBNL3 = libnl-3-200_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL3)_SRC_PATH = $(SRC_PATH)/libnl3
SONIC_MAKE_DEBS += $(LIBNL3)
LIBNL3_DEV = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL3_DEV)))
LIBNL_GENL3 = libnl-genl-3-200_$(LIBNL3_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_GENL3)))
LIBNL_GENL3_DEV = libnl-genl-3-dev_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL_GENL3_DEV)_DEPENDS += $(LIBNL_GENL3) $(LIBNL3_DEV)
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_GENL3_DEV)))
LIBNL_ROUTE3 = libnl-route-3-200_$(LIBNL3_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_ROUTE3)))
LIBNL_ROUTE3_DEV = libnl-route-3-dev_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL_ROUTE3_DEV)_DEPENDS += $(LIBNL_ROUTE3) $(LIBNL3_DEV)
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_ROUTE3_DEV)))
LIBNL_NF3 = libnl-nf-3-200_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL_NF3)_DEPENDS += $(LIBNL_ROUTE3_DEV)
$(LIBNL_NF3)_RDEPENDS += $(LIBNL_ROUTE3)
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_NF3)))
LIBNL_NF3_DEV = libnl-nf-3-dev_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL_NF3_DEV)_DEPENDS += $(LIBNL_NF3)
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_NF3_DEV)))
LIBNL_CLI = libnl-cli-3-200_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL_CLI)_DEPENDS += $(LIBNL_GENL3_DEV) $(LIBNL_NF3_DEV) $(LIBNL_ROUTE3_DEV)
$(LIBNL_CLI)_RDEPENDS += $(LIBNL_GENL3) $(LIBNL_NF3) $(LIBNL_ROUTE3)
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_CLI)))
LIBNL_CLI_DEV = libnl-cli-3-dev_$(LIBNL3_VERSION)_amd64.deb
$(LIBNL_CLI_DEV)_DEPENDS += $(LIBNL_CLI) $(LIBNL_GENL3_DEV) $(LIBNL_NF3_DEV) $(LIBNL_ROUTE3_DEV)
$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_CLI_DEV)))

21
rules/libteam.mk Normal file
View File

@ -0,0 +1,21 @@
# libteam packages
LIBTEAM_VERSION = 1.26-1
export LIBTEAM_VERSION
LIBTEAM = libteam5_$(LIBTEAM_VERSION)_amd64.deb
$(LIBTEAM)_SRC_PATH = $(SRC_PATH)/libteam
$(LIBTEAM)_DEPENDS += $(LIBNL_GENL3_DEV) $(LIBNL_CLI_DEV)
SONIC_MAKE_DEBS += $(LIBTEAM)
LIBTEAM_DEV = libteam-dev_$(LIBTEAM_VERSION)_amd64.deb
$(LIBTEAM_DEV)_DEPENDS += $(LIBTEAMDCT)
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_DEV)))
LIBTEAMDCT = libteamdctl0_$(LIBTEAM_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAMDCT)))
LIBTEAM_UTILS = libteam-utils_$(LIBTEAM_VERSION)_amd64.deb
$(LIBTEAM_UTILS)_DEPENDS += $(LIBTEAMDCT)
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_UTILS)))

9
rules/linux-kernel.mk Normal file
View File

@ -0,0 +1,9 @@
# redis package
KVERSION = 3.16.0-4-amd64
export KVERSION
LINUX_KERNEL = linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb
$(LINUX_KERNEL)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel
SONIC_MAKE_DEBS += $(LINUX_KERNEL)

12
rules/lldpd.mk Normal file
View File

@ -0,0 +1,12 @@
# lldpd package
LLDPD_VERSION = 0.9.5-0
LLDPD = lldpd_$(LLDPD_VERSION)_amd64.deb
$(LLDPD)_DEPENDS += $(LIBSNMP_DEV)
$(LLDPD)_RDEPENDS += $(LIBSNMP)
$(LLDPD)_SRC_PATH = $(SRC_PATH)/lldpd
SONIC_DPKG_DEBS += $(LLDPD)
LIBLLDPCTL = liblldpctl-dev_$(LLDPD_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LLDPD),$(LIBLLDPCTL)))

13
rules/mpdecimal.mk Normal file
View File

@ -0,0 +1,13 @@
# mpdecimal package
MPDECIMAL_VERSION = 2.4.2
MPDECIMAL_VERSION_FULL = $(MPDECIMAL_VERSION)-1
export MPDECIMAL_VERSION MPDECIMAL_VERSION_FULL
LIBMPDECIMAL = libmpdec2_$(MPDECIMAL_VERSION_FULL)_amd64.deb
$(LIBMPDECIMAL)_SRC_PATH = $(SRC_PATH)/mpdecimal
SONIC_MAKE_DEBS += $(LIBMPDECIMAL)
LIBMPDECIMAL_DEV = libmpdec-dev_$(MPDECIMAL_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBMPDECIMAL),$(LIBMPDECIMAL_DEV)))

6
rules/quagga.mk Normal file
View File

@ -0,0 +1,6 @@
# quagga package
QUAGGA = quagga_0.99.24.1-2.1_amd64.deb
$(QUAGGA)_DEPENDS += $(LIBSNMP_DEV)
$(QUAGGA)_SRC_PATH = $(SRC_PATH)/sonic-quagga
SONIC_DPKG_DEBS += $(QUAGGA)

15
rules/redis.mk Normal file
View File

@ -0,0 +1,15 @@
# redis package
REDIS_VERSION = 3.2.4-1~bpo8+1
REDIS_TOOLS = redis-tools_$(REDIS_VERSION)_amd64.deb
$(REDIS_TOOLS)_SRC_PATH = $(SRC_PATH)/redis
SONIC_MAKE_DEBS += $(REDIS_TOOLS)
REDIS_SERVER = redis-server_$(REDIS_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(REDIS_TOOLS),$(REDIS_SERVER)))
REDIS_SENTINEL = redis-sentinel_$(REDIS_VERSION)_amd64.deb
$(REDIS_SENTINEL)_DEPENDS += $(REDIS_SERVER)
$(REDIS_SENTINEL)_RDEPENDS += $(REDIS_SERVER)
$(eval $(call add_derived_package,$(REDIS_TOOLS),$(REDIS_SENTINEL)))

20
rules/sairedis.mk Normal file
View File

@ -0,0 +1,20 @@
# sairedis package
LIBSAIREDIS = libsairedis_1.0.0_amd64.deb
$(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis
$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV)
$(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON)
SONIC_DPKG_DEBS += $(LIBSAIREDIS)
LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DEV)))
SYNCD = syncd_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD)))
LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA)))
LIBSAIMETADATA_DEV = libsaimetadata-dev_1.0.0_amd64.deb
$(LIBSAIMETADATA_DEV)_DEPENDS += $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DEV)))

53
rules/snmpd.mk Normal file
View File

@ -0,0 +1,53 @@
# snmpd package
SNMPD_VERSION = 5.7.3+dfsg
SNMPD_VERSION_FULL = $(SNMPD_VERSION)-1.5
export SNMPD_VERSION SNMPD_VERSION_FULL
LIBSNMP_BASE = libsnmp-base_$(SNMPD_VERSION_FULL)_all.deb
$(LIBSNMP_BASE)_SRC_PATH = $(SRC_PATH)/snmpd
SONIC_MAKE_DEBS += $(LIBSNMP_BASE)
SNMPTRAPD = snmptrapd_$(SNMPD_VERSION_FULL)_amd64.deb
$(SNMPTRAPD)_DEPENDS += $(LIBSNMP) $(SNMPD)
$(SNMPTRAPD)_RDEPENDS += $(LIBSNMP) $(SNMPD)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPTRAPD)))
SNMP = snmp_$(SNMPD_VERSION_FULL)_amd64.deb
$(SNMP)_DEPENDS += $(LIBSNMP)
$(SNMP)_RDEPENDS += $(LIBSNMP)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMP)))
SNMPD = snmpd_$(SNMPD_VERSION_FULL)_amd64.deb
$(SNMPD)_DEPENDS += $(LIBSNMP)
$(SNMPD)_RDEPENDS += $(LIBSNMP)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPD)))
LIBSNMP = libsnmp30_$(SNMPD_VERSION_FULL)_amd64.deb
$(LIBSNMP)_RDEPENDS += $(LIBSNMP_BASE)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP)))
LIBSNMP_DBG = libsnmp30-dbg_$(SNMPD_VERSION_FULL)_amd64.deb
$(LIBSNMP_DBG)_DEPENDS += $(LIBSNMP)
$(LIBSNMP_DBG)_RDEPENDS += $(LIBSNMP)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_DBG)))
LIBSNMP_DEV = libsnmp-dev_$(SNMPD_VERSION_FULL)_amd64.deb
$(LIBSNMP_DEV)_DEPENDS += $(LIBSNMP)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_DEV)))
LIBSNMP_PERL = libsnmp-perl_$(SNMPD_VERSION_FULL)_amd64.deb
$(LIBSNMP_PERL)_DEPENDS += $(LIBSNMP)
$(LIBSNMP_PERL)_RDEPENDS += $(LIBSNMP)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_PERL)))
PYTHON_NETSNMP = python-netsnmp_$(SNMPD_VERSION_FULL)_amd64.deb
$(PYTHON_NETSNMP)_DEPENDS += $(LIBSNMP)
$(PYTHON_NETSNMP)_RDEPENDS += $(LIBSNMP)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(PYTHON_NETSNMP)))
TKMIB = tkmib_$(SNMPD_VERSION_FULL)_all.deb
$(TKMIB)_DEPENDS += $(LIBSNMP_PERL)
$(TKMIB)_RDEPENDS += $(LIBSNMP_PERL)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(TKMIB)))

6
rules/sonic-aboot.mk Normal file
View File

@ -0,0 +1,6 @@
# sonic aboot installer
SONIC_ABOOT = sonic-aboot.bin
$(SONIC_ABOOT)_MACHINE = aboot
$(SONIC_ABOOT)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS)
SONIC_INSTALLERS += $(SONIC_ABOOT)

6
rules/sonic-generic.mk Normal file
View File

@ -0,0 +1,6 @@
# sonic generic installer
SONIC_GENERIC = sonic-generic.bin
$(SONIC_GENERIC)_MACHINE = generic
$(SONIC_GENERIC)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS)
SONIC_INSTALLERS += $(SONIC_GENERIC)

6
rules/sswsdk-py2.mk Normal file
View File

@ -0,0 +1,6 @@
# sswsdk python2 wheel
SSWSDK_PY2 = sswsdk-2.0.1-py2-none-any.whl
$(SSWSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk
$(SSWSDK_PY2)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(SSWSDK_PY2)

8
rules/sswsdk-py3.mk Normal file
View File

@ -0,0 +1,8 @@
# sswsdk python3 wheel
SSWSDK_PY3 = sswsdk-2.0.1-py3-none-any.whl
$(SSWSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk
$(SSWSDK_PY3)_PYTHON_VERSION = 3
# Synthetic dependency just to avoid race condition
$(SSWSDK_PY3)_DEPENDS += $(SSWSDK_PY2)
SONIC_PYTHON_WHEELS += $(SSWSDK_PY3)

13
rules/swss-common.mk Normal file
View File

@ -0,0 +1,13 @@
# libswsscommon package
LIBSWSSCOMMON = libswsscommon_1.0.0_amd64.deb
$(LIBSWSSCOMMON)_SRC_PATH = $(SRC_PATH)/sonic-swss-common
$(LIBSWSSCOMMON)_DEPENDS += $(LIBHIREDIS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) \
$(LIBNL_ROUTE3_DEV) $(LIBNL_NF3_DEV) \
$(LIBNL_CLI_DEV)
$(LIBSWSSCOMMON)_RDEPENDS += $(LIBHIREDIS) $(LIBNL3) $(LIBNL_GENL3) \
$(LIBNL_ROUTE3) $(LIBNL_NF3) $(LIBNL_CLI)
SONIC_DPKG_DEBS += $(LIBSWSSCOMMON)
LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV)))

9
rules/swss.mk Normal file
View File

@ -0,0 +1,9 @@
# swss package
SWSS = swss_1.0.0_amd64.deb
$(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss
$(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \
$(LIBTEAMDCT) $(LIBTEAM_UTILS)
$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) $(LIBTEAMDCT) \
$(LIBTEAM_UTILS)
SONIC_DPKG_DEBS += $(SWSS)

17
rules/thrift.mk Normal file
View File

@ -0,0 +1,17 @@
# thrift package
THRIFT_VERSION = 0.9.3
THRIFT_VERSION_FULL = $(THRIFT_VERSION)-2
LIBTHRIFT = libthrift-$(THRIFT_VERSION)_$(THRIFT_VERSION_FULL)_amd64.deb
$(LIBTHRIFT)_SRC_PATH = $(SRC_PATH)/thrift
SONIC_MAKE_DEBS += $(LIBTHRIFT)
LIBTHRIFT_DEV = libthrift-dev_$(THRIFT_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBTHRIFT),$(LIBTHRIFT_DEV)))
PYTHON_THRIFT = python-thrift_$(THRIFT_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBTHRIFT),$(PYTHON_THRIFT)))
THRIFT_COMPILER = thrift-compiler_$(THRIFT_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBTHRIFT),$(THRIFT_COMPILER)))

311
slave.mk Normal file
View File

@ -0,0 +1,311 @@
###############################################################################
## Presettings
###############################################################################
# Select bash for commands
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
.SECONDEXPANSION:
SPACE :=
SPACE +=
###############################################################################
## General definitions
###############################################################################
SRC_PATH = src
RULES_PATH = rules
TARGET_PATH = target
DOCKERS_PATH = dockers
DEBS_PATH = $(TARGET_PATH)/debs
PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels
PROJECT_ROOT = $(shell pwd)
CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo undefined)
PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM)
###############################################################################
## Utility rules
## Define configuration, help etc.
###############################################################################
.platform :
@echo Build system is not configured, please run make configure
@exit 1
configure :
@mkdir -p target/debs
@mkdir -p target/python-wheels
@echo $(PLATFORM) > .platform
distclean : .platform clean
@rm -f .platform
###############################################################################
## Include other rules
###############################################################################
include $(RULES_PATH)/config
include $(RULES_PATH)/functions
include $(RULES_PATH)/*.mk
ifneq ($(CONFIGURED_PLATFORM), undefined)
include $(PLATFORM_PATH)/rules.mk
endif
MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS)
###############################################################################
## Generic rules section
## All rules must go after includes for propper targets expansion
###############################################################################
###############################################################################
## Online targets
###############################################################################
# Download debian packages from online location
# Add new package for download:
# SOME_NEW_DEB = some_new_deb.deb
# $(SOME_NEW_DEB)_URL = https://url/to/this/deb.deb
# SONIC_ONLINE_DEBS += $(SOME_NEW_DEB)
$(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform
$(HEADER)
$(foreach deb,$* $($*_DERIVED_DEBS), \
{ wget -O $(DEBS_PATH)/$(deb) $($(deb)_URL) $(LOG) || exit 1 ; } ; )
$(FOOTER)
# Download regular files from online location
# Files are stored in deb packages directory for convenience
# Add new file for download:
# SOME_NEW_FILE = some_new_file
# $(SOME_NEW_FILE)_URL = https://url/to/this/file
# SONIC_ONLINE_FILES += $(SOME_NEW_FILE)
$(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_FILES)) : $(DEBS_PATH)/% : .platform
$(HEADER)
wget -O $@ $($*_URL) $(LOG)
$(FOOTER)
# Copy debian packages from local directory
# Add new package for copy:
# SOME_NEW_DEB = some_new_deb.deb
# $(SOME_NEW_DEB)_PATH = path/to/some_new_deb.deb
# SONIC_COPY_DEBS += $(SOME_NEW_DEB)
$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform
$(HEADER)
$(foreach deb,$* $($*_DERIVED_DEBS), \
{ cp $($(deb)_PATH) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; )
$(FOOTER)
###############################################################################
## Debian package related targets
###############################################################################
# Build project using build.sh script
# They are essentially a one-time build projects that get sources from some URL
# and compile them
# Add new package for build:
# SOME_NEW_DEB = some_new_deb.deb
# $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name
# $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ...
# SONIC_MAKE_DEBS += $(SOME_NEW_DEB)
$(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)))
$(HEADER)
# remove target to force rebuild
rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS))
# build project and take package
make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG)
$(FOOTER)
# Build project with dpkg-buildpackage
# Add new package for build:
# SOME_NEW_DEB = some_new_deb.deb
# $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name
# $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ...
# SONIC_DPKG_DEBS += $(SOME_NEW_DEB)
$(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)))
$(HEADER)
# Build project and take package
rm -f $($*_SRC_PATH)/debian/*.debhelper.log
pushd $($*_SRC_PATH) $(LOG)
[ ! -f ./autogen.sh ] || ./autogen.sh $(LOG)
dpkg-buildpackage -rfakeroot -b -us -uc $(LOG)
popd $(LOG)
mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG)
$(FOOTER)
# Build project with python setup.py --command-packages=stdeb.command
# Add new package for build:
# SOME_NEW_DEB = some_new_deb.deb
# $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name
# $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ...
# SONIC_PYTHON_STDEB_DEBS += $(SOME_NEW_DEB)
$(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)))
$(HEADER)
# Build project and take package
pushd $($*_SRC_PATH) $(LOG)
python setup.py --command-packages=stdeb.command bdist_deb
popd $(LOG)
mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG)
$(FOOTER)
# Rules for derived debian packages (dev, dbg, etc.)
# All noise takes place in main deb recipe, so we are just telling that
# we depend on it and move our deb to other targets
# Add new dev package:
# $(eval $(call add_derived_package,$(ORIGINAL_DEB),derived_deb_file.deb))
$(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)))
$(HEADER)
# All noise takes place in main deb recipe, so we are just telling that
# we depend on it
# Put newer timestamp
[ -f $@ ] && touch $@
$(FOOTER)
# Targets for installing debian packages prior to build one that depends on them
SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \
$(SONIC_ONLINE_DEBS) \
$(SONIC_COPY_DEBS) \
$(SONIC_MAKE_DEBS) \
$(SONIC_DPKG_DEBS) \
$(SONIC_PYTHON_STDEB_DEBS) \
$(SONIC_DERIVED_DEBS)))
$(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(DEBS_PATH)/$$*
$(HEADER)
[ -f $(DEBS_PATH)/$* ] || { echo $(DEBS_PATH)/$* does not exist $(LOG) && exit 1; }
# put a lock here because dpkg does not allow installing packages in parallel
while true; do
if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then
{ sudo dpkg -i $(DEBS_PATH)/$* $(LOG) && rm -d $(DEBS_PATH)/dpkg_lock && break; } || { rm -d $(DEBS_PATH)/dpkg_lock && exit 1 ; }
fi
done
$(FOOTER)
###############################################################################
## Python packages
###############################################################################
# Build project using python setup.py bdist_wheel
# Projects that generate python wheels
# Add new package for build:
# SOME_NEW_WHL = some_new_whl.whl
# $(SOME_NEW_WHL)_SRC_PATH = $(SRC_PATH)/project_name
# $(SOME_NEW_WHL)_PYTHON_VERSION = 2 (or 3)
# $(SOME_NEW_WHL)_DEPENDS = $(SOME_OTHER_WHL1) $(SOME_OTHER_WHL2) ...
# SONIC_PYTHON_WHEELS += $(SOME_NEW_DEB)
$(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS)))
$(HEADER)
pushd $($*_SRC_PATH) $(LOG)
python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG)
popd $(LOG)
mv $($*_SRC_PATH)/dist/$* $(PYTHON_WHEELS_PATH) $(LOG)
$(FOOTER)
# Targets for installing python wheels.
# Autogenerated
SONIC_INSTALL_WHEELS = $(addsuffix -install, $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)))
$(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS))) $(PYTHON_WHEELS_PATH)/$$*
$(HEADER)
[ -f $(PYTHON_WHEELS_PATH)/$* ] || { echo $(PYTHON_WHEELS_PATH)/$* does not exist $(LOG) && exit 1; }
# put a lock here to avoid race conditions
while true; do
if mkdir $(PYTHON_WHEELS_PATH)/pip_lock &> /dev/null; then
{ sudo pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; }
fi
done
$(FOOTER)
###############################################################################
## Docker images related targets
###############################################################################
# start docker daemon
docker-start :
@sudo service docker start &> /dev/null && sleep 1
# targets for building simple docker images that do not depend on any debian packages
$(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
$(HEADER)
docker build --no-cache -t $* $($*.gz_PATH) $(LOG)
docker save $* | gzip -c > $@
$(FOOTER)
# Targets for building docker images
$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
$(HEADER)
mkdir -p $($*.gz_PATH)/deps $(LOG)
mkdir -p $($*.gz_PATH)/python-wheels $(LOG)
sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/deps $(LOG)
sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG)
sed 's/SED_DPKG/RUN cd deps \&\& dpkg -i $(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')/g' $($*.gz_PATH)/Dockerfile.template > $($*.gz_PATH)/Dockerfile
docker build --no-cache -t $* $($*.gz_PATH) $(LOG)
docker save $* | gzip -c > $@
$(FOOTER)
DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \
$(SONIC_SIMPLE_DOCKER_IMAGES) \
$(SONIC_DOCKER_IMAGES)))
$(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz
$(HEADER)
docker load -i $(TARGET_PATH)/$*.gz $(LOG)
$(FOOTER)
###############################################################################
## Installers
###############################################################################
# targets for building installers with base image
$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))
$(HEADER)
./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG)
TARGET_MACHINE=$($*_MACHINE) ./build_image.sh $(LOG)
$(FOOTER)
###############################################################################
## Clean targets
###############################################################################
SONIC_CLEAN_DEBS = $(addsuffix -clean,$(addprefix $(DEBS_PATH)/, \
$(SONIC_ONLINE_DEBS) \
$(SONIC_ONLINE_FILES) \
$(SONIC_COPY_DEBS) \
$(SONIC_MAKE_DEBS) \
$(SONIC_DPKG_DEBS) \
$(SONIC_PYTHON_STDEB_DEBS) \
$(SONIC_DERIVED_DEBS)))
$(SONIC_CLEAN_DEBS) : $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_DERIVED_FROM)))
@# remove derived targets if main one is removed, because we treat them
@# as part of one package
@rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS))
SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \
$(SONIC_DOCKER_IMAGES) \
$(SONIC_SIMPLE_DOCKER_IMAGES)))
$(SONIC_CLEAN_TARGETS) : $(TARGET_PATH)/%-clean : .platform
@rm -f $(TARGET_PATH)/$*
SONIC_CLEAN_WHEELS = $(addsuffix -clean,$(addprefix $(PYTHON_WHEELS_PATH)/, \
$(SONIC_PYTHON_WHEELS)))
$(SONIC_CLEAN_WHEELS) : $(PYTHON_WHEELS_PATH)/%-clean : .platform
@rm -f $(PYTHON_WHEELS_PATH)/$*
clean-logs : .platform
@rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log
clean : .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_WHEELS)
###############################################################################
## all
###############################################################################
all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL))
###############################################################################
## Standard targets
###############################################################################
.PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure
.INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start

105
sonic-slave/Dockerfile Normal file
View File

@ -0,0 +1,105 @@
FROM debian:jessie
MAINTAINER johnar@microsoft.com
RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list
RUN apt-get clean && apt-get update && apt-get install -y apt-utils default-jre-headless openssh-server curl wget unzip git build-essential libtool lintian
RUN apt-get update && apt-get install -y sudo dh-make dh-exec kmod libtinyxml2-2 libboost-program-options1.55-dev libtinyxml2-dev python python-pip libncurses5-dev texinfo dh-autoreconf python3-pip
RUN apt-get update && apt-get install -y doxygen devscripts git-buildpackage perl-modules libswitch-perl dh-systemd
# For quagga build
RUN apt-get update && apt-get install -y libreadline-dev texlive-latex-base texlive-generic-recommended texlive-fonts-recommended libpam0g-dev libpam-dev libcap-dev imagemagick ghostscript groff libpcre3-dev gawk chrpath
# For libnl3 (local) build
RUN apt-get install -y cdbs
# For SAI meta build
RUN apt-get update && apt-get install -y libxml-simple-perl
# For linux build
RUN apt-get update && apt-get install -y bc fakeroot build-essential devscripts quilt stgit
RUN apt-get update && apt-get -y build-dep linux
# For platform-modules build
RUN apt-get update && apt-get install -y module-assistant
# For thrift build
RUN apt-get update && apt-get install -y gem2deb libboost-all-dev libevent-dev libglib2.0-dev libqt4-dev python-all-dev python-twisted php5-dev phpunit libbit-vector-perl openjdk-7-jdk javahelper maven-debian-helper ant libmaven-ant-tasks-java libhttpclient-java libslf4j-java libservlet3.1-java qt5-default
# For mellanox sdk build
RUN apt-get update && apt-get install -y libpcre3 libpcre3-dev byacc flex libglib2.0-dev bison expat libexpat1-dev dpatch libdb-dev iptables-dev swig
# For mellanox sai build
RUN apt-get update && apt-get install -y libtool-bin libxml2-dev
# For build image
RUN apt-get update && apt-get install -y cpio squashfs-tools zip
# For broadcom sdk build
RUN apt-get update && apt-get install -y linux-compiler-gcc-4.8-x86 linux-kbuild-3.16
# teamd build
RUN apt-get update && apt-get install -y libdaemon-dev libdbus-1-dev libjansson-dev
# For cavium sdk build
RUN apt-get update && apt-get install -y libpcap-dev dnsutils libusb-dev
# For debian image reconfiguration
RUN apt-get update && apt-get install -y augeas-tools
# For p4 build
RUN apt-get update && apt-get install -y libyaml-dev libevent-dev libjudy-dev libedit-dev libpcap-dev libnanomsg-dev
RUN apt-get update && apt-get install -y python-stdeb
RUN pip install ctypesgen
RUN pip install crc16
# For redis build
RUN apt-get update && apt-get install -y libjemalloc-dev
# For mft kernel module build
RUN apt-get update && apt-get install -y dkms
RUN mkdir /var/run/sshd
EXPOSE 22
# For gtest
RUN apt-get update && apt-get install -y libgtest-dev cmake && cd /usr/src/gtest && cmake . && make -C /usr/src/gtest
# For Jenkins static analysis, unit testing and code coverage
RUN apt-get update && apt-get install -y cppcheck clang pylint python-pytest gcovr python-pytest=2.6.3* python-pytest-cov python-parse
# For snmpd
RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev
# For mpdecimal
RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-jinja2 python-markupsafe python-pygments python-roman python-sphinx sphinx-common python3-sphinx
# Install depot-tools (for git-retry)
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools
ENV PATH /usr/share/depot_tools:$PATH
# Install docker engine 1.11.2 inside docker
RUN curl -sSL https://get.docker.com/ | sh && apt-get install -y --force-yes -q docker-engine=1.11.2-0~jessie
# Add user
ARG user
ARG uid
ARG guid
RUN useradd $user -u $uid -g $guid -d /var/$user -m -s /bin/bash
RUN gpasswd -a $user docker
COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2
RUN chown $user /var/$user/.ssh -R
RUN chmod go= /var/$user/.ssh -R
# Add user to sudoers
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
USER $user

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC769BQUJVeSIOyPsN4/Vo8xTqXQ6RI7ysVyCw/ABP3FIxf+fxmtm8t/Nbp9hq0uLHOjCw8UQbJ+XltsThFWJfH6RJY5NbfvwG7nUDjfjjp+SGEIHaVgIlpiuqiPbZ6QMjZ8Q0Sgi5p5ts1xe/4TFThwOJBHmhwydD5nk3BH7P3DDwlOCov5gjM40uMZJkketlO83zGG+25zu7O0hfDVt1vyK9bNWAhhPmGc79zdetfeFCxjimsff2m31B1KuVXiT5PDB1w+BSrUK6nNzJubnYCRgjg4prVTjA50EhlT2P7EoJAbW3TnTq8vUDkcstsGe/HZpfIB1VHBX97u4fAfGJZ root@acs-jenkins

View File

@ -1,214 +0,0 @@
## TODO: if install dev package really happens, rebuild the depending project
.ONESHELL:
SHELL := /bin/bash
REDIS_VERSION=3.2.4-1~bpo8+1_amd64
LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb \
libnl-3-dev_3.2.27-1_amd64.deb \
libnl-genl-3-200_3.2.27-1_amd64.deb \
libnl-genl-3-dev_3.2.27-1_amd64.deb \
libnl-route-3-200_3.2.27-1_amd64.deb \
libnl-route-3-dev_3.2.27-1_amd64.deb \
libnl-nf-3-200_3.2.27-1_amd64.deb \
libnl-nf-3-dev_3.2.27-1_amd64.deb \
libnl-cli-3-200_3.2.27-1_amd64.deb \
libnl-cli-3-dev_3.2.27-1_amd64.deb
LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb \
libteamdctl0_1.26-1_amd64.deb \
libteam-dev_1.26-1_amd64.deb \
libteam-utils_1.26-1_amd64.deb
MPDECIMAL_VER=2.4.2-1
MPDECIMAL-DEBS=libmpdec2_$(MPDECIMAL_VER)_amd64.deb \
libmpdec-dev_$(MPDECIMAL_VER)_amd64.deb
PYTHON3_5_VER=3.5.2-8
PYTHON3_5-DEBS=libpython3.5-minimal_$(PYTHON3_5_VER)_amd64.deb \
python3.5-minimal_$(PYTHON3_5_VER)_amd64.deb \
libpython3.5-stdlib_$(PYTHON3_5_VER)_amd64.deb \
python3.5_$(PYTHON3_5_VER)_amd64.deb
## Function: build_project, directory
## Build the project and save the .deb target in the same directory
## TRICK: clean dh state so it will force recreating .deb later
define build_project
rm -f $(1)/debian/*.debhelper.log
pushd $(1)
[ ! -f ./autogen.sh ] || ./autogen.sh
dpkg-buildpackage -rfakeroot -b -us -uc
popd
endef
## Function: build_project_py2, directory
## Build the project and save the .deb target in the same directory
define build_project_py2
pushd $(1)
python2 setup.py bdist_wheel
popd
endef
## Function: build_project_py3, directory
## Build the project and save the .deb target in the same directory
define build_project_py3
pushd $(1)
python3 setup.py bdist_wheel
popd
endef
## Function: install_deb, debfile
install_deb = \
[ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1;
## Function: install_py2, whlfile
install_py2 = \
sudo pip install $(1)
## Function: install_py3, whlfile
install_py3 = \
sudo pip3 install $(1)
## Rules
$(LIBNL-DEBS):
pushd libnl3; ./build.sh; popd
$(LIBTEAM-DEBS): $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd libteam; ./build.sh; popd
$(MPDECIMAL-DEBS):
pushd mpdecimal; ./build.sh; popd
$(PYTHON3_5-DEBS): $(MPDECIMAL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd python3.5; ./build.sh; popd
redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb:
pushd redis; ./build.sh; popd
libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd hiredis; ./build.sh; popd
libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb thrift-compiler_0.9.3-2_amd64.deb:
pushd thrift; ./build.sh; popd
p4-bmv2_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd p4-bmv2; ./build.sh; popd
kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb mft-4.5.0-31.amd64.deb:
pushd mft; ./build.sh; popd
python-p4-hlir_0.9.36-1_all.deb:
pushd p4-hlir; ./build.sh; popd
python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb python-p4-hlir_0.9.36-1_all.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd p4c-bm; ./build.sh; popd
python-tenjin_1.1.1-1_all.deb:
pushd tenjin; ./build.sh; popd
snmpd_5.7.3+dfsg-1.5_amd64.deb snmptrapd_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb libsnmp30-dbg_5.7.3+dfsg-1.5_amd64.deb libsnmp-dev_5.7.3+dfsg-1.5_amd64.deb libsnmp-perl_5.7.3+dfsg-1.5_amd64.deb python-netsnmp_5.7.3+dfsg-1.5_amd64.deb tkmib_5.7.3+dfsg-1.5_all.deb:
pushd snmpd; ./build.sh; popd
sswsdk-2.0.1-py2-none-any.whl:
$(call build_project_py2, sonic-py-swsssdk)
cp sonic-py-swsssdk/dist/$@ .
sswsdk-2.0.1-py3-none-any.whl:
$(call build_project_py3, sonic-py-swsssdk)
cp sonic-py-swsssdk/dist/$@ .
sonic_d-2.0.0-py2-none-any.whl: sswsdk-2.0.1-py2-none-any.whl
$(foreach dep, $^, $(call install_py2, $(dep)))
$(call build_project_py2, sonic-dbsyncd)
cp sonic-dbsyncd/dist/$@ .
asyncsnmp-2.1.0-py3-none-any.whl: sswsdk-2.0.1-py3-none-any.whl
$(foreach dep, $^, $(call install_py3, $(dep)))
$(call build_project_py3, sonic-snmpagent)
cp sonic-snmpagent/dist/$@ .
p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd p4-switch; ./build.sh; popd
lldpd_0.9.5-0_amd64.deb liblldpctl-dev_0.9.5-0_amd64.deb:
## Install build dependency for lldpd
## Note: lldpd and snmpd conflict on Build-Depends, so install before build
sudo apt-get -y build-dep lldpd
$(call build_project, lldpd)
quagga_0.99.24.1-2.1_amd64.deb:
$(call build_project, sonic-quagga)
libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss-common)
brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb brcm-sdk/libopennsl_*_amd64.deb brcm-sdk/libsaibcm_1.0.2*_amd64.deb brcm-sdk/libsaibcm-dev_1.0.2*_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-sairedis)
mkdir -p brcm
cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/
mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/*.deb
## Install applibs first for late depending packages
$(call install_deb, mlnx-sdk/applibs_1.mlnx.*.deb)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(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 libsaimetadata_1.0.0_amd64.deb libsaimetadata-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 cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-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 libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb cavm/
p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-sairedis)
mkdir -p p4
cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb p4/
## Note: fpmsyncd and teamsyncd are two implicit targets
brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss)
cp swss_1.0.0_amd64.deb brcm/
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
cp sonic-swss/debian/swss/usr/bin/teamsyncd .
## Note: fpmsyncd and teamsyncd are two implicit targets
mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss)
cp swss_1.0.0_amd64.deb mlnx/
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
cp sonic-swss/debian/swss/usr/bin/teamsyncd .
## Note: fpmsyncd and teamsyncd are two implicit targets
cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS)
$(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/fpmsyncd .
cp sonic-swss/debian/swss/usr/bin/teamsyncd .
p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss)
cp swss_1.0.0_amd64.deb p4/
$(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
initramfs-tools/initramfs-tools_0.120_all.deb:
pushd initramfs-tools; ./build.sh; popd

View File

@ -1,7 +0,0 @@
## Get vendor SAI SDK
## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk
libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb
libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb
libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb
libsaibcm_1.0.2~20160727172452.52_amd64.deb

View File

@ -1,7 +0,0 @@
## 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

22
src/hiredis/Makefile Normal file
View File

@ -0,0 +1,22 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = libhiredis0.13_$(HIREDIS_VERSION_FULL)_amd64.deb
DERIVED_TARGETS = libhiredis-dbg_$(HIREDIS_VERSION_FULL)_amd64.deb libhiredis-dev_$(HIREDIS_VERSION_FULL)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf hiredis-$(HIREDIS_VERSION)
wget -O hiredis_$(HIREDIS_VERSION).orig.tar.gz http://http.debian.net/debian/pool/main/h/hiredis/hiredis_$(HIREDIS_VERSION).orig.tar.gz
wget -O hiredis_$(HIREDIS_VERSION_FULL).debian.tar.xz http://http.debian.net/debian/pool/main/h/hiredis/hiredis_$(HIREDIS_VERSION_FULL).debian.tar.xz
wget -O hiredis_$(HIREDIS_VERSION_FULL).dsc http://http.debian.net/debian/pool/main/h/hiredis/hiredis_$(HIREDIS_VERSION_FULL).dsc
dpkg-source -x hiredis_$(HIREDIS_VERSION_FULL).dsc
pushd hiredis-$(HIREDIS_VERSION)
fakeroot debian/rules binary
popd
mv $* $(DERIVED_TARGETS) $(DEST)/
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

View File

@ -1,12 +0,0 @@
#!/bin/bash -x
# Install redis-server
sudo dpkg -i redis/*.deb
wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3.orig.tar.gz
wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3-2.debian.tar.xz
wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3-2.dsc
dpkg-source -x hiredis_0.13.3-2.dsc
pushd hiredis-0.13.3; fakeroot debian/rules binary; popd
cp *.deb ..

View File

@ -0,0 +1,21 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtaining the initramfs-tools
rm -rf ./initramfs-tools
git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools
# Patch
pushd ./initramfs-tools
patch -p1 < ../loopback-file-system-support.patch
# Build the package
rm -f debian/*.debhelper.log
dpkg-buildpackage -rfakeroot -b -us -uc
popd
mv $* $(DEST)/

View File

@ -1,19 +0,0 @@
#!/bin/bash
## This script is to build the initramfs-tools with patches
##
## USAGE:
## ./build.sh
# Obtaining the initramfs-tools
rm -rf ./initramfs-tools
git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools
# Patch
pushd ./initramfs-tools
patch -p1 < $OLDPWD/loopback-file-system-support.patch
# Build the package
rm -f debian/*.debhelper.log
dpkg-buildpackage -rfakeroot -b -us -uc
popd

35
src/libnl3/Makefile Normal file
View File

@ -0,0 +1,35 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = libnl-3-200_$(LIBNL3_VERSION)_amd64.deb
DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \
libnl-genl-3-200_$(LIBNL3_VERSION)_amd64.deb \
libnl-genl-3-dev_$(LIBNL3_VERSION)_amd64.deb \
libnl-route-3-200_$(LIBNL3_VERSION)_amd64.deb \
libnl-route-3-dev_$(LIBNL3_VERSION)_amd64.deb \
libnl-nf-3-200_$(LIBNL3_VERSION)_amd64.deb \
libnl-nf-3-dev_$(LIBNL3_VERSION)_amd64.deb \
libnl-cli-3-200_$(LIBNL3_VERSION)_amd64.deb \
libnl-cli-3-dev_$(LIBNL3_VERSION)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtaining the libnl3
rm -rf ./libnl3
git clone https://anonscm.debian.org/git/collab-maint/libnl3.git
pushd ./libnl3
git checkout -f b77c0e49cb
# Patch
export QUILT_PATCHES=debian/patches
quilt push
quilt push
quilt push
quilt push
quilt push
dpkg-buildpackage -rfakeroot -b -us -uc
popd
mv $(DERIVED_TARGETS) $* $(DEST)/
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

View File

@ -1,23 +0,0 @@
#!/bin/bash
## This script is to build the libnl3 3.2.27-1
##
## USAGE:
## ./build.sh
# Obtaining the libnl3
rm -rf ./libnl3
git clone https://anonscm.debian.org/git/collab-maint/libnl3.git
pushd ./libnl3
git checkout -f b77c0e49cb
# Patch
export QUILT_PATCHES=debian/patches
quilt push
quilt push
quilt push
quilt push
quilt push
dpkg-buildpackage -rfakeroot -b -us -uc
popd
cp *.deb ..

31
src/libteam/Makefile Normal file
View File

@ -0,0 +1,31 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = libteam5_$(LIBTEAM_VERSION)_amd64.deb
DERIVED_TARGETS = libteam-dev_$(LIBTEAM_VERSION)_amd64.deb \
libteamdctl0_$(LIBTEAM_VERSION)_amd64.deb \
libteam-utils_$(LIBTEAM_VERSION)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtain libteam
rm -rf ./libteam
git clone https://github.com/jpirko/libteam.git
pushd ./libteam
git checkout -f v1.26
popd
git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp
pushd ./tmp
git checkout -f da006f2 # v1.26
popd
mv tmp/debian libteam/
rm -rf tmp
pushd ./libteam
dpkg-buildpackage -rfakeroot -b -us -uc
popd
mv $(DERIVED_TARGETS) $* $(DEST)/
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

View File

@ -1,26 +0,0 @@
#!/bin/bash
## This script is to build libteam
##
## USAGE:
## ./build.sh
# Obtain libteam
rm -rf ./libteam
git clone https://github.com/jpirko/libteam.git
pushd ./libteam
git checkout -f v1.26
popd
git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp
pushd ./tmp
git checkout -f da006f2 # v1.26
popd
mv tmp/debian libteam/
rm -rf tmp
pushd ./libteam
dpkg-buildpackage -rfakeroot -b -us -uc
popd
cp *.deb ..

View File

@ -1,22 +0,0 @@
#!/bin/bash
## This script is to build the kernel-mft-dkms_4.5.0-3.16.0-4-amd64 kernel modules
##
## USAGE:
## ./build.sh
MFT_NAME=mft-4.5.0-31-x86_64-deb
MFT_TGZ=${MFT_NAME}.tgz
MFT_KERNEL_DEB=kernel-mft-dkms_4.5.0-31_all.deb
KERNELVER=3.16.0-4-amd64
wget -N http://www.mellanox.com/downloads/MFT/${MFT_TGZ}
tar xzf $MFT_TGZ
pushd $MFT_NAME/SDEBS
dpkg -i $MFT_KERNEL_DEB
TARBALL_PATH=$(dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k ${KERNELVER} --media tar | grep "Disk image location" | cut -d':' -f2)
echo $TARBALL_PATH
tar xvf $TARBALL_PATH
popd
cp $MFT_NAME/SDEBS/ubuntu-drivers/3.16.0/kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb ../
cp $MFT_NAME/DEBS/mft-4.5.0-31.amd64.deb ../

View File

@ -1,24 +0,0 @@
## Get vendor SAI SDK
## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk
fw-SPC.mfa
applibs-dev_1.mlnx.4.2.3002_amd64.deb
applibs_1.mlnx.4.2.3002_amd64.deb
iproute2-dev_1.mlnx.4.2.3002_amd64.deb
iproute2_1.mlnx.4.2.3002_amd64.deb
python-sdk-api_1.mlnx.4.2.3002_amd64.deb
sx-complib-dev-static_1.mlnx.4.2.3002_amd64.deb
sx-complib-dev_1.mlnx.4.2.3002_amd64.deb
sx-complib_1.mlnx.4.2.3002_amd64.deb
sx-examples-dev_1.mlnx.4.2.3002_amd64.deb
sx-examples_1.mlnx.4.2.3002_amd64.deb
sx-gen-utils-dev_1.mlnx.4.2.3002_amd64.deb
sx-gen-utils_1.mlnx.4.2.3002_amd64.deb
sx-kernel-dev_1.mlnx.4.2.3002_amd64.deb
sx-kernel_1.mlnx.4.2.3002_amd64.deb
sx-scew-dev-static_1.mlnx.4.2.3002_amd64.deb
sx-scew-dev_1.mlnx.4.2.3002_amd64.deb
sx-scew_1.mlnx.4.2.3002_amd64.deb
sxd-libs-dev-static_1.mlnx.4.2.3002_amd64.deb
sxd-libs-dev_1.mlnx.4.2.3002_amd64.deb
sxd-libs_1.mlnx.4.2.3002_amd64.deb

22
src/mpdecimal/Makefile Normal file
View File

@ -0,0 +1,22 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = libmpdec2_$(MPDECIMAL_VERSION_FULL)_amd64.deb
DERIVED_TARGETS = libmpdec-dev_$(MPDECIMAL_VERSION_FULL)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf mpdecimal-$(MPDECIMAL_VERSION)
wget -N -O mpdecimal_$(MPDECIMAL_VERSION).orig.tar.gz http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_$(MPDECIMAL_VERSION).orig.tar.gz
wget -N -O mpdecimal_$(MPDECIMAL_VERSION_FULL).debian.tar.xz http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_$(MPDECIMAL_VERSION_FULL).debian.tar.xz
wget -N -O mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc
dpkg-source -x mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc
pushd mpdecimal-$(MPDECIMAL_VERSION)
dpkg-buildpackage -us -uc -b
popd
mv $* $(DERIVED_TARGETS) $(DEST)/
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

View File

@ -1,20 +0,0 @@
#!/bin/bash
MPDECIMAL_VER=2.4.2
MPDECIMAL_DEB_VER=1
wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}.orig.tar.gz
wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.debian.tar.xz
wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.dsc
dpkg-source -x mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.dsc
pushd mpdecimal-${MPDECIMAL_VER}
sudo apt-get -y build-dep mpdecimal
dpkg-buildpackage -us -uc -b
popd
cp *.deb ../

View File

@ -1,5 +0,0 @@
#!/bin/bash -x
pushd behavioral-model; ./autogen.sh; dpkg-buildpackage -us -uc -b -j4; popd
cp *.deb ../

View File

@ -1,7 +0,0 @@
#!/bin/bash -x
pushd p4-hlir
python setup.py --command-packages=stdeb.command bdist_deb
popd
cp p4-hlir/deb_dist/*.deb ../

View File

@ -1,17 +0,0 @@
#!/bin/bash -x
sudo pip install ctypesgen
sudo pip install crc16
pushd switch
mkdir -p p4-build/bmv2/switch
mkdir -p p4-build/bmv2/pd_thrift_gen
./autogen.sh
dpkg-buildpackage -us -uc -b -j4
popd
cp *.deb ../

Some files were not shown because too many files have changed in this diff Show More