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 3cc595d414
7 changed files with 328 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,71 @@
#@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"
# 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 = "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_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
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 115200;ttyAMA0"
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"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " kernel-modules kernel-devicetree"
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
# Needed for phy firmware
MACHINE_EXTRA_RDEPENDS += "linux-firmware-ath11k"
MACHINE_EXTRA_RDEPENDS += "linux-firmware-ath10k"

View File

@ -0,0 +1,38 @@
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# 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 = "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,38 @@
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# 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 = "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,37 @@
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"
# We use the revision in order to avoid having to fetch it from the
# repo during parse
SRCREV = "c11f5649c2053684dc8f6658228cf3e9baf47422"
# Patch from https://github.com/SolidRun/cn913x_build
# Git SHA: f33e2aeb01c7ee061be7b053035ae87ce30fce4a
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,105 @@
DESCRIPTION = "Linux kernel for various NetModule 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
}
# Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile
do_kernel_version_sanity_check() {
if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then
exit 0
fi
# The Makefile determines the kernel version shown at runtime
# Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile
VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//)
PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//)
# Build a string for regex and a plain version string
reg="^${VERSION}\.${PATCHLEVEL}"
vers="${VERSION}.${PATCHLEVEL}"
if [ -n "${SUBLEVEL}" ]; then
# Ignoring a SUBLEVEL of zero is fine
if [ "${SUBLEVEL}" = "0" ]; then
reg="${reg}(\.${SUBLEVEL})?"
else
reg="${reg}\.${SUBLEVEL}"
vers="${vers}.${SUBLEVEL}"
fi
fi
vers="${vers}${EXTRAVERSION}"
reg="${reg}${EXTRAVERSION}"
if [ -z `echo ${PV} | grep -E "${reg}"` ]; then
bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source or set KERNEL_VERSION_SANITY_SKIP=\"1\" in your recipe."
fi
exit 0
}
require recipes-kernel/linux/linux-yocto-coreos-efi.inc