builds and runs on intel-x86 and rpi4 with acceptable realtime performance

This commit is contained in:
vaughn committed 2026-09-25 17:29:14 -04:00
1 parent 2bce6fa556
commit 3faf544f0b
120 files changed
+6317 -1

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
default=boot graphics console
timeout=5
menuentry 'boot graphics console'{
linux /@KERNEL_IMAGETYPE@ LABEL=initrd-install @APPEND@
initrd /wrlinux-image-installer-initramfs-@MACHINE@.rootfs.@INITRAMFS_FSTYPES@
}
menuentry 'boot serial console'{
linux /@KERNEL_IMAGETYPE@ LABEL=initrd-install console=ttyS0,115200 @APPEND@
initrd /wrlinux-image-installer-initramfs-@MACHINE@.rootfs.@INITRAMFS_FSTYPES@
}
@@ -0,0 +1,26 @@
diff --git a/tuned.spec b/tuned.spec
index 0b7dc03..6213976 100644
--- a/tuned.spec
+++ b/tuned.spec
@@ -397,7 +397,7 @@ if [ "$1" == 0 ]; then
# cleanup for Boot loader specification (BLS)
# clear grubenv variables
- grub2-editenv - unset tuned_params tuned_initrd &>/dev/null || :
+ grub2-editenv /boot/EFI/BOOT/grubenv unset tuned_params tuned_initrd &>/dev/null || :
# unpatch BLS entries
MACHINE_ID=`cat /etc/machine-id 2>/dev/null`
if [ "$MACHINE_ID" ]
diff --git a/tuned/plugins/plugin_bootloader.py b/tuned/plugins/plugin_bootloader.py
index 2711e11..c327384 100644
--- a/tuned/plugins/plugin_bootloader.py
+++ b/tuned/plugins/plugin_bootloader.py
@@ -481,7 +481,7 @@ class BootloaderPlugin(base.Plugin):
def _update_grubenv(self, d):
log.debug("updating grubenv, setting %s" % str(d))
l = ["%s=%s" % (str(option), str(value)) for option, value in d.items()]
- (rc, out) = self._cmd.execute(["grub2-editenv", "-", "set"] + l)
+ (rc, out) = self._cmd.execute(["grub2-editenv", "/boot/EFI/BOOT/grubenv", "set"] + l)
if rc != 0:
log.warning("cannot update grubenv: '%s'" % out)
return False
@@ -0,0 +1,27 @@
Upstream-Status: Inappropriate [oe specific]
diff --git a/tuned.spec b/tuned.spec
index 0b7dc03..6213976 100644
--- a/tuned.spec
+++ b/tuned.spec
@@ -397,7 +397,7 @@ if [ "$1" == 0 ]; then
# cleanup for Boot loader specification (BLS)
# clear grubenv variables
- grub2-editenv - unset tuned_params tuned_initrd &>/dev/null || :
+ grub2-editenv "/boot/EFI/BOOT/grubenv" unset tuned_params tuned_initrd &>/dev/null || :
# unpatch BLS entries
MACHINE_ID=`cat /etc/machine-id 2>/dev/null`
if [ "$MACHINE_ID" ]
diff --git a/tuned/plugins/plugin_bootloader.py b/tuned/plugins/plugin_bootloader.py
index 2711e11..c327384 100644
--- a/tuned/plugins/plugin_bootloader.py
+++ b/tuned/plugins/plugin_bootloader.py
@@ -481,7 +481,7 @@ class BootloaderPlugin(base.Plugin):
def _update_grubenv(self, d):
log.debug("updating grubenv, setting %s" % str(d))
l = ["%s=%s" % (str(option), str(value)) for option, value in d.items()]
- (rc, out) = self._cmd.execute(["grub2-editenv", "-", "set"] + l)
+ (rc, out) = self._cmd.execute(["grub2-editenv", "/boot/EFI/BOOT/grubenv", "set"] + l)
if rc != 0:
log.warning("cannot update grubenv: '%s'" % out)
return False
+49
View File
@@ -0,0 +1,49 @@
diff --git a/tuned.spec b/tuned.spec
index 0b7dc03..6213976 100644
--- a/tuned.spec
+++ b/tuned.spec
@@ -397,7 +397,7 @@ if [ "$1" == 0 ]; then
# cleanup for Boot loader specification (BLS)
# clear grubenv variables
- grub2-editenv - unset tuned_params tuned_initrd &>/dev/null || :
+ grub2-editenv /boot/EFI/BOOT/grubenv unset tuned_params tuned_initrd &>/dev/null || :
# unpatch BLS entries
MACHINE_ID=`cat /etc/machine-id 2>/dev/null`
if [ "$MACHINE_ID" ]
diff --git a/tuned/plugins/plugin_bootloader.py b/tuned/plugins/plugin_bootloader.py
index 2711e11..451a642 100644
--- a/tuned/plugins/plugin_bootloader.py
+++ b/tuned/plugins/plugin_bootloader.py
@@ -361,9 +361,13 @@ class BootloaderPlugin(base.Plugin):
log.debug("initial patching of grub.cfg")
s = r"\1\n\n" + consts.GRUB2_TEMPLATE_HEADER_BEGIN + "\n"
for opt in d:
+ log.debug("opt: " + opt)
s += r"set " + self._cmd.escape(opt) + "=\"" + self._cmd.escape(d[opt]) + "\"\n"
s += consts.GRUB2_TEMPLATE_HEADER_END + r"\n"
+ log.debug("\n\ns = \n" + s)
+ log.debug("\n\n#1 grub_cfg = \n" + grub_cfg)
grub2_cfg = re.sub(r"^(\s*###\s+END\s+[^#]+/00_header\s+### *)\n", s, grub2_cfg, flags = re.MULTILINE)
+ log.debug("\n\n#2 grub_cfg = \n" + grub_cfg)
d2 = {"linux" : consts.GRUB2_TUNED_VAR, "initrd" : consts.GRUB2_TUNED_INITRD_VAR}
for i in d2:
@@ -373,6 +377,8 @@ class BootloaderPlugin(base.Plugin):
grub2_cfg = re.sub(r"^(\s*" + i + r"(?:16|efi)?\s+\S+rescue.*)\$" + d2[i] + r" *(.*)$", r"\1\2", grub2_cfg, flags = re.MULTILINE)
# fix whitespaces in rescue kernels
grub2_cfg = re.sub(r"^(\s*" + i + r"(?:16|efi)?\s+\S+rescue.*) +$", r"\1", grub2_cfg, flags = re.MULTILINE)
+
+ log.debug("\n\n#3 grub_cfg = \n" + grub_cfg)
return grub2_cfg
def _grub2_default_env_patch(self):
@@ -481,7 +487,7 @@ class BootloaderPlugin(base.Plugin):
def _update_grubenv(self, d):
log.debug("updating grubenv, setting %s" % str(d))
l = ["%s=%s" % (str(option), str(value)) for option, value in d.items()]
- (rc, out) = self._cmd.execute(["grub2-editenv", "-", "set"] + l)
+ (rc, out) = self._cmd.execute(["grub2-editenv", "/boot/EFI/BOOT/grubenv", "set"] + l)
if rc != 0:
log.warning("cannot update grubenv: '%s'" % out)
return False
+93
View File
@@ -0,0 +1,93 @@
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/redhat-performance/tuned;protocol=https;branch=master"
SRC_URI[sha256sum] = "66fa95b07b73a1ceafb6712b140fbbd77136d4cf86de47d6cabef9137a9bbdfa"
SRC_URI += " file://tuned-boot-path.patch "
#SRC_URI += " file://grubenv_location.patch "
# Modify these as desired
PV = "2.26+git${SRCPV}"
SRCREV = "181472a0be2125c8cd36c7673ec546d75d396a3d"
# LinuxCNC build separation is broken, so we need to build in src
#S = '${UNPACKDIR}/git'
#TARGET_CC_ARCH += " ${LDFLAGS}"
INHERIT += "grub-efi"
DEPENDS += " desktop-file-utils-native python3"
RDEPENDS:${PN} += "grub-bootconf grub-efi grub-efi-editenv python3 python3-core bash systemtap python3-dbus python3-pygobject python3-pyudev python3-linux-procfs irqbalance "
#RDEPENDS:${PN} += " grub grub-editenv grub-bootconf grub-common grub-efi grub-efi-editenv "
inherit pkgconfig
inherit systemd
SYSTEMD_AUTO_ENABLE:${PN} = "enable"
SYSTEMD_SERVICE:${PN} = "tuned.service"
BASELIB:${PN} = "lib64"
#TODO make file callouts explicit, or at least somehow filter down to ensure only required files are packaged
FILES:${PN} += "\
/usr/lib64/* \
/usr/lib/* \
/usr/local/* \
/usr/share/* \
/usr/bin/grub2-editenv \
/etc/default/grub \
"
FILES:${PN}-dev = " "
FILES:${PN}-dbg = " "
do_configure:append () {
cd ${S}
oe_runmake
}
do_install:append () {
cd ${S}
oe_runmake install DESTDIR=${D}
mkdir -p ${RECIPE_SYSROOT}/etc
#TODO this is mad hacky, we don't want user account info tied up in the build enviornment
cp /etc/passwd ${RECIPE_SYSROOT}/etc/passwd
cp /etc/group ${RECIPE_SYSROOT}/etc/group
rm ${D}/run -rf
rm ${PKGD}/var/volatile -rf
PYVER=$(find ${RECIPE_SYSROOT}/usr/${BASELIB} -maxdepth 1 -type d -name python3\.* -exec basename {} \;)
mkdir -p ${D}/usr/${BASELIB}/${PYVER}/site-packages
#PYTHON_SITELIB might break on a future update to tuned; this line is copied manually from the makefile
PYTHON_SITELIB=$(python3 -c 'from sysconfig import get_path; print(get_path("purelib"));')
mv ${D}${PYTHON_SITELIB}/${PN} ${D}/usr/${BASELIB}/${PYVER}/site-packages
ln -s /boot/EFI/BOOT/grub.cfg ${D}/etc/grub2.cfg
ln -s grub-editenv ${D}/usr/bin/grub2-editenv
ln -s grub-mkconfig ${D}/usr/bin/grub2-mkconfig
mkdir -p ${D}/etc/default
echo "#this file was generated by the Tuned bitbake install script" > ${D}/etc/default/grub
#mkdir -p ${D}/boot/grub
#mkdir -p ${DEPLOY_DIR_IMAGE}/boot
#ln -s /boot/EFI/BOOT/ ${DEPLOY_DIR_IMAGE}/boot/grub
#source Makefile
}
#raspberry pi seems to struggle with only 1 housekeeping core, so we set a second one here
#unclear why, or if this will extend to other ARM systems (as a stab in the dark, possibly where u-boot is required?)
#Specifically, an RPi 5 reports kernel panic if isolcpus=1-3, or even 1-2 (although it boots normally if isolcpus=2-3).
# with isolcpus=1-2, a boot delay of 2s allowed the Pi to boot successfully
# with isolcpus=1-3, Pi reports a kernel panic with boot delay even up to 4s
do_install:append:rpi () {
sed -i "s/1}/2}/" ${D}/etc/${PN}/realtime-variables.conf
}
do_package_qa:prepend () {
import shutil
_dir = d.getVar('PKGD') + "/var/volatile"
if os.path.isdir(_dir):
shutil.rmtree(_dir)
_dir = d.getVar('PKGDEST') + "/" + d.getVar('PN') + "/var/volatile"
if os.path.isdir(_dir):
shutil.rmtree(_dir)
}
#IMAGE_BOOT_FILES += "grub"
#IMAGE_EFI_BOOT_FILES += "/boot/grub"
INSANE_SKIP:${PN} += "host-user-contaminated"