[platform]: remove sku from build parameter (#350)

different sku will be contained in a single one sonic image.
no longer need to specify sku at the build time
This commit is contained in:
lguohan 2017-03-01 17:05:13 -08:00 committed by GitHub
parent 903499000f
commit 0ed9b3ce28
14 changed files with 1077 additions and 21 deletions

2
.gitignore vendored
View File

@ -6,6 +6,8 @@
fsroot/ fsroot/
fs.* fs.*
target/ target/
*.deb
*.changes
# Subdirectories in src # Subdirectories in src
src/hiredis/* src/hiredis/*

View File

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

View File

@ -32,15 +32,15 @@ You also need to change all git paths to relative path as we build all submodule
To build NOS installer image and docker images, run the following commands: To build NOS installer image and docker images, run the following commands:
make configure PLATFORM=[ASIC_VENDOR] SKU=[HW_SKU] make configure PLATFORM=[ASIC_VENDOR]
make make
**NOTE**: We recommend reserving 50G free space to build one platform. **NOTE**: We recommend reserving 50G free space to build one platform.
Supported PLATFORM and SKU are: Supported PLATFORM are:
- PLATFORM=broadcom SKU=Force10-S6000 - PLATFORM=broadcom
- PLATFORM=mellanox SKU=ACS-MSN2700 - PLATFORM=mellanox
- PLATFORM=cavium SKU=AS7512 - PLATFORM=cavium
- PLATFORM=p4 - PLATFORM=p4
You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc.

File diff suppressed because it is too large Load Diff

View File

@ -55,9 +55,6 @@ sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/
sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/
# Copy default minigraph
sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml
# Install dependencies for SONiC config engine # Install dependencies for SONiC config engine
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
python-lxml \ python-lxml \
@ -118,7 +115,6 @@ sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/
# Generate build version file # Generate build version file
export git_revision=$(git rev-parse --short HEAD) export git_revision=$(git rev-parse --short HEAD)
export sonic_hwsku={{sonic_hwsku}}
export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version`
export kernel_version={{kversion}} export kernel_version={{kversion}}
j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml

View File

@ -1,4 +1,3 @@
build_version: {{git_revision}} build_version: {{git_revision}}
build_hwsku: {{sonic_hwsku}}
debian_version: {{debian_version}} debian_version: {{debian_version}}
kernel_version: {{kernel_version}} kernel_version: {{kernel_version}}

View File

@ -4,17 +4,18 @@ Requires=database.service
After=database.service After=database.service
[Service] [Service]
User=root
# Wait for redis server start before database clean # Wait for redis server start before database clean
ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done" ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done"
ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
{% if sonic_hwsku == 'ACS-MSN2700' %} {% if sonic_asic_platform == 'mellanox' %}
ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/etc/init.d/sxdkernel start
ExecStartPre=/usr/bin/mst start ExecStartPre=/usr/bin/mst start
ExecStartPre=/etc/mlnx/msn2700 start ExecStartPre=/etc/mlnx/msn2700 start
{% elif sonic_hwsku == 'AS7512' %} {% elif sonic_asic_platform == 'cavium' %}
ExecStartPre=-/etc/init.d/xpnet.sh stop ExecStartPre=-/etc/init.d/xpnet.sh stop
ExecStartPre=/etc/init.d/xpnet.sh start ExecStartPre=/etc/init.d/xpnet.sh start
{% endif %} {% endif %}
@ -26,11 +27,11 @@ ExecStart=/bin/bash -c "/usr/bin/{{docker_container_name}}.sh start & /usr/bin/s
ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStop=/usr/bin/{{docker_container_name}}.sh stop
ExecStopPost=/usr/bin/syncd.sh stop ExecStopPost=/usr/bin/syncd.sh stop
{% if sonic_hwsku == 'ACS-MSN2700' %} {% if sonic_asic_platform == 'mellanox' %}
ExecStopPost=/etc/mlnx/msn2700 stop ExecStopPost=/etc/mlnx/msn2700 stop
ExecStopPost=/etc/init.d/sxdkernel stop ExecStopPost=/etc/init.d/sxdkernel stop
ExecStopPost=/usr/bin/mst stop ExecStopPost=/usr/bin/mst stop
{% elif sonic_hwsku == 'AS7512' %} {% elif sonic_asic_platform == 'cavium' %}
ExecStopPost=/etc/init.d/xpnet.sh stop ExecStopPost=/etc/init.d/xpnet.sh stop
ExecStopPost=/etc/init.d/xpnet.sh start ExecStopPost=/etc/init.d/xpnet.sh start
{% endif %} {% endif %}

View File

@ -16,9 +16,23 @@
echo "install platform dependent packages at the first boot time" echo "install platform dependent packages at the first boot time"
if [ -f /host/platform/firsttime ]; then if [ -f /host/platform/firsttime ]; then
if [ -d /host/platform/$onie_platform ]; then
dpkg -i /host/platform/$onie_platform/*.deb if [ -n $aboot_platform ]; then
platform=$aboot_platform
elif [ -n $onie_platform ]; then
platform=$onie_platform
else
echo "Unknown sonic platform"
rm /host/platform/firsttime
exit 0
fi fi
cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/
if [ -d /host/platform/$platform ]; then
dpkg -i /host/platform/$platform/*.deb
fi
rm /host/platform/firsttime rm /host/platform/firsttime
fi fi

View File

@ -25,7 +25,6 @@ PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels
PROJECT_ROOT = $(shell pwd) PROJECT_ROOT = $(shell pwd)
CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) 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)
############################################################################### ###############################################################################
@ -49,7 +48,6 @@ 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 .sku clean distclean : .platform .sku clean
@rm -f .platform .sku @rm -f .platform .sku
@ -65,7 +63,6 @@ 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)
@ -312,7 +309,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))" export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))"
export image_type="$($*_IMAGE_TYPE)" export image_type="$($*_IMAGE_TYPE)"
export sonicadmin_user="$(USERNAME)" export sonicadmin_user="$(USERNAME)"
export sonic_hwsku="$(CONFIGURED_SKU)"
export sonic_asic_platform="$(CONFIGURED_PLATFORM)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)"
export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)"