Skip to content

Commit

Permalink
[vs]: BMv2-based DPU KVM image (#18762)
Browse files Browse the repository at this point in the history
Why I did it
Provide POC for development and cooperation.
Test for CI (Azp)

Microsoft ADO (number only): 27515178

How I did it
HLD: sonic-net/SONiC#1634

How to verify it
Merge PR: sonic-net/sonic-sairedis#1377

Download the vsdpu image from Azp
check the syncd links to the correct DASH SAI
admin@vlab-01:~$ docker exec -ti syncd bash
root@vlab-01:/# dpkg -l | grep sai
ii  libsai                                 1.0.0                          amd64        This package contains DASH libsai
root@vlab-01:/# dpkg -L libsai
/.
/etc
/etc/dash
/etc/dash/dash_pipeline.json
/etc/dash/dash_pipeline_ir.json
/etc/dash/dash_pipeline_p4rt.json
/etc/dash/dash_pipeline_p4rt.txt
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libsai.so
root@vlab-01:/# which syncd_dash
/usr/bin/syncd_dash
root@vlab-01:/# ldd /usr/bin/syncd_dash | grep sai
        libsaimetadata.so.0 => /usr/lib/x86_64-linux-gnu/libsaimetadata.so.0 (0x00007f949e99b000)
        libsaimeta.so.0 => /usr/lib/x86_64-linux-gnu/libsaimeta.so.0 (0x00007f949e8ca000)
        libsai.so => /usr/lib/x86_64-linux-gnu/libsai.so (0x00007f949e417000)
root@vlab-01:/# md5sum /usr/lib/x86_64-linux-gnu/libsai.so
9e86fa2f49a824837064d1b8f95b7e48  /usr/lib/x86_64-linux-gnu/libsai.so
root@vlab-01:/# ls /etc/dash
dash_pipeline.json  dash_pipeline_ir.json  dash_pipeline_p4rt.json  dash_pipeline_p4rt.txt
Check the dash engine logs(BMv2) likes following
admin@vlab-01:~$ docker logs dash_engine
Calling target program-options parser
Adding interface eth1 as port 0
[11:20:12.458] [bmv2] [D] [thread 7] Adding interface eth1 as port 0
[11:20:12.500] [bmv2] [E] [thread 7] Add port operation failed
Adding interface eth2 as port 1
[11:20:12.500] [bmv2] [D] [thread 7] Adding interface eth2 as port 1
[11:20:12.556] [bmv2] [E] [thread 7] Add port operation failed
Server listening on 0.0.0.0:9559
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_dash_pipeline241': dash_pipeline241 -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'dash_ingress.vip': dash_ingress.deny -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_dash_pipeline247': dash_pipeline247 -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'dash_ingress.direction_lookup_stage.direction_lookup': dash_ingress.direction_lookup_stage.set_inbound_direction -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'dash_ingress.appliance': NoAction -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_eni_lookup33': eni_lookup33 -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_eni_lookup33_0': eni_lookup33_0 -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_eni_lookup33_1': eni_lookup33_1 -
[11:22:09.706] [bmv2] [D] [thread 23] Set default default entry for table 
...
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_metering_update92': metering_update92 -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_metering_update94': metering_update94 -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_metering_update97': metering_update97 -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'dash_ingress.metering_update_stage.meter_bucket': NoAction -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_metering_update103': metering_update103 -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_metering_update105': metering_update105 -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'dash_ingress.metering_update_stage.eni_meter': NoAction -
[11:23:32.035] [bmv2] [D] [thread 23] Set default default entry for table 'tbl_drop_action': dash_ingress.drop_action -
[11:23:32.049] [bmv2] [D] [thread 23] simple_switch target has been notified of a config swap

Signed-off-by: Ze Gan <ganze718@gmail.com>
  • Loading branch information
Pterosaur authored May 17, 2024
1 parent 2c69277 commit 3a84ba8
Show file tree
Hide file tree
Showing 27 changed files with 470 additions and 3 deletions.
4 changes: 4 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ sudo cp $IMAGE_CONFIGS/misc/docker-wait-any $FILESYSTEM_ROOT/usr/bin/
sudo cp $IMAGE_CONFIGS/topology/topology.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
echo "topology.service" | sudo tee -a $GENERATED_SERVICE_FILE
sudo cp $IMAGE_CONFIGS/topology/topology.sh $FILESYSTEM_ROOT/usr/bin

sudo cp platform/vs/dash-engine.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable dash-engine

{%- endif %}

# Copy platform topology configuration scripts
Expand Down
16 changes: 16 additions & 0 deletions platform/vs/dash-engine.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Dash engine service
Before=syncd.service
StartLimitIntervalSec=1200
StartLimitBurst=3

[Service]
User=root
ExecStartPre=/usr/bin/dash_engine.sh start
ExecStart=/usr/bin/dash_engine.sh wait
ExecStop=/usr/bin/dash_engine.sh stop
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
8 changes: 8 additions & 0 deletions platform/vs/docker-dash-engine.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DPATH := $($(DOCKER_DASH_ENGINE)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-dash-engine.mk platform/vs/docker-dash-engine.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

$(DOCKER_DASH_ENGINE)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_DASH_ENGINE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_DASH_ENGINE)_DEP_FILES := $(DEP_FILES)
14 changes: 14 additions & 0 deletions platform/vs/docker-dash-engine.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# docker image for vs gbsyncd

DOCKER_DASH_ENGINE = docker-dash-engine.gz
$(DOCKER_DASH_ENGINE)_VERSION = 1.0.0
$(DOCKER_DASH_ENGINE)_PACKAGE_NAME = dash-engine
$(DOCKER_DASH_ENGINE)_PATH = $(PLATFORM_PATH)/docker-dash-engine

SONIC_DOCKER_IMAGES += $(DOCKER_DASH_ENGINE)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DASH_ENGINE)

