Skip to content

Commit 7bffe35

Browse files
authored
Merge pull request #11 from Azure/master
Sync to master
2 parents 20dfb03 + 3a6d7be commit 7bffe35

File tree

557 files changed

+28842
-3069
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

557 files changed

+28842
-3069
lines changed

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,31 @@ target/
1111
*.buildinfo
1212

1313
# Subdirectories in src
14+
src/bash/*
15+
!src/bash/Makefile
16+
src/ixgbe/*
17+
!src/ixgbe/Makefile
18+
src/isc-dhcp/*
19+
!src/isc-dhcp/Makefile
20+
!src/isc-dhcp/patch
21+
src/socat/*
22+
!src/socat/Makefile
23+
!src/socat/*.patch
24+
src/tacacs/*
25+
src/tacacs/nsm/*
26+
src/tacacs/pam/*
27+
!src/tacacs/nsm/Makefile
28+
!src/tacacs/nsm/*.patch
29+
!src/tacacs/pam/Makefile
30+
!src/tacacs/pam/*.patch
1431
src/hiredis/*
1532
!src/hiredis/Makefile
1633
src/igb/*
1734
!src/igb/Makefile
1835
src/initramfs-tools/*
1936
!src/initramfs-tools/Makefile
37+
src/iproute2/*
38+
!src/iproute2/Makefile
2039
src/isc-dhcp/*
2140
!src/isc-dhcp/Makefile
2241
!src/isc-dhcp/patch/
@@ -27,12 +46,17 @@ src/libteam/*
2746
src/lldpd/*
2847
!src/lldpd/Makefile
2948
!src/lldpd/patch/
49+
src/lm-sensors/*
50+
!src/lm-sensors/Makefile
3051
src/mpdecimal/*
3152
!src/mpdecimal/Makefile
3253
src/python-click/*
3354
!src/python-click/Makefile
3455
src/python3/*
3556
!src/python3/Makefile
57+
src/radvd/*
58+
!src/radvd/Makefile
59+
!src/radvd/patch/
3660
src/redis/*
3761
!src/redis/Makefile
3862
src/snmpd/*
@@ -42,12 +66,21 @@ src/sonic-device-data/src/debian/
4266
src/supervisor/*
4367
!src/supervisor/Makefile
4468
!src/supervisor/patch/
69+
src/telemetry/debian/*
70+
!src/telemetry/debian/changelog
71+
!src/telemetry/debian/compat
72+
!src/telemetry/debian/control
73+
!src/telemetry/debian/rules
74+
!src/telemetry/debian/telemetry.init.d
4575
src/thrift/*
76+
!src/thrift/patch/
4677
!src/thrift/Makefile
4778

4879
# Autogenerated Dockerfiles
4980
dockers/docker-base/Dockerfile
81+
dockers/docker-base-stretch/Dockerfile
5082
dockers/docker-config-engine/Dockerfile
83+
dockers/docker-config-engine-stretch/Dockerfile
5184
dockers/docker-database/Dockerfile
5285
dockers/docker-dhcp-relay/Dockerfile
5386
dockers/docker-fpm-frr/Dockerfile
@@ -73,3 +106,6 @@ installer/x86_64/platforms/
73106
src/sonic-config-engine/**/*.pyc
74107
src/sonic-config-engine/build
75108
src/sonic-config-engine/sonic_config_engine.egg-info
109+
src/sonic-daemon-base/**/*.pyc
110+
src/sonic-daemon-base/build
111+
src/sonic-daemon-base/sonic_daemon_base.egg-info

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@
6262
[submodule "src/redis-dump-load"]
6363
path = src/redis-dump-load
6464
url = https://github.com/p/redis-dump-load.git
65+
[submodule "platform/mellanox/mlnx-sai/SAI-Implementation"]
66+
path = platform/mellanox/mlnx-sai/SAI-Implementation
67+
url = https://github.com/Mellanox/SAI-Implementation

