From 26ee7cc5f48abed35c81a17df7a7eeddc475beb9 Mon Sep 17 00:00:00 2001 From: "arheneus@marvell.com" <51254330+antony-rheneus@users.noreply.github.com> Date: Tue, 30 Mar 2021 03:57:01 +0530 Subject: [PATCH] [marvell]: Marvell prestera kernel driver (#7066) Build Marvell kernel driver for prestera sai sdk Builds interrupt and dma kernel driver Removed the older method pre-compiled kernel module debian package and its makefile --- platform/marvell-armhf/linux-kernel-armhf.mk | 6 --- platform/marvell-armhf/linux/Makefile | 10 ---- platform/marvell-armhf/one-image.mk | 2 +- platform/marvell-armhf/prestera.mk | 11 ++++ .../marvell-armhf/prestera/debian/changelog | 5 ++ platform/marvell-armhf/prestera/debian/compat | 1 + .../marvell-armhf/prestera/debian/control | 15 ++++++ .../debian/mrvlprestera.install.template | 3 ++ platform/marvell-armhf/prestera/debian/rules | 53 +++++++++++++++++++ platform/marvell-armhf/rules.mk | 2 +- 10 files changed, 90 insertions(+), 18 deletions(-) delete mode 100644 platform/marvell-armhf/linux-kernel-armhf.mk delete mode 100644 platform/marvell-armhf/linux/Makefile create mode 100644 platform/marvell-armhf/prestera.mk create mode 100644 platform/marvell-armhf/prestera/debian/changelog create mode 100644 platform/marvell-armhf/prestera/debian/compat create mode 100755 platform/marvell-armhf/prestera/debian/control create mode 100644 platform/marvell-armhf/prestera/debian/mrvlprestera.install.template create mode 100755 platform/marvell-armhf/prestera/debian/rules diff --git a/platform/marvell-armhf/linux-kernel-armhf.mk b/platform/marvell-armhf/linux-kernel-armhf.mk deleted file mode 100644 index ac7aa3faf1..0000000000 --- a/platform/marvell-armhf/linux-kernel-armhf.mk +++ /dev/null @@ -1,6 +0,0 @@ -# linux kernel package for marvell armhf - -# Add platform specific DTB -LINUX_KERNEL_DTB = linux-image-4.9.189-armhf.deb -$(LINUX_KERNEL_DTB)_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL_DTB) -SONIC_ONLINE_DEBS += $(LINUX_KERNEL_DTB) diff --git a/platform/marvell-armhf/linux/Makefile b/platform/marvell-armhf/linux/Makefile deleted file mode 100644 index dba660649a..0000000000 --- a/platform/marvell-armhf/linux/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL_DTB) - -$(addprefix $(DEST)/, $(LINUX_KERNEL_DTB)): $(DEST)/% : - # get deb package - wget -O $(DEST)/$(LINUX_KERNEL_DTB) $(LINUX_KERNEL_MRVL_URL) - diff --git a/platform/marvell-armhf/one-image.mk b/platform/marvell-armhf/one-image.mk index 44bcd95952..b72b553487 100644 --- a/platform/marvell-armhf/one-image.mk +++ b/platform/marvell-armhf/one-image.mk @@ -4,7 +4,7 @@ SONIC_ONE_IMAGE = sonic-marvell-armhf.bin $(SONIC_ONE_IMAGE)_MACHINE = marvell-armhf $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) -$(SONIC_ONE_IMAGE)_INSTALLS += $(LINUX_KERNEL_DTB) +$(SONIC_ONE_IMAGE)_INSTALLS += $(MRVL_PRESTERA_DEB) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(ET6448M_PLATFORM) \ $(NOKIA_7215_PLATFORM) ifeq ($(INSTALL_DEBUG_TOOLS),y) diff --git a/platform/marvell-armhf/prestera.mk b/platform/marvell-armhf/prestera.mk new file mode 100644 index 0000000000..2365319b9d --- /dev/null +++ b/platform/marvell-armhf/prestera.mk @@ -0,0 +1,11 @@ +# Marvell Prestera + +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.0 + +$(MRVL_PRESTERA_DEB)_SRC_PATH = $(PLATFORM_PATH)/prestera +$(MRVL_PRESTERA_DEB)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(MRVL_PRESTERA_DEB) diff --git a/platform/marvell-armhf/prestera/debian/changelog b/platform/marvell-armhf/prestera/debian/changelog new file mode 100644 index 0000000000..ab8de1dfa3 --- /dev/null +++ b/platform/marvell-armhf/prestera/debian/changelog @@ -0,0 +1,5 @@ +mrvlprestera (1.0) unstable; urgency=low + + * Prestera switch driver + + -- Marvell Fri, 19 Feb 2021 10:39:18 +0800 diff --git a/platform/marvell-armhf/prestera/debian/compat b/platform/marvell-armhf/prestera/debian/compat new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/platform/marvell-armhf/prestera/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/marvell-armhf/prestera/debian/control b/platform/marvell-armhf/prestera/debian/control new file mode 100755 index 0000000000..51cb0579a2 --- /dev/null +++ b/platform/marvell-armhf/prestera/debian/control @@ -0,0 +1,15 @@ +Source: mrvlprestera +Section: unknown +Priority: optional +Maintainer: Marvell +Build-Depends: debhelper (>=9) +Standards-Version: 3.9.6 +Homepage: +#Vcs-Git: git://anonscm.debian.org/collab-maint/mrvlprestera.git +#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/mrvlprestera.git + +Package: mrvlprestera +Architecture: armhf +Homepage: +Description: + kernel modules for prestera switch driver diff --git a/platform/marvell-armhf/prestera/debian/mrvlprestera.install.template b/platform/marvell-armhf/prestera/debian/mrvlprestera.install.template new file mode 100644 index 0000000000..d0e96ab1e7 --- /dev/null +++ b/platform/marvell-armhf/prestera/debian/mrvlprestera.install.template @@ -0,0 +1,3 @@ +mrvl-prestera/cpssEnabler/linuxNoKernelModule/drivers/mvDmaDrv.ko /lib/modules/KVERSION/kernel/extra +mrvl-prestera/cpssEnabler/linuxNoKernelModule/drivers/mvIntDrv.ko /lib/modules/KVERSION/kernel/extra +mrvl-prestera/platform/armhf/* / diff --git a/platform/marvell-armhf/prestera/debian/rules b/platform/marvell-armhf/prestera/debian/rules new file mode 100755 index 0000000000..67692a4272 --- /dev/null +++ b/platform/marvell-armhf/prestera/debian/rules @@ -0,0 +1,53 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/pkg-info.mk + +PACKAGE_PRE_NAME := mrvlprestera +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIR := mrvl-prestera/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 -b ${MRVL_PRESTERA_SRC_TAG} ${MRVL_PRESTERA_SRC_URL} + sed "s/KVERSION/${KVERSION}/g" /sonic/platform/marvell-armhf/prestera/debian/mrvlprestera.install.template > /sonic/platform/marvell-armhf/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 diff --git a/platform/marvell-armhf/rules.mk b/platform/marvell-armhf/rules.mk index 58b9654956..fd320e8caa 100644 --- a/platform/marvell-armhf/rules.mk +++ b/platform/marvell-armhf/rules.mk @@ -5,9 +5,9 @@ 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)/linux-kernel-armhf.mk include $(PLATFORM_PATH)/platform-et6448m.mk include $(PLATFORM_PATH)/platform-nokia.mk +include $(PLATFORM_PATH)/prestera.mk ENABLE_SYNCD_RPC = "" INCLUDE_MGMT_FRAMEWORK = ""