Skip to content

Commit

Permalink
Build sonic-vpp from sonic-buildimage (#123)
Browse files Browse the repository at this point in the history
 - Remove platform/vpp from directory hierarchy.
 - Add sonic-platform-modules-vpp to install VPP specific files
 - Add platform_setup.sh to tweak sonic-device-data before build
 - Add vpp-port-config.service to run vpp_ports_setup.sh for changing
   the driver of data ports to dpdk
 - Move .mk and .dep to rules directory
 - Update README.md for building instructions
  • Loading branch information
yue-fred-gao authored Oct 28, 2024
1 parent 802cd77 commit 0023aba
Show file tree
Hide file tree
Showing 329 changed files with 1,185 additions and 255 deletions.
69 changes: 14 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,68 +28,27 @@ There are two types of sonic-vpp image build targets supported

## Building a single container image

Issue the command shown below. It will pull the required repos, setup the vpp platform, configure and then initiate the image build.

```
make sonic
```

Note- If your internet access is only through a proxy, set the http_proxy and issue the command as suggested below
```
http_proxy=http_proxy_url https_proxy=https_proxy_url no_proxy=localhost,127.0.0.1,<other_hosts_or_ipaddresses> make sonic
```

To use a different label for SONiC build
```
SONIC_CHECKOUT_LABEL=sonic_git_commit_label make sonic
```
To build a debug container image run below command
```
INSTALL_DEBUG_TOOLS=y make sonic
```

> Note: Refer the instructions above on how to pass proxy if internet access is only though proxy
The ./build directory contains all the repos pulled. The ./build/sonic-buildimage/target directory contains the
sonic vpp targets.

In case of a build failure just run below command. There is no need to do rest of targets in the Makefile.
```
make sonic_build
```

If internet access is only through a proxy use below command
```
http_proxy=http_proxy_url http_proxy=https_proxy_url no_proxy=localhost,127.0.0.1,other_hosts_or_ipaddresses make sonic
```

To use a different label for SONiC build
```
SONIC_CHECKOUT_LABEL=sonic_git_commit_label make sonic_build
```

> Note : The nightly build labels can be found [*here*](https://sonic-build.azurewebsites.net/ui/sonic/pipelines/142/builds?branchName=master)
The built image can be found at `./build/sonic-buildimage/target/docker-sonic-vpp.gz`.
1. git clone --recurse-submodules https://github.com/sonic-net/sonic-buildimage.git
2. git submodule add https://github.com/sonic-platform-vpp.git platform/vpp
3. Apply the diff in https://github.com/sonic-net/sonic-sairedis/pull/1424 if the PR hasn't been merged.
4. make init
5. make configure PLATFORM=vpp
6. NOBULLSEYE=1 NOBUSTER=1 make SONIC_BUILD_JOBS=4 target/docker-sonic-vpp.gz
Note: this is not tested and could be broken, which will be fixed later. In the meantime, use branch prior-to-build-change for single container image build.

### Testing the single container image

Refer to the [Getting started](docs/README.getting-started.md) document in docs directory for details.


## Building a KVM VM image
Run below make command (in case of proxy use the proxy parameters as mentioned above in the "make sonic" build)
```
make sonic_vm
```

To build a debug VM image image run below command
```
INSTALL_DEBUG_TOOLS=y make sonic_vm
```

The built vm image can be found at `build/sonic-buildimage/target/sonic-vpp.img.gz`.

1. git clone --recurse-submodules https://github.com/sonic-net/sonic-buildimage.git
2. git submodule add https://github.com/sonic-platform-vpp.git platform/vpp
3. Apply the diff in https://github.com/sonic-net/sonic-sairedis/pull/1424 if the PR hasn't been merged.
4. make init
5. make configure PLATFORM=vpp
6. NOBULLSEYE=1 NOBUSTER=1 make SONIC_BUILD_JOBS=4 target/sonic-vpp.img.gz
Note: the first 3 steps are needed until the PR to upstream sonic is merged.
### Testing the qemu VM image

Refer to the [document](docs/README.sonic_vm.md) in docs directory for details.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"fast-shutdown": {
"after": [],
"before": []
},
"syslog": {
"support-rate-limit": true
}
},
"container": {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VPP_ENV_FILE=/etc/sonic/vpp/syncd_vpp_env
source $VPP_ENV_FILE

function error()
{
echo "Error : $*" 1>&2
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 0 additions & 11 deletions platform/vpp/docker-sonic-vpp/Dockerfile.cleanup

This file was deleted.

11 changes: 0 additions & 11 deletions platform/vpp/docker-syncd-vpp/Dockerfile-dbg.cleanup

This file was deleted.

11 changes: 0 additions & 11 deletions platform/vpp/docker-syncd-vpp/Dockerfile.cleanup

This file was deleted.

This file was deleted.

Binary file not shown.
Empty file.
28 changes: 0 additions & 28 deletions platform/vpp/gbsyncd-vpp.mk

This file was deleted.

5 changes: 5 additions & 0 deletions platform_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
sed -i -e 's/vs/vpp/g' /sonic/device/virtual/x86_64-kvm_x86_64-r0/platform_asic

# copy VPP sai.profile to the sonic-device-data package (Or permanently add sai.vpp_profile to sonic-device-data and change syncd script)
sed -i -e 's/_VS_/_VPP_/g' /sonic/src/sonic-device-data/src/sai.vs_profile
26 changes: 13 additions & 13 deletions platform/vpp/rules.dep → rules.dep
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include $(PLATFORM_PATH)/syncd-vpp.dep
include $(PLATFORM_PATH)/sonic-version.dep
include $(PLATFORM_PATH)/docker-sonic-vpp.dep
include $(PLATFORM_PATH)/docker-syncd-vpp.dep
include $(PLATFORM_PATH)/docker-gbsyncd-vpp.dep
include $(PLATFORM_PATH)/docker-ptf.dep
include $(PLATFORM_PATH)/docker-ptf-sai.dep
include $(PLATFORM_PATH)/libsaithrift-dev.dep
include $(PLATFORM_PATH)/one-image.dep
include $(PLATFORM_PATH)/onie.dep
include $(PLATFORM_PATH)/kvm-image.dep

include $(PLATFORM_RULES)/vpp.dep
include $(PLATFORM_RULES)/saivpp.dep
include $(PLATFORM_RULES)/sonic-version.dep
include $(PLATFORM_RULES)/platform-modules-vpp.dep
include $(PLATFORM_RULES)/docker-syncd-vpp.dep
include $(PLATFORM_RULES)/docker-gbsyncd-vpp.dep
include $(PLATFORM_RULES)/docker-ptf.dep
include $(PLATFORM_RULES)/docker-ptf-sai.dep
include $(PLATFORM_RULES)/libsaithrift-dev.dep
include $(PLATFORM_RULES)/one-image.dep
include $(PLATFORM_RULES)/onie.dep
include $(PLATFORM_RULES)/kvm-image.dep
include $(PLATFORM_RULES)/raw-image.dep
29 changes: 16 additions & 13 deletions platform/vpp/rules.mk → rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include $(PLATFORM_PATH)/syncd-vpp.mk
include $(PLATFORM_PATH)/sonic-version.mk
include $(PLATFORM_PATH)/docker-sonic-vpp.mk
include $(PLATFORM_PATH)/docker-syncd-vpp.mk
include $(PLATFORM_PATH)/docker-gbsyncd-vpp.mk
include $(PLATFORM_PATH)/docker-ptf.mk
include $(PLATFORM_PATH)/docker-ptf-sai.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/onie.mk
include $(PLATFORM_PATH)/kvm-image.mk
include $(PLATFORM_PATH)/raw-image.mk
rc:=$(shell $(PLATFORM_PATH)/platform_setup.sh)
PLATFORM_RULES := $(PLATFORM_PATH)/rules
export PLATFORM_RULES
include $(PLATFORM_RULES)/vpp.mk
include $(PLATFORM_RULES)/saivpp.mk
include $(PLATFORM_RULES)/sonic-version.mk
include $(PLATFORM_RULES)/platform-modules-vpp.mk
include $(PLATFORM_RULES)/docker-syncd-vpp.mk
include $(PLATFORM_RULES)/docker-gbsyncd-vpp.mk
include $(PLATFORM_RULES)/docker-ptf.mk
include $(PLATFORM_RULES)/docker-ptf-sai.mk
include $(PLATFORM_RULES)/libsaithrift-dev.mk
include $(PLATFORM_RULES)/one-image.mk
include $(PLATFORM_RULES)/onie.mk
include $(PLATFORM_RULES)/kvm-image.mk
include $(PLATFORM_RULES)/raw-image.mk

SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_KVM_IMAGE) $(DOCKER_SONIC_VPP) $(SONIC_RAW_IMAGE)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#DPKG FRK
DPATH := $($(DOCKER_GBSYNCD_BASE)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vpp/docker-gbsyncd-vpp.mk platform/vpp/docker-gbsyncd-vpp.dep
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-gbsyncd-vpp.mk $(PLATFORM_RULES)/docker-gbsyncd-vpp.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
DOCKER_GBSYNCD_PLATFORM_CODE = vpp
include $(PLATFORM_PATH)/../template/docker-gbsyncd-bookworm.mk

$(DOCKER_GBSYNCD_BASE)_DEPENDS += $(SYNCD_VPP)
$(DOCKER_GBSYNCD_BASE)_DEPENDS += $(LIBSAIVPP) \
$(SYNCD)

$(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VPP_DBG) \
$(LIBSWSSCOMMON_DBG) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

DPATH := $($(DOCKER_PTF_SAI)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vpp/docker-ptf-sai.mk platform/vpp/docker-ptf-sai.dep
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-ptf-sai.mk $(PLATFORM_RULES)/docker-ptf-sai.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion platform/vpp/docker-ptf.dep → rules/docker-ptf.dep
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


DPATH := $($(DOCKER_PTF)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-ptf.mk platform/vs/docker-ptf.dep
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-ptf.mk $(PLATFORM_RULES)/docker-ptf.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#DPKG FRK
DPATH := $($(DOCKER_SONIC_VPP)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vpp/docker-sonic-vpp.mk platform/vpp/docker-sonic-vpp.dep
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-sonic-vpp.mk $(PLATFORM_RULES)/docker-sonic-vpp.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#DPKG FRK
DPATH := $($(DOCKER_SYNCD_BASE)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-syncd-vs.mk platform/vs/docker-syncd-vs.dep
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-syncd-vpp.mk $(PLATFORM_RULES)/docker-syncd-vpp.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
DOCKER_SYNCD_PLATFORM_CODE = vpp
include $(PLATFORM_PATH)/../template/docker-syncd-bookworm.mk

$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD_VPP) \
$(IPROUTE2)
$(DOCKER_SYNCD_BASE)_DEPENDS += $(LIBSAIVPP) \
$(SYNCD)

$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VPP_DBG) \
$(SYNCD)_DEPENDS += $(LIBSAIVPP) $(LIBSAIVPP_DEV)

$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \
$(LIBSWSSCOMMON_DBG) \
$(LIBSAIMETADATA_DBG) \
$(LIBSAIREDIS_DBG) \
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion platform/vpp/kvm-image.mk → rules/kvm-image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# sonic kvm image

SONIC_KVM_IMAGE = sonic-vpp.img.gz
$(SONIC_KVM_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
$(SONIC_KVM_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(VPP_PLATFORM_MODULE)
$(SONIC_KVM_IMAGE)_MACHINE = vpp
$(SONIC_KVM_IMAGE)_IMAGE_TYPE = kvm
ifeq ($(INSTALL_DEBUG_TOOLS),y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#DPKG FRK
SPATH := $($(LIBSAITHRIFT_DEV)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/broadcom/libsaithrift-dev.mk platform/broadcom/libsaithrift-dev.dep
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/libsaithrift-dev.mk $(PLATFORM_RULES)/libsaithrift-dev.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_PATHS := $(SPATH) $(SPATH)/test/ptf $(SPATH)/test/saithrift/ctypesgen
$(foreach path, $(SMDEP_PATHS), $(eval $(path) :=$(filter-out $(SMDEP_PATHS),$(addprefix $(path)/, $(shell cd $(path) && git ls-files | grep -Ev " " )))))
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion platform/vpp/one-image.mk → rules/one-image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
SONIC_ONE_IMAGE = sonic-vpp.bin
$(SONIC_ONE_IMAGE)_MACHINE = vpp
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(VPP_PLATFORM_MODULE)
ifeq ($(INSTALL_DEBUG_TOOLS),y)
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)
$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES))
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions rules/platform-modules-vpp.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/platform-modules-vpp.mk $(PLATFORM_RULES)/platform-modules-vpp.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(VPP_PLATFORM_MODULE_REL_PATH)))

$(CISCO_8000_PLATFORM_MODULE)_CACHE_MODE := GIT_CONTENT_SHA
$(CISCO_8000_PLATFORM_MODULE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(CISCO_8000_PLATFORM_MODULE)_DEP_FILES := $(DEP_FILES)
5 changes: 5 additions & 0 deletions rules/platform-modules-vpp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VPP_PLATFORM_MODULE_VERSION = 1.0.0
VPP_PLATFORM_MODULE = platform-modules-vpp_$(VPP_PLATFORM_MODULE_VERSION)_amd64.deb
VPP_PLATFORM_MODULE_REL_PATH = sonic-platform-modules-vpp
$(VPP_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/$(VPP_PLATFORM_MODULE_REL_PATH)
SONIC_DPKG_DEBS += $(VPP_PLATFORM_MODULE)
File renamed without changes.
2 changes: 1 addition & 1 deletion platform/vpp/raw-image.mk → rules/raw-image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
SONIC_RAW_IMAGE = sonic-vpp.raw
$(SONIC_RAW_IMAGE)_MACHINE = vpp
$(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw
$(SONIC_RAW_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
$(SONIC_RAW_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(VPP_PLATFORM_MODULE)
$(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_RAW_IMAGE)
21 changes: 21 additions & 0 deletions rules/saivpp.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

SPATH := $($(LIBSAIVPP)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/saivpp.mk $(PLATFORM_RULES)/saivpp.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH))

$(VPPINFRA)_CACHE_MODE := GIT_CONTENT_SHA
$(VPPINFRA)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(VPPINFRA)_DEP_FILES := $(DEP_FILES)
Loading

0 comments on commit 0023aba

Please sign in to comment.