Squash merge master (11de390)
This commit is contained in:
parent
854d12f848
commit
e4bd20c18a
14
.gitmodules
vendored
14
.gitmodules
vendored
@ -1,3 +1,15 @@
|
||||
[submodule "docker-base"]
|
||||
path = docker-base
|
||||
path = dockers/docker-base
|
||||
url = https://github.com/Azure/sonic-docker-base.git
|
||||
[submodule "sonic-swss-common"]
|
||||
path = src/sonic-swss-common
|
||||
url = https://github.com/Azure/sonic-swss-common
|
||||
[submodule "sonic-linux-kernel"]
|
||||
path = src/sonic-linux-kernel
|
||||
url = https://github.com/Azure/sonic-linux-kernel
|
||||
[submodule "sonic-sairedis"]
|
||||
path = src/sonic-sairedis
|
||||
url = https://github.com/Azure/sonic-sairedis
|
||||
[submodule "sonic-swss"]
|
||||
path = src/sonic-swss
|
||||
url = https://github.com/Azure/sonic-swss
|
||||
|
111
Makefile
Normal file
111
Makefile
Normal file
@ -0,0 +1,111 @@
|
||||
## TODO: if install dev package really happens, rebuild the depending project
|
||||
|
||||
## Arguments from make command line
|
||||
USERNAME=
|
||||
PASSWORD_ENCRYPTED=
|
||||
|
||||
## Select bash for commands
|
||||
SHELL := /bin/bash
|
||||
|
||||
## Capture all the files in SDK directories
|
||||
MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb))
|
||||
BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb))
|
||||
|
||||
## 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
|
||||
|
||||
## Rules
|
||||
.phony : brcm-all mlnx-all
|
||||
|
||||
src/%:
|
||||
$(MAKE) -C src $(subst src/,,$@)
|
||||
|
||||
dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-fpm/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-orchagent-mlnx/deps/%: src/mlnx/%
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-orchagent/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-orchagent/deps/%: src/brcm/%
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%-mlnx/deps/syncd_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%/deps/syncd_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%/deps/libsairedis_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-syncd/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
target/docker-base.gz:
|
||||
$(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)
|
||||
## 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) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb)
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd)
|
||||
docker load < $<
|
||||
$(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 orchagent swssconfig portsyncd intfsyncd neighsyncd)
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd)
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/acs-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/acs-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/acs-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz)
|
||||
|
||||
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
|
||||
mlnx-all: target/acs-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz)
|
48
README.md
48
README.md
@ -1,44 +1,42 @@
|
||||
# Build Switch Images - buildimage
|
||||
# Build SONiC Switch Images - buildimage
|
||||
|
||||
# Description
|
||||
Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS.
|
||||
|
||||
# Prerequisite
|
||||
## 1. Build environment
|
||||
Preferably use [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile), or use Debian Jessie and manually install packages appearing in the Dockerfile.
|
||||
## 2. Linux kernel with switch drivers
|
||||
Build the [Azure/sonic-linux-kernel](https://github.com/Azure/sonic-linux-kernel) project and copy the output .deb file into ./deps directory.
|
||||
## 1. Clone or fetch the code repository with all git submodules
|
||||
To clone the code repository recursively, assuming git version 1.9 or newer
|
||||
|
||||
## 3. initramfs-tools with loop device support
|
||||
Run the script to build the .deb file into ./deps directory.
|
||||
git clone --recursive https://github.com/Azure/sonic-buildimage.git
|
||||
|
||||
./get_deps.sh
|
||||
|
||||
## 4. Fetch the git submodule
|
||||
If there is no files under ./docker-base, manually fetch them.
|
||||
If it is already cloned, however there is no files under ./dockers/docker-base/ or ./src/sonic-linux-kernel/, manually fetch all the git submodules.
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
## 2. Build environment
|
||||
Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container.
|
||||
|
||||
# Usage
|
||||
## Build NOS installer image
|
||||
## Build NOS installer image and docker images
|
||||
|
||||
./build_debian USERNAME PASSWORD_ENCRYPTED && ./build_image.sh
|
||||
|
||||
For example, the user name is 'admin' and the password is 'YourPaSsWoRd'.
|
||||
make [VENDOR]-all USERNAME=[USERNAME] PASSWORD_ENCRYPTED=[PASSWORD_ENCRYPTED]
|
||||
|
||||
./build_debian.sh "admin" "$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" && ./build_image.sh
|
||||
Supported VENDOR are:
|
||||
- brcm: Broadcom
|
||||
- mlnx: Mellanox
|
||||
|
||||
For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. To build all the images for Broadcom platform, use the command:
|
||||
|
||||
make brcm-all USERNAME="admin" PASSWORD_ENCRYPTED="$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')"
|
||||
|
||||
The root is disabled, but the created user could sudo.
|
||||
|
||||
|
||||
## Build docker images
|
||||
|
||||
./build_docker.sh docker-sswsyncd
|
||||
./build_docker.sh docker-database
|
||||
./build_docker.sh docker-bgp
|
||||
./build_docker.sh docker-snmp
|
||||
./build_docker.sh docker-lldp
|
||||
./build_docker.sh docker-basic_router
|
||||
The target directory is ./target, containing the NOS installer image and docker images.
|
||||
- acs-generic.bin: SONiC switch installer image (ONIE compatiable)
|
||||
- docker-base.gz: base docker image where others are built from (gzip tar archive)
|
||||
- docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive)
|
||||
- docker-orchagent.gz: docker image for SWitch State Service (SWSS)
|
||||
- docker-syncd.gz: docker image for the daemon to sync database and switch ASIC
|
||||
|
||||
# Contribution guide
|
||||
|
||||
|
@ -89,7 +89,7 @@ trap_push clean_sys
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs
|
||||
|
||||
## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates
|
||||
sudo cp docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/
|
||||
sudo cp dockers/docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/
|
||||
sudo cp files/apt/apt.conf.d/81norecommends $FILESYSTEM_ROOT/etc/apt/apt.conf.d/
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual`'
|
||||
|
||||
@ -142,7 +142,7 @@ wget $docker_deb_url -qO $docker_deb_temp && {
|
||||
}
|
||||
sudo chroot $FILESYSTEM_ROOT docker version
|
||||
sudo chroot $FILESYSTEM_ROOT service docker stop
|
||||
## Add docker config drop-in to select aufs, otherwise it may other storage driver
|
||||
## Add docker config drop-in to select aufs, otherwise it may select other storage driver
|
||||
sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/
|
||||
## Note: $_ means last argument of last command
|
||||
sudo cp files/docker/docker.service.conf $_
|
||||
|
@ -42,19 +42,19 @@ done
|
||||
shift "$((OPTIND - 1))"
|
||||
|
||||
## Dockerfile directory
|
||||
DOCKER_BUILD_DIR=$1
|
||||
DOCKER_BUILD_DIR=dockers/$1
|
||||
REGISTRY_SERVER=$2
|
||||
REGISTRY_PORT=$3
|
||||
REGISTRY_USERNAME=$4
|
||||
REGISTRY_PASSWD=$5
|
||||
|
||||
[ -d "$DOCKER_BUILD_DIR" ] || {
|
||||
[ -f "$DOCKER_BUILD_DIR"/Dockerfile ] || {
|
||||
echo "Invalid DOCKER_BUILD_DIR directory" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "$docker_image_name" ] || {
|
||||
docker_image_name=$DOCKER_BUILD_DIR
|
||||
docker_image_name=$(basename $DOCKER_BUILD_DIR)
|
||||
}
|
||||
|
||||
[ ${BUILD_NUMBER} ] || {
|
||||
@ -93,10 +93,14 @@ image_id=$(docker inspect --format="{{json .Id}}" $docker_image_name | sed -e 's
|
||||
## TODO: wait docker-squash supporting Docker 1.10+
|
||||
## ref: https://github.com/jwilder/docker-squash/issues/45
|
||||
if [ "$docker_image_name" = "docker-base" ]; then
|
||||
## Run old image in a container
|
||||
tmp_container=$(docker run -d ${docker_image_name} /bin/bash)
|
||||
## Export the container's filesystem, then import as a new image
|
||||
docker export $tmp_container | docker import - ${docker_image_name}
|
||||
trap_push "docker rmi $image_id"
|
||||
trap_push "docker rm -f $tmp_container || true"
|
||||
## Remove the container
|
||||
docker rm -f $tmp_container || true
|
||||
## Remove the old image
|
||||
docker rmi -f $image_id || true
|
||||
fi
|
||||
|
||||
image_sha=''
|
||||
@ -113,8 +117,8 @@ if [ -n "$REGISTRY_SERVER" ] && [ -n "$REGISTRY_PORT" ]; then
|
||||
|
||||
## Push image to registry server
|
||||
## And get the image digest SHA256
|
||||
trap_push "docker rmi $remote_image_name"
|
||||
trap_push "docker rmi $build_remote_image_name"
|
||||
trap_push "docker rmi $remote_image_name || true"
|
||||
trap_push "docker rmi $build_remote_image_name || true"
|
||||
image_sha=$(docker push $remote_image_name | sed -n "s/.*: digest: sha256:\([0-9a-f]*\).*/\\1/p")
|
||||
docker push $build_remote_image_name
|
||||
fi
|
||||
|
@ -19,6 +19,7 @@
|
||||
}
|
||||
GIT_REVISION=$(git rev-parse --short HEAD)
|
||||
|
||||
mkdir -p `dirname $OUTPUT_ONIE_IMAGE`
|
||||
sudo rm -f $OUTPUT_ONIE_IMAGE
|
||||
if [ "$TARGET_MACHINE" = "generic" ]; then
|
||||
## Generate an ONIE installer image
|
||||
|
@ -1,48 +0,0 @@
|
||||
FROM debian:jessie
|
||||
|
||||
MAINTAINER Pavel Shirshov
|
||||
|
||||
## Copy dependencies
|
||||
COPY deps /root/deps
|
||||
|
||||
## Make apt-get non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
## Set the apt source, update package cache and install necessary packages
|
||||
RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get dist-upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
openssh-server \
|
||||
vim-tiny \
|
||||
python \
|
||||
python-scapy \
|
||||
net-tools \
|
||||
python-setuptools \
|
||||
supervisor \
|
||||
traceroute \
|
||||
lsof \
|
||||
tcpdump \
|
||||
&& dpkg -i /root/deps/python-ptf_*.deb \
|
||||
&& dpkg -i --force-depends /root/deps/libthrift-0.9.2_*.deb \
|
||||
&& dpkg -i --force-depends /root/deps/python-thrift_*.deb \
|
||||
&& apt-get -y install -f \
|
||||
&& rm -rf /root/deps \
|
||||
&& apt-get -y autoclean \
|
||||
&& apt-get -y autoremove \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
## Adjust sshd settings
|
||||
RUN mkdir /var/run/sshd \
|
||||
&& echo 'root:root' | chpasswd \
|
||||
&& sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
|
||||
&& sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \
|
||||
&& sed -i '$aUseDNS no' /etc/ssh/sshd_config \
|
||||
&& mkdir /root/deps
|
||||
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
ENTRYPOINT ["/usr/bin/supervisord"]
|
@ -1,6 +1,6 @@
|
||||
FROM docker-base
|
||||
|
||||
COPY deps/*py2*.whl deps/python-sswsdk_*.deb deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/
|
||||
COPY deps/*py2*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/
|
||||
|
||||
## Pre-install the fundamental packages
|
||||
## Install Python SSWSDK (lldpsyncd dependancy)
|
||||
@ -10,8 +10,10 @@ COPY deps/*py2*.whl deps/python-sswsdk_*.deb deps/lldpsyncd_*.deb deps/lldpd_*.d
|
||||
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \
|
||||
dpkg_apt /deps/lldpd_*.deb && \
|
||||
dpkg_apt /deps/lldpsyncd_*.deb && \
|
||||
apt-get install -y python-pip && \
|
||||
pip install /deps/*.whl && \
|
||||
apt-get remove -y python-pip && \
|
||||
apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \
|
||||
pip install --no-cache-dir /deps/*.whl && \
|
||||
rm -rf /deps
|
||||
|
||||
## There is a known bug: agetty processes at 100% cpu
|
@ -12,7 +12,7 @@ if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then
|
||||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
|
||||
PORTSYNCD_ARGS+="-p /etc/ssw/ACS-S6000/port_config.ini"
|
||||
elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then
|
||||
ORCHAGENT_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini"
|
||||
PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini"
|
||||
fi
|
||||
|
||||
service rsyslog start
|
75
dockers/docker-ptf/Dockerfile
Normal file
75
dockers/docker-ptf/Dockerfile
Normal file
@ -0,0 +1,75 @@
|
||||
FROM debian:jessie
|
||||
|
||||
MAINTAINER Pavel Shirshov
|
||||
|
||||
## Copy dependencies
|
||||
COPY deps /root/deps
|
||||
|
||||
## Make apt-get non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
## Set the apt source, update package cache and install necessary packages
|
||||
RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get dist-upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
openssh-server \
|
||||
vim \
|
||||
python \
|
||||
python-scapy \
|
||||
net-tools \
|
||||
python-setuptools \
|
||||
supervisor \
|
||||
traceroute \
|
||||
lsof \
|
||||
tcpdump \
|
||||
unzip \
|
||||
pkg-config \
|
||||
binutils \
|
||||
net-tools \
|
||||
python-pip \
|
||||
build-essential \
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python-dev \
|
||||
wget \
|
||||
cmake \
|
||||
&& dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \
|
||||
&& dpkg_apt /root/deps/python-ptf_*.deb \
|
||||
&& dpkg_apt /root/deps/libthrift-0.9.2_*.deb \
|
||||
&& dpkg_apt /root/deps/python-thrift_*.deb \
|
||||
&& rm -rf /root/deps \
|
||||
&& apt-get -y autoclean \
|
||||
&& apt-get -y autoremove \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
|
||||
&& tar xvfz 1.0.0.tar.gz \
|
||||
&& cd nanomsg-1.0.0 \
|
||||
&& mkdir -p build \
|
||||
&& cmake . \
|
||||
&& make install \
|
||||
&& ldconfig \
|
||||
&& cd .. \
|
||||
&& rm -fr nanomsg-1.0.0 \
|
||||
&& rm -f 1.0.0.tar.gz \
|
||||
&& pip install cffi \
|
||||
&& pip install --upgrade cffi \
|
||||
&& pip install nnpy \
|
||||
&& mkdir -p /opt \
|
||||
&& cd /opt \
|
||||
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
|
||||
|
||||
## Adjust sshd settings
|
||||
RUN mkdir /var/run/sshd \
|
||||
&& echo 'root:root' | chpasswd \
|
||||
&& sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
|
||||
&& sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \
|
||||
&& sed -i '$aUseDNS no' /etc/ssh/sshd_config \
|
||||
&& mkdir /root/deps
|
||||
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
ENTRYPOINT ["/usr/bin/supervisord"]
|
@ -15,11 +15,11 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
|
||||
## TODO: add kmod into Depends
|
||||
RUN apt-get install -f kmod
|
||||
|
||||
COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/local/bin/"]
|
||||
COPY ["deps/dsserve", "deps/bcmcmd", "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/local/bin/start.sh \
|
||||
ENTRYPOINT /usr/bin/start.sh \
|
||||
&& /bin/bash
|
@ -41,5 +41,11 @@ docker_try_rmi() {
|
||||
local image_name="$1"
|
||||
## Note: inspect output has quotation characters, so sed to remove it as an argument
|
||||
local image_id=$(docker inspect --format="{{json .Id}}" $image_name | sed -e 's/^"//' -e 's/"$//')
|
||||
[ -z "$image_id" ] || docker rmi $image_name
|
||||
[ -z "$image_id" ] || {
|
||||
## Remove all the exited containers from this image
|
||||
docker ps -a -q -f "status=exited" -f "ancestor=$1" | xargs --no-run-if-empty docker rm
|
||||
## Note: If there are running containers from this image, the build system is in an
|
||||
## unexpected state. The 'rmi' will fail and we need investigate the build environment.
|
||||
docker rmi $image_name
|
||||
}
|
||||
}
|
||||
|
19
get_deps.sh
19
get_deps.sh
@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
## This script is to build the dependencies of an ONIE installer image
|
||||
##
|
||||
## USAGE:
|
||||
## ./get_deps.sh
|
||||
|
||||
# Obtaining the initramfs-tools
|
||||
rm -rf deps/initramfs-tools
|
||||
git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git deps/initramfs-tools
|
||||
|
||||
# Patch
|
||||
pushd deps/initramfs-tools
|
||||
patch -p1 < $OLDPWD/patch/initramfs-tools/loopback-file-system-support.patch
|
||||
|
||||
# Build the package
|
||||
fakeroot debian/rules clean
|
||||
fakeroot debian/rules binary
|
||||
|
||||
popd
|
@ -1,5 +1,5 @@
|
||||
## DESCRIPTION:
|
||||
## partition related config
|
||||
## config for ONIE image
|
||||
##
|
||||
|
||||
## Partition size in MB
|
||||
@ -19,4 +19,4 @@ FILESYSTEM_SQUASHFS=fs.squashfs
|
||||
ONIE_INSTALLER_PAYLOAD=fs.zip
|
||||
|
||||
## Output file name for onie installer
|
||||
OUTPUT_ONIE_IMAGE=acs-$TARGET_MACHINE.bin
|
||||
OUTPUT_ONIE_IMAGE=target/acs-$TARGET_MACHINE.bin
|
||||
|
67
src/Makefile
Normal file
67
src/Makefile
Normal file
@ -0,0 +1,67 @@
|
||||
## TODO: if install dev package really happens, rebuild the depending project
|
||||
|
||||
.ONESHELL:
|
||||
SHELL := /bin/bash
|
||||
|
||||
## 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: install_deb, debfile
|
||||
install_deb = \
|
||||
[ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1;
|
||||
|
||||
## Rules
|
||||
quagga_0.99.24.1-2_amd64.deb:
|
||||
pushd quagga; ./build.sh; popd
|
||||
|
||||
redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.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_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb
|
||||
pushd hiredis; ./build.sh; popd
|
||||
|
||||
libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb
|
||||
$(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: 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 brcm/
|
||||
|
||||
mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/applibs_1.mlnx.4.2.2100_amd64.deb mlnx-sdk/*.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 mlnx/
|
||||
|
||||
## Note: fpmsyncd is one implicit target
|
||||
brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/portsyncd brcm/routeresync brcm/swssconfig: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb
|
||||
$(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/* brcm/
|
||||
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
|
||||
|
||||
## Note: fpmsyncd is one implicit target
|
||||
mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/portsyncd mlnx/routeresync mlnx/swssconfig: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb
|
||||
$(foreach dep, $^, $(call install_deb, $(dep)))
|
||||
$(call build_project, sonic-swss)
|
||||
cp swss_1.0.0_amd64.deb mlnx/
|
||||
cp sonic-swss/debian/swss/usr/bin/* mlnx/
|
||||
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
|
||||
|
||||
$(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb):
|
||||
pushd sonic-linux-kernel; sudo ./build.sh; popd
|
||||
|
||||
initramfs-tools/initramfs-tools_0.120_all.deb:
|
||||
pushd initramfs-tools; ./build.sh; popd
|
4
src/brcm-sdk/filelist.txt
Normal file
4
src/brcm-sdk/filelist.txt
Normal file
@ -0,0 +1,4 @@
|
||||
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
|
14
src/hiredis/build.sh
Executable file
14
src/hiredis/build.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
sudo apt-get install -y libjemalloc-dev
|
||||
|
||||
# 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 ..
|
19
src/initramfs-tools/build.sh
Executable file
19
src/initramfs-tools/build.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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
|
32
src/mlnx-sdk/filelist.txt
Normal file
32
src/mlnx-sdk/filelist.txt
Normal file
@ -0,0 +1,32 @@
|
||||
applibs-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
applibs_1.mlnx.4.2.2100_amd64.deb
|
||||
iproute2-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
iproute2_1.mlnx.4.2.2100_amd64.deb
|
||||
mft_4.1.0-28_amd64.deb
|
||||
mlnx-sai_1.mlnx.160712_amd64.deb
|
||||
python-sdk-api_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-acl-rm-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-acl-rm_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-complib-dev-static_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-complib-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-complib_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-examples-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-examples_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-gen-utils-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-gen-utils_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-kernel-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-kernel_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-libnl-dev-static_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-libnl-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-libnl_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-scew-dev-static_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-scew-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-scew_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-sdn-hal-dev-static_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-sdn-hal-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sx-sdn-hal_1.mlnx.4.2.2100_amd64.deb
|
||||
sxd-libs-dev-static_1.mlnx.4.2.2100_amd64.deb
|
||||
sxd-libs-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
sxd-libs_1.mlnx.4.2.2100_amd64.deb
|
||||
testx-dev_1.mlnx.4.2.2100_amd64.deb
|
||||
testx_1.mlnx.4.2.2100_amd64.deb
|
36
src/quagga/build.sh
Executable file
36
src/quagga/build.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
mkdir quagga
|
||||
|
||||
# Get debian source for 0.9.24.1-2
|
||||
wget -O quagga_0.99.24.1.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/quagga_0.99.24.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=7g3AC%2FkoX3wYztJYtXFt6Wl7zj%2BYwLkbXVNaSaRvUDU%3D&se=2026-07-21T00%3A07%3A31Z&sp=r'
|
||||
tar -xzf quagga_0.99.24.1.orig.tar.gz --strip-components=1 -C quagga
|
||||
ls -lrt
|
||||
|
||||
# Get debian packaging for 0.99.24.1-2
|
||||
wget -O quagga_0.99.24.1-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/quagga_0.99.24.1-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=VFEq4ec99OjVaypAx14DkO5I8N4CIBIPOuSw79qHUXg%3D&se=2026-07-21T00%3A03%3A10Z&sp=r'
|
||||
tar -xJf quagga_0.99.24.1-2.debian.tar.xz -C quagga
|
||||
ls -lrt
|
||||
|
||||
cd quagga
|
||||
ls -lrt
|
||||
|
||||
# Enable FPM in debian/rules
|
||||
awk '/--with-libpam/ { print; print " --enable-fpm \\"; next }1' debian/rules > tmp && mv tmp debian/rules
|
||||
|
||||
# Update changelog
|
||||
#echo 'quagga (0.99.24.1-2.1) unstable; urgency=medium
|
||||
#
|
||||
# * Non-maintainer upload.
|
||||
# * enable fpm
|
||||
#
|
||||
# -- Guohan Lu <gulv@microsoft.com> Sat, 18 Jul 2015 16:10:47 -0700
|
||||
#' > tmp && cat debian/changelog >> tmp && mv tmp debian/changelog
|
||||
|
||||
#./configure --enable-fpm
|
||||
#make
|
||||
|
||||
sudo chmod a+x debian/rules
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc
|
||||
cd ..
|
||||
cp *.deb ..
|
14
src/redis/build.sh
Executable file
14
src/redis/build.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
export REDIS_DOWNLOAD_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7.orig.tar.gz
|
||||
export REDIS_PACKAGING_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7-2.debian.tar.xz
|
||||
|
||||
wget -O redis_3.0.7-2.dsc 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.dsc?sv=2015-04-05&sr=b&sig=evQtsWTIUFlgWbzLLifS1lDgop%2BzlqIP8ehZl3p%2FCKI%3D&se=2026-07-24T01%3A48%3A19Z&sp=r'
|
||||
wget -O redis_3.0.7.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7.orig.tar.gz?sv=2015-04-05&sr=b&sig=0ht16%2Fi8%2FPZQHp1PrDPYW0iRwcLfUPw1JpKUapizu8o%3D&se=2026-07-24T01%3A48%3A49Z&sp=r'
|
||||
wget -O redis_3.0.7-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=4a33ECTvURfNUEDkS436ZlSsIpLIC9QdJrBBRIoWpW0%3D&se=2026-07-24T01%3A49%3A22Z&sp=r'
|
||||
|
||||
dpkg-source -x redis_3.0.7-2.dsc
|
||||
|
||||
pushd redis-3.0.7; fakeroot debian/rules binary; popd
|
||||
|
||||
cp *.deb ..
|
1
src/sonic-linux-kernel
Submodule
1
src/sonic-linux-kernel
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 9794d29a08a4f81fbcd900e03072561f42b81074
|
1
src/sonic-sairedis
Submodule
1
src/sonic-sairedis
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 68b0a9b914c3a3816c809d7951de70136d09dc27
|
1
src/sonic-swss
Submodule
1
src/sonic-swss
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit b56c9cc507cdfc473d6d0d1159f134dfd83a96df
|
1
src/sonic-swss-common
Submodule
1
src/sonic-swss-common
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 38b461a168a6154aad978d3a97f08c2c933e943a
|
Loading…
Reference in New Issue
Block a user