feat(nitroc): add BSP recipes for Nitroc

This was ported from NWL to CoreOS. https://bitbucket.gad.local/projects/NM-NSP/repos/netmodule-wireless-linux/pull-requests/49/overview

Co-authored-by: Stefen Eichenberger <stefan.eichenberger@netmodule.com>
This commit is contained in:
Sam Dolt 2024-03-18 14:26:52 +01:00
parent 6a87dab5a8
commit 2be0c69de4
12 changed files with 224 additions and 127 deletions

View File

@ -4,3 +4,4 @@
# #
require conf/machine/include/cn913x.inc require conf/machine/include/cn913x.inc
require conf/machine/include/cn913x-solidrun.inc

View File

@ -4,6 +4,7 @@
# #
require conf/machine/include/cn913x.inc require conf/machine/include/cn913x.inc
require conf/machine/include/cn913x-solidrun.inc
### Device specific settings ### Device specific settings
# Needed for phy firmware # Needed for phy firmware

View File

@ -0,0 +1,33 @@
#@TYPE: Machine
#@NAME: cn9131-nitroc
#@DESCRIPTION: Machine support for Belden Nitroc Platform
#
require conf/machine/include/cn913x.inc
# Bootloader configuration
# *****************************************************************************
PREFERRED_VERSION_u-boot ?= "2020.10-marvell"
# Set the configuration and device tree for Nitroc
UBOOT_MACHINE = "nitroc_defconfig"
UBOOT_BUILDENV_DEVICE_TREE ??= "cn9131-nitroc-v1"
# Kernel configuration
# ******************************************************************************
PREFERRED_PROVIDER_virtual/kernel ?= "linux-nitroc"
PREFERRED_VERSION_linux-netmodule ?= "v6.6.y%"
PREFERRED_VERSION_trusted-firmware-a ?= "2.9-nitroc"
KERNEL_IMAGETYPE = "Image"
KERNEL_DEFCONFIG ?= "nitroc_defconfig"
KERNEL_DEVICETREE ?= "\
marvell/cn9131-nitroc-v1.dtb \
marvell/cn9131-nitroc-m12.dtb \
marvell/cn9131-nitroc-rj45.dtb \
"
# Needed for phy firmware
MACHINE_EXTRA_RDEPENDS += "linux-firmware-ath10k linux-firmware-ath11k"

View File

@ -0,0 +1,30 @@
# Use source code provided by Solidrun for Falcon support
# Bootloader configuration
# *****************************************************************************
PREFERRED_VERSION_u-boot ?= "2019.10-solidrun"
# Solidrun made cn913x use the same defconfig for u-boot, but another devicetree
# by settings UBOOT_BUILDENV_DEVICE_TREE in the machine configuration file
UBOOT_MACHINE = "sr_cn913x_cex7_defconfig"
UBOOT_BUILDENV_DEVICE_TREE ??= "${MACHINE}"
UBOOT_ENTRYPOINT = "0x7000000"
UBOOT_LOADADDRESS = "0x7000000"
# Kernel configuration
# ******************************************************************************
PREFERRED_PROVIDER_virtual/kernel ?= "linux-netmodule"
PREFERRED_VERSION_linux-netmodule ?= "git-5.15-solidrun"
PREFERRED_VERSION_trusted_firmware_a = "2.6"
KERNEL_IMAGETYPE = "Image"
KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
KERNEL_DEFCONFIG ?= "cn9130-netmodule_defconfig"
KERNEL_DEVICETREE ?= "\
marvell/${MACHINE}.dtb \
"

View File

