one image implementation (#215)

* Single image

* Fix review comments

* Update syncd service. Add HW mgmt to Mellanox single image.

* Add single image template for Broadcom platform.

SKU should be provided during configure:
make configure PLATFORM=broadcom SKU=Force10-S6000

* Add single image template for Cavium platform.

SKU should be provided during configure:
make configure PLATFORM=cavium SKU=AS7512

* Add description to sonic_debian_extension.j2 file.
This commit is contained in:
Oleksandr Ivantsiv 2017-01-29 21:33:33 +02:00 committed by lguohan
parent c18b65bc16
commit 34ea91349c
68 changed files with 4025 additions and 60 deletions

View File

@ -30,6 +30,7 @@ DOCKER_BUILD = docker build --no-cache \
-C sonic \ -C sonic \
-f slave.mk \ -f slave.mk \
PLATFORM=$(PLATFORM) \ PLATFORM=$(PLATFORM) \
SKU=$(SKU) \
$@ $@
sonic-slave-build : sonic-slave-build :

View File

@ -132,15 +132,6 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u
## Install latest intel igb driver ## 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 sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko
## Install package without starting service
## ref: https://wiki.debian.org/chroot
trap_push 'sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d'
sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null <<EOF
#!/bin/sh
exit 1
EOF
sudo chmod a+x $FILESYSTEM_ROOT/usr/sbin/policy-rc.d
## Install docker ## Install docker
echo '[INFO] Install docker' echo '[INFO] Install docker'
## Install apparmor utils since they're missing and apparmor is enabled in the kernel ## Install apparmor utils since they're missing and apparmor is enabled in the kernel
@ -172,7 +163,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \
## Note: gdisk is needed for sgdisk in install.sh ## Note: gdisk is needed for sgdisk in install.sh
## Note: parted is needed for partprobe in install.sh ## Note: parted is needed for partprobe in install.sh
## Note: ca-certificates is needed for easy_install ## Note: ca-certificates is needed for easy_install
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
file \ file \
ifupdown \ ifupdown \
iproute2 \ iproute2 \
@ -195,7 +186,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \
i2c-tools \ i2c-tools \
efibootmgr \ efibootmgr \
usbutils \ usbutils \
pciutils pciutils \
iptables-persistent \
logrotate
## Remove sshd host keys, and will regenerate on first sshd start ## Remove sshd host keys, and will regenerate on first sshd start
sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key*
@ -248,6 +241,10 @@ EOF
sudo cp files/dhcp/rfc3442-classless-routes $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d sudo cp files/dhcp/rfc3442-classless-routes $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d
if [ -f sonic_debian_extension.sh ]; then
./sonic_debian_extension.sh $FILESYSTEM_ROOT
fi
## Clean up apt ## Clean up apt
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean
@ -268,6 +265,9 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS
sudo du -hs $FILESYSTEM_ROOT sudo du -hs $FILESYSTEM_ROOT
sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker
## Compress docker files
pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS var/lib/docker; popd
## Compress together with /boot and /var/lib/docker as an installer payload zip file ## Compress together with /boot and /var/lib/docker as an installer payload zip file
pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/ -r var/lib/docker; popd pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd
sudo zip -g $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS sudo zip -g $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS $FILESYSTEM_DOCKERFS

View File

@ -21,14 +21,14 @@ GIT_REVISION=$(git rev-parse --short HEAD)
mkdir -p `dirname $OUTPUT_ONIE_IMAGE` mkdir -p `dirname $OUTPUT_ONIE_IMAGE`
sudo rm -f $OUTPUT_ONIE_IMAGE sudo rm -f $OUTPUT_ONIE_IMAGE
if [ "$TARGET_MACHINE" = "generic" ]; then if [ "$IMAGE_TYPE" = "onie" ]; then
## Generate an ONIE installer image ## Generate an ONIE installer image
## Note: Don't leave blank between lines. It is single line command. ## Note: Don't leave blank between lines. It is single line command.
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
installer $TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $GIT_REVISION $ONIE_IMAGE_PART_SIZE \ installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $GIT_REVISION $ONIE_IMAGE_PART_SIZE \
$ONIE_INSTALLER_PAYLOAD $ONIE_INSTALLER_PAYLOAD
## Use 'aboot' as target machine category which includes Aboot as bootloader ## Use 'aboot' as target machine category which includes Aboot as bootloader
elif [ "$TARGET_MACHINE" = "aboot" ]; then elif [ "$IMAGE_TYPE" = "aboot" ]; then
## Add Aboot boot0 file into the image ## Add Aboot boot0 file into the image
cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ONIE_IMAGE cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ONIE_IMAGE
pushd files/Aboot && sudo zip -g $OLDPWD/$OUTPUT_ONIE_IMAGE boot0; popd pushd files/Aboot && sudo zip -g $OLDPWD/$OUTPUT_ONIE_IMAGE boot0; popd

View File

@ -8,7 +8,7 @@ mkdir -p /etc/snmp
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snmp/snmpd.conf.j2 >/etc/snmp/snmpd.conf sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snmp/snmpd.conf.j2 >/etc/snmp/snmpd.conf
hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ /bin/cp -rf /etc/ssw/$hwsku/alias_map.json /etc/snmp/
mkdir -p /var/sonic mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

View File

@ -0,0 +1,12 @@
[Unit]
Description=BGP container
Requires=database.service
After=database.service
[Service]
User={{ sonicadmin_user }}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Database container
Requires=docker.service
After=docker.service
[Service]
User={{ sonicadmin_user }}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,25 @@
#!/bin/bash
start() {
docker inspect --type container {{docker_container_name}} &>/dev/null
if [ "$?" -eq "0" ]; then
docker start -a {{docker_container_name}}
else
docker run {{docker_image_run_opt}} --name={{docker_container_name}} {{docker_image_name}}
fi
}
stop() {
docker stop {{docker_container_name}}
}
case "$1" in
start|stop)
$1
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -0,0 +1,12 @@
[Unit]
Description=LLDP container
Requires=database.service
After=database.service
[Service]
User={{ sonicadmin_user }}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=SNMP container
Requires=database.service
After=database.service
[Service]
User={{ sonicadmin_user }}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,124 @@
#!/bin/bash
## This script is to automate loading of vendor specific docker images
## and instalation of configuration files and vendor specific packages
## to debian file system.
##
## USAGE:
## ./sonic_debian_extension.sh FILESYSTEM_ROOT
## PARAMETERS:
## FILESYSTEM_ROOT
## Path to debian file system root directory
FILESYSTEM_ROOT=$1
[ -n "$FILESYSTEM_ROOT" ] || {
echo "Error: no or empty FILESYSTEM_ROOT argument"
exit 1
}
## Enable debug output for script
set -x -e
. functions.sh
BUILD_TEMPLATES=files/build_templates
IMAGE_CONFIGS=files/image_config
VENDOR_CONFIGS=src/sonic-config-engine/platform
{% if installer_debs.strip() -%}
clean_sys() {
sudo umount $FILESYSTEM_ROOT/sys/fs/cgroup/* \
$FILESYSTEM_ROOT/sys/fs/cgroup \
$FILESYSTEM_ROOT/sys || true
}
trap_push clean_sys
sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs
sudo chroot $FILESYSTEM_ROOT service docker start
sudo chroot $FILESYSTEM_ROOT docker version
# Install config engine dependencies
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
python-lxml \
python-jinja2 \
python-netaddr \
python-ipaddr \
python-yaml
sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}}
# Create all needed directories
sudo mkdir -p $FILESYSTEM_ROOT/etc/ssw/
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/
# Apply apt configuration files
sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/
sudo cp -R $IMAGE_CONFIGS/apt/sources.list.d/ $FILESYSTEM_ROOT/etc/apt/
cat $IMAGE_CONFIGS/apt/sonic-dev.gpg.key | sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add -
# Apply environtment configuration files
sudo cp $IMAGE_CONFIGS/environment/environment $FILESYSTEM_ROOT/etc/
sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/
# Copy default minigraph
sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml
# Copy NTP configuration files and templates
sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service
sudo cp $IMAGE_CONFIGS/ntp/ntp-config.sh $FILESYSTEM_ROOT/usr/bin/
sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT/etc/sonic/templates/
sudo cp $IMAGE_CONFIGS/ntp/ntp.yml $FILESYSTEM_ROOT/etc/sonic/
# Copy rsyslog configuration files and templates
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT/etc/systemd/system/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable rsyslog-config.service
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/etc/sonic/templates/
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.yml $FILESYSTEM_ROOT/etc/sonic/
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/
# Copy interfaces configuration files and templates
sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.service $FILESYSTEM_ROOT/etc/systemd/system/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable interfaces-config.service
sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.sh $FILESYSTEM_ROOT/usr/bin/
sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/
# Copy SNMP configuration files
sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/
# Generate system desription file
export git_revision=$(git rev-parse --short HEAD)
export sonic_hwsku={{sonic_hwsku}}
export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version`
export kernel_version={{kversion}}
j2 $BUILD_TEMPLATES/sysDescription.j2 > sysDescription
sudo mv sysDescription $FILESYSTEM_ROOT/etc/ssw/
# Copy sudoers configuration file
sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/
# Copy vendor specific configuration files
sudo cp -R $VENDOR_CONFIGS/{{sonic_hwsku}}/ $FILESYSTEM_ROOT/etc/ssw/
{% for deb in installer_debs.strip().split(' ') -%}
sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT
{% endfor %}
## Run depmod command for target kernel modules
sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}}
{% endif %}
{% if installer_images.strip() -%}
{% for image in installer_images.strip().split(' ') -%}
sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}}
{% endfor %}
sudo chroot $FILESYSTEM_ROOT service docker stop
{% for script in installer_start_scrips.split(' ') -%}
sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/
{% endfor %}
{% for service in installer_services.split(' ') -%}
sudo cp {{service}} $FILESYSTEM_ROOT/etc/systemd/system/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable {{service}}
{% endfor %}
sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true
sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys
{% endif %}

View File

@ -0,0 +1,13 @@
[Unit]
Description=orchagent container
Requires=database.service
After=database.service
[Service]
User={{ sonicadmin_user }}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
ExecStopPost=/usr/bin/syncd.sh stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,29 @@
[Unit]
Description=syncd container
Requires=database.service
After=database.service
[Service]
User=root
{% if sonic_hwsku == 'ACS-MSN2700' %}
ExecStartPre=/etc/init.d/sxdkernel start
ExecStartPre=/usr/bin/mst start
ExecStartPre=/etc/mlnx/msn2700 start
{% elif sonic_hwsku == 'AS7512' %}
ExecStartPre=-/etc/init.d/xpnet.sh stop
ExecStartPre=/etc/init.d/xpnet.sh start
{% endif %}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
{% if sonic_hwsku == 'ACS-MSN2700' %}
ExecStopPost=/etc/mlnx/msn2700 stop
ExecStopPost=/etc/init.d/sxdkernel stop
ExecStopPost=/usr/bin/mst stop
{% elif sonic_hwsku == 'AS7512' %}
ExecStopPost=/etc/init.d/xpnet.sh stop
ExecStopPost=/etc/init.d/xpnet.sh start
{% endif %}
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
SONiC Software Version: SONiC-OS-{{git_revision}} HwSku: {{sonic_hwsku}} - Distribution: Debian {{debian_version}} - Kernel: {{kernel_version}}

View File

@ -0,0 +1,12 @@
[Unit]
Description=TEAMD container
Requires=database.service
After=database.service
[Service]
User={{ sonicadmin_user }}
ExecStart=/usr/bin/{{docker_container_name}}.sh start
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk
xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX
UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA
LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH
B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT
c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8
aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG
FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56
LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V
/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4
GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W
aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1
af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m
J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam
aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP
++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR
eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86
dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG
266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y
AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm
k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b
tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU
R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL
nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf
FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU=
=sb3d
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1 @@
deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free

View File

@ -0,0 +1 @@
deb [arch=amd64] http://packages.microsoft.com/repos/sonic-dev/ jessie main

View File

@ -0,0 +1 @@
VTYSH_PAGER=more

View File

@ -0,0 +1,12 @@
You are on
____ ___ _ _ _ ____
/ ___| / _ \| \ | (_)/ ___|
\___ \| | | | \| | | |
___) | |_| | |\ | | |___
|____/ \___/|_| \_|_|\____|
-- Software for Open Networking In the Cloud --
Unauthorized access and/or use are prohibited.
All access and/or use are subject to monitoring.

View File

@ -0,0 +1,11 @@
[Unit]
Description=Update interfaces configuration
Before=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/interfaces-config.sh
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
#!/bin/bash
sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/interfaces.j2 >/etc/network/interfaces
sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/vlan_interfaces.j2 >/etc/network/interfaces.d/vlan_interfaces
sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/lag_interfaces.j2 >/etc/network/interfaces.d/lag_interfaces

View File

@ -0,0 +1,50 @@
#
{% block banner %}
# =========== Managed by config engine DO NOT EDIT! ========================
# generated by templates/interfaces.j2 using sonic-cfggen
# file: interfaces
{% endblock %}
#
{% block loopback %}
# The loopback network interface
auto lo
iface lo inet loopback
# Use command 'ip addr list dev lo' to check all addresses
{% for minigraph_lo_interface in minigraph_lo_interfaces %}
iface lo {{ 'inet' if minigraph_lo_interface['addr'] | ipv4 else 'inet6' }} static
address {{ minigraph_lo_interface['addr'] }}
netmask {{ minigraph_lo_interface['mask'] }}
#
{% endfor %}
{% endblock loopback %}
#
{% block mgmt_interface %}
# The management network interface
auto eth0
{% if minigraph_mgmt_interface['addr'] %}
iface eth0 inet static
address {{ minigraph_mgmt_interface['addr'] }}
netmask {{ minigraph_mgmt_interface['mask'] }}
################ management network policy routing rules
#### management port up rules"
up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default
up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default
#### management port down rules"
down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default
down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default
{# TODO: COPP policy type rules #}
{% else %}
iface eth0 inet dhcp
{% endif %}
{% endblock mgmt_interface %}
#
{% block front_panel_interface %}
# The switch front panel interfaces
{% for interface in minigraph_interfaces %}
auto {{ interface['alias'] }}
iface {{ interface['alias'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static
address {{ interface['addr'] }}
netmask {{ interface['mask'] }}
#
{% endfor %}
{% endblock front_panel_interface %}

View File

@ -0,0 +1,20 @@
#
{% block banner %}
# =========== Managed by config engine DO NOT EDIT! ========================
# generated by templates/lag_interfaces.j2 using sonic-cfggen
# file: lag_interfaces
{% endblock %}
#
{% block lag_interface %}
# The switch LAG interfaces
{% for interface in minigraph_interfaces %}
{% if 'PortChannel' in interface['alias'] %}
auto {{ interface['name'] }}
iface {{ interface['name'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static
address {{ interface['addr'] }}
netmask {{ interface['mask'] }}
{% endif %}
{% endfor %}
{% endblock lag_interface %}
#

View File

@ -0,0 +1,18 @@
#
{% block banner %}
# =========== Managed by config engine DO NOT EDIT! ========================
# generated by templates/interfaces.j2 using sonic-cfggen
# file: vlan_interfaces
{% endblock %}
#
{% block vlan_interface %}
# The switch VLAN interfaces
{% for interface in minigraph_vlan_interfaces %}
auto {{ interface['name'] }}
iface {{ interface['name'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static
bridge_ports {{ interface['members'] }}
address {{ interface['addr'] }}
netmask {{ interface['mask'] }}
{% endfor %}
{% endblock vlan_interface %}
#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
[Unit]
Description=Update NTP configuration
Before=ntp.service
[Service]
Type=oneshot
ExecStart=/usr/bin/ntp-config.sh
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,3 @@
#!/bin/bash
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/ntp.yml -t /etc/sonic/templates/ntp.conf.j2 >/etc/ntp.conf

View File

@ -0,0 +1,63 @@
###############################################################################
# Managed by Ansible
# file: ansible/roles/acs/templates/ntp.conf.j2
###############################################################################
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
{% for ntp_server in ntp_servers %}
server {{ ntp_server }} iburst
{% endfor %}
#only listen on localhost and eth0 ips (default is to listen on all ip addresses)
interface ignore wildcard
interface listen {{ minigraph_mgmt_interface.addr }}
interface listen 127.0.0.1
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

View File

@ -0,0 +1,6 @@
ntp_servers:
- 0.debian.pool.ntp.org
- 1.debian.pool.ntp.org
- 2.debian.pool.ntp.org
- 3.debian.pool.ntp.org

View File

@ -0,0 +1,11 @@
[Unit]
Description=Update rsyslog configuration
Before=rsyslog.service
[Service]
Type=oneshot
ExecStart=/usr/bin/rsyslog-config.sh
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,3 @@
#!/bin/bash
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/rsyslog.yml -t /etc/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf

View File

@ -0,0 +1,71 @@
###############################################################################
# Managed by Ansible
# file: ansible/roles/acs/templates/rsyslog.conf.j2
###############################################################################
#
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog # provides kernel logging support
#$ModLoad immark # provides --MARK-- message capability
# provides UDP syslog reception
$ModLoad imudp
$UDPServerAddress 127.0.0.1 # bind to localhost before udp server run
$UDPServerRun 514
# provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514
###########################
#### GLOBAL DIRECTIVES ####
###########################
#Set remote syslog server
{% for server in syslog_servers %}
*.* @{{ server }}:514
{% endfor %}
#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# Define a custom template
$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate ACSFileFormat
#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
###############
#### RULES ####
###############

View File

@ -0,0 +1,46 @@
## Quagga rules
if $programname == "zebra" then {
/var/log/quagga/zebra.log
stop
}
if $programname == "bgpd" then {
/var/log/quagga/bgpd.log
stop
}
if $programname == "quagga" then {
/var/log/quagga/zebra.log
stop
}
if $programname == "watchquagga" then {
/var/log/quagga/zebra.log
stop
}
## Platform modules rules
if $programname == "platform-modules" then {
/var/log/syslog
stop
}
## Sensord rules
if $programname == "sensord" then {
/var/log/syslog
stop
}
## Sswsyncd rules
if $programname == "sswsyncd" then {
/var/log/syslog
stop
}
## Ansible rules
if $programname startswith "ansible" then {
/var/log/messages
stop
}

View File

@ -0,0 +1,66 @@
#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
kern.* -/var/persist/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#
# Logging for INN news system.
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Some "catch-all" log files.
#
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
*.=crit;*.=alert;*.=emerg -/var/persist/log/alarms
#
# Emergencies are sent to everybody logged in.
#
*.emerg :omusrmsg:*
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole

View File

@ -0,0 +1 @@
syslog_servers: []

View File

@ -0,0 +1 @@
snmp_rocommunity: public

View File

@ -0,0 +1,33 @@
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
#Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults env_keep += "VTYSH_PAGER"
# Host alias specification
# User alias specification
# Cmnd alias specification
# Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC
Cmnd_Alias READ_ONLY_CMDS = /usr/bin/portstat,\
/usr/bin/vtysh -c "show.*"
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d

View File

@ -397,6 +397,10 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || {
# Decompress the file for the file system directly to the partition # Decompress the file for the file system directly to the partition
unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt
if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then
cd $demo_mnt && tar xf $FILESYSTEM_DOCKERFS; cd $OLDPWD
fi
# Store machine description in target file system # Store machine description in target file system
cp /etc/machine.conf $demo_mnt cp /etc/machine.conf $demo_mnt

View File

@ -18,5 +18,8 @@ FILESYSTEM_SQUASHFS=fs.squashfs
## Filename for onie installer payload, will be the main part of onie installer ## Filename for onie installer payload, will be the main part of onie installer
ONIE_INSTALLER_PAYLOAD=fs.zip ONIE_INSTALLER_PAYLOAD=fs.zip
## Filename for docker file system
FILESYSTEM_DOCKERFS=dockerfs.tar.gz
## Output file name for onie installer ## Output file name for onie installer
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin

View File

View File

@ -1,9 +1,8 @@
include $(PLATFORM_GENERIC_PATH)/rules.mk
include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk
include $(PLATFORM_PATH)/single-image.mk
BCMCMD = bcmcmd BCMCMD = bcmcmd
$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r"
@ -13,9 +12,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv
SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE)
SONIC_ALL += $(DOCKER_SYNCD_BRCM) \ SONIC_ALL += $(SONIC_SINGLE_IMAGE)
$(DOCKER_ORCHAGENT_BRCM) \
debs/$(BRCM_OPENNSL_KERNEL)
# Inject brcm sai into sairedis # Inject brcm sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV)

View File

@ -0,0 +1,8 @@
# sonic mellanox single image installer
SONIC_SINGLE_IMAGE = sonic-broadcom.bin
$(SONIC_SINGLE_IMAGE)_MACHINE = broadcom
$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_SINGLE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL)
$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE)

View File

View File

@ -1,12 +1,10 @@
include $(PLATFORM_GENERIC_PATH)/rules.mk
include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/cavm-sai.mk
include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk
include $(PLATFORM_PATH)/docker-orchagent-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk
include $(PLATFORM_PATH)/cavm_platform_modules.mk include $(PLATFORM_PATH)/cavm_platform_modules.mk
include $(PLATFORM_PATH)/single-image.mk
SONIC_ALL += $(DOCKER_SYNCD_CAVM) \ SONIC_ALL += $(SONIC_SINGLE_IMAGE)
$(DOCKER_ORCHAGENT_CAVM)
# Inject cavium sai into sairedis # Inject cavium sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI)

View File

@ -0,0 +1,8 @@
# sonic mellanox single image installer
SONIC_SINGLE_IMAGE = sonic-cavium.bin
$(SONIC_SINGLE_IMAGE)_MACHINE = cavium
$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_SINGLE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB)
$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE)

View File

@ -0,0 +1,9 @@
# sonic aboot installer
SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot.bin
$(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = aboot
$(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot
$(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS =
$(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS =
SONIC_INSTALLERS += $(SONIC_GENERIC_ABOOT_IMAGE)

View File

@ -0,0 +1,8 @@
# sonic generic ONIE image installer
SONIC_GENERIC_ONIE_IMAGE = sonic-generic.bin
$(SONIC_GENERIC_ONIE_IMAGE)_MACHINE = generic
$(SONIC_GENERIC_ONIE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_GENERIC_ONIE_IMAGE)_DEPENDS =
$(SONIC_GENERIC_ONIE_IMAGE)_DOCKERS =
SONIC_INSTALLERS += $(SONIC_GENERIC_ONIE_IMAGE)

View File

View File

@ -1,8 +1,10 @@
include $(PLATFORM_PATH)/aboot-image.mk
include $(PLATFORM_PATH)/onie-image.mk
SONIC_ALL += $(DOCKER_DATABASE) \ SONIC_ALL += $(DOCKER_DATABASE) \
$(DOCKER_FPM) \
$(DOCKER_TEAMD) \
$(DOCKER_LLDP_SV2) \ $(DOCKER_LLDP_SV2) \
$(DOCKER_SNMP_SV2) \ $(DOCKER_SNMP_SV2) \
$(DOCKER_PLATFORM_MONITOR) \ $(DOCKER_PLATFORM_MONITOR) \
$(DOCKER_DHCP_RELAY) \ $(DOCKER_DHCP_RELAY) \
$(DOCKER_PTF) $(DOCKER_PTF) \
$(SONIC_GENERIC_ONIE_IMAGE)

View File

@ -5,3 +5,13 @@ $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent
$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS)
$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX)
$(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --volumes-from database
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

@ -6,3 +6,10 @@ $(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) $(PYTHON_SDK_API)
$(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) $(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW)
$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
$(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd
$(DOCKER_SYNCD_MLNX)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SYNCD_MLNX)_RUN_OPT += --volumes-from database
$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

View File

@ -1,5 +1,3 @@
include $(PLATFORM_GENERIC_PATH)/rules.mk
include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/fw.mk include $(PLATFORM_PATH)/fw.mk
include $(PLATFORM_PATH)/mft.mk include $(PLATFORM_PATH)/mft.mk
@ -7,17 +5,9 @@ include $(PLATFORM_PATH)/mlnx-sai.mk
include $(PLATFORM_PATH)/hw-management.mk include $(PLATFORM_PATH)/hw-management.mk
include $(PLATFORM_PATH)/docker-syncd-mlnx.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk
include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk
include $(PLATFORM_PATH)/single-image.mk
SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ SONIC_ALL += $(SONIC_SINGLE_IMAGE)
$(DOCKER_ORCHAGENT_MLNX) \
$(DOCKER_FPM) \
$(DOCKER_DATABASE) \
$(DOCKER_LLDP_SV2) \
$(DOCKER_SNMP_SV2) \
$(DOCKER_TEAMD) \
$(DOCKER_PLATFORM_MONITOR) \
debs/$(MLNX_HW_MANAGEMENT) \
debs/$(SX_KERNEL)
# Inject mlnx sai into sairedis # Inject mlnx sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI)

View File

@ -0,0 +1,8 @@
# sonic mellanox single image installer
SONIC_SINGLE_IMAGE = sonic-mellanox.bin
$(SONIC_SINGLE_IMAGE)_MACHINE = mellanox
$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_SINGLE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT)
$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE)

View File

@ -5,3 +5,9 @@ $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database
$(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS)
$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE)
$(DOCKER_DATABASE)_CONTAINER_NAME = database
$(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t
$(DOCKER_DATABASE)_RUN_OPT += -v /var/run/redis

View File

@ -5,3 +5,9 @@ $(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm
$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) $(SONIC_CONFIG_ENGINE) $(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_FPM) SONIC_DOCKER_IMAGES += $(DOCKER_FPM)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM)
$(DOCKER_FPM)_CONTAINER_NAME = bgp
$(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_FPM)_RUN_OPT += --volumes-from database
$(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

@ -6,3 +6,8 @@ $(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(SONIC_CONFIG_ENGINE)
$(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2)
$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)
$(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp
$(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t
$(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

@ -6,3 +6,9 @@ $(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(SONIC_CONFIG_ENGINE)
$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) $(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3)
$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
$(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp
$(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro
$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

@ -5,3 +5,8 @@ $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd
$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_CONFIG_ENGINE) $(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE) $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD)
$(DOCKER_TEAMD)_CONTAINER_NAME = teamd
$(DOCKER_TEAMD)_RUN_OPT += --net=host --privileged -t
$(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

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

View File

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

View File

@ -24,9 +24,9 @@ DEBS_PATH = $(TARGET_PATH)/debs
PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels
PROJECT_ROOT = $(shell pwd) PROJECT_ROOT = $(shell pwd)
CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo undefined) CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic)
CONFIGURED_SKU := $(shell [ -f .sku ] && cat .sku || echo undefined)
PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM)
PLATFORM_GENERIC_PATH = platform/generic
############################################################################### ###############################################################################
## Utility rules ## Utility rules
@ -34,27 +34,38 @@ PLATFORM_GENERIC_PATH = platform/generic
############################################################################### ###############################################################################
.platform : .platform :
ifneq ($(CONFIGURED_PLATFORM),generic)
@echo Build system is not configured, please run make configure @echo Build system is not configured, please run make configure
@exit 1 @exit 1
endif
.sku :
ifneq ($(CONFIGURED_PLATFORM),generic)
@echo Build system is not configured, please run make configure
@exit 1
endif
configure : configure :
@mkdir -p target/debs @mkdir -p target/debs
@mkdir -p target/python-wheels @mkdir -p target/python-wheels
@echo $(PLATFORM) > .platform @echo $(PLATFORM) > .platform
@echo $(SKU) > .sku
distclean : .platform clean distclean : .platform .sku clean
@rm -f .platform @rm -f .platform .sku
############################################################################### ###############################################################################
## Include other rules ## Include other rules
############################################################################### ###############################################################################
include $(RULES_PATH)/config include $(RULES_PATH)/config
include $(RULES_PATH)/functions include $(RULES_PATH)/functions
include $(RULES_PATH)/*.mk include $(RULES_PATH)/*.mk
ifneq ($(CONFIGURED_PLATFORM), undefined) ifneq ($(CONFIGURED_PLATFORM), undefined)
include $(PLATFORM_PATH)/rules.mk include $(PLATFORM_PATH)/rules.mk
endif endif
export CONFIGURED_SKU
MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS)
@ -274,10 +285,47 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA
############################################################################### ###############################################################################
# targets for building installers with base image # targets for building installers with base image
$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS))
$(HEADER) $(HEADER)
## Pass initramfs and linux kernel explicitly. They are used for all platforms
export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)"
export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)"
export kversion="$(KVERSION)"
export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))"
export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))"
export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))"
export image_type="$($*_IMAGE_TYPE)"
export sonicadmin_user="$(USERNAME)"
export sonic_hwsku="$(CONFIGURED_SKU)"
$(foreach docker, $($*_DOCKERS),\
export docker_image="$(docker)"
export docker_image_name="$(basename $(docker))"
export docker_container_name="$($(docker)_CONTAINER_NAME)"
export docker_image_run_opt="$($(docker)_RUN_OPT)"
j2 files/build_templates/docker_image_ctl.j2 > $($(docker)_CONTAINER_NAME).sh
j2 files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 > $($(docker)_CONTAINER_NAME).service
chmod +x $($(docker)_CONTAINER_NAME).sh
)
export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))"
export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))"
$(if $($*_DOCKERS),
j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh
chmod +x sonic_debian_extension.sh,
)
./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG)
TARGET_MACHINE=$($*_MACHINE) ./build_image.sh $(LOG) TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG)
$(foreach docker, $($*_DOCKERS), \
rm $($(docker)_CONTAINER_NAME).sh
rm $($(docker)_CONTAINER_NAME).service
)
$(if $($*_DOCKERS),
rm sonic_debian_extension.sh,
)
$(FOOTER) $(FOOTER)
############################################################################### ###############################################################################
@ -326,4 +374,4 @@ all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL))
.PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure .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 .INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start .platform .sku

View File

@ -0,0 +1 @@
#TODO: Add correct info here

View File

@ -0,0 +1 @@
# TODO: Add correct info here

View File

@ -0,0 +1 @@
# TODO: Add correct info here