Makefile.work

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
# * make NOSTRETCH=1 KEEP_SLAVE_ON=yes <any jessie target>
2828
# * SOURCE_FOLDER: host path to be mount as /var/$(USER)/src, only effective when KEEP_SLAVE_ON=yes
2929
# * SONIC_BUILD_JOBS: Specifying number of concurrent build job(s) to run
30+
# * VS_PREPARE_MEM: Prepare memory in VS build (drop cache and compact).
31+
# * Default: yes
32+
# * Values: yes, no
3033
# * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build
3134
#
3235
###############################################################################
@@ -103,6 +106,7 @@ DOCKER_BUILD = docker build --no-cache \
103106

104107
SONIC_BUILD_INSTRUCTION := make \
105108
-f slave.mk \
109+
BLDENV=$(BLDENV) \
106110
PLATFORM=$(PLATFORM) \
107111
BUILD_NUMBER=$(BUILD_NUMBER) \
108112
BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) \
@@ -114,10 +118,12 @@ SONIC_BUILD_INSTRUCTION := make \
114118
PASSWORD=$(PASSWORD) \
115119
USERNAME=$(USERNAME) \
116120
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \
121+
VS_PREPARE_MEM=$(VS_PREPARE_MEM) \
117122
KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \
118123
HTTP_PROXY=$(http_proxy) \
119124
HTTPS_PROXY=$(https_proxy) \
120-
SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY)
125+
SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) \
126+
$(SONIC_OVERRIDE_BUILD_VARS)
121127

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

@@ -166,12 +172,15 @@ init :
166172
reset :
167173
@echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
168174
@read ans && \
169-
if [ $$ans == y ]; then \
170-
git clean -xfdf; \
171-
git reset --hard; \
172-
git submodule foreach --recursive git clean -xfdf; \
173-
git submodule foreach --recursive git reset --hard; \
174-
git submodule update --init --recursive;\
175-
else \
176-
echo "Reset aborted"; \
177-
fi
175+
if [ $$ans == y ]; then \
176+
echo "Resetting local repository. Please wait..."; \
177+
$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) sudo rm -rf fsroot; \
178+
git clean -xfdf; \
179+
git reset --hard; \
180+
git submodule foreach --recursive git clean -xfdf; \
181+
git submodule foreach --recursive git reset --hard; \
182+
git submodule update --init --recursive; \
183+
echo "Reset complete!"; \
184+
else \
185+
echo "Reset aborted"; \
186+
fi

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mell
3737

3838
# Description
3939

40-
Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [list](https://github.com/Azure/SONiC/wiki/Supported-Devices-and-Platforms)
40+
Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatible network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [list](https://github.com/Azure/SONiC/wiki/Supported-Devices-and-Platforms)
4141

4242
# Hardware
4343
Any server can be a build image server. We are using a server with 1T hard disk. The OS is Ubuntu 16.04.
@@ -80,6 +80,11 @@ To build SONiC installer image and docker images, run the following commands:
8080
**NOTE**:
8181

8282
- Recommend reserving 50G free space to build one platform.
83+
- If Docker's workspace folder, `/var/lib/docker`, resides on a partition without sufficient free space, you may encounter an error like the following during a Docker container build job:
84+
85+
`/usr/bin/tar: /path/to/sonic-buildimage/<some_file>: Cannot write: No space left on device`
86+
87+
The solution is to [move the directory](https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux) to a partition with more free space.
8388
- Use `http_proxy=[your_proxy] https_proxy=[your_proxy] make` to enable http(s) proxy in the build process.
8489
- Add your user account to `docker` group and use your user account to make. `root` or `sudo` are not supported.
8590

@@ -125,11 +130,11 @@ It is recommended to use clean targets to clean all packages that are built toge
125130
- If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically.
126131
This may take a while, but it is a one-time action, so please be patient.
127132

128-
- The root user account is disabled. However, the created user can sudo.
133+
- The root user account is disabled. However, the created user can `sudo`.
129134

130-
- The target directory is ./target, containing the NOS installer image and docker images.
131-
- sonic-generic.bin: SONiC switch installer image (ONIE compatiable)
132-
- sonic-aboot.bin: SONiC switch installer image (Aboot compatiable)
135+
- The target directory is `./target`, containing the NOS installer image and docker images.
136+
- sonic-generic.bin: SONiC switch installer image (ONIE compatible)
137+
- sonic-aboot.bin: SONiC switch installer image (Aboot compatible)
133138
- docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive)
134139
- docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive)
135140
- docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive)
@@ -146,7 +151,7 @@ This may take a while, but it is a one-time action, so please be patient.
146151