$(DOCKER_DASH_ENGINE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM)

$(DOCKER_DASH_ENGINE)_CONTAINER_NAME = dash_engine
$(DOCKER_DASH_ENGINE)_CONTAINER_PRIVILEGED = true
11 changes: 11 additions & 0 deletions platform/vs/docker-dash-engine/Dockerfile.cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Base docker build
FROM docker-dash-engine-sonic:latest

# Copy the cache data to host
From scratch as output
COPY --from=docker-dash-engine-sonic:latest /cache.tgz cache.tgz

# Clean up the cache data
FROM docker-dash-engine-sonic:latest as final
RUN rm /cache.tgz

23 changes: 23 additions & 0 deletions platform/vs/docker-dash-engine/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM p4lang/behavioral-model@sha256:ce45720e28a96a50f275c1b511cd84c2558b62f2cf7a7e506765183bc3fb2e32
## FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

RUN apt-get install -f -y supervisor rsyslog python3-pip
RUN pip3 install supervisord-dependent-startup

COPY ["start.sh", "/usr/bin/"]

## COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
## COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
## COPY ["critical_processes", "/etc/supervisor/"]

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

## ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT ["/usr/bin/start.sh"]
1 change: 1 addition & 0 deletions platform/vs/docker-dash-engine/critical_processes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
program:simple_switch_grpc
3 changes: 3 additions & 0 deletions platform/vs/docker-dash-engine/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

simple_switch_grpc --interface 0@eth1 --interface 1@eth2 --log-console --no-p4
33 changes: 33 additions & 0 deletions platform/vs/docker-dash-engine/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true

[eventlistener:dependent-startup]
command=python3 -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
buffer_size=1024

[program:rsyslogd]
command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=true
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true

[program:start]
command=/usr/bin/start.sh
priority=2
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
7 changes: 7 additions & 0 deletions platform/vs/docker-gbsyncd-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ RUN apt-get update

RUN apt-get install -f -y iproute2 libcap2-bin

