layers: meta-nwl-marvell-bsp: add initial layer and add Nitroc support

Add an initial Marvell BSP layer which supports Nitroc. It is different
from CoreOS for now because it uses a newer kernel, U-Boot and trusted
firmware.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@netmodule.com>
This commit is contained in:
Stefan Eichenberger 2024-01-23 14:26:23 +01:00 committed by Stefan Eichenberger
parent 3e672279f7
commit c790b986ca
7 changed files with 270 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "nwl-marvell-bsp"
BBFILE_PATTERN_nwl-marvell-bsp = "^${LAYERDIR}/"
BBFILE_PRIORITY_nwl-marvell-bsp = "7"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_nwl-marvell-bsp = "1"
LAYERDEPENDS_nwl-marvell-bsp = "core meta-belden-coreos"
LAYERSERIES_COMPAT_nwl-marvell-bsp = "kirkstone"

View File

@ -0,0 +1,70 @@
#@TYPE: Machine
#@NAME: cn9131-nitroc
#@DESCRIPTION: Belden NetModule CN9131 NITROC
#
# cn913x is from Marvell octeon tx2 family, but it's based on a cortex-A72
# so we can't use the armv8-2a/tune-octeontx2.inc (armv8a vs arm8-2a)
# instead we can use the older octeontx family previously known as thunderx
require conf/machine/include/arm/armv8a/tune-thunderx.inc
# SOC_FAMILY is added to MACHINE_OVERRIDES in the soc-family.inc file
SOC_FAMILY = "cn913x"
require conf/machine/include/soc-family.inc
# Bootloader configuration
# *****************************************************************************
PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
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"
KERNEL_IMAGETYPE = "Image"
KERNEL_DEFCONFIG ?= "nitroc_defconfig"
KERNEL_DEVICETREE ?= "\
marvell/cn9131-nitroc-v1.dtb \
marvell/cn9131-nitroc-m12.dtb \
marvell/cn9131-nitroc-rj45.dtb \
"
# getty configuration
# ******************************************************************************
SERIAL_CONSOLES = "115200;ttyS0"
SERIAL_CONSOLES_CHECK ?= "${SERIAL_CONSOLES}"
APPEND += "console=ttyS0,115200"
# Image generation
# ******************************************************************************
# Ensure that both flash-image.bin and boot.scr are generated as they are needed
# for a wic image
do_image_wic[depends] += "trusted-firmware-a:do_deploy"
WKS_FILE = "cn913x-sdcard.wks.in"
COREOS_INSTALLER_WKS_FILE ?= "cn913x-sdcard-installer.wks"
IMAGE_FSTYPES += "wic.xz wic.bmap"
COREOS_IMAGE_SWUPDATE_EXTRACLASSES += " coreos-image-swupdate-cn913x"
# No watchdog available yet
EFIBOOTGUARD_TIMEOUT ?= "0"
require conf/machine/include/coreos-generic-features/efi.inc
require conf/machine/include/coreos-generic-features/partitions.inc
### Device specific settings
# Kernel modules are not essential for booting but are needed for most things
MACHINE_EXTRA_RDEPENDS += "kernel-modules"
# Device trees are included in the unified kernel and not needed in the rootfs
# MACHINE_EXTRA_RDEPENDS += "kernel-devicetree"
# Needed for phy firmware
MACHINE_EXTRA_RDEPENDS += "linux-firmware-ath11k"
MACHINE_EXTRA_RDEPENDS += "linux-firmware-ath10k"

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

@ -0,0 +1,29 @@
DESCRIPTION = "Marvell DDR training library"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://Makefile;md5=9993156c815673120e02a7c8e00a8cc3"
SRC_URI = "git://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git;protocol=https;branch=master"
# Modify these as desired
PV = "devel+git${SRCPV}"
SRCREV = "bfcf62051be835f725005bb5137928f7c27b792e"
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}/." "${D}/usr/src/${PN}/"
}
FILES:${PN}-dev = "/usr/src/${PN}"
INSANE_SKIP:${PN}-dev += "file-rdeps"
SYSROOT_DIRS += " /usr/src/${PN} "

View File

@ -0,0 +1,21 @@
require recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
DEPENDS += "mv-ddr-marvell binaries-marvell coreutils-native"
COMPATIBLE_MACHINE = "cn913x"
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