[Marvell-arm64] Support lazy install of sdk drivers

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>
This commit is contained in:
Pavan Naregundi 2023-06-13 12:55:23 +05:30 committed by Guohan Lu
parent be22217b64
commit 5c5e4c77f4
16 changed files with 25 additions and 126 deletions

3
.gitmodules vendored
View File

@ -115,3 +115,6 @@
[submodule "src/sonic-dash-api/sonic-dash-api"] [submodule "src/sonic-dash-api/sonic-dash-api"]
path = 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 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

@ -0,0 +1 @@
Subproject commit a5e93cbd8d90c767891e9ad56447b1047cfa558a

View File

@ -1,11 +1,8 @@
# Marvell Prestera # Marvell Prestera platform package
export MRVL_PRESTERA_VER = 1.0 export MRVL_PRESTERA_VER = 1.0
export MRVL_PRESTERA = mrvlprestera_$(MRVL_PRESTERA_VER)_$(PLATFORM_ARCH) export MRVL_PRESTERA = mrvlprestera_$(MRVL_PRESTERA_VER)_$(PLATFORM_ARCH)
export MRVL_PRESTERA_DEB = $(MRVL_PRESTERA).deb 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) $(MRVL_PRESTERA_DEB)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
SONIC_DPKG_DEBS += $(MRVL_PRESTERA_DEB) SONIC_DPKG_DEBS += $(MRVL_PRESTERA_DEB)

View File

@ -48,7 +48,7 @@ else
fit_addr=0x8000000 fit_addr=0x8000000
initrd_addr=0x2000000 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' FW_ENV_DEFAULT='/dev/mtd1 0x0 0x10000 0x100000'
demo_part=1 demo_part=1

View File

@ -1,5 +0,0 @@
mrvlprestera (1.0) unstable; urgency=low
* Prestera switch driver
-- Marvell <pnaregundi@marvell.com> Fri, 19 Feb 2021 10:39:18 +0800

View File

@ -1 +0,0 @@
9

View File

@ -1,15 +0,0 @@
Source: mrvlprestera
Section: unknown
Priority: optional
Maintainer: Marvell <pnaregundi@marvell.com>
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.6
Homepage: <insert the upstream URL, if relevant>
#Vcs-Git: git://anonscm.debian.org/collab-maint/mrvlprestera.git
#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/mrvlprestera.git
Package: mrvlprestera
Architecture: arm64
Homepage: <insert the upstream URL, if relevant>
Description:
kernel modules for prestera switch driver

View File

@ -1,3 +0,0 @@
mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers/mvMbusDrv.ko /lib/modules/KVERSION/kernel/extra
mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers/mvIntDrv.ko /lib/modules/KVERSION/kernel/extra
mrvl-prestera/platform/arm64/* /

View File

@ -1,56 +0,0 @@
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
PACKAGE_PRE_NAME := mrvlprestera
ifneq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= $(shell uname -r)
endif
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIR := mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers
%:
dh $@ --with systemd,python2,python3 --buildsystem=pybuild
clean:
dh_testdir
dh_testroot
dh_clean
build:
# get sources
rm -rf mrvl-prestera || true
git clone ${MRVL_PRESTERA_SRC_URL}
cd mrvl-prestera && git checkout ${MRVL_PRESTERA_SRC_TAG} && cd ..
sed "s/KVERSION/${KVERSION}/g" /sonic/platform/marvell-arm64/prestera/debian/mrvlprestera.install.template > /sonic/platform/marvell-arm64/prestera/debian/mrvlprestera.install
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$(MODULE_DIR)/
binary: binary-arch binary-indep
# Nothing to do
binary-arch:
# Nothing to do
binary-indep:
dh_testdir
dh_installdirs
# Resuming debhelper scripts
dh_testroot
dh_install
dh_installchangelogs
dh_installdocs
dh_systemd_enable
dh_installinit
dh_systemd_start
dh_link
dh_fixperms
dh_compress
dh_strip
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: build binary binary-arch binary-indep clean

View File

@ -5,7 +5,7 @@ include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk
include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/prestera.mk include $(PLATFORM_PATH)/mrvl-prestera.mk
include $(PLATFORM_PATH)/platform-nokia.mk include $(PLATFORM_PATH)/platform-nokia.mk
SONIC_ALL += $(SONIC_ONE_IMAGE) \ SONIC_ALL += $(SONIC_ONE_IMAGE) \

View File

@ -4,9 +4,9 @@
# Load required kernel-mode drivers # Load required kernel-mode drivers
load_kernel_drivers() { load_kernel_drivers() {
echo "Loading 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/kernel/extra/nokia_7215_ixs_a1_cpld.ko
sudo insmod /lib/modules/5.10.0-23-2-arm64/ac5_thermal_sensor.ko sudo insmod /lib/modules/5.10.0-23-2-arm64/kernel/extra/ac5_thermal_sensor.ko
} }
nokia_7215_profile() nokia_7215_profile()

View File

@ -1,33 +0,0 @@
#!/bin/bash
fw_uboot_env_cfg()
{
echo "Setting up U-Boot environment..."
MACH_FILE="/host/machine.conf"
PLATFORM=`sed -n 's/onie_platform=\(.*\)/\1/p' $MACH_FILE`
FW_ENV_DEFAULT='/dev/mtd0 0x400000 0x10000 0x10000'
echo $FW_ENV_DEFAULT > /etc/fw_env.config
}
update_modulelist()
{
MODULE_FILE="/etc/modules-load.d/marvell.conf"
if grep -Fxq "mvMbusDrv" $MODULE_FILE
then
echo "Module list up to date"
else
echo "mvMbusDrv" >> $MODULE_FILE
modprobe mvMbusDrv
fi
}
main()
{
fw_uboot_env_cfg
update_modulelist
}
main $@

View File

@ -11,10 +11,13 @@ ifneq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= $(shell uname -r) KVERSION ?= $(shell uname -r)
endif endif
KERNEL_SRC := /lib/modules/$(KVERSION) KERNEL_SRC := /lib/modules/$(KVERSION)
INSTALL_MOD_DIR := kernel/extra/
MOD_SRC_DIR:= $(shell pwd) MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= 7215 MODULE_DIRS:= 7215
UTILS_DIR := utils UTILS_DIR := utils
MODULE_DIR:= modules MODULE_DIR:= modules
MRVL_MODULE_DIR:= mrvl-modules
PRESTERA_MODULE_SRC := mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers
SERVICE_DIR := service SERVICE_DIR := service
PLATFORM_DIR := sonic_platform PLATFORM_DIR := sonic_platform
@ -28,6 +31,12 @@ clean:
build: build:
(for mod in $(MODULE_DIRS); do \ (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; \ 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}; \ python3 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
done) done)
@ -50,6 +59,7 @@ binary-indep:
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /lib/systemd/system; \ 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}/$(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}/$(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); \ 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; \ python3 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
done) done)

View File

@ -1,4 +1,4 @@
7215/scripts/nokia-7215_plt_setup.sh usr/local/bin
7215/scripts/nokia-7215-init.sh usr/local/bin 7215/scripts/nokia-7215-init.sh usr/local/bin
7215/service/nokia-7215init.service etc/systemd/system 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 7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-nokia_ixs7215_52xb-r0
../mrvl-prestera/platform/arm64/ac5x/* /

View File

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

View File

@ -20,7 +20,7 @@
}; };
fdt_ac5x { fdt_ac5x {
description = "Flattened Device Tree blob for 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"; type = "flat_dt";
arch = "arm64"; arch = "arm64";
compression = "none"; compression = "none";