Skip to content

Commit

Permalink
Merge pull request #6 from Azure/master
Browse files Browse the repository at this point in the history
Sync to master
  • Loading branch information
nikos-github authored Jan 30, 2018
2 parents 58082cd + 26efb65 commit 5707b61
Show file tree
Hide file tree
Showing 348 changed files with 20,145 additions and 3,219 deletions.
25 changes: 15 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,32 @@ target/
# Subdirectories in src
src/hiredis/*
!src/hiredis/Makefile
src/igb/*
!src/igb/Makefile
src/initramfs-tools/*
!src/initramfs-tools/Makefile
src/redis/*
!src/redis/Makefile
src/isc-dhcp/*
!src/isc-dhcp/Makefile
!src/isc-dhcp/patch/
src/libnl3/*
!src/libnl3/Makefile
src/libteam/*
!src/libteam/Makefile
src/snmpd/*
!src/snmpd/Makefile
src/thrift/*
!src/thrift/Makefile
src/sonic-device-data/src/device/
src/sonic-device-data/src/debian/
src/igb/*
!src/igb/Makefile
src/mpdecimal/*
!src/mpdecimal/Makefile
src/python3/*
!src/python3/Makefile
src/redis/*
!src/redis/Makefile
src/snmpd/*
!src/snmpd/Makefile
src/sonic-device-data/src/device/
src/sonic-device-data/src/debian/
src/supervisor/*
!src/supervisor/Makefile
!src/supervisor/patch/
src/thrift/*
!src/thrift/Makefile

# Autogenerated Dockerfiles
dockers/docker-base/Dockerfile
Expand All @@ -46,6 +50,7 @@ dockers/docker-fpm-quagga/Dockerfile
dockers/docker-lldp-sv2/Dockerfile
dockers/docker-orchagent/Dockerfile
dockers/docker-platform-monitor/Dockerfile
dockers/docker-router-advertiser/Dockerfile
dockers/docker-snmp-sv2/Dockerfile
dockers/docker-teamd/Dockerfile
dockers/docker-sonic-mgmt/Dockerfile
Expand Down
18 changes: 12 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
[submodule "sonic-swss"]
path = src/sonic-swss
url = https://github.com/Azure/sonic-swss
[submodule "src/p4-switch/switch"]
path = platform/p4/p4-switch/switch
url = https://github.com/krambn/switch
[submodule "src/p4-bmv2/behavioral-model"]
path = platform/p4/p4-bmv/behavioral-model
url = https://github.com/krambn/behavioral-model
[submodule "src/p4c-bm/p4c-bm"]
path = platform/p4/p4c-bm/p4c-bm
url = https://github.com/krambn/p4c-bm
Expand Down Expand Up @@ -56,6 +50,9 @@
[submodule "platform/broadcom/sonic-platform-modules-ingrasys"]
path = platform/broadcom/sonic-platform-modules-ingrasys
url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys
[submodule "src/sonic-platform-common"]
path = src/sonic-platform-common
url = https://github.com/Azure/sonic-platform-common
[submodule "src/sonic-platform-daemons"]
path = src/sonic-platform-daemons
url = https://github.com/Azure/sonic-platform-daemons
Expand All @@ -68,3 +65,12 @@
[submodule "src/sonic-frr/frr"]
path = src/sonic-frr/frr
url = https://github.com/FRRouting/frr.git
[submodule "platform/p4/p4-hlir/p4-hlir-v1.1"]
path = platform/p4/p4-hlir/p4-hlir-v1.1
url = https://github.com/p4lang/p4-hlir.git
[submodule "platform/p4/SAI-P4-BM"]
path = platform/p4/SAI-P4-BM
url = https://github.com/Mellanox/SAI-P4-BM.git
[submodule "platform/nephos/sonic-platform-modules-ingrasys"]
path = platform/nephos/sonic-platform-modules-ingrasys
url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys-nephos.git
36 changes: 31 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# * USERNAME: Desired username -- default at rules/config
# * PASSWORD: Desired password -- default at rules/config
# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes.
# * SOURCE_FOLDER: host path to be mount as /var/src, only effective when KEEP_SLAVE_ON=yes
# * SONIC_BUILD_JOB: Specifying number of concurrent build job(s) to run
#
###############################################################################

Expand All @@ -33,10 +35,14 @@ SLAVE_IMAGE = sonic-slave-$(USER)
DOCKER_RUN := docker run --rm=true --privileged \
-v $(PWD):/sonic \
-w /sonic \
-e "http_proxy=$(http_proxy)" \
-e "https_proxy=$(https_proxy)" \
-i$(if $(TERM),t,)

DOCKER_BASE_BUILD = docker build --no-cache \
-t $(SLAVE_BASE_IMAGE) \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
sonic-slave && \
docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG)

Expand All @@ -58,9 +64,12 @@ SONIC_BUILD_INSTRUCTION := make \
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \
PASSWORD=$(PASSWORD) \
USERNAME=$(USERNAME)
USERNAME=$(USERNAME) \
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \
HTTP_PROXY=$(http_proxy) \
HTTPS_PROXY=$(https_proxy)

.PHONY: sonic-slave-build sonic-slave-bash init
.PHONY: sonic-slave-build sonic-slave-bash init reset

.DEFAULT_GOAL := all

Expand All @@ -72,7 +81,11 @@ SONIC_BUILD_INSTRUCTION := make \
{ echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \
$(DOCKER_BUILD) ; }
ifeq "$(KEEP_SLAVE_ON)" "yes"
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
ifdef SOURCE_FOLDER
@$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
else
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
endif
else
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@
endif
Expand All @@ -91,5 +104,18 @@ sonic-slave-bash :
@$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash

init :
git submodule update --init --recursive
git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git'
@git submodule update --init --recursive
@git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git'

reset :
@echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
@read ans && \
if [ $$ans == y ]; then \
git clean -xfdf; \
git reset --hard; \
git submodule foreach --recursive git clean -xfdf; \
git submodule foreach --recursive git reset --hard; \
git submodule update --init --recursive;\
else \
echo "Reset aborted"; \
fi
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all)
Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all)
P4: [![P4](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all)
VS: [![VS](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all)

*201709*: Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/)
Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/)
Nephos: [![Nephos](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/)
Marvell: [![Marvell](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/)
*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all)
Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all)
Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all)
P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all)
VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all)

*201709*:
Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/)
Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/)
Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/)
Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/)
Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/)
Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/)

# sonic-buildimage

Expand All @@ -27,12 +31,17 @@ Please refer to [SONiC roadmap](https://github.com/Azure/SONiC/wiki/Sonic-Roadma
## Clone or fetch the code repository with all git submodules
To clone the code repository recursively, assuming git version 1.9 or newer:

git clone --recursive https://github.com/Azure/sonic-buildimage.git
git clone https://github.com/Azure/sonic-buildimage.git

## Usage

To build SONiC installer image and docker images, run the following commands:

cd sonic-buildimage

# (Optional) Checkout a specific branch. By default, it uses master branch
git checkout [branch_name]

# Execute make init once after cloning the repo, or fetched remote repo with submodule updates
make init

Expand All @@ -41,15 +50,19 @@ To build SONiC installer image and docker images, run the following commands:

make

**NOTE**: We recommend reserving 50G free space to build one platform.

**NOTE**:

- We recommend reserving 50G free space to build one platform.
- Use ```http_proxy=[your_proxy] https_proxy=[your_proxy] make``` to enable http(s) proxy in the build process.

The SONiC installer contains all docker images needed. SONiC uses one image for all devices of a same ASIC vendor. The supported ASIC vendors are:

- PLATFORM=broadcom
- PLATFORM=marvell
- PLATFORM=mellanox
- PLATFORM=cavium
- PLATFORM=centec
- PLATFORM=nephos
- PLATFORM=p4
- PLATFORM=vs

Expand Down Expand Up @@ -93,9 +106,11 @@ This may take a while, but it is a one-time action, so please be patient.
- docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive)
- docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive)
- docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive)
- docker-orchagent-nephos.gz: docker image for SWitch State Service (SWSS) on Nephos platform (gzip tar archive)
- docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive)
- docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive)
- docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive)
- docker-syncd-nephos.gz: docker image for the daemon to sync database and Nephos switch ASIC (gzip tar archive)
- docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive)
- docker-sonic-vs.gz: docker image for all-in-one for software virtual switch (gzip tar archive)

Expand Down
22 changes: 18 additions & 4 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime

## Build a basic Debian system by debootstrap
echo '[INFO] Debootstrap...'
sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian
sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://debian-archive.trafficmanager.net/debian

## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...'
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname"
Expand All @@ -79,6 +79,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 localhos
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "proc /proc proc defaults 0 0" >> /etc/fstab'
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "sysfs /sys sysfs defaults 0 0" >> /etc/fstab'

## Setup proxy
[ -n "$http_proxy" ] && sudo /bin/bash -c "echo 'Acquire::http::Proxy \"$http_proxy\";' > $FILESYSTEM_ROOT/etc/apt/apt.conf.d/01proxy"

## Note: mounting is necessary to makedev and install linux image
echo '[INFO] Mount all'
## Output all the mounted device for troubleshooting
Expand Down Expand Up @@ -123,6 +126,8 @@ sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-to
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs
sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs
sudo cp files/initramfs-tools/setfacl $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl

# Hook into initramfs: rename the management interfaces on arista switches
sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net
Expand All @@ -142,6 +147,9 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u
## Install latest intel igb driver
sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko

## Install latest intel ixgbe driver
sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko

## Install docker
echo '[INFO] Install docker'
## Install apparmor utils since they're missing and apparmor is enabled in the kernel
Expand Down Expand Up @@ -208,6 +216,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
less \
unzip \
gdisk \
sysfsutils \
grub2-common

sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \
Expand All @@ -224,6 +233,8 @@ sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/
sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service
## Config sshd
sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT
sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config
sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config

## Config monit
sudo sed -i '
Expand Down Expand Up @@ -285,8 +296,8 @@ set /files/etc/sysctl.conf/net.core.rmem_max 2097152
" -r $FILESYSTEM_ROOT

## docker-py is needed by Ansible docker module
sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip
sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0'
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT easy_install pip
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0'
## Note: keep pip installed for maintainance purpose

## Create /var/run/redis folder for docker-database to mount
Expand All @@ -310,7 +321,7 @@ sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic
sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null <<EOF
build_version: $(sonic_get_version)
debian_version: $(cat $FILESYSTEM_ROOT/etc/debian_version)
debian_version: '$(cat $FILESYSTEM_ROOT/etc/debian_version)'
kernel_version: $kversion
asic_type: $sonic_asic_platform
commit_id: $(git rev-parse --short HEAD)
Expand All @@ -337,6 +348,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get clean
sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'rm -rf /usr/share/doc/* /usr/share/locale/* /var/lib/apt/lists/* /tmp/*'

## Clean up proxy
[ -n "$http_proxy" ] && sudo rm -f $FILESYSTEM_ROOT/etc/apt/apt.conf.d/01proxy

## Umount all
echo '[INFO] Umount all'
## Display all process details access /proc
Expand Down
Loading

0 comments on commit 5707b61

Please sign in to comment.