From 5e43e138efeed075773cc9061e7f3ba229c427d9 Mon Sep 17 00:00:00 2001 From: Leonardo Graboski Veiga Date: Tue, 11 Feb 2025 10:19:51 -0300 Subject: [PATCH 1/4] linux-xenomai: add recipes for kernel 6.12 Add recipes to build Xenomai 3 and 4 on top of the Linux Kernel 6.12. Signed-off-by: Leonardo Graboski Veiga --- recipes-kernel/linux/files/xenomai-common.cfg | 81 +++++++++++ recipes-kernel/linux/files/xenomai3.cfg | 128 ++++++++++++++++++ recipes-kernel/linux/files/xenomai4.cfg | 39 ++++++ recipes-kernel/linux/linux-xenomai-3_6.12.bb | 40 ++++++ recipes-kernel/linux/linux-xenomai-4_6.12.bb | 33 +++++ 5 files changed, 321 insertions(+) create mode 100644 recipes-kernel/linux/files/xenomai-common.cfg create mode 100644 recipes-kernel/linux/files/xenomai3.cfg create mode 100644 recipes-kernel/linux/files/xenomai4.cfg create mode 100644 recipes-kernel/linux/linux-xenomai-3_6.12.bb create mode 100644 recipes-kernel/linux/linux-xenomai-4_6.12.bb diff --git a/recipes-kernel/linux/files/xenomai-common.cfg b/recipes-kernel/linux/files/xenomai-common.cfg new file mode 100644 index 00000000..748bd12f --- /dev/null +++ b/recipes-kernel/linux/files/xenomai-common.cfg @@ -0,0 +1,81 @@ +# +# IRQ subsystem +# +CONFIG_IRQ_PIPELINE=y + +# +# Timers subsystem +# +CONFIG_CONTEXT_TRACKING=y +# CONFIG_CONTEXT_TRACKING_FORCE is not set +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_HZ=n +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_VIRT_CPU_ACCOUNTING=y +# CONFIG_TICK_CPU_ACCOUNTING is not set +CONFIG_VIRT_CPU_ACCOUNTING_GEN=y + +# +# RCU Subsystem +# +CONFIG_RCU_EXPERT=y +CONFIG_RCU_FANOUT=64 +CONFIG_RCU_FANOUT_LEAF=16 +# CONFIG_RCU_FAST_NO_HZ is not set +# CONFIG_RCU_BOOST is not set +CONFIG_RCU_NOCB_CPU=y +# CONFIG_TASKS_TRACE_RCU_READ_MB is not set + +# +# Processor type and features +# +CONFIG_SCHED_MC=y +CONFIG_SCHED_MC_PRIO=n +CONFIG_MCORE2=y + +CONFIG_DOVETAIL=y +CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE=y + +# +# Memory Management options +# +CONFIG_COMPACTION=n +CONFIG_MIGRATION=n +CONFIG_TRANSPARENT_HUGEPAGE=n + +CONFIG_HZ_250=y +CONFIG_HZ=250 + +# +# Power management and ACPI options +# +CONFIG_SUSPEND=n +CONFIG_PM=n +CONFIG_ACPI_PROCESSOR=n + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=n +CONFIG_CPU_FREQ_STAT=n +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=n +CONFIG_CPU_FREQ_GOV_ONDEMAND=n + +CONFIG_DEBUG_IRQ_PIPELINE=y +# CONFIG_IRQ_PIPELINE_TORTURE_TEST is not set +CONFIG_DEBUG_DOVETAIL=y +CONFIG_RAW_PRINTK=y + +# +# CPU Idle +# +CONFIG_CPU_IDLE=n +CONFIG_INTEL_IDLE=n +# end of CPU Idle \ No newline at end of file diff --git a/recipes-kernel/linux/files/xenomai3.cfg b/recipes-kernel/linux/files/xenomai3.cfg new file mode 100644 index 00000000..5e7c5f6f --- /dev/null +++ b/recipes-kernel/linux/files/xenomai3.cfg @@ -0,0 +1,128 @@ +# +# General architecture-dependent options +# +CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM=y +# end of General architecture-dependent options + +CONFIG_XENOMAI=y +CONFIG_XENO_ARCH_FPU=y +CONFIG_XENO_ARCH_SYS3264=y + +# +# Core features +# +# CONFIG_XENO_OPT_SCHED_CLASSES is not set +CONFIG_XENO_OPT_STATS=y +CONFIG_XENO_OPT_SHIRQ=y +CONFIG_XENO_OPT_RR_QUANTUM=1000 +CONFIG_XENO_OPT_AUTOTUNE=y +# CONFIG_XENO_OPT_SCALABLE_SCHED is not set +# CONFIG_XENO_OPT_TIMER_LIST is not set +CONFIG_XENO_OPT_TIMER_RBTREE=y +CONFIG_XENO_OPT_VFILE=y +# end of Core features + +# +# Sizes and static limits +# +CONFIG_XENO_OPT_REGISTRY_NRSLOTS=4096 +CONFIG_XENO_OPT_SYS_HEAPSZ=4096 +CONFIG_XENO_OPT_PRIVATE_HEAPSZ=256 +CONFIG_XENO_OPT_SHARED_HEAPSZ=256 +CONFIG_XENO_OPT_NRTIMERS=512 +# end of Sizes and static limits + +# +# Latency settings +# +CONFIG_XENO_OPT_TIMING_SCHEDLAT=0 +CONFIG_XENO_OPT_TIMING_KSCHEDLAT=0 +CONFIG_XENO_OPT_TIMING_IRQLAT=0 +# end of Latency settings + +CONFIG_XENO_OPT_DEBUG=y +CONFIG_XENO_OPT_DEBUG_COBALT=y +CONFIG_XENO_OPT_DEBUG_MEMORY=y +CONFIG_XENO_OPT_DEBUG_CONTEXT=y +CONFIG_XENO_OPT_DEBUG_LOCKING=y +CONFIG_XENO_OPT_DEBUG_USER=y +CONFIG_XENO_OPT_DEBUG_MUTEX_RELAXED=y +CONFIG_XENO_OPT_DEBUG_MUTEX_SLEEP=y +CONFIG_XENO_OPT_DEBUG_LEGACY=y +# CONFIG_XENO_OPT_DEBUG_TRACE_RELAX is not set +CONFIG_XENO_OPT_WATCHDOG=y +CONFIG_XENO_OPT_WATCHDOG_TIMEOUT=4 + +# +# Drivers +# +CONFIG_XENO_OPT_RTDM_COMPAT_DEVNODE=y +CONFIG_XENO_DRIVERS_AUTOTUNE=y + +# +# Serial drivers +# +# CONFIG_XENO_DRIVERS_16550A is not set +# end of Serial drivers + +# +# Testing drivers +# +CONFIG_XENO_DRIVERS_TIMERBENCH=y +CONFIG_XENO_DRIVERS_SWITCHTEST=y +CONFIG_XENO_DRIVERS_HEAPCHECK=y +CONFIG_XENO_DRIVERS_RTDMTEST=m +# end of Testing drivers + +# +# CAN drivers +# +# CONFIG_XENO_DRIVERS_CAN is not set +# end of CAN drivers + +# +# RTnet +# +# CONFIG_XENO_DRIVERS_NET is not set +# end of RTnet + +# +# ANALOGY drivers +# +# CONFIG_XENO_DRIVERS_ANALOGY is not set +# end of ANALOGY drivers + +# +# Real-time IPC drivers +# +# CONFIG_XENO_DRIVERS_RTIPC is not set +# end of Real-time IPC drivers + +# +# UDD support +# +# CONFIG_XENO_DRIVERS_UDD is not set +# end of UDD support + +# +# Real-time GPIO drivers +# +# CONFIG_XENO_DRIVERS_GPIO is not set +# end of Real-time GPIO drivers + +# +# GPIOPWM support +# +# CONFIG_XENO_DRIVERS_GPIOPWM is not set +# end of GPIOPWM support + +# +# Real-time SPI master drivers +# +# end of Real-time SPI master drivers +# end of Drivers + +CONFIG_XENO_VERSION_MAJOR=3 +CONFIG_XENO_VERSION_MINOR=2 +CONFIG_XENO_REVISION_LEVEL=4 +CONFIG_XENO_VERSION_STRING="3.2.4" diff --git a/recipes-kernel/linux/files/xenomai4.cfg b/recipes-kernel/linux/files/xenomai4.cfg new file mode 100644 index 00000000..b3623c75 --- /dev/null +++ b/recipes-kernel/linux/files/xenomai4.cfg @@ -0,0 +1,39 @@ +# +# Processor type and features +# +CONFIG_EVL=y +CONFIG_EVL_SCHED_QUOTA=y +CONFIG_EVL_SCHED_TP=y +CONFIG_EVL_SCHED_TP_NR_PART=4 +# CONFIG_EVL_HIGH_PERCPU_CONCURRENCY is not set +CONFIG_EVL_RUNSTATS=y +# CONFIG_EVL_NET is not set + +# +# Fixed sizes and limits +# +CONFIG_EVL_COREMEM_SIZE=2048 +CONFIG_EVL_NR_THREADS=256 +CONFIG_EVL_NR_MONITORS=512 +CONFIG_EVL_NR_CLOCKS=8 +CONFIG_EVL_NR_XBUFS=128 +CONFIG_EVL_NR_PROXIES=64 +CONFIG_EVL_NR_OBSERVABLES=64 +# end of Fixed sizes and limits + +# +# Pre-calibrated latency +# +CONFIG_EVL_LATENCY_USER=0 +CONFIG_EVL_LATENCY_KERNEL=0 +CONFIG_EVL_LATENCY_IRQ=0 +# end of Pre-calibrated latency + +# CONFIG_EVL_DEBUG is not set + +# +# Out-of-band device drivers +# +CONFIG_EVL_LATMUS=y +CONFIG_EVL_HECTIC=y +# end of Out-of-band device drivers diff --git a/recipes-kernel/linux/linux-xenomai-3_6.12.bb b/recipes-kernel/linux/linux-xenomai-3_6.12.bb new file mode 100644 index 00000000..e0cbbe70 --- /dev/null +++ b/recipes-kernel/linux/linux-xenomai-3_6.12.bb @@ -0,0 +1,40 @@ +# From linux-toradex-upstream as base +require recipes-kernel/linux/linux-toradex-upstream_6.12.bb + +# From linux-toradex%.bbappend for Torizon +require recipes-kernel/linux/linux-torizon.inc +require recipes-kernel/linux/linux-toradex-kmeta.inc + +SUMMARY = "Linux kernel for Xenomai 3 with Dovetail and the Cobalt core patches" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers, e.g. as dependency of +# core-image-rt-sdk, core-image-rt. +python () { + if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-xenomai-3": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-xenomai-3 to enable it") +} + +LINUX_REPO = "git://source.denx.de/Xenomai/linux-dovetail.git" +XENBRANCH = "master" + + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SRC_URI:append = " \ + git://source.denx.de/Xenomai/xenomai.git;protocol=https;branch=${XENBRANCH};name=xenomai;destsuffix=xenomai; \ + file://xenomai-common.cfg \ + file://xenomai3.cfg \ + " + +PV = "6.12" +LINUX_VERSION ?= "6.12.8" +KBRANCH = "v6.12.y-dovetail-rebase" +KERNEL_VERSION_SANITY_SKIP = "1" +SRCREV_machine = "ed55d775d3b3df3948c43598e7a68be7c0737392" +SRCREV_machine:use-head-next = "${AUTOREV}" +SRCREV_xenomai ?= "c46e3e2c5a9fe95ccac1772882c6451fe2f719b6" + +do_patch:append () { + ${WORKDIR}/xenomai/scripts/prepare-kernel.sh --linux=${STAGING_KERNEL_DIR} --arch=${ARCH} +} diff --git a/recipes-kernel/linux/linux-xenomai-4_6.12.bb b/recipes-kernel/linux/linux-xenomai-4_6.12.bb new file mode 100644 index 00000000..cf923e25 --- /dev/null +++ b/recipes-kernel/linux/linux-xenomai-4_6.12.bb @@ -0,0 +1,33 @@ +# From linux-toradex-upstream as base +require recipes-kernel/linux/linux-toradex-upstream_6.12.bb + +# From linux-toradex%.bbappend for Torizon +require recipes-kernel/linux/linux-torizon.inc +require recipes-kernel/linux/linux-toradex-kmeta.inc + +SUMMARY = "Linux kernel with Xenomai 4 patches and the EVL core" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers, e.g. as dependency of +# core-image-rt-sdk, core-image-rt. +python () { + if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-xenomai-4": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-xenomai-4 to enable it") +} + +LINUX_REPO = "git://source.denx.de/Xenomai/xenomai4/linux-evl.git" + + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SRC_URI:append = " \ + file://xenomai-common.cfg \ + file://xenomai4.cfg \ + " + +PV = "6.12" +LINUX_VERSION ?= "6.12.8" +KBRANCH = "v6.12.y-evl-rebase" +KERNEL_VERSION_SANITY_SKIP = "1" +SRCREV_machine = "0d91a2ee592e2110bdbdb2d751f0596b475464d2" +SRCREV_machine:use-head-next = "${AUTOREV}" From 5e1c8fbaf0b041f1fc43440066a57e1962b6924d Mon Sep 17 00:00:00 2001 From: Leonardo Graboski Veiga Date: Wed, 12 Feb 2025 10:44:24 -0300 Subject: [PATCH 2/4] conf: distro: torizon-upstream-xenomai: add Xenomai distros Add distros that allow to build Xenomai 3 and 4 on Toradex hardware. Signed-off-by: Leonardo Graboski Veiga --- conf/distro/include/xenomai.inc | 20 ++++++++++++++++++++ conf/distro/torizon-upstream-xenomai3.conf | 12 ++++++++++++ conf/distro/torizon-upstream-xenomai4.conf | 13 +++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 conf/distro/include/xenomai.inc create mode 100644 conf/distro/torizon-upstream-xenomai3.conf create mode 100644 conf/distro/torizon-upstream-xenomai4.conf diff --git a/conf/distro/include/xenomai.inc b/conf/distro/include/xenomai.inc new file mode 100644 index 00000000..45d9670e --- /dev/null +++ b/conf/distro/include/xenomai.inc @@ -0,0 +1,20 @@ + +# Xenomai config + +XENOMAI_KERNEL_ARGS = "audit=0 clocksource=arch_sys_counter nohz_full=1,3 \ + irqaffinity=0 isolcpus=1,3 rcu_nocbs=1,3 rcu_nocb_poll=1024 \ + nosoftlockup numa_balancing=disable hugepages=1024 " +OSTREE_KERNEL_ARGS:sota:append:verdin-imx8mp:xenomai4 = " ${XENOMAI_KERNEL_ARGS} " +OSTREE_KERNEL_ARGS:sota:append:verdin-imx8mp:xenomai3 = " ${XENOMAI_KERNEL_ARGS} " + +PREFERRED_PROVIDER_virtual/kernel:xenomai4:upstream = "linux-xenomai-4" +PREFERRED_PROVIDER_virtual/dtb:xenomai4:upstream = "device-tree-overlays-mainline" +LINUX_VERSION_EXTENSION:xenomai4:upstream ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai4" + +PREFERRED_PROVIDER_virtual/kernel:xenomai3:upstream = "linux-xenomai-3" +PREFERRED_PROVIDER_virtual/dtb:xenomai3:upstream = "device-tree-overlays-mainline" +LINUX_VERSION_EXTENSION:xenomai3:upstream ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai3" + +# This is required to build the upstream device trees +IMX_DEFAULT_BSP:xenomai4:upstream = "mainline" +IMX_DEFAULT_BSP:xenomai3:upstream = "mainline" diff --git a/conf/distro/torizon-upstream-xenomai3.conf b/conf/distro/torizon-upstream-xenomai3.conf new file mode 100644 index 00000000..92822d4d --- /dev/null +++ b/conf/distro/torizon-upstream-xenomai3.conf @@ -0,0 +1,12 @@ +require conf/distro/torizon.conf +require conf/distro/include/xenomai.inc + +DISTRO = "torizon-upstream-xenomai3" +DISTRO_NAME = "Torizon OS Upstream with Xenomai 3" + +DISTRO_FLAVOUR = " (UPSTREAM XENOMAI3)" +DISTRO_FLAVOUR:experimental = " (UPSTREAM XENOMAI3 EXPERIMENTAL)" + +DISTROOVERRIDES .= ":xenomai3:upstream" + +IMAGE_BASENAME_SUFFIX = "-xenomai3" diff --git a/conf/distro/torizon-upstream-xenomai4.conf b/conf/distro/torizon-upstream-xenomai4.conf new file mode 100644 index 00000000..0f8a9aae --- /dev/null +++ b/conf/distro/torizon-upstream-xenomai4.conf @@ -0,0 +1,13 @@ +require conf/distro/torizon.conf +require conf/distro/include/xenomai.inc + +DISTRO = "torizon-upstream-xenomai4" +DISTRO_NAME = "Torizon OS Upstream with Xenomai 4" + +DISTRO_FLAVOUR = " (UPSTREAM XENOMAI4)" +DISTRO_FLAVOUR:experimental = " (UPSTREAM XENOMAI4 EXPERIMENTAL)" + +DISTROOVERRIDES .= ":xenomai4:upstream" + +IMAGE_BASENAME_SUFFIX = "-xenomai4" + From 6e40c1a863046f1eabe8066be85e0e3cfdfb9ee1 Mon Sep 17 00:00:00 2001 From: Leonardo Graboski Veiga Date: Mon, 17 Feb 2025 14:21:03 -0300 Subject: [PATCH 3/4] conf: distro: xenomai.inc: unify shared distro data Some distro data was in the intel-corei7-64.inc file, which is specific to the machine. This makes it confusing to adjust config that is applicable to the Xenomai distros. Some of the configs will still be applicable only to the machine-distro couple, but the reason for the overrides is the distro, so it sounds more suitable to leave the configs in a distro file. Signed-off-by: Leonardo Graboski Veiga --- conf/distro/common-torizon-xenomai3.conf | 1 + conf/distro/common-torizon-xenomai4.conf | 1 + conf/distro/include/xenomai.inc | 6 ++++-- conf/machine/include/intel-corei7-64.inc | 16 +++------------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/conf/distro/common-torizon-xenomai3.conf b/conf/distro/common-torizon-xenomai3.conf index 078b5397..f2a45a69 100644 --- a/conf/distro/common-torizon-xenomai3.conf +++ b/conf/distro/common-torizon-xenomai3.conf @@ -1,4 +1,5 @@ require conf/distro/common-torizon.conf +require conf/distro/include/xenomai.inc DISTRO = "common-torizon-xenomai3" DISTRO_NAME = "Common Torizon OS with Xenomai 3" diff --git a/conf/distro/common-torizon-xenomai4.conf b/conf/distro/common-torizon-xenomai4.conf index ddec24b2..382a0fa8 100644 --- a/conf/distro/common-torizon-xenomai4.conf +++ b/conf/distro/common-torizon-xenomai4.conf @@ -1,4 +1,5 @@ require conf/distro/common-torizon.conf +require conf/distro/include/xenomai.inc DISTRO = "common-torizon-xenomai4" DISTRO_NAME = "Common Torizon OS with Xenomai 4" diff --git a/conf/distro/include/xenomai.inc b/conf/distro/include/xenomai.inc index 45d9670e..625f76fd 100644 --- a/conf/distro/include/xenomai.inc +++ b/conf/distro/include/xenomai.inc @@ -4,13 +4,15 @@ XENOMAI_KERNEL_ARGS = "audit=0 clocksource=arch_sys_counter nohz_full=1,3 \ irqaffinity=0 isolcpus=1,3 rcu_nocbs=1,3 rcu_nocb_poll=1024 \ nosoftlockup numa_balancing=disable hugepages=1024 " -OSTREE_KERNEL_ARGS:sota:append:verdin-imx8mp:xenomai4 = " ${XENOMAI_KERNEL_ARGS} " -OSTREE_KERNEL_ARGS:sota:append:verdin-imx8mp:xenomai3 = " ${XENOMAI_KERNEL_ARGS} " +OSTREE_KERNEL_ARGS:sota:append:xenomai4 = " ${XENOMAI_KERNEL_ARGS} " +OSTREE_KERNEL_ARGS:sota:append:xenomai3 = " ${XENOMAI_KERNEL_ARGS} " +PREFERRED_PROVIDER_virtual/kernel:xenomai4 = "linux-xenomai-4" PREFERRED_PROVIDER_virtual/kernel:xenomai4:upstream = "linux-xenomai-4" PREFERRED_PROVIDER_virtual/dtb:xenomai4:upstream = "device-tree-overlays-mainline" LINUX_VERSION_EXTENSION:xenomai4:upstream ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai4" +PREFERRED_PROVIDER_virtual/kernel:xenomai3 = "linux-xenomai-3" PREFERRED_PROVIDER_virtual/kernel:xenomai3:upstream = "linux-xenomai-3" PREFERRED_PROVIDER_virtual/dtb:xenomai3:upstream = "device-tree-overlays-mainline" LINUX_VERSION_EXTENSION:xenomai3:upstream ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai3" diff --git a/conf/machine/include/intel-corei7-64.inc b/conf/machine/include/intel-corei7-64.inc index 984f2e6b..5b92d49b 100644 --- a/conf/machine/include/intel-corei7-64.inc +++ b/conf/machine/include/intel-corei7-64.inc @@ -4,12 +4,6 @@ WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" OSTREE_KERNEL_ARGS:sota:append:intel-corei7-64 = "console=ttyS0,115200 root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:10 " -XENOMAI_KERNEL_ARGS = "audit=0 hpet=disable clocksource=tsc tsc=reliable intel_pstate=disable intel_idle.max_cstate=0 intel.max_cstate=0 processor.max_cstate=0 processor_idle.max_cstate=0 \ - rcupdate.rcu_cpu_stall_suppress=1 mce=off nmi_watchdog=0 nosoftlockup noht numa_balancing=disable hugepages=1024 rcu_nocb_poll=1024 irqaffinity=0 isolcpus=1,3 rcu_nocbs=1,3 nohz_full=1,3 \ - i915.enable_rc6=0 i915.enable_dc=0 i915.disable_power_well=0 " -OSTREE_KERNEL_ARGS:sota:append:intel-corei7-64:xenomai3 = " ${XENOMAI_KERNEL_ARGS} " -OSTREE_KERNEL_ARGS:sota:append:intel-corei7-64:xenomai4 = " ${XENOMAI_KERNEL_ARGS} " - OSTREE_BOOTLOADER:intel-corei7-64 = "grub" OSTREE_DEPLOY_DEVICETREE:intel-corei7-64 = "0" EFI_PROVIDER:intel-corei7-64 = "grub-efi" @@ -26,13 +20,9 @@ PREFERRED_PROVIDER_u-boot-fw-utils = "grub-ota-fallback" PREFERRED_RPROVIDER_u-boot-fw-utils = "grub-ota-fallback" PREFERRED_PROVIDER_virtual/dtb = "" -PREFERRED_PROVIDER_virtual/kernel:xenomai3 = "linux-xenomai-3" -PREFERRED_VERSION_linux-xenomai-3 ?= "5.10.%" - -PREFERRED_PROVIDER_virtual/kernel:xenomai4 = "linux-xenomai-4" -PREFERRED_VERSION_linux-xenomai-4 = "5.10.%" +# If an older kernel is preferred, set the PREFERRED_VERSION +#PREFERRED_VERSION_linux-xenomai-3 = "5.10%" +#PREFERRED_VERSION_linux-xenomai-4 = "5.10%" IMAGE_INSTALL:remove = " minnowboard-efi-startup network-configuration" LINUX_VERSION_EXTENSION ?= "-torizon-${LINUX_KERNEL_TYPE}" -LINUX_VERSION_EXTENSION:xenomai3 ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai3" -LINUX_VERSION_EXTENSION:xenomai4 ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai4" From 53cfd7d5f41d05da91e44de21d8972f6c389de72 Mon Sep 17 00:00:00 2001 From: Leonardo Graboski Veiga Date: Mon, 17 Feb 2025 14:43:22 -0300 Subject: [PATCH 4/4] linux-xenomai: adapt recipes for intel-corei7-64 The Xenomai 6.12 recipes before this commit are only applicable to Toradex BSPs. This adaptation makes it possible to use it for intel-corei7-64 (x86) architecture as well. A big caveat is that it must stick to kernel 6.6 because intel only has 6.12 on master but not on scarthgap. This leads to several overrides. Signed-off-by: Leonardo Graboski Veiga --- .../linux/linux-xenomai%.bbappend | 16 ++++ recipes-kernel/linux/linux-xenomai-3_6.12.bb | 76 ++++++++++++++----- recipes-kernel/linux/linux-xenomai-4_6.12.bb | 58 ++++++++++---- 3 files changed, 119 insertions(+), 31 deletions(-) create mode 100644 dynamic-layers/meta-intel/recipes-kernel/linux/linux-xenomai%.bbappend diff --git a/dynamic-layers/meta-intel/recipes-kernel/linux/linux-xenomai%.bbappend b/dynamic-layers/meta-intel/recipes-kernel/linux/linux-xenomai%.bbappend new file mode 100644 index 00000000..3f2a305e --- /dev/null +++ b/dynamic-layers/meta-intel/recipes-kernel/linux/linux-xenomai%.bbappend @@ -0,0 +1,16 @@ +LINUX_VERSION_EXTENSION:prepend = "-intel-pk" + +COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)" + +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}" + +KCONFIG_REPO:intel-corei7-64 = "git://git.yoctoproject.org/yocto-kernel-cache" + +# Add patches from +# https://github.com/YoeDistro/meta-intel/blob/scarthgap/recipes-kernel/linux/linux-intel.inc +TDX_PATCHES:append = " \ + file://fix-perf-reproducibility.patch \ + file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \ + file://0002-mconf-fix-output-of-cflags-and-libraries.patch \ +" diff --git a/recipes-kernel/linux/linux-xenomai-3_6.12.bb b/recipes-kernel/linux/linux-xenomai-3_6.12.bb index e0cbbe70..1e6a8367 100644 --- a/recipes-kernel/linux/linux-xenomai-3_6.12.bb +++ b/recipes-kernel/linux/linux-xenomai-3_6.12.bb @@ -1,11 +1,4 @@ -# From linux-toradex-upstream as base -require recipes-kernel/linux/linux-toradex-upstream_6.12.bb - -# From linux-toradex%.bbappend for Torizon -require recipes-kernel/linux/linux-torizon.inc -require recipes-kernel/linux/linux-toradex-kmeta.inc - -SUMMARY = "Linux kernel for Xenomai 3 with Dovetail and the Cobalt core patches" +SUMMARY = "Linux kernel with Xenomai 3 Dovetail and the Cobalt core patches" # Skip processing of this recipe if it is not explicitly specified as the # PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying @@ -16,25 +9,74 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-xenomai-3 to enable it") } -LINUX_REPO = "git://source.denx.de/Xenomai/linux-dovetail.git" -XENBRANCH = "master" +# Use BSP kernel recipe as the base +BASE_KERNEL_CONFIG:aarch64:tdx = "recipes-kernel/linux/linux-toradex-upstream_6.12.bb" +# meta-intel does not have a 6.12 recipe on scarthgap, only on master, so fix on 6.6 +BASE_KERNEL_CONFIG:intel-corei7-64 = "recipes-kernel/linux/linux-intel_6.6.bb" +# Remove source code from +# https://github.com/YoeDistro/meta-intel/blob/scarthgap/recipes-kernel/linux/linux-intel_6.6.bb +SRC_URI:remove:intel-corei7-64 = " \ + git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \ + file://0001-6.6-vt-conmakehash-improve-reproducibility.patch \ + file://0001-6.6-lib-build_OID_registry-fix-reproducibility-issues.patch \ +" +require ${BASE_KERNEL_CONFIG} +# Include Torizon features +require recipes-kernel/linux/linux-torizon.inc +require recipes-kernel/linux/linux-toradex-kmeta.inc +# Path to search for BSP patches +FILESEXTRAPATHS:prepend:aarch64:tdx := \ + "${TOPDIR}/layers/meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-upstream_6.12: \ +" +TDX_PATCHES ?= "" +FILESEXTRAPATHS:prepend:intel-corei7-64 := " \ + ${TOPDIR}/layers/meta-intel/recipes-kernel/linux/linux-intel: \ +" FILESEXTRAPATHS:prepend := "${THISDIR}/files:" -SRC_URI:append = " \ - git://source.denx.de/Xenomai/xenomai.git;protocol=https;branch=${XENBRANCH};name=xenomai;destsuffix=xenomai; \ - file://xenomai-common.cfg \ - file://xenomai3.cfg \ - " -PV = "6.12" -LINUX_VERSION ?= "6.12.8" +LINUX_REPO = "git://source.denx.de/Xenomai/linux-dovetail.git" +SRC_URI = " \ + ${LINUX_REPO};protocol=https;branch=${KBRANCH};name=machine \ + ${KCONFIG_REPO};protocol=https;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA} \ + git://${KMETAREPOSITORY};protocol=${KMETAPROTOCOL};type=kmeta;name=torizon-meta;branch=${KMETABRANCH};destsuffix=${KMETATORIZON} \ + ${TDX_PATCHES} \ + \ + file://xenomai-common.cfg \ + file://xenomai3.cfg \ +" + +LINUX_VERSION = "6.12.8" KBRANCH = "v6.12.y-dovetail-rebase" +KMETA_BRANCH:aarch64:tdx = "main" +KMETA_BRANCH:intel-corei7-64 = "yocto-6.6" KERNEL_VERSION_SANITY_SKIP = "1" SRCREV_machine = "ed55d775d3b3df3948c43598e7a68be7c0737392" SRCREV_machine:use-head-next = "${AUTOREV}" +SRCREV_meta:aarch64:tdx = "${SRCREV_meta-toradex-bsp}" +SRCREV_meta:use-head-next = "${AUTOREV}" + +# meta-intel does not have a 6.12 recipe on scarthgap, only on master, so fix on 6.6 +LINUX_VERSION:intel-corei7-64 = "6.6.69" +KBRANCH:intel-corei7-64 = "v6.6.y-dovetail-rebase" +KMETA_BRANCH:intel-corei7-64 = "yocto-6.6" +SRCREV_machine:intel-corei7-64 = "2899dc64fca2535f2cc699e29538b381a21adbc0" + +# For Xenomai 3 the patches are not kept in the kernel source repo +XENBRANCH = "master" +SRC_URI:append = " \ + git://source.denx.de/Xenomai/xenomai.git;protocol=https;branch=${XENBRANCH};name=xenomai;destsuffix=xenomai; \ +" + SRCREV_xenomai ?= "c46e3e2c5a9fe95ccac1772882c6451fe2f719b6" do_patch:append () { + # Avoid error "ERROR: linux-xenomai-3-6.6.69+git-r0 do_kernel_configcheck: config analysis failed when running 'symbol_why.py" + # due to https://source.denx.de/Xenomai/xenomai/-/commit/ec0fc2b4491e1e2f11ecb09f420cadeecdbbd02e + # Just make sure to not enable XENO_DRIVERS_NET_FEC + sed -i '/depends on BROKEN/d' ${WORKDIR}/xenomai/kernel/drivers/net/drivers/Kconfig + + # Apply the Xenomai patch ${WORKDIR}/xenomai/scripts/prepare-kernel.sh --linux=${STAGING_KERNEL_DIR} --arch=${ARCH} } diff --git a/recipes-kernel/linux/linux-xenomai-4_6.12.bb b/recipes-kernel/linux/linux-xenomai-4_6.12.bb index cf923e25..f2d0adbd 100644 --- a/recipes-kernel/linux/linux-xenomai-4_6.12.bb +++ b/recipes-kernel/linux/linux-xenomai-4_6.12.bb @@ -1,10 +1,3 @@ -# From linux-toradex-upstream as base -require recipes-kernel/linux/linux-toradex-upstream_6.12.bb - -# From linux-toradex%.bbappend for Torizon -require recipes-kernel/linux/linux-torizon.inc -require recipes-kernel/linux/linux-toradex-kmeta.inc - SUMMARY = "Linux kernel with Xenomai 4 patches and the EVL core" # Skip processing of this recipe if it is not explicitly specified as the @@ -16,18 +9,55 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-xenomai-4 to enable it") } -LINUX_REPO = "git://source.denx.de/Xenomai/xenomai4/linux-evl.git" +# Use BSP kernel recipe as the base +BASE_KERNEL_CONFIG:aarch64:tdx = "recipes-kernel/linux/linux-toradex-upstream_6.12.bb" +# meta-intel does not have a 6.12 recipe on scarthgap, only on master, so fix on 6.6 +BASE_KERNEL_CONFIG:intel-corei7-64 = "recipes-kernel/linux/linux-intel_6.6.bb" +# Remove source code from +# https://github.com/YoeDistro/meta-intel/blob/scarthgap/recipes-kernel/linux/linux-intel_6.6.bb +SRC_URI:remove:intel-corei7-64 = " \ + git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \ + file://0001-6.6-vt-conmakehash-improve-reproducibility.patch \ + file://0001-6.6-lib-build_OID_registry-fix-reproducibility-issues.patch \ +" +require ${BASE_KERNEL_CONFIG} +# Include Torizon features +require recipes-kernel/linux/linux-torizon.inc +require recipes-kernel/linux/linux-toradex-kmeta.inc +# Path to search for BSP patches +FILESEXTRAPATHS:prepend:aarch64:tdx := \ + "${TOPDIR}/layers/meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-upstream_6.12: \ +" +TDX_PATCHES ?= "" +FILESEXTRAPATHS:prepend:intel-corei7-64 := " \ + ${TOPDIR}/layers/meta-intel/recipes-kernel/linux/linux-intel: \ +" FILESEXTRAPATHS:prepend := "${THISDIR}/files:" -SRC_URI:append = " \ - file://xenomai-common.cfg \ - file://xenomai4.cfg \ - " -PV = "6.12" -LINUX_VERSION ?= "6.12.8" +LINUX_REPO = "git://source.denx.de/Xenomai/xenomai4/linux-evl.git" +SRC_URI = " \ + ${LINUX_REPO};protocol=https;branch=${KBRANCH};name=machine \ + ${KCONFIG_REPO};protocol=https;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA} \ + git://${KMETAREPOSITORY};protocol=${KMETAPROTOCOL};type=kmeta;name=torizon-meta;branch=${KMETABRANCH};destsuffix=${KMETATORIZON} \ + ${TDX_PATCHES} \ + \ + file://xenomai-common.cfg \ + file://xenomai4.cfg \ +" + +LINUX_VERSION = "6.12.8" KBRANCH = "v6.12.y-evl-rebase" +KMETA_BRANCH:aarch64:tdx = "main" KERNEL_VERSION_SANITY_SKIP = "1" SRCREV_machine = "0d91a2ee592e2110bdbdb2d751f0596b475464d2" SRCREV_machine:use-head-next = "${AUTOREV}" +SRCREV_meta:aarch64:tdx = "${SRCREV_meta-toradex-bsp}" +SRCREV_meta:use-head-next = "${AUTOREV}" + +# meta-intel does not have a 6.12 recipe on scarthgap, only on master, so fix on 6.6 +LINUX_VERSION:intel-corei7-64 = "6.6.69" +KBRANCH:intel-corei7-64 = "v6.6.y-evl-rebase" +KMETA_BRANCH:intel-corei7-64 = "yocto-6.6" +SRCREV_machine:intel-corei7-64 = "a183f2498555d05cddd096212d5b81f10894a762"