# For DASH engine

COPY debs/libnl-3-dev_3.5.0-1_amd64.deb debs/libnl-route-3-dev_3.5.0-1_amd64.deb debs/
RUN dpkg -i debs/libnl-3-dev_3.5.0-1_amd64.deb debs/libnl-route-3-dev_3.5.0-1_amd64.deb

RUN apt-get install -f -y libabsl20220623 libc-ares2 python3-six libboost-thread1.74.0 libboost-dev libboost-system-dev libboost-thread-dev libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-thread1.74.0 libnanomsg5 libpcap0.8 libthrift-0.17.0 libboost-dev libboost-filesystem-dev libboost-program-options-dev libgmp-dev libnanomsg-dev libpcap-dev libtool pkg-config libthrift-dev python3-thrift thrift-compiler libboost-iostreams1.74.0 libgc1 cpp libboost-dev libboost-all-dev libboost-graph-dev libboost-iostreams-dev libfl-dev libgc-dev libgmp-dev libbpf-dev tcpdump libelf-dev llvm clang python3-pyroute2 python3-ply python3-scapy python3-setuptools python3-thrift libthrift-0.17.0 libgrpc++1.51 libgrpc29 libprotobuf32 libboost-dev libboost-system-dev libboost-thread-dev libprotoc-dev protobuf-compiler python3-protobuf libgrpc++-dev libgrpc-dev protobuf-compiler-grpc python3-grpcio

COPY \
{% for deb in docker_gbsyncd_vs_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
Expand Down
9 changes: 8 additions & 1 deletion platform/vs/docker-syncd-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

RUN apt-get install -y libcap2-bin
RUN apt-get install -f -y iproute2 libcap2-bin

# For DASH engine

COPY debs/libnl-3-dev_3.5.0-1_amd64.deb debs/libnl-route-3-dev_3.5.0-1_amd64.deb debs/
RUN dpkg -i debs/libnl-3-dev_3.5.0-1_amd64.deb debs/libnl-route-3-dev_3.5.0-1_amd64.deb

RUN apt-get install -f -y libabsl20220623 libc-ares2 python3-six libboost-thread1.74.0 libboost-dev libboost-system-dev libboost-thread-dev libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-thread1.74.0 libnanomsg5 libpcap0.8 libthrift-0.17.0 libboost-dev libboost-filesystem-dev libboost-program-options-dev libgmp-dev libnanomsg-dev libpcap-dev libtool pkg-config libthrift-dev python3-thrift thrift-compiler libboost-iostreams1.74.0 libgc1 cpp libboost-dev libboost-all-dev libboost-graph-dev libboost-iostreams-dev libfl-dev libgc-dev libgmp-dev libbpf-dev tcpdump libelf-dev llvm clang python3-pyroute2 python3-ply python3-scapy python3-setuptools python3-thrift libthrift-0.17.0 libgrpc++1.51 libgrpc29 libprotobuf32 libboost-dev libboost-system-dev libboost-thread-dev libprotoc-dev protobuf-compiler python3-protobuf libgrpc++-dev libgrpc-dev protobuf-compiler-grpc python3-grpcio

{% if docker_syncd_vs_debs.strip() -%}
# Copy built Debian packages
Expand Down
1 change: 1 addition & 0 deletions platform/vs/rules.dep
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ include $(PLATFORM_PATH)/one-image.dep
include $(PLATFORM_PATH)/onie.dep
include $(PLATFORM_PATH)/kvm-image.dep

include $(PLATFORM_PATH)/docker-dash-engine.dep
1 change: 1 addition & 0 deletions platform/vs/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/onie.mk
include $(PLATFORM_PATH)/kvm-image.mk
include $(PLATFORM_PATH)/raw-image.mk
include $(PLATFORM_PATH)/docker-dash-engine.mk

SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_KVM_IMAGE) $(DOCKER_SONIC_VS) $(SONIC_RAW_IMAGE)
10 changes: 10 additions & 0 deletions platform/vs/syncd-vs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ $(LIBSAIREDIS)_DEB_BUILD_PROFILES += syncd vs