@ -11,31 +11,8 @@ require conf/machine/include/soc-family.inc
# ***************************************************************************** # *****************************************************************************
PREFERRED_PROVIDER_virtual/bootloader = "u-boot" PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
PREFERRED_VERSION_u-boot ?= "2019.10-solidrun"
# All cn913x use the same defconfig for u-boot, but another devicetree by
# settings UBOOT_BUILDENV_DEVICE_TREE in the machine configuration file
UBOOT_MACHINE = "sr_cn913x_cex7_defconfig"
UBOOT_BUILDENV_DEVICE_TREE ??= "${MACHINE}"
UBOOT_ENTRYPOINT = "0x7000000"
UBOOT_LOADADDRESS = "0x7000000"
# Kernel configuration
# ******************************************************************************
PREFERRED_PROVIDER_virtual/kernel ?= "linux-netmodule"
PREFERRED_VERSION_linux-netmodule ?= "git-5.15-solidrun"
PREFERRED_VERSION_trusted_firmware_a = "2.6"
KERNEL_IMAGETYPE = "Image"
KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
KERNEL_DEFCONFIG ?= "cn9130-netmodule_defconfig"
KERNEL_DEVICETREE ?= "\
marvell/${MACHINE}.dtb \
"
# getty configuration # getty configuration
# ****************************************************************************** # ******************************************************************************
@ -54,7 +31,7 @@ WKS_FILE = "cn913x-sdcard.wks.in"
COREOS_INSTALLER_WKS_FILE ?= "cn913x-sdcard-installer.wks" COREOS_INSTALLER_WKS_FILE ?= "cn913x-sdcard-installer.wks"
IMAGE_FSTYPES += "wic.xz wic.bmap" IMAGE_FSTYPES += "wic.xz wic.bmap"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " kernel-modules kernel-devicetree" MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " kernel-modules"
COREOS_IMAGE_SWUPDATE_EXTRACLASSES += " coreos-image-swupdate-cn913x" COREOS_IMAGE_SWUPDATE_EXTRACLASSES += " coreos-image-swupdate-cn913x"
# No watchdog available yet # No watchdog available yet

View File

@ -0,0 +1,29 @@
DESCRIPTION = "Marvell binaries like the system controller firmware"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://README.md;md5=bbdf038ac62317d3a12a067c50dadc61"
SRC_URI = "git://git@bitbucket.gad.local:7999/nm-nsp/binaries-marvell.git;protocol=ssh;user=git;branch=nitroc"
# Modify these as desired
PV = "11.23.08+git${SRCPV}"
SRCREV = "6765e4fa3eae4000a307bdb891fe8c03f3422f91"
S = "${WORKDIR}/git"
do_configure () {
:
}
do_compile () {
:
}
do_install () {
# The sources are needed by arm-trusted-firmware
install -d "${D}/usr/src/${PN}"
cp -r "${S}/mrvl_scp_bl2.img" "${D}/usr/src/${PN}/"
}
FILES:${PN}-dev = "/usr/src/${PN}"
INSANE_SKIP:${PN}-dev += "file-rdeps"
SYSROOT_DIRS += " /usr/src/${PN} "

View File

@ -1,23 +0,0 @@
From 85df3fa1ce20e577b2a1c83af01a88b7abc373ac Mon Sep 17 00:00:00 2001
From: Alon Rotman <alon.rotman@solid-run.com>
Date: Wed, 24 Mar 2021 15:47:08 +0200
Subject: [PATCH] COMPILE: fix stack overflow warning
Signed-off-by: Alon Rotman <alon.rotman@solid-run.com>
---
drivers/snps/snps_fw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/snps/snps_fw.c b/drivers/snps/snps_fw.c
index e2bbe57..811d70c 100644
--- a/drivers/snps/snps_fw.c
+++ b/drivers/snps/snps_fw.c
@@ -451,7 +451,7 @@ static void snps_mail_box_print_stream_msg(int msg_id, int msg_log_index)
/* 1D and 2D have different mail box dictionary database */
mb_stream_database = (snps_get_state() == TRAINING_2D ? two_d_messages : one_d_messages);
- stream_msg_count = sizeof(mb_stream_database) / sizeof(mb_stream_database[0]);
+ stream_msg_count = sizeof(mb_stream_database) / sizeof(struct mail_box_stream_message);
/* Most of the dictionary msg_id's are continuous, so first check database if
* msg_id cell holds this msg_id */

View File