147152
## Contribution Guide
148153

149-
All contributors must sign a contribution license agreement before contributions can be accepted. Contact [email protected].
154+
All contributors must sign a contribution license agreement before contributions can be accepted. Contact [[email protected]](mailto:[email protected]).
150155

151156
## GitHub Workflow
152157

build_debian.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
set -x -e
3030

3131
## docker engine version (with platform)
32-
DOCKER_VERSION=5:18.09.0~3-0~debian-stretch
33-
LINUX_KERNEL_VERSION=4.9.0-8
32+
DOCKER_VERSION=5:18.09.2~3-0~debian-stretch
33+
LINUX_KERNEL_VERSION=4.9.0-8-2
3434

3535
## Working directory to prepare the file system
3636
FILESYSTEM_ROOT=./fsroot
@@ -114,13 +114,14 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'cd /dev && MAKEDEV generic'
114114
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install busybox
115115
echo '[INFO] Install SONiC linux kernel image'
116116
## Note: duplicate apt-get command to ensure every line return zero
117-
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools-core_*.deb || \
117+
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/initramfs-tools-core_*.deb || \
118118
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
119-
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \
119+
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/initramfs-tools_*.deb || \
120120
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
121-
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \
121+
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \
122122
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
123123
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install acl
124+
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install dmidecode
124125

125126
## Update initramfs for booting with squashfs+overlay
126127
cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null
@@ -129,6 +130,8 @@ cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-t
129130
sudo mkdir -p $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/
130131
sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs
131132
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs
133+
sudo cp files/initramfs-tools/arista-hook $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-hook
134+
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-hook
132135
sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs
133136
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs
134137
sudo cp files/initramfs-tools/setfacl $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl
@@ -150,14 +153,14 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mou
150153
sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog
151154
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog
152155
# Management interface (eth0) dhcp can be optionally turned off (during a migration from another NOS to SONiC)
153-
sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp
154-
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp
156+
#sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp
157+
#sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp
155158
sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck
156159
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck
157160
pushd $FILESYSTEM_ROOT/usr/share/initramfs-tools/scripts/init-bottom && sudo patch -p1 < $OLDPWD/files/initramfs-tools/udev.patch; popd
158161

159162
## Install latest intel ixgbe driver
160-
sudo cp target/files/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/${LINUX_KERNEL_VERSION}-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
163+
sudo cp target/files/stretch/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/${LINUX_KERNEL_VERSION}-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
161164

162165
## Install docker
163166
echo '[INFO] Install docker'
@@ -169,7 +172,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install apt-transport-https \
169172
curl \
170173
gnupg2 \
171174
software-properties-common
172-
sudo LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/docker.gpg -fsSL https://download.docker.com/linux/debian/gpg
175+
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/docker.gpg -fsSL https://download.docker.com/linux/debian/gpg
173176
sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add /tmp/docker.gpg
174177
sudo LANG=C chroot $FILESYSTEM_ROOT rm /tmp/docker.gpg
175178
sudo LANG=C chroot $FILESYSTEM_ROOT add-apt-repository \
@@ -243,7 +246,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
243246
python-scapy \
244247
tcptraceroute \
245248
mtr-tiny \
246-
locales
249+
locales \
250+
cgroup-tools
247251