SYNCD_VS = syncd-vs_1.0.0_$(CONFIGURED_ARCH).deb
$(SYNCD_VS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBSAIVS)

ifeq ($(BLDENV),bookworm)
$(LIBSAIREDIS)_DEB_BUILD_PROFILES += dashsai
$(LIBSAIREDIS)_DEPENDS += $(DASH_SAI)
$(SYNCD_VS)_RDEPENDS += $(DASH_SAI)
else
$(warning DASH_SAI cannot support this build environment $(BLDENV))
endif


$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS)))

SYNCD_VS_DBG = syncd-vs-dbgsym_1.0.0_$(CONFIGURED_ARCH).deb
Expand Down
8 changes: 8 additions & 0 deletions rules/dash-sai.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SPATH := $($(DASH_SAI)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/dash-sai.mk rules/dash-sai.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH))

$(DASH_SAI)_CACHE_MODE := GIT_CONTENT_SHA
$(DASH_SAI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DASH_SAI)_DEP_FILES := $(DEP_FILES)
17 changes: 17 additions & 0 deletions rules/dash-sai.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# DASH SAI repo: https://github.com/sonic-net/DASH

DASH_SAI_VERSION = 1.0.0
DASH_SAI_COMMIT = cc281333e24ade258773ea843f669251a44d7c9a

export DASH_SAI_VERSION
export DASH_SAI_COMMIT

DASH_SAI = libsai_$(DASH_SAI_VERSION)_$(CONFIGURED_ARCH).deb
$(DASH_SAI)_SRC_PATH = $(SRC_PATH)/dash-sai
$(DASH_SAI)_DEPENDS = $(P4LANG_PI) $(P4LANG_BMV2) $(P4LANG_P4C)
$(DASH_SAI)_RDEPENDS = $(P4LANG_PI) $(P4LANG_BMV2) $(P4LANG_P4C)
SONIC_MAKE_DEBS += $(DASH_SAI)

DASH_SAI_DEV = libsai-dev_$(DASH_SAI_VERSION)_$(CONFIGURED_ARCH).deb
$(DASH_SAI_DEV)_DEPENDS = $(DASH_SAI)
$(eval $(call add_derived_package,$(DASH_SAI),$(DASH_SAI_DEV)))
39 changes: 39 additions & 0 deletions rules/grpc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# grpc package
# A newer GRPC has been released in bookworm, So we only need to build it
# in the bullseye environment.
ifeq ($(BLDENV),bullseye)

GRPC_VERSION = 1.30.2
GRPC_VERSION_FULL = $(GRPC_VERSION)-3

export GRPC_VERSION
export GRPC_VERSION_FULL