@ -1,62 +0,0 @@
From 18c20824d9cb05c461c30f86484c0f2b0132bb85 Mon Sep 17 00:00:00 2001
From: Konstantin Porotchkin <kostap@marvell.com>
Date: Tue, 19 Jan 2021 14:06:36 +0200
Subject: [PATCH] fix compilation errors popped up by GCC-10
1. Multiple structure definitions due to define usage
in a header file.
2. Computing static array size from a derived pointer
Change-Id: Ic016813c3f06e2ec8ff9b7ad33c182c85faaa7d5
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/boot/mv_ddr/+/43918
Tested-by: sa_ip-sw-jenkins <sa_ip-sw-jenkins@marvell.com>
Reviewed-by: Ofer Heifetz <oferh@marvell.com>
Reviewed-by: Nadav Haklai <nadavh@marvell.com>
---
drivers/snps/snps.h | 2 +-
drivers/snps/snps_fw.c | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/snps/snps.h b/drivers/snps/snps.h
index 2ed1fec..6964c1c 100644
--- a/drivers/snps/snps.h
+++ b/drivers/snps/snps.h
@@ -322,7 +322,7 @@ struct snps_global_data {
int current_run_num;
};
-struct snps_global_data gd;
+extern struct snps_global_data gd;
extern int static_section_completed;
diff --git a/drivers/snps/snps_fw.c b/drivers/snps/snps_fw.c
index 811d70c..7417e06 100644
--- a/drivers/snps/snps_fw.c
+++ b/drivers/snps/snps_fw.c
@@ -101,6 +101,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ddr_topology_def.h"
#include "ddr3_training_ip_db.h"
+struct snps_global_data gd;
+
struct mail_box_major_message mb_major_messages[] = {
/* ID, Message string */
{MB_MAJOR_ID_END_INIT, "End of initialization"},
@@ -450,8 +452,13 @@ static void snps_mail_box_print_stream_msg(int msg_id, int msg_log_index)
debug_enter();
/* 1D and 2D have different mail box dictionary database */
- mb_stream_database = (snps_get_state() == TRAINING_2D ? two_d_messages : one_d_messages);
- stream_msg_count = sizeof(mb_stream_database) / sizeof(struct mail_box_stream_message);
+ if (snps_get_state() == TRAINING_2D) {
+ mb_stream_database = two_d_messages;
+ stream_msg_count = ARRAY_SIZE(two_d_messages);
+ } else {
+ mb_stream_database = one_d_messages;
+ stream_msg_count = ARRAY_SIZE(one_d_messages);
+ }
/* Most of the dictionary msg_id's are continuous, so first check database if
* msg_id cell holds this msg_id */

View File

@ -1,24 +1,12 @@
# Recipe created by recipetool DESCRIPTION = "Marvell DDR training library"
# This is the basis of a recipe and may need further editing in order to be fully functional. LICENSE = "GPL-2.0-or-later"
# (Feel free to remove these comments when editing.) LIC_FILES_CHKSUM = "file://Makefile;md5=9993156c815673120e02a7c8e00a8cc3"
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is SRC_URI = "git://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git;protocol=https;branch=master"
# your responsibility to verify that the values are complete and correct.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
# drivers/snps/fw/snps_license.txt
LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://drivers/snps/fw/snps_license.txt;md5=eec6820d302b600f6c1dc29d86f75ccb"
SRC_URI = "git://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git;branch=mv-ddr-devel;protocol=https \
file://0001-COMPILE-fix-stack-overflow-warning.patch \
file://0001-fix-compilation-errors-popped-up-by-GCC-10.patch \
"
# Modify these as desired # Modify these as desired
PV = "1.0+git${SRCPV}" PV = "devel+git${SRCPV}"
SRCREV = "305d923e6bc4236cd3b902f6679b0aef9e5fa52d" SRCREV = "bfcf62051be835f725005bb5137928f7c27b792e"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"

View File

@ -0,0 +1,20 @@
require recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
DEPENDS += "mv-ddr-marvell binaries-marvell coreutils-native"
COMPATIBLE_MACHINE = "cn9131-nitroc"
LIC_FILES_CHKSUM += "file://docs/license.rst;md5=b2c740efedc159745b9b31f88ff03dde"
SRC_URI = "git://git@bitbucket.gad.local:7999/nm-nsp/trusted-firmware-a.git;protocol=ssh;user=git;branch=nitroc-v2.9.0"
SRCREV = "41911b0db0a07878a384e8358950b79e6df7d1be"
EXTRA_OEMAKE += "MV_DDR_PATH=${PKG_CONFIG_SYSROOT_DIR}/usr/src/mv-ddr-marvell DDR_TOPOLOGY=2 SCP_BL2=${PKG_CONFIG_SYSROOT_DIR}/usr/src/binaries-marvell/mrvl_scp_bl2.img"
TFA_PLATFORM = "t9130_nitroc"
TFA_BUILD_TARGET = "all mrvl_flash"
TFA_INSTALL_TARGET = "flash-image"
TFA_DEBUG = "1"
TFA_MBEDTLS = "0"
TFA_UBOOT = "1"
TFA_UEFI = "0"

View File

@ -0,0 +1,32 @@
HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
DESCRIPTION = "U-Boot, a boot loader for Embedded boards based on PowerPC, \
ARM, MIPS and several other processors, which can be installed in a boot \
ROM and used to initialize and test the hardware or to download and run \
application code."
SECTION = "bootloaders"
DEPENDS += "flex-native bison-native"
COMPATIBLE_MACHINE = "cn913x"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025"
PE = "1"
SRCREV = "3534f6601c53362407bc6b3bf0af85908c38b81c"
SRC_URI = "git://git@bitbucket.gad.local:7999/nm-nsp/netmodule-u-boot.git;protocol=ssh;user=git;branch=sdk11.23.08-v2020.10-nitroc"
S = "${WORKDIR}/git"
require recipes-bsp/u-boot/u-boot.inc
require recipes-bsp/u-boot/u-boot-coreos.inc
# Solidrun patches require to build out-of-the-tree
B = "${WORKDIR}/build"
DEPENDS += "bc-native dtc-native u-boot-mkimage-native"
do_compile:prepend() {
export DEVICE_TREE="${UBOOT_BUILDENV_DEVICE_TREE}"
}
SYSROOT_DIRS += " /boot "

View File

@ -0,0 +1,71 @@
DESCRIPTION = "Linux kernel for the Nitroc hardware"
COMPATIBLE_MACHINE = "cn9131-nitroc"
inherit kernel
SRC_URI = "git://git@bitbucket.gad.local:7999/nm-nsp/netmodule-linux.git;protocol=ssh;user=git;branch=nitroc-v6.6.y"
SRCREV ?= "0b8f8f81ab0ec015002357820f50bfc2924390fe"
PV = "v6.6.y+git${SRCPV}"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
S = "${WORKDIR}/git"
#If a KERNEL_DEFCONFIG is specified, the defconfig specified in SRC_URI will be overwritten!
do_configure:append(){
if [ "${KERNEL_DEFCONFIG}" != "" ]; then
oe_runmake ${KERNEL_DEFCONFIG}
fi
configs="${@" ".join(find_cfgs(d))}"
if [ ! -z "${configs}" ]; then
${S}/scripts/kconfig/merge_config.sh -m -O ${WORKDIR}/build ${WORKDIR}/build/.config ${WORKDIR}/*.cfg
fi
}
# The default kenrel.bbclass expects it can remove the source symlink,
# newer kernels don't have this symlink so we need to override kernel_do_install
kernel_do_install() {
#
# First install the modules
#
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
# Remove empty module directories to prevent QA issues
find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
else
bbnote "no modules to install"
fi
#
# Install various kernel output (zImage, map file, config, module support files)
#
install -d ${D}/${KERNEL_IMAGEDEST}
#
# When including an initramfs bundle inside a FIT image, the fitImage is created after the install task
# by do_assemble_fitimage_initramfs.
# This happens after the generation of the initramfs bundle (done by do_bundle_initramfs).
# So, at the level of the install task we should not try to install the fitImage. fitImage is still not
# generated yet.
# After the generation of the fitImage, the deploy task copies the fitImage from the build directory to
# the deploy folder.
#
for imageType in ${KERNEL_IMAGETYPES} ; do
if [ $imageType != "fitImage" ] || [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ] ; then
install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType ${D}/${KERNEL_IMAGEDEST}/$imageType-${KERNEL_VERSION}
fi
done
install -m 0644 System.map ${D}/${KERNEL_IMAGEDEST}/System.map-${KERNEL_VERSION}
install -m 0644 .config ${D}/${KERNEL_IMAGEDEST}/config-${KERNEL_VERSION}
install -m 0644 vmlinux ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION}
[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
install -d ${D}${sysconfdir}/modules-load.d
install -d ${D}${sysconfdir}/modprobe.d
}
require recipes-kernel/linux/linux-yocto-coreos-efi.inc