248252
#Adds a locale to a debian system in non-interactive mode
249253
sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \
@@ -264,6 +268,10 @@ sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-
264268
## Disable kexec supported reboot which was installed by default
265269
sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec
266270

271+
## Modifty ntp default configuration: disable initial jump (add -x), and disable
272+
## jump when time difference is greater than 1000 seconds (remove -g).
273+
sudo sed -i "s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/" $FILESYSTEM_ROOT/etc/default/ntp
274+
267275
## Fix ping tools permission so non root user can directly use them
268276
## Note: this is a workaround since aufs doesn't support extended attributes
269277
## Ref: https://github.com/moby/moby/issues/5650#issuecomment-303499489
@@ -342,8 +350,10 @@ set /files/etc/sysctl.conf/net.ipv6.conf.all.keep_addr_on_down 1
342350
set /files/etc/sysctl.conf/net.ipv6.conf.eth0.keep_addr_on_down 1
343351
344352
set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra_defrtr 0
353+
set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra 0
345354
346355
set /files/etc/sysctl.conf/net.ipv4.tcp_l3mdev_accept 1
356+
set /files/etc/sysctl.conf/net.ipv4.udp_l3mdev_accept 1
347357
348358
set /files/etc/sysctl.conf/net.core.rmem_max 2097152
349359
set /files/etc/sysctl.conf/net.core.wmem_max 2097152

build_debug_docker_j2.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#! /bin/bash
2+
3+
echo "
4+
FROM $1
5+
6+
ARG docker_container_name
7+
8+
## Make apt-get non-interactive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
{% if $2 is defined %}
12+
{% if $2|length %}
13+
14+
COPY \
15+
{% for deb in $2.split(' ') -%}
16+
debs/{{ deb }}{{' '}}
17+
{%- endfor -%}
18+
debs/
19+
20+
RUN dpkg -i \
21+
{% for deb in $2.split(' ') -%}
22+
debs/{{ deb }}{{' '}}
23+
{%- endfor %}
24+
25+
{% endif %}
26+
{% endif %}
27+
28+
{% if $3 is defined %}
29+
{% if $3|length %}
30+
31+
RUN apt-get install -f -y \
32+
{% for dbg in $3.split(' ') -%}
33+
{{ dbg }}{{' '}}
34+
{%- endfor %}
35+
36+
{% endif %}
37+
{% endif %}
38+
39+
40+
## Clean up
41+
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
42+
RUN rm -rf /debs
43+
44+
"

build_kvm_image.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh -ex
1+
#!/bin/bash -ex
22

33
# Copyright (C) 2014 Curt Brune <[email protected]>
44
#
@@ -47,6 +47,15 @@ prepare_installer_disk()
4747
create_disk
4848
prepare_installer_disk
4949

50+
echo "Prepare memory for KVM build: $vs_build_prepare_mem"
51+
free -m
52+
if [[ "$vs_build_prepare_mem" == "yes" ]]; then
53+
# Force o.s. to drop cache and compact memory so that KVM can get 2G memory
54+
sudo bash -c 'echo 1 > /proc/sys/vm/drop_caches'
55+
sudo bash -c 'echo 1 > /proc/sys/vm/compact_memory'
56+
free -m
57+
fi
58+
5059
/usr/bin/kvm -m $MEM \
5160
-name "onie" \
5261
-boot "order=cd,once=d" -cdrom "$ONIE_RECOVERY_ISO" \

device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ bcm_stat_flags=0
33
parity_enable=0
44
parity_correction=0
55

6-
l2_mem_entries=163840
7-
l3_mem_entries=81920
6+
bcm_num_cos=8
7+
l2_mem_entries=32768
8+
l3_mem_entries=16384
9+
l3_alpm_enable=2
10+
ipv6_lpm_128b_enable=1
11+
812
mmu_lossless=0
913
lls_num_l2uc=12
1014
module_64ports=0

0 commit comments

Comments
 (0)