GRPC = libgrpc10_$(GRPC_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(GRPC)_DEPENDS = $(PROTOBUF) $(PROTOC32) $(PROTOBUF_COMPILER) $(PROTOBUF_DEV) $(PROTOC_DEV) $(RUBY_PROTOBUF)
$(GRPC)_SRC_PATH = $(SRC_PATH)/grpc
SONIC_MAKE_DEBS += $(GRPC)

GRPC_DEV = libgrpc-dev_$(GRPC_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(GRPC_DEV)_DEPENDS = $(GRPC)
$(eval $(call add_derived_package,$(GRPC),$(GRPC_DEV)))

GRPC_CPP = libgrpc++1_$(GRPC_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(GRPC_CPP)_DEPENDS = $(GRPC) $(PROTOC32)
$(eval $(call add_derived_package,$(GRPC),$(GRPC_CPP)))

GRPC_CPP_DEV = libgrpc++-dev_$(GRPC_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(GRPC_CPP_DEV)_DEPENDS = $(GRPC_CPP) $(GRPC_DEV)
$(eval $(call add_derived_package,$(GRPC),$(GRPC_CPP_DEV)))

PYTHON3_GRPC = python3-grpcio_$(GRPC_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(PYTHON3_GRPC)_DEPENDS = $(GRPC_DEV) $(GRPC) $(GRPC_DEV) $(GRPC_CPP) $(GRPC_CPP_DEV) $(PYTHON3_PROTOBUF)
$(PYTHON3_GRPC)_RDEPENDS = $(GRPC) $(GRPC_CPP) $(PYTHON3_PROTOBUF)
$(eval $(call add_derived_package,$(GRPC),$(PYTHON3_GRPC)))

GRPC_COMPILER = protobuf-compiler-grpc_$(GRPC_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(GRPC_COMPILER)_DEPENDS = $(PROTOBUF) $(PROTOC32) $(PROTOBUF_COMPILER)
$(GRPC_COMPILER)_RDEPENDS = $(PROTOBUF) $(PROTOC32) $(PROTOBUF_COMPILER)
$(eval $(call add_derived_package,$(GRPC),$(GRPC_COMPILER)))

endif
9 changes: 9 additions & 0 deletions rules/p4lang.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

SPATH := $($(P4LANG_PI)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/p4lang.mk rules/p4lang.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH))

$(P4LANG_PI)_CACHE_MODE := GIT_CONTENT_SHA
$(P4LANG_PI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(P4LANG_PI)_DEP_FILES := $(DEP_FILES)
45 changes: 45 additions & 0 deletions rules/p4lang.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# p4lang package

# Main target: p4lang-pi
P4LANG_PI_VERSION = 0.1.0
P4LANG_PI_VERSION_FULL = $(P4LANG_PI_VERSION)-15

export P4LANG_PI_VERSION
export P4LANG_PI_VERSION_FULL

P4LANG_PI = p4lang-pi_$(P4LANG_PI_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(P4LANG_PI)_DEPENDS = $(PROTOBUF) $(PROTOBUF_LITE) $(PROTOC32) $(PYTHON3_PROTOBUF) $(GRPC) $(GRPC_CPP) $(PYTHON3_GRPC) $(PROTOBUF_DEV) $(PROTOC_DEV) $(PROTOBUF_COMPILER) $(GRPC_DEV) $(GRPC_CPP_DEV) $(GRPC_COMPILER)
$(P4LANG_PI)_RDEPENDS = $(PROTOBUF) $(PROTOBUF_LITE) $(PROTOC32) $(PYTHON3_PROTOBUF) $(GRPC) $(GRPC_CPP) $(PYTHON3_GRPC) $(PROTOBUF_DEV) $(PROTOC_DEV) $(PROTOBUF_COMPILER) $(GRPC_DEV) $(GRPC_CPP_DEV) $(GRPC_COMPILER)


P4LANG = $(P4LANG_PI)
$(P4LANG)_SRC_PATH = $(SRC_PATH)/p4lang
SONIC_MAKE_DEBS += $(P4LANG)

# p4lang-bmv2

P4LANG_BMV2_VERSION = 1.15.0
P4LANG_BMV2_VERSION_FULL = $(P4LANG_BMV2_VERSION)-7

export P4LANG_BMV2_VERSION
export P4LANG_BMV2_VERSION_FULL

P4LANG_BMV2 = p4lang-bmv2_$(P4LANG_BMV2_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(P4LANG_BMV2)_SRC_PATH = $(SRC_PATH)/p4lang
$(P4LANG_BMV2)_DEPENDS = $(P4LANG_PI)
$(P4LANG_BMV2)_RDEPENDS = $(P4LANG_PI)
SONIC_MAKE_DEBS += $(P4LANG_BMV2)

# p4lang-p4c

P4LANG_P4C_VERSION = 1.2.4.2
P4LANG_P4C_VERSION_FULL = $(P4LANG_P4C_VERSION)-2

export P4LANG_P4C_VERSION
export P4LANG_P4C_VERSION_FULL

P4LANG_P4C = p4lang-p4c_$(P4LANG_P4C_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(P4LANG_P4C)_SRC_PATH = $(SRC_PATH)/p4lang
$(P4LANG_P4C)_DEPENDS = $(P4LANG_BMV2)
$(P4LANG_P4C)_RDEPENDS = $(P4LANG_BMV2)
SONIC_MAKE_DEBS += $(P4LANG_P4C)
9 changes: 9 additions & 0 deletions rules/protobuf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ ifeq ($(BLDENV),bullseye)
$(PROTOC32)_RDEPENDS = $(PROTOBUF) $(PROTOBUF_LITE)
$(eval $(call add_derived_package,$(PROTOBUF),$(PROTOC32)))

PROTOC_DEV = libprotoc-dev_$(PROTOBUF_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(PROTOC_DEV)_DEPENDS = $(PROTOBUF) $(PROTOBUF_LITE) $(PROTOC32)
$(eval $(call add_derived_package,$(PROTOBUF),$(PROTOC_DEV)))

PROTOBUF_COMPILER = protobuf-compiler_$(PROTOBUF_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(PROTOBUF_COMPILER)_DEPENDS = $(PROTOC32)
$(PROTOBUF_COMPILER)_RDEPENDS = $(PROTOC32)
Expand All @@ -34,4 +38,9 @@ ifeq ($(BLDENV),bullseye)
$(PYTHON3_PROTOBUF)_RDEPENDS = $(PROTOBUF)
$(eval $(call add_derived_package,$(PROTOBUF),$(PYTHON3_PROTOBUF)))

RUBY_PROTOBUF = ruby-google-protobuf_$(PROTOBUF_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(RUBY_PROTOBUF)_DEPENDS = $(PROTOBUF_DEV) $(PROTOBUF)
$(RUBY_PROTOBUF)_RDEPENDS = $(PROTOBUF)
$(eval $(call add_derived_package,$(PROTOBUF),$(RUBY_PROTOBUF)))

endif
1 change: 0 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ ifeq ($(SONIC_ENABLE_BOOTCHART),y)
ENABLE_BOOTCHART = y
endif


ifeq ($(ENABLE_ASAN),y)
ifneq ($(CONFIGURED_ARCH),amd64)
$(Q)echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)"
Expand Down
31 changes: 31 additions & 0 deletions sonic-slave-bookworm/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,34 @@ RUN apt-get update && apt-get install -y \
hwdata \
libzip-dev

{%- if CONFIGURED_ARCH != "arm64" and CONFIGURED_ARCH != "armhf" %}
RUN apt-get update && apt-get install -y \
# For p4 libraries
libgrpc++-dev \
libgrpc-dev \
libprotoc-dev \
protobuf-compiler-grpc \
valgrind \
python3-protobuf \
python3-grpcio \
thrift-compiler \
gfortran \
libopenmpi-dev \
libthrift-0.17.0 \
libthrift-dev \
libboost-all-dev \
libboost-graph-dev \
libboost-iostreams-dev \
libgc-dev \
tcpdump \
llvm \
net-tools \
python3-pyroute2 \
python3-ply \
python3-scapy \
python3-thrift
{%- endif %}

{%- if CROSS_BUILD_ENVIRON == "y" %}
# Arm vs. amd64 versions conflict - remove amd64 packages
RUN apt-get remove -y libnl-3-200
Expand Down Expand Up @@ -506,6 +534,9 @@ RUN patch -p1 -i /disable-non-manylinux.patch /usr/local/lib/python3.11/dist-pac
# For building sonic-utilities
RUN pip3 install fastentrypoints mock

# For DASH BMv2
RUN pip3 install jsonpath_ng

# For building sonic_ycabled
# Note: Match version in bookworm
RUN pip3 install grpcio==1.51.1 grpcio-tools==1.51.1
Expand Down
Loading

0 comments on commit 3a84ba8

Please sign in to comment.