Skip to content

Commit

Permalink
[Marvell-arm64] Support lazy install of sdk drivers
Browse files Browse the repository at this point in the history
This patch adds support for lazy install of Marvell prestera SDK
drivers for platform-nokia. Lazy install for drivers is added as
updated sdk driver needs to classify the drivers required for platform
during compile time. SDK drivers and platform files are now fetched
from a submodule(mrvl-prestera).

Additionaly, DTB required for sonic_fit creation during compile time
is sourced from sonic-linux-kernel.

Change-Id: Id5b011e6bd67accf7b1579d91cb7affad464e916
Signed-off-by: Pavan Naregundi <pnaregundi@marvell.com>
  • Loading branch information
pavannaregundi committed Oct 9, 2023
1 parent caf0e18 commit e2773ef
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 126 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,6 @@
[submodule "src/sonic-dash-api/sonic-dash-api"]
path = src/sonic-dash-api/sonic-dash-api
url = https://github.com/sonic-net/sonic-dash-api.git
[submodule "platform/marvell-arm64/mrvl-prestera"]
path = platform/marvell-arm64/mrvl-prestera
url = https://github.com/Marvell-switching/mrvl-prestera.git
1 change: 1 addition & 0 deletions platform/marvell-arm64/mrvl-prestera
Submodule mrvl-prestera added at a5e93c
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Marvell Prestera

# Marvell Prestera platform package
export MRVL_PRESTERA_VER = 1.0
export MRVL_PRESTERA = mrvlprestera_$(MRVL_PRESTERA_VER)_$(PLATFORM_ARCH)
export MRVL_PRESTERA_DEB = $(MRVL_PRESTERA).deb
export MRVL_PRESTERA_SRC_URL = https://github.com/Marvell-switching/mrvl-prestera.git
export MRVL_PRESTERA_SRC_TAG = MRVL_PRESTERA_DRIVER_1.3

$(MRVL_PRESTERA_DEB)_SRC_PATH = $(PLATFORM_PATH)/prestera
$(MRVL_PRESTERA_DEB)_SRC_PATH = $(PLATFORM_PATH)/mrvl-prestera
$(MRVL_PRESTERA_DEB)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
SONIC_DPKG_DEBS += $(MRVL_PRESTERA_DEB)
2 changes: 1 addition & 1 deletion platform/marvell-arm64/platform.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ else
fit_addr=0x8000000
initrd_addr=0x2000000

fdt_fname="/boot/armada-7020-comexpress.dtb"
fdt_fname="/usr/lib/linux-image-$kernel_version/marvell/armada-7020-comexpress.dtb"

FW_ENV_DEFAULT='/dev/mtd1 0x0 0x10000 0x100000'
demo_part=1
Expand Down
5 changes: 0 additions & 5 deletions platform/marvell-arm64/prestera/debian/changelog

This file was deleted.

1 change: 0 additions & 1 deletion platform/marvell-arm64/prestera/debian/compat

This file was deleted.

15 changes: 0 additions & 15 deletions platform/marvell-arm64/prestera/debian/control

This file was deleted.

This file was deleted.

56 changes: 0 additions & 56 deletions platform/marvell-arm64/prestera/debian/rules

This file was deleted.

2 changes: 1 addition & 1 deletion platform/marvell-arm64/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk
include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/prestera.mk
include $(PLATFORM_PATH)/mrvl-prestera.mk
include $(PLATFORM_PATH)/platform-nokia.mk

SONIC_ALL += $(SONIC_ONE_IMAGE) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

# Load required kernel-mode drivers
load_kernel_drivers() {
echo "Loading Kernel Drivers"
sudo insmod /lib/modules/5.10.0-23-2-arm64/nokia_7215_ixs_a1_cpld.ko
sudo insmod /lib/modules/5.10.0-23-2-arm64/ac5_thermal_sensor.ko
echo "Loading Kernel Drivers"
sudo insmod /lib/modules/5.10.0-23-2-arm64/kernel/extra/nokia_7215_ixs_a1_cpld.ko
sudo insmod /lib/modules/5.10.0-23-2-arm64/kernel/extra/ac5_thermal_sensor.ko
}

nokia_7215_profile()
Expand Down

This file was deleted.

10 changes: 10 additions & 0 deletions platform/marvell-arm64/sonic-platform-nokia/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ ifneq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= $(shell uname -r)
endif
KERNEL_SRC := /lib/modules/$(KVERSION)
INSTALL_MOD_DIR := kernel/extra/
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= 7215
UTILS_DIR := utils
MODULE_DIR:= modules
MRVL_MODULE_DIR:= mrvl-modules
PRESTERA_MODULE_SRC := mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers
SERVICE_DIR := service
PLATFORM_DIR := sonic_platform

Expand All @@ -28,6 +31,12 @@ clean:

build:
(for mod in $(MODULE_DIRS); do \
cd $(MOD_SRC_DIR)/../$(PRESTERA_MODULE_SRC)/; \
make clean; \
make modules -C $(KERNEL_SRC)/build M=`pwd` CONFIG_KM_MVMBUS=y CONFIG_KM_MVINT=y || exit 1; \
mkdir $(MOD_SRC_DIR)/$${mod}/$(MRVL_MODULE_DIR); \
cp *.ko $(MOD_SRC_DIR)/$${mod}/$(MRVL_MODULE_DIR)/; \
cd $(MOD_SRC_DIR); \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules || exit 1; \
python3 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
done)
Expand All @@ -50,6 +59,7 @@ binary-indep:
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(MRVL_MODULE_DIR)/mvcpss.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
python3 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
done)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
7215/scripts/nokia-7215_plt_setup.sh usr/local/bin
7215/scripts/nokia-7215-init.sh usr/local/bin
7215/service/nokia-7215init.service etc/systemd/system
7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-nokia_ixs7215_52xb-r0
../mrvl-prestera/platform/arm64/ac5x/* /
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ set -e

case "$1" in
configure)
sh /usr/local/bin/nokia-7215_plt_setup.sh
chmod a+x /usr/local/bin/nokia-7215-init.sh
depmod -a
systemctl restart kmod
systemctl enable nokia-7215init.service
systemctl start nokia-7215init.service

Expand Down
2 changes: 1 addition & 1 deletion platform/marvell-arm64/sonic_fit.its
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
};
fdt_ac5x {
description = "Flattened Device Tree blob for AC5x";
data = /incbin/("/boot/ac5x.dtb");
data = /incbin/("/usr/lib/linux-image-5.10.0-23-2-arm64/marvell/ac5-98dx35xx-rd.dtb");
type = "flat_dt";
arch = "arm64";
compression = "none";
Expand Down

0 comments on commit e2773ef

Please sign in to comment.