Skip to content

Commit 7129232

Browse files
authored
[Mellanox] add rshim package to mellanox image (#18684)
- Why I did it To add rshim (BlueField Rshim Host Driver) package to the mellanox image. - How I did it Added rshim.mk to the Mellanox platform. Disabled rshim.service in sonic_debian_extension.j2 - How to verify it Build sonic-mellanox.bin Signed-off-by: Yakiv Huryk <[email protected]>
1 parent 1bd734b commit 7129232

File tree

9 files changed

+96
-2
lines changed

9 files changed

+96
-2
lines changed

files/build_templates/sonic_debian_extension.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable nv-syncd-shared
10381038

10391039
# Install minicom package
10401040
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install minicom
1041+
1042+
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable rshim.service
10411043
{% endif %}
10421044

10431045
{% if sonic_asic_platform == "nvidia-bluefield" %}

platform/mellanox/one-image.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES.
2+
# Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES.
33
# Apache-2.0
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,7 +19,7 @@
1919
SONIC_ONE_IMAGE = sonic-mellanox.bin
2020
$(SONIC_ONE_IMAGE)_MACHINE = mellanox
2121
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
22-
$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT_OEM) $(MFT) $(MFT_FWTRACE_CFG) $(MLNX_HW_MANAGEMENT)
22+
$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT_OEM) $(MFT) $(MFT_FWTRACE_CFG) $(MLNX_HW_MANAGEMENT) $(MLNX_RSHIM)
2323
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
2424
ifeq ($(INSTALL_DEBUG_TOOLS),y)
2525
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)

platform/mellanox/rshim.dep

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SPATH := $(MLNX_RSHIM)_SRC_PATH
2+
DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/rshim.mk $(PLATFORM_PATH)/rshim.dep
3+
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
4+
DEP_FILES += $(shell git ls-files -- $(SPATH))
5+
6+
$(MLNX_RSHIM)_CACHE_MODE := GIT_CONTENT_SHA
7+
$(MLNX_RSHIM)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) $(MLNX_RSHIM_DRIVER_VERSION)
8+
$(MLNX_RSHIM)_DEP_FILES := $(DEP_FILES)

platform/mellanox/rshim.mk

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
3+
# Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
MLNX_RSHIM_DRIVER_VERSION = 2.0.19
19+
MLNX_RSHIM_ASSETS_GITHUB_URL = https://github.com/Mellanox/sonic-bluefield-packages
20+
MLNX_RSHIM_ASSETS_RELEASE_TAG = rshim-$(MLNX_RSHIM_DRIVER_VERSION)-$(BLDENV)-$(CONFIGURED_ARCH)
21+
MLNX_RSHIM_ASSETS_URL = $(MLNX_RSHIM_ASSETS_GITHUB_URL)/releases/download/$(MLNX_RSHIM_ASSETS_RELEASE_TAG)
22+
23+
MLNX_RSHIM = rshim_${MLNX_RSHIM_DRIVER_VERSION}_${CONFIGURED_ARCH}.deb
24+
$(MLNX_RSHIM)_SRC_PATH = $(PLATFORM_PATH)/rshim
25+
$(MLNX_RSHIM)_URL = $(MLNX_RSHIM_ASSETS_URL)/$(MLNX_RSHIM)
26+
$(MLNX_RSHIM)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
27+
28+
MLNX_BSD_RSHIM_SRC_BASE_URL =
29+
30+
export MLNX_RSHIM MLNX_BSD_RSHIM_SRC_BASE_URL MLNX_RSHIM_DRIVER_VERSION
31+
32+
ifneq ($(MLNX_BSD_RSHIM_SRC_BASE_URL), )
33+
SONIC_MAKE_DEBS += $(MLNX_RSHIM)
34+
else
35+
SONIC_ONLINE_DEBS += $(MLNX_RSHIM)
36+
endif

platform/mellanox/rshim/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except these files
4+
!.gitignore
5+
!Makefile

platform/mellanox/rshim/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
3+
# Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
.ONESHELL:
19+
SHELL = /bin/bash
20+
.SHELLFLAGS += -ex
21+
22+
SRPMS_URL = $(MLNX_BSD_RSHIM_SRC_BASE_URL)/build/install/distro/SRPMS/
23+
RSHIM_URL = $(shell lynx --listonly --nonumbers -dump $(SRPMS_URL) | grep rshim)
24+
25+
$(addprefix $(DEST)/, $(MLNX_RSHIM)): $(DEST)/% :
26+
rm -rf ./rshim*
27+
mkdir ./rshim_src
28+
29+
wget ${RSHIM_URL}
30+
rpm2cpio rshim-${MLNX_RSHIM_DRIVER_VERSION}*.src.rpm | cpio -idmv
31+
tar xf rshim-${MLNX_RSHIM_DRIVER_VERSION}.tar.gz -C rshim_src --strip-components=1
32+
33+
pushd rshim_src
34+
35+
# Build the package
36+
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -rfakeroot -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
37+
38+
popd
39+
40+
mv $* $(DEST)/

platform/mellanox/rules.dep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ include $(PLATFORM_PATH)/mlnx-onie-fw-update.dep
1717
include $(PLATFORM_PATH)/mlnx-ssd-fw-update.dep
1818
include $(PLATFORM_PATH)/install-pending-fw.dep
1919
include $(PLATFORM_PATH)/component-versions.dep
20+
include $(PLATFORM_PATH)/rshim.dep

platform/mellanox/rules.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ include $(PLATFORM_PATH)/iproute2.mk
3535
include $(PLATFORM_PATH)/install-pending-fw.mk
3636
include $(PLATFORM_PATH)/integration-scripts.mk
3737
include $(PLATFORM_PATH)/component-versions.mk
38+
include $(PLATFORM_PATH)/rshim.mk
3839

3940
SONIC_ALL += $(SONIC_ONE_IMAGE) \
4041
$(DOCKER_FPM)

sonic-slave-bookworm/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ RUN apt-get update && apt-get install -y \
428428
rpm2cpio \
429429
libsnmp-dev \
430430
libpopt-dev \
431+
libfuse-dev \
431432
{%- if CONFIGURED_ARCH == "arm64" %}
432433
grub-efi-arm64-bin \
433434
{%- endif %}

0 commit comments

Comments
 (0)