From f0a809c0bc2a319b7d3e0a787634580657076214 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Fri, 13 Nov 2026 14:53:23 -0300 Subject: [PATCH 01/16] restore-dumped-headrevs: Remove the class It relies on bb.persist_data, removed from BitBake (681a7516e), and on Python 2's contextlib.nested, so every oel build crashes at ConfigParsed once a saved_persist_data.db exists. Drop the class and its OELDIR and DUMP_HEADREVS_DB settings in oel.inc; nothing else uses them. Tested with bitbake -p (977 recipes, 0 errors). Signed-off-by: Luciano Dittgen (cherry picked from commit 61a2711047cfa13dae44d8ba7d422c074e5fb006) --- classes/restore-dumped-headrevs.bbclass | 32 ------------------------- conf/distro/include/oel.inc | 7 ------ 2 files changed, 39 deletions(-) delete mode 100644 classes/restore-dumped-headrevs.bbclass diff --git a/classes/restore-dumped-headrevs.bbclass b/classes/restore-dumped-headrevs.bbclass deleted file mode 100644 index 48a9b43..0000000 --- a/classes/restore-dumped-headrevs.bbclass +++ /dev/null @@ -1,32 +0,0 @@ -# nooelint: oelint.bbclass.underscores oelint.file.inlinesuppress_na no EXPORT_FUNCTIONS here, so the dash is harmless -def copy_persist_domain(d, domain, other_db_path, restore=False): - import contextlib - - source_table = bb.persist_data.persist(domain, d) - dest_table = bb.persist_data.SQLTable(other_db_path, domain) - if restore: - source_table, dest_table = dest_table, source_table - - with contextlib.nested(source_table, dest_table): - dest_table.update(source_table) - -def dump_headrevs(d, dump_db_path): - copy_persist_domain(d, 'BB_URI_HEADREVS', dump_db_path) - -def restore_headrevs(d, dump_db_path): - copy_persist_domain(d, 'BB_URI_HEADREVS', dump_db_path, restore=True) - -DUMP_HEADREVS_DB ?= '${COREBASE}/saved_persist_data.db' -DUMP_HEADREVS_STAMP ?= '${STAMP}.restored_headrevs' - -restore_dumped_headrevs[doc] = "Restore dumped BB_URI_HEADREVS persistent data once, at config-parse time, when a dump database is present." -python restore_dumped_headrevs() { - stamp_path = d.getVar('DUMP_HEADREVS_STAMP') - dump_db_path = d.getVar('DUMP_HEADREVS_DB') - if not os.path.exists(stamp_path) and os.path.exists(dump_db_path): - restore_headrevs(d, dump_db_path) - bb.utils.mkdirhier(os.path.dirname(stamp_path)) - open(stamp_path, 'w').close() -} -restore_dumped_headrevs[eventmask] = "bb.event.ConfigParsed" -addhandler restore_dumped_headrevs diff --git a/conf/distro/include/oel.inc b/conf/distro/include/oel.inc index d15893f..c02fba5 100644 --- a/conf/distro/include/oel.inc +++ b/conf/distro/include/oel.inc @@ -13,19 +13,12 @@ TARGET_VENDOR = "-oel" SDKMACHINE ?= "x86_64" -# Paths -OELDIR ?= "${COREBASE}/.." - SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}" SDKPATHINSTALL = "/opt/${DISTRO}/${SDK_VERSION}" # Move the persist db up out of TMPDIR so it survives its removal PERSISTENT_DIR = "${TOPDIR}/db" -# Restore any available saved headrevs -DUMP_HEADREVS_DB ?= '${OELDIR}/${MACHINE}/saved_persist_data.db' -INHERIT += "restore-dumped-headrevs" - # Share the hashserv DB across builds using the same SSTATE_DIR. Weakest # assignment so a local.conf/site.conf ?= still wins. BB_HASHSERVE_DB_DIR ??= "${SSTATE_DIR}" From aa8e20e7a23fa88b95def9e807e9bcba6af6f28d Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Fri, 13 Nov 2026 15:02:19 -0300 Subject: [PATCH 02/16] distro/oel: Drop the sstate_stage_all vardeps workaround No sstate_stage_all function exists in OE-Core or BitBake, so the flag lands on an empty variable and affects no task signature. Signed-off-by: Luciano Dittgen (cherry picked from commit 91971fcf83e8bb8d328c22ff515f5e79d51c0026) --- conf/distro/include/oel.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/conf/distro/include/oel.inc b/conf/distro/include/oel.inc index c02fba5..54c0660 100644 --- a/conf/distro/include/oel.inc +++ b/conf/distro/include/oel.inc @@ -133,9 +133,6 @@ DISTRO_EXTRA_RRECOMMENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', #### Workarounds & Overrides #### -# Work around missing vardep bug in bitbake -sstate_stage_all[vardeps] += "sstate_stage_dirs" - # Layer name and path for the recipe RECIPE_LAYERNAME = "${@bb.utils.get_file_layer('${FILE}', d) or 'UNKNOWN'}" RECIPE_LAYERDIR = "${LAYERDIR_${RECIPE_LAYERNAME}}" From f340438ca96b8f14c63f5a993ef7ec6a10dbaac4 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Fri, 13 Nov 2026 15:01:45 -0300 Subject: [PATCH 03/16] mirrors: Remove the class OE-Core's classes-global/mirrors.bbclass shadows it, so it was never loaded, and nothing inherits it by name. Its URLs (angstrom, nexcess, gbxs, plain-http autobuilder) are dead anyway. Verified with bitbake -e busybox: only the OE-Core class is in the include history and none of these mirrors appear in MIRRORS. Signed-off-by: Luciano Dittgen (cherry picked from commit 53c701f4ec1492280489349de34138ec7ca15af2) --- classes/mirrors.bbclass | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 classes/mirrors.bbclass diff --git a/classes/mirrors.bbclass b/classes/mirrors.bbclass deleted file mode 100644 index 68ae9a6..0000000 --- a/classes/mirrors.bbclass +++ /dev/null @@ -1,23 +0,0 @@ -# nooelint: oelint.vars.bbvars.PREMIRRORS set here on purpose: this is the project mirror class -PREMIRRORS:append = " \ - git://sources.redhat.com/ git://sourceware.org/ \ -" - -# nooelint: oelint.vars.bbvars.MIRRORS set here on purpose: this is the project mirror class -MIRRORS += "\ - ${KERNELORG_MIRROR}/ https://kernel.googlesource.com/ \ - ${KERNELORG_MIRROR}/ http://mirror.nexcess.net/kernel.org/ \ - ${KERNELORG_MIRROR}/ http://mirror.gbxs.net/pub/ \ - ${APACHE_MIRROR}/ http://archive.apache.org/dist/ \ - ${DEBIAN_MIRROR}/ ftp://archive.debian.org/debian/pool/ \ - git://git.kernel.org/pub/ http://mirror.nexcess.net/kernel.org/ \ - \ - (ftp|https?)://.*/.* http://autobuilder.yoctoproject.org/sources/ \ - (ftp|https?)://.*/.* http://sources.openembedded.org/ \ - (ftp|https?)://.*/.* http://www.angstrom-distribution.org/unstable/sources/ \ - \ - (cvs|svn|git|gitsm|hg|bzr|osc|p4|svk)://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \ - (cvs|svn|git|gitsm|hg|bzr|osc|p4|svk)://.*/.* http://autobuilder.yoctoproject.org/sources/ \ - (cvs|svn|git|gitsm|hg|bzr|osc|p4|svk)://.*/.* http://sources.openembedded.org/ \ - (cvs|svn|git|gitsm|hg|bzr|osc|p4|svk)://.*/.* http://www.angstrom-distribution.org/unstable/sources/ \ -" From 22a36d56a1eb1319202d1b3145c4ff198523195e Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Fri, 13 Nov 2026 16:50:08 -0300 Subject: [PATCH 04/16] cve-filter: Remove the class and its Python library OE-Core removed cve-check (00de455f8d), whose JSON report this class filtered, so it cannot run on blacksail or wrynose. The README now points at OE-Core's sbom-cve-check fragment. Tested with bitbake -p (0 errors). Signed-off-by: Luciano Dittgen (cherry picked from commit 5e0d46ab1d3f1759163f60b44aa8e3e47ef4e84a) --- README | 14 ++ classes/cve-filter.bbclass | 109 ----------- conf/layer.conf | 2 - lib/ossystems/__init__.py | 4 - lib/ossystems/cve_filter.py | 357 ------------------------------------ 5 files changed, 14 insertions(+), 472 deletions(-) delete mode 100644 classes/cve-filter.bbclass delete mode 100644 lib/ossystems/__init__.py delete mode 100644 lib/ossystems/cve_filter.py diff --git a/README b/README index ffdd9fb..5efb0bc 100644 --- a/README +++ b/README @@ -11,6 +11,20 @@ URI: git://git.openembedded.org/openembedded-core branch: master revision: HEAD +CVE checking +------------ + +The layer no longer ships a CVE filter class: OE-Core dropped the +cve-check class it relied on. Use OE-Core's SBOM-based checker instead, +which reads the image SPDX and writes VEX-aware reports to the deploy +directory: + + bitbake-config-build enable-fragment core/yocto/sbom-cve-check + +or, in local.conf: + + OE_FRAGMENTS += "core/yocto/sbom-cve-check" + Contributing ------------ diff --git a/classes/cve-filter.bbclass b/classes/cve-filter.bbclass deleted file mode 100644 index aff2968..0000000 --- a/classes/cve-filter.bbclass +++ /dev/null @@ -1,109 +0,0 @@ -# nooelint: oelint.bbclass.underscores oelint.file.inlinesuppress_na no EXPORT_FUNCTIONS here, so the dash is harmless -# Copyright (c) 2024 O.S. Systems Software LTDA. -# Usage Instructions for the Yocto CVE Filter Class - -# This class is designed to filter CVEs (Common Vulnerabilities -# and Exposures) from CVE files. It should be used in conjunction -# with the cve-check class from the openembedded-core. - -# Steps to Use This Class - -# 1. Add the following lines to your distro configuration file: - -# include conf/distro/include/cve-extra-exclusions.inc -# INHERIT += "cve-check" - -# 2. Inherit the cve-filter class in the image recipe. -# -# -------- Configuration Variables ---------------------------- - -# The cve-filter class provides several configurable variables: - -# CVE_FILTER_PREVIOUS_FILE: Specifies the previous version of -# the CVE JSON file. If no file is provided, only the current -# file will be considered. -# Default: empty - -# CVE_FILTER_PREVIOUS_VERSION: Specifies the distro version of -# the previous CVE JSON file. The CVE_FILTER_PREVIOUS_FILE must -# be defined, otherwise the value 0 will be used. -# Example: "1.0.0" -# Default: "0.0.0" - -# CVE_FILTER_MARKDOWN_FILE_NAME: Specifies the name of the -# output Markdown file containing the list of detected CVEs. -# Default: "${IMAGE_NAME}.md" - -# CVE_FILTER_IGNORED_CVES: Lists the CVEs that should be ignored by the filter. -# Example: "CVE-2017-6264 CVE-2023-1234" -# Default: empty - -# CVE_FILTER_SCOREV2_CUTTOFF and CVE_FILTER_SCOREV3_CUTTOFF: -# Set the value of cut off CVE Score to SCOREV2 and V3. CVEs below the value -# set here will no be considered. -# Example: "9" -# Default: "0" - -# Set the PATH to find the old CVE Json list -CVE_FILTER_PREVIOUS_FILE ??= "" -CVE_FILTER_PREVIOUS_VERSION ??= "0.0.0" - -CVE_FILTER_CURRENT_FILE = "${IMGDEPLOYDIR}/${IMAGE_NAME}.json" -CVE_FILTER_CURRENT_VERSION = "${DISTRO_VERSION}" - -# Set the name of markdown output file -CVE_FILTER_MARKDOWN_FILE_NAME ?= "${IMAGE_NAME}.md" -CVE_FILTER_MARKDOWN_FILE = "${IMGDEPLOYDIR}/${CVE_FILTER_MARKDOWN_FILE_NAME}" - -# List of CVE should be ignored Eg: CVE-2023-1234 -CVE_FILTER_IGNORED_CVES ??= "" - -# Cut off score V2 and V3 value -CVE_FILTER_SCOREV2_CUTOFF ??= "0" -CVE_FILTER_SCOREV3_CUTOFF ??= "0" - -inherit python3native - -python do_cve_filter (){ - from ossystems.cve_filter import Cve - - previousFile = d.getVar("CVE_FILTER_PREVIOUS_FILE") - previousVersion = d.getVar("CVE_FILTER_PREVIOUS_VERSION") - cveIgnoreList = d.getVar("CVE_FILTER_IGNORED_CVES").split() - scoreV2CutOff = int(d.getVar("CVE_FILTER_SCOREV2_CUTOFF")) - scoreV3CutOff = int(d.getVar("CVE_FILTER_SCOREV3_CUTOFF")) - - cve_prev = Cve() - cve_prev.setMarkdonFileName(d.getVar("CVE_FILTER_MARKDOWN_FILE")) - cve_curr = Cve() - - if previousFile: - cve_prev.loadCVEfile(previousFile) - cve_prev.setCVEVersion(previousVersion) - cve_prev.setScoreV2CutOff(scoreV2CutOff) - cve_prev.setScoreV3CutOff(scoreV3CutOff) - cve_prev.setIgnoreCVEList(cveIgnoreList) - cve_prev.loadCVEData() - else: - bb.warn("Previous CVE File Not Defined!!!") - - cve_curr.loadCVEfile(d.getVar("CVE_FILTER_CURRENT_FILE")) - cve_curr.setCVEVersion(d.getVar("CVE_FILTER_CURRENT_VERSION")) - cve_curr.setScoreV2CutOff(scoreV2CutOff) - cve_curr.setScoreV3CutOff(scoreV3CutOff) - cve_curr.setIgnoreCVEList(cveIgnoreList) - cve_curr.loadCVEData() - cve_prev.compareCVes(cve_curr) - bb.plain("DONE!!") -} - -do_cve_filter[doc] = "Compare the image CVE report against a previous version and emit a filtered Markdown summary of the new CVEs." -addtask cve_filter after do_rootfs before do_image - -# nooelint: oelint.var.rootfspostcmd the trailing space keeps this prepend apart from the next function -ROOTFS_POSTPROCESS_COMMAND:prepend = "link_cvefilter_markdownfile " - -link_cvefilter_markdownfile[doc] = "Create a stable-named symlink to the CVE filter Markdown report in the deploy directory." -link_cvefilter_markdownfile () { - ln -sf ${CVE_FILTER_MARKDOWN_FILE_NAME} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.md -} diff --git a/conf/layer.conf b/conf/layer.conf index 37efb68..347e4b5 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -10,8 +10,6 @@ BBFILE_PATTERN_ossystems-base := "^${LAYERDIR}/" BBFILE_PRIORITY_ossystems-base = "8" LAYERDEPENDS_ossystems-base = "core" -addpylib ${LAYERDIR}/lib ossystems - LAYERSERIES_COMPAT_ossystems-base = "wrynose" LICENSE_PATH += "${LAYERDIR}/conf/licenses" diff --git a/lib/ossystems/__init__.py b/lib/ossystems/__init__.py deleted file mode 100644 index 8e5d5cb..0000000 --- a/lib/ossystems/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) - -BBIMPORTS = ["cve_filter"] diff --git a/lib/ossystems/cve_filter.py b/lib/ossystems/cve_filter.py deleted file mode 100644 index 6ea3b34..0000000 --- a/lib/ossystems/cve_filter.py +++ /dev/null @@ -1,357 +0,0 @@ -import argparse -import json -import sys - - -# Class to store the CVE data -class Issue: - def __init__(self, id, summary, scorev2, scorev3, vector, status, link): - self.id = id - self.summary = summary - self.scorev2 = scorev2 - self.scorev3 = scorev3 - self.vector = vector - self.status = status - self.link = link - - def __eq__(self, other): - return self.id == other.id - - def __hash__(self): - return hash(self.id) - - def __str__(self): - return self.id - - def toTuple(self): - return ( - self.id, - self.summary, - self.scorev2, - self.scorev3, - self.vector, - self.status, - self.link, - ) - - -# Class to store the filtered and ready to print CVes -class CVEFilter: - def __init__(self, name, status): - self.name = name - self.status = status - self.both = [] - self.patched = [] - self.old = [] - self.new = [] - - def setVersion(self, version1, version2=0): - self.version1 = version1 - self.version2 = version2 - - def addCVEBoth(self, issue): - self.both.append(issue) - - def addCVEPatched(self, issue): - self.patched.append(issue) - - def addCVEOld(self, issue): - self.old.append(issue) - - def addCVENew(self, issue): - self.new.append(issue) - - -# Class to store the Package with the list of Issues -class Package: - def __init__(self, name, version): - self.name = name - self.version = version - self.cve = [] - - def addCVE(self, cve): - self.cve.append(cve) - - -# Class to handle CVEs -class Cve: - def __init__(self): - self.__markdownFileName = "output.md" - self.__packages = [] - self.__printIssues = [] - self.__ignored_cves = [] - self.__version = 0 - self.__scoreV2cf = 0 - self.__scoreV3cf = 0 - - # def __del__ (self): - # self.__cveJsonFile.close() - - def loadCVEfile(self, fileName): - try: - self.__cveJsonFile = open(fileName, "r") - try: - self.__jsonData = json.load(self.__cveJsonFile) - except ValueError as e: - print("Fail on JSON file: " + fileName) - print(e) - self.__jsonPackages = self.__jsonData["package"] - - except FileNotFoundError: - print("File not found or wrong file name! " + fileName) - exit(1) - except: - print("Error to open file!") - exit(1) - - def setMarkdonFileName(self, name): - if name: - self.__markdownFileName = name - - def setIgnoreCVEList(self, listcve): - self.__ignored_cves = list(listcve) - - def setCVEVersion(self, version=0): - self.__version = version - - def setScoreV2CutOff(self, score): - self.__scoreV2cf = score - - def setScoreV3CutOff(self, score): - self.__scoreV3cf = score - - def getCVEPackages(self): - return self.__packages - - def getCVEVersion(self): - return self.__version - - def printCVEs(self): - print(self.__jsonData["package"]) - - def loadCVEData(self): - for pack in self.__jsonPackages: - p = Package(pack["name"], pack["version"]) - entry = False - for id in pack["issue"]: - if (float(id["scorev2"]) >= self.__scoreV2cf or float(id["scorev3"]) >= self.__scoreV3cf) and id[ - "status" - ] != "Ignored": - if not (id["id"] in self.__ignored_cves): - p.addCVE( - Issue( - id["id"], - id["summary"], - id["scorev2"], - id["scorev3"], - id["vector"], - id["status"], - id["link"], - ) - ) - entry = True - if entry: - self.__packages.append(p) - - def __creatMarkdownFile(self): - try: - self.__markdownFile = open(self.__markdownFileName, "w") - except: - print("ERROR to create the Markdown output file") - exit(1) - - def printUnpatchedListCVEs(self): - for package in self.__packages: - print("--------------- PACKAGE -----------------") - print(package.name) - print(package.version) - print("=============== ISSUES ==================") - for id in package.cve: - if id.status != "Patched": - print(id.id) - print(id.scorev2) - print(id.scorev3) - print(id.status) - - def compareCVes(self, compCVE): - self.__creatMarkdownFile() - packagesNew = compCVE.getCVEPackages() - for packageOld in self.__packages: - contain = False - for packageNew in packagesNew: - if packageOld.name == packageNew.name: - # This case if the package has the same version - if packageOld.version == packageNew.version: - cveOutput = CVEFilter(packageOld.name, "Kept") - cveOutput.setVersion(packageOld.version) - self.__checkIssues(cveOutput, packageOld.cve, packageNew.cve) - self.__printIssues.append(cveOutput) - # remove package that has comparated - packagesNew.remove(packageNew) - contain = True - break - - # This case if the package was upgrated - elif packageOld.version < packageNew.version: - cveOutput = CVEFilter(packageOld.name, "Updated") - cveOutput.setVersion(packageOld.version, packageNew.version) - self.__checkIssues(cveOutput, packageOld.cve, packageNew.cve) - self.__printIssues.append(cveOutput) - # remove package that has comparated - packagesNew.remove(packageNew) - contain = True - break - - # This case if the package was Downgrade - else: - cveOutput = CVEFilter(packageOld.name, "Downgraded") - cveOutput.setVersion(packageOld.version, packageNew.version) - self.__checkIssues(cveOutput, packageOld.cve, packageNew.cve) - self.__printIssues.append(cveOutput) - # remove package that has comparated - packagesNew.remove(packageNew) - contain = True - break - - # This case is when the package was removed - if not contain: - cveOutput = CVEFilter(packageOld.name, "Removed") - cveOutput.setVersion(packageOld.version) - self.__checkIssues(cveOutput, packageOld.cve, []) - self.__printIssues.append(cveOutput) - # remove package that has comparated - # For all cases that packages was added - for newpackage in packagesNew: - cveOutput = CVEFilter(newpackage.name, "Added") - cveOutput.setVersion(newpackage.version) - self.__checkIssues(cveOutput, [], newpackage.cve) - self.__printIssues.append(cveOutput) - # remove package that has comparated - self.__printCVEs( - self.__printIssues, self.getCVEVersion(), compCVE.getCVEVersion() - ) - - def __checkIssues(self, cveOut, cveListOld, cveListNew): - cveOut.new = cveListNew.copy() - if cveListOld and cveListNew: - for cveold in cveListOld: - contain = False - for cvenew in cveOut.new: - if cveold.id == cvenew.id: - if (cveold.status == cvenew.status) and ( - cvenew.status == "Unpatched" - ): - cveOut.addCVEBoth(cveold) - cveOut.new.remove(cvenew) - contain = True - break - elif (cveold.status == cvenew.status) and ( - cvenew.status == "Patched" - ): - cveOut.new.remove(cvenew) - contain = True - break - elif (cveold.status != cvenew.status) and ( - cvenew.status == "Patched" - ): - cveOut.addCVEPatched(cvenew) - cveOut.new.remove(cvenew) - contain = True - break - elif (cveold.status != cvenew.status) and ( - cvenew.status == "Unpatched" - ): - cveOut.addCVENew(cvenew) - cveOut.new.remove(cvenew) - contain = True - break - if not contain: - cveOut.addCVEOld(cveold) - elif cveListNew: - for cveNew in cveListNew: - if cveNew.status == "Patched": - cveOut.new.remove(cveNew) - else: - for cveOld in cveListOld: - if cveOld.status != "Patched": - cveOut.addCVEOld(cveOld) - - def __printCVEs(self, cvePrint, v1, v2): - self.__markdownFile.write(f"# {v1} -> {v2}") - for cve in cvePrint: - if cve.old or cve.both or cve.patched or cve.new: - if cve.status == "Updated" or cve.status == "Downgraded": - self.__markdownFile.write("\n") - self.__markdownFile.write( - "## " - + cve.name - + ": " - + cve.version1 - + " -> " - + cve.version2 - + " : " - + cve.status - + "\n" - ) - else: - self.__markdownFile.write("\n") - self.__markdownFile.write( - "## " - + cve.name - + ": " - + cve.version1 - + " : " - + cve.status - + "\n" - ) - self.__printIs(cve) - - def __printIs(self, issue): - if issue.both: - if issue.status == "Updated" or issue.status == "Downgraded": - self.__markdownFile.write("\n### Affect both versions\n") - else: - self.__markdownFile.write("\n### Unsolved\n") - self.__markdownFile.write("| CVE | STATUS | SCORE V2 | SCORE V3 |\n") - self.__markdownFile.write("|:--|:--:|:--:|:---:|\n") - s = ' Vulnerable ' - for i in issue.both: - self.__markdownFile.write( - f"|[{i.id}]({i.link})|{s}|{i.scorev2}|{i.scorev3}|\n" - ) - - if issue.patched: - self.__markdownFile.write("\n### Fixed in new revision\n") - self.__markdownFile.write("| CVE | STATUS | SCORE V2 | SCORE V3 |\n") - self.__markdownFile.write("|:--|:--:|:--:|:---:|\n") - s = ' Patched ' - for i in issue.patched: - self.__markdownFile.write( - f"|[{i.id}]({i.link})|{s}|{i.scorev2}|{i.scorev3}|\n" - ) - - if issue.old: - if issue.status == "Removed": - self.__markdownFile.write("\n### Affected the removed version\n") - else: - self.__markdownFile.write("\n### Affect the old version\n") - self.__markdownFile.write("| CVE | STATUS | SCORE V2 | SCORE V3 |\n") - self.__markdownFile.write("|:--|:--:|:--:|:---:|\n") - s = ' Vulnerable ' - for i in issue.old: - self.__markdownFile.write( - f"|[{i.id}]({i.link})|{s}|{i.scorev2}|{i.scorev3}|\n" - ) - - if issue.new: - if issue.status == "Updated" or issue.status == "Downgraded": - self.__markdownFile.write("\n### New Issues added\n") - else: - self.__markdownFile.write("\n### Affect only new revision\n") - self.__markdownFile.write("| CVE | STATUS | SCORE V2 | SCORE V3 |\n") - self.__markdownFile.write("|:--|:--:|:--:|:---:|\n") - s = ' Vulnerable ' - for i in issue.new: - self.__markdownFile.write( - f"|[{i.id}]({i.link})|{s}|{i.scorev2}|{i.scorev3}|\n" - ) From 145f59beab97f2507fd7c9f87d5c73f1737c9b65 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 09:21:12 -0300 Subject: [PATCH 05/16] gstreamer1.0-plugins-base: Drop the viv-fb bbappend OE-Core has carried PACKAGECONFIG[viv-fb], with the same virtual/libgles2 virtual/libg2d dependencies, and the viv-fb entry in OPENGL_WINSYS since 846564f1a9 and ec3a1cb771 (2021-04-15), the same day this staging copy was added. The bbappend only duplicates it, and choosing a Vivante window system is BSP policy that does not belong in a distro layer anyway; a BSP layer enables it through PACKAGECONFIG. Signed-off-by: Luciano Dittgen (cherry picked from commit f750d96037f8f055611acf5fd6f4c01e547e9401) --- recipes-staging/gstreamer/gstreamer1.0-plugins-base_%.bbappend | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 recipes-staging/gstreamer/gstreamer1.0-plugins-base_%.bbappend diff --git a/recipes-staging/gstreamer/gstreamer1.0-plugins-base_%.bbappend b/recipes-staging/gstreamer/gstreamer1.0-plugins-base_%.bbappend deleted file mode 100644 index 414d584..0000000 --- a/recipes-staging/gstreamer/gstreamer1.0-plugins-base_%.bbappend +++ /dev/null @@ -1,2 +0,0 @@ -PACKAGECONFIG[viv-fb] = ",,virtual/libgles2 virtual/libg2d" -OPENGL_WINSYS:append:oel = " ${@bb.utils.contains('PACKAGECONFIG', 'viv-fb', 'viv-fb', '', d)}" From 66873dd97171956fbec2c225676fd5aa84a6e586 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 19:18:11 -0300 Subject: [PATCH 06/16] net-persistent-mac: Drop the single-interface leftover The script once handled only $INTERFACE. The INTERFACES loop replaced it, but a copy of the old block stayed after the loop and repeated the work for the last interface, plus an IF_FILE built from the unset variable. Behaviour is unchanged. Signed-off-by: Luciano Dittgen (cherry picked from commit 7eab4816653fa61c0b8d3661e55e38ed0bd18111) --- .../net-persistent-mac/net-persistent-mac | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac b/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac index ce748b3..3ba9ff3 100644 --- a/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac +++ b/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac @@ -6,8 +6,6 @@ set -e mkdir -p "$MAC_DIR" -IF_FILE="$MAC_DIR/$INTERFACE.mac" - for if in $INTERFACES; do mkdir -p "$MAC_DIR" IF_FILE="$MAC_DIR/$if.mac" @@ -32,21 +30,3 @@ for if in $INTERFACES; do fi fi done -# Store MAC for reuse -if [ ! -r "$IF_FILE" ]; then - if [ -e "$IF_MAC" ]; then - echo "Storing MAC for $INTERFACE for future use." - cat "$IF_MAC" > "$IF_FILE" - else - echo "Failed to read MAC for $INTERFACE; skiping device." - fi -fi - -if [ -r "$IF_FILE" ]; then - # Restore MAC setting - WANTED_MAC=`cat $IF_FILE` - if [ "$WANTED_MAC" != "`cat $IF_MAC`" ]; then - echo "Setting MAC of $INTERFACE to $WANTED_MAC." - ifconfig $INTERFACE hw ether "$WANTED_MAC" - fi -fi From e82ec7f6b6cb5c6c331e29cd7f7657c7958b3ae0 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 19:20:43 -0300 Subject: [PATCH 07/16] net-persistent-mac: Set the MAC with ip instead of ifconfig OE-Core's busybox no longer builds ifconfig, so on oel the script stored the MAC but failed restoring it ("ifconfig: not found"). busybox and iproute2 both provide 'ip link set dev address '. Tested with the new ossystems_net_persistent_mac oeqa test on qemux86-64. Signed-off-by: Luciano Dittgen (cherry picked from commit c0926e4656f824587f516acef81b0dcacb5fcfc0) --- .../net-persistent-mac/net-persistent-mac/net-persistent-mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac b/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac index 3ba9ff3..495511a 100644 --- a/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac +++ b/recipes-core/net-persistent-mac/net-persistent-mac/net-persistent-mac @@ -26,7 +26,7 @@ for if in $INTERFACES; do WANTED_MAC=`cat $IF_FILE` if [ "$WANTED_MAC" != "`cat $IF_MAC`" ]; then echo "Setting MAC of $if to $WANTED_MAC." - ifconfig $if hw ether "$WANTED_MAC" + ip link set dev "$if" address "$WANTED_MAC" fi fi done From 3647cfd5d1021646ed0df3a5f83623f0212e81b8 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 19:20:43 -0300 Subject: [PATCH 08/16] oeqa/runtime: Add a test for ossystems-factory-defaults Checks that the restore ran at boot (anchor and unit result) and that removing the anchor restores the factory files and runs the hooks once. Tested with testimage on qemux86-64. Signed-off-by: Luciano Dittgen (cherry picked from commit a46348f7658d1aee81bcf3cbcf46f17fa3e131e2) --- .../cases/ossystems_factory_defaults.py | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 lib/oeqa/runtime/cases/ossystems_factory_defaults.py diff --git a/lib/oeqa/runtime/cases/ossystems_factory_defaults.py b/lib/oeqa/runtime/cases/ossystems_factory_defaults.py new file mode 100644 index 0000000..a8f1b63 --- /dev/null +++ b/lib/oeqa/runtime/cases/ossystems_factory_defaults.py @@ -0,0 +1,80 @@ +# +# Copyright (C) 2026 O.S. Systems Software LTDA. +# +# SPDX-License-Identifier: MIT +# + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.data import skipIfNotFeature +from oeqa.runtime.decorator.package import OEHasPackage + + +class FactoryDefaultsTest(OERuntimeTestCase): + """ossystems-factory-defaults: restore /data from the factory copy once.""" + + @classmethod + def setUpClass(cls): + td = cls.td + cls.runtime_dir = td.get('OSSYSTEMS_FACTORY_DEFAULTS_RUNTIME_DIR') or '/data' + cls.factory_dir = td.get('OSSYSTEMS_FACTORY_DEFAULTS_DIR') or '/usr/share/factory-defaults' + cls.hooks_dir = td.get('OSSYSTEMS_FACTORY_DEFAULTS_HOOKS_DIR') or '/etc/factory-defaults.d' + cls.anchor = cls.runtime_dir + '/.factory-defaults' + if 'systemd' in td.get('DISTRO_FEATURES', '').split(): + cls.program = '/usr/bin/factory-defaults' + else: + cls.program = '/etc/init.d/factory-defaults' + + def run_ok(self, cmd): + status, output = self.target.run(cmd) + self.assertEqual(status, 0, msg='%s\n%s' % (cmd, output)) + return output + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['ossystems-factory-defaults']) + def test_factory_defaults_ran_at_boot(self): + status, output = self.target.run('test -e %s' % self.anchor) + self.assertEqual(status, 0, + msg='%s missing: factory-defaults did not complete at boot' % self.anchor) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['ossystems-factory-defaults']) + @skipIfNotFeature('systemd', 'Test requires systemd in DISTRO_FEATURES') + def test_factory_defaults_unit(self): + unit = 'ossystems-factory-defaults.service' + self.assertEqual(self.run_ok('systemctl is-enabled %s' % unit).strip(), 'enabled') + output = self.run_ok('systemctl show -p Result -p ExecMainStatus %s' % unit) + props = dict(l.split('=', 1) for l in output.splitlines() if '=' in l) + self.assertEqual(props.get('Result'), 'success', msg=output) + self.assertEqual(props.get('ExecMainStatus'), '0', msg=output) + + @OETestDepends(['ossystems_factory_defaults.FactoryDefaultsTest.test_factory_defaults_ran_at_boot']) + def test_factory_defaults_restore(self): + """Removing the anchor restores the factory files and runs the hooks, once.""" + probe = 'oeqa-factory-probe' + hook = self.hooks_dir + '/zz-oeqa' + marker = '/tmp/oeqa-factory-hook-ran' + setup = ' && '.join([ + 'mkdir -p %s %s' % (self.factory_dir, self.hooks_dir), + 'echo factory > %s/%s' % (self.factory_dir, probe), + 'printf "#!/bin/sh\\ntouch %s\\n" > %s' % (marker, hook), + 'chmod 0755 %s' % hook, + 'rm -f %s %s %s/%s' % (self.anchor, marker, self.runtime_dir, probe), + ]) + cleanup = 'rm -f %s %s %s/%s %s/%s; touch %s' % ( + hook, marker, self.factory_dir, probe, self.runtime_dir, probe, self.anchor) + try: + self.run_ok(setup) + self.run_ok(self.program) + self.assertEqual(self.run_ok('cat %s/%s' % (self.runtime_dir, probe)).strip(), 'factory') + self.run_ok('test -e %s' % marker) + self.run_ok('test -e %s' % self.anchor) + + # With the anchor in place a second run must leave /data alone. + self.run_ok('rm -f %s && echo changed > %s/%s' % (marker, self.runtime_dir, probe)) + self.run_ok(self.program) + self.assertEqual(self.run_ok('cat %s/%s' % (self.runtime_dir, probe)).strip(), 'changed') + status, _ = self.target.run('test -e %s' % marker) + self.assertNotEqual(status, 0, msg='hooks ran again although the anchor exists') + finally: + self.target.run(cleanup) From 967c969d4f610026a550d274f82894bb1b1cf9e4 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 19:20:43 -0300 Subject: [PATCH 09/16] oeqa/runtime: Add a test for net-persistent-mac Checks the unit result, that each configured interface has its MAC stored, and on a dummy interface that a stored MAC is applied. Tested with testimage on qemux86-64. Signed-off-by: Luciano Dittgen (cherry picked from commit 766821d5dbd40604feffc83f0186b887cc8a360c) --- .../cases/ossystems_net_persistent_mac.py | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 lib/oeqa/runtime/cases/ossystems_net_persistent_mac.py diff --git a/lib/oeqa/runtime/cases/ossystems_net_persistent_mac.py b/lib/oeqa/runtime/cases/ossystems_net_persistent_mac.py new file mode 100644 index 0000000..995a55e --- /dev/null +++ b/lib/oeqa/runtime/cases/ossystems_net_persistent_mac.py @@ -0,0 +1,82 @@ +# +# Copyright (C) 2026 O.S. Systems Software LTDA. +# +# SPDX-License-Identifier: MIT +# + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.data import skipIfNotFeature +from oeqa.runtime.decorator.package import OEHasPackage + +DEFAULTS = '/etc/default/net-persistent-mac' + + +class NetPersistentMacTest(OERuntimeTestCase): + """net-persistent-mac: store each interface's MAC once, restore it after.""" + + def run_ok(self, cmd): + status, output = self.target.run(cmd) + self.assertEqual(status, 0, msg='%s\n%s' % (cmd, output)) + return output + + def config(self): + out = self.run_ok('. %s; echo "$INTERFACES"; echo "$MAC_DIR"' % DEFAULTS) + lines = out.splitlines() + return lines[0].split(), lines[1].strip() + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['net-persistent-mac']) + @skipIfNotFeature('systemd', 'Test requires systemd in DISTRO_FEATURES') + def test_net_persistent_mac_unit(self): + unit = 'net-persistent-mac.service' + self.assertEqual(self.run_ok('systemctl is-enabled %s' % unit).strip(), 'enabled') + output = self.run_ok('systemctl show -p Result -p ExecMainStatus %s' % unit) + props = dict(l.split('=', 1) for l in output.splitlines() if '=' in l) + self.assertEqual(props.get('Result'), 'success', msg=output) + self.assertEqual(props.get('ExecMainStatus'), '0', msg=output) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['net-persistent-mac']) + def test_net_persistent_mac_stored(self): + """Every configured interface that exists has its MAC stored, nothing else.""" + interfaces, mac_dir = self.config() + expected = set() + for iface in interfaces: + status, current = self.target.run('cat /sys/class/net/%s/address' % iface) + if status != 0: + continue + expected.add('%s.mac' % iface) + stored = self.run_ok('cat %s/%s.mac' % (mac_dir, iface)).strip() + self.assertEqual(stored, current.strip()) + if not expected: + self.skipTest('none of %s exists on this target' % interfaces) + present = set(self.run_ok('ls -A %s' % mac_dir).split()) + self.assertEqual(present, expected, msg='unexpected files in %s' % mac_dir) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['net-persistent-mac']) + def test_net_persistent_mac_restore(self): + """A stored MAC is applied to the interface (on a dummy interface).""" + iface = 'oeqa0' + wanted = '02:00:5e:10:20:30' + status, output = self.target.run('ip link add %s type dummy' % iface) + if status != 0: + self.skipTest('cannot create a dummy interface: %s' % output) + _, mac_dir = self.config() + try: + self.run_ok('cp %s /tmp/oeqa-npm.default' % DEFAULTS) + self.run_ok('sed -i "s/^INTERFACES=.*/INTERFACES=\\"%s\\"/" %s' % (iface, DEFAULTS)) + + # First run stores the current MAC. + current = self.run_ok('cat /sys/class/net/%s/address' % iface).strip() + self.run_ok('net-persistent-mac') + self.assertEqual(self.run_ok('cat %s/%s.mac' % (mac_dir, iface)).strip(), current) + + # A later run restores the stored one. + self.run_ok('echo %s > %s/%s.mac' % (wanted, mac_dir, iface)) + self.run_ok('net-persistent-mac') + self.assertEqual(self.run_ok('cat /sys/class/net/%s/address' % iface).strip(), wanted) + finally: + self.target.run('mv /tmp/oeqa-npm.default %s; ip link del %s; rm -f %s/%s.mac' + % (DEFAULTS, iface, mac_dir, iface)) From 077290c7f30db63902cb73a46e0c0b402f2eb214 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 19:20:43 -0300 Subject: [PATCH 10/16] oeqa/runtime: Add a test for easysplash Checks that the units are enabled and, headless, that 'easysplash open' plays the installed animation into fakesink and exits 0 after 'easysplash client --stop'. Tested with testimage on qemux86-64. Signed-off-by: Luciano Dittgen (cherry picked from commit cb131471f246b4ded4cce0a8d50585c5c4aa6909) --- .../runtime/cases/ossystems_easysplash.py | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lib/oeqa/runtime/cases/ossystems_easysplash.py diff --git a/lib/oeqa/runtime/cases/ossystems_easysplash.py b/lib/oeqa/runtime/cases/ossystems_easysplash.py new file mode 100644 index 0000000..5e65781 --- /dev/null +++ b/lib/oeqa/runtime/cases/ossystems_easysplash.py @@ -0,0 +1,56 @@ +# +# Copyright (C) 2026 O.S. Systems Software LTDA. +# +# SPDX-License-Identifier: MIT +# + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.data import skipIfNotFeature +from oeqa.runtime.decorator.package import OEHasPackage + +RUNDIR = '/tmp/oeqa-easysplash' + + +class EasySplashTest(OERuntimeTestCase): + """easysplash: units installed and the open/client protocol works headless.""" + + def run_ok(self, cmd, timeout=None): + status, output = self.target.run(cmd, timeout=timeout) + self.assertEqual(status, 0, msg='%s\n%s' % (cmd, output)) + return output + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['easysplash']) + @skipIfNotFeature('systemd', 'Test requires systemd in DISTRO_FEATURES') + def test_easysplash_units(self): + for unit in ('easysplash-start.service', 'easysplash-quit.service'): + self.assertEqual(self.run_ok('systemctl is-enabled %s' % unit).strip(), 'enabled') + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['easysplash']) + def test_easysplash_open_stop(self): + """Play the installed animation into fakesink, then stop it as a client.""" + status, _ = self.target.run('test -e /usr/lib/easysplash/animation/animation.toml') + if status != 0: + self.skipTest('no animation installed') + try: + self.run_ok('rm -rf %s && mkdir -p %s' % (RUNDIR, RUNDIR)) + self.run_ok("(easysplash open --video-sink fakesink --runtime-dir %s/run " + "--log debug /usr/lib/easysplash/animation > %s/log 2>&1; " + "echo $? > %s/rc) > /dev/null 2>&1 &" % (RUNDIR, RUNDIR, RUNDIR)) + + # The server binds its socket only after the animation was loaded. + status, output = self.target.run( + 'for i in $(seq 1 60); do [ -S %s/run/ipc.socket ] && break; ' + '[ -e %s/rc ] && break; sleep 1; done; cat %s/log' + % (RUNDIR, RUNDIR, RUNDIR), timeout=90) + self.assertNotEqual(self.target.run('test -e %s/rc' % RUNDIR)[0], 0, + msg='easysplash exited before being stopped:\n%s' % output) + + self.run_ok('easysplash client --stop --runtime-dir %s/run' % RUNDIR) + output = self.run_ok('for i in $(seq 1 60); do [ -e %s/rc ] && break; sleep 1; done; ' + 'cat %s/log; cat %s/rc' % (RUNDIR, RUNDIR, RUNDIR), timeout=90) + self.assertEqual(output.splitlines()[-1].strip(), '0', msg=output) + finally: + self.target.run('killall easysplash 2>/dev/null; rm -rf %s' % RUNDIR) From f3e0752a9262523c611da8e91ff3b50ac1a1a4be Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Mon, 16 Nov 2026 19:20:43 -0300 Subject: [PATCH 11/16] oeqa/runtime: Add a test for zram-init Checks that zram_swap.service is active and a zram swap is listed in /proc/swaps; skips on kernels without zram. It fails today on linux-yocto with features/zram: the unit asks for zstd, and the kernel builds only the lzo zram backend. Signed-off-by: Luciano Dittgen (cherry picked from commit 8e9fc0784fc58941dcf39092b5e7be7485a46280) --- lib/oeqa/runtime/cases/ossystems_zram_init.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/oeqa/runtime/cases/ossystems_zram_init.py diff --git a/lib/oeqa/runtime/cases/ossystems_zram_init.py b/lib/oeqa/runtime/cases/ossystems_zram_init.py new file mode 100644 index 0000000..1e1f1bd --- /dev/null +++ b/lib/oeqa/runtime/cases/ossystems_zram_init.py @@ -0,0 +1,30 @@ +# +# Copyright (C) 2026 O.S. Systems Software LTDA. +# +# SPDX-License-Identifier: MIT +# + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.data import skipIfNotFeature +from oeqa.runtime.decorator.package import OEHasPackage + + +class ZramInitTest(OERuntimeTestCase): + """zram-init: zram_swap.service sets up a zram swap device at boot.""" + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['zram-init']) + @skipIfNotFeature('systemd', 'Test requires systemd in DISTRO_FEATURES') + def test_zram_swap(self): + status, output = self.target.run('modprobe zram 2>/dev/null; test -e /sys/class/zram-control') + if status != 0: + self.skipTest('kernel has no zram support') + + status, output = self.target.run('systemctl is-active zram_swap.service') + if status != 0: + output += self.target.run('systemctl status --full zram_swap.service')[1] + self.assertEqual(status, 0, msg=output) + + status, output = self.target.run('cat /proc/swaps') + self.assertIn('/dev/zram', output, msg='no zram swap active:\n%s' % output) From e7b943d570b1b70a3450677b6b61e7868a66113f Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Tue, 17 Nov 2026 15:46:12 -0300 Subject: [PATCH 12/16] zram-init: Size the swap device from /proc/meminfo zram_swap.service sized the device with "free -m", which BusyBox ignores, so the size came out in KiB and zram-init failed with "cannot set zram0 size" (110880 MB asked on a 216 MiB guest). Patch the unit to read MemTotal instead. Tested with testimage on qemux86-64 (oel). Signed-off-by: Luciano Dittgen (cherry picked from commit efb9190421f5e7ca60cb7dbe703ad15e3d27c045) --- ...e-Read-the-RAM-size-from-proc-meminf.patch | 32 +++++++++++++++++++ recipes-extended/zram-init/zram-init_13.3.bb | 5 ++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 recipes-extended/zram-init/zram-init/0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch diff --git a/recipes-extended/zram-init/zram-init/0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch b/recipes-extended/zram-init/zram-init/0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch new file mode 100644 index 0000000..7d54206 --- /dev/null +++ b/recipes-extended/zram-init/zram-init/0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luciano Dittgen +Date: Tue, 17 Nov 2026 15:31:20 -0300 +Subject: [PATCH] zram_swap.service: Read the RAM size from /proc/meminfo + +The unit sizes the swap device from "free -m". BusyBox free ignores -m +and prints KiB, so on a BusyBox system the device is requested 1024 +times too large (110880 MB on a 216 MiB machine). The kernel cannot +allocate it and zram-init fails with "cannot set zram0 size". + +Take MemTotal from /proc/meminfo, which is in KiB everywhere, and halve +it into MiB. This also drops the dependency on procps. + +Upstream-Status: Pending +Signed-off-by: Luciano Dittgen +--- + systemd/system/zram_swap.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/systemd/system/zram_swap.service b/systemd/system/zram_swap.service +index 99aae6e..19afea5 100644 +--- a/systemd/system/zram_swap.service ++++ b/systemd/system/zram_swap.service +@@ -14,7 +14,7 @@ RemainAfterExit=true + # zram_tmp.service and zram_var_tmp.service and that + # num_devices in modprobe.d/zram.conf contains the maximal used number + 1 + +-ExecStart=/bin/sh -c "exec /sbin/zram-init -azstd -Lzram_swap `LC_ALL=C free -m | awk '/^Mem:/{print int($2/2)}'`" ++ExecStart=/bin/sh -c "exec /sbin/zram-init -azstd -Lzram_swap `awk '/^MemTotal:/{print int($2/2048)}' /proc/meminfo`" + ExecStop=/sbin/zram-init 0 + + [Install] diff --git a/recipes-extended/zram-init/zram-init_13.3.bb b/recipes-extended/zram-init/zram-init_13.3.bb index 110cabd..53e6a00 100644 --- a/recipes-extended/zram-init/zram-init_13.3.bb +++ b/recipes-extended/zram-init/zram-init_13.3.bb @@ -12,7 +12,10 @@ inherit update-rc.d systemd DEPENDS += "gettext-native" PE = "1" -SRC_URI = "git://github.com/vaeth/zram-init;protocol=https;branch=main" +SRC_URI = "\ + git://github.com/vaeth/zram-init;protocol=https;branch=main \ + file://0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch \ +" SRCREV = "96579c79295da74cc1921270946b99baa035d0d3" EXTRA_OEMAKE += "SHEBANG='#!/bin/sh'" From b62051a7f8d73ab87c9b85ca4ad10ddcd7de9773 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Tue, 17 Nov 2026 15:46:23 -0300 Subject: [PATCH 13/16] zram-init: Pass the device number to hot_remove "zram-init 0" wrote /dev/zram0 to zram-control/hot_remove, which takes the id, so it exited 1 after tearing the swap down and failed ExecStop of zram_swap.service. Tested with testimage on qemux86-64 (oel), which now stops and restarts the unit. Signed-off-by: Luciano Dittgen (cherry picked from commit 7c6cf34afca03f396196b8e7b98e27c1a538a5db) --- ...Pass-the-device-number-to-hot_remove.patch | 32 +++++++++++++++++++ recipes-extended/zram-init/zram-init_13.3.bb | 1 + 2 files changed, 33 insertions(+) create mode 100644 recipes-extended/zram-init/zram-init/0002-zram-init-Pass-the-device-number-to-hot_remove.patch diff --git a/recipes-extended/zram-init/zram-init/0002-zram-init-Pass-the-device-number-to-hot_remove.patch b/recipes-extended/zram-init/zram-init/0002-zram-init-Pass-the-device-number-to-hot_remove.patch new file mode 100644 index 0000000..3de8f4d --- /dev/null +++ b/recipes-extended/zram-init/zram-init/0002-zram-init-Pass-the-device-number-to-hot_remove.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luciano Dittgen +Date: Tue, 17 Nov 2026 15:31:12 -0300 +Subject: [PATCH] zram-init: Pass the device number to hot_remove + +The zram-control hot_remove attribute takes the device id ("0"), not +the device node path. Writing "/dev/zram0" fails with EINVAL, so +"zram-init 0" reports "failed to reset zram0" and exits 1 even though +the swap was turned off and the device reset. Under systemd this makes +ExecStop of zram_swap.service fail. + +Write $dev instead of $devnode. + +Upstream-Status: Pending +Signed-off-by: Luciano Dittgen +--- + sbin/zram-init.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sbin/zram-init.in b/sbin/zram-init.in +index f577cfc..56d9108 100755 +--- a/sbin/zram-init.in ++++ b/sbin/zram-init.in +@@ -346,7 +346,7 @@ then if $swap + then zramctl --reset -- "$devnode" || status=$? + else SysCtl 1 "$block/reset" || status=$? + if $umount && test -w "$zclass/hot_remove" +- then SysCtl "$devnode" "$zclass/hot_remove" \ ++ then SysCtl "$dev" "$zclass/hot_remove" \ + || status=$? + fi + fi diff --git a/recipes-extended/zram-init/zram-init_13.3.bb b/recipes-extended/zram-init/zram-init_13.3.bb index 53e6a00..648ece3 100644 --- a/recipes-extended/zram-init/zram-init_13.3.bb +++ b/recipes-extended/zram-init/zram-init_13.3.bb @@ -15,6 +15,7 @@ PE = "1" SRC_URI = "\ git://github.com/vaeth/zram-init;protocol=https;branch=main \ file://0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch \ + file://0002-zram-init-Pass-the-device-number-to-hot_remove.patch \ " SRCREV = "96579c79295da74cc1921270946b99baa035d0d3" From ff2ca3ab7fb713767b16de253e8b94ad7e48e1bb Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Tue, 17 Nov 2026 15:46:31 -0300 Subject: [PATCH 14/16] zram-init: Install a real sysvinit script The sysvinit branch installed upstream's openrc-run script, which needs OpenRC, so zram-init never ran under sysvinit. Ship a small LSB script doing what zram_swap.service does, with ZRAM_SIZE and ZRAM_ALGO overridable in /etc/default/zram-init. Tested start/stop/restart/status by hand on qemux86-64. Signed-off-by: Luciano Dittgen (cherry picked from commit 0eaa700d5190295e68f71157604b53943e4d5bf5) --- .../zram-init/zram-init/zram-init.init | 41 +++++++++++++++++++ recipes-extended/zram-init/zram-init_13.3.bb | 4 +- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 recipes-extended/zram-init/zram-init/zram-init.init diff --git a/recipes-extended/zram-init/zram-init/zram-init.init b/recipes-extended/zram-init/zram-init/zram-init.init new file mode 100644 index 0000000..4a4454a --- /dev/null +++ b/recipes-extended/zram-init/zram-init/zram-init.init @@ -0,0 +1,41 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: zram-init +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Swap on a compressed zram device +### END INIT INFO +# +# The sysvinit counterpart of zram_swap.service: a zram swap device of +# half the RAM. Override ZRAM_SIZE (MiB) and ZRAM_ALGO in +# /etc/default/zram-init. + +ZRAM_ALGO=zstd +ZRAM_SIZE= + +[ -r /etc/default/zram-init ] && . /etc/default/zram-init + +[ -n "$ZRAM_SIZE" ] || \ + ZRAM_SIZE=$(awk '/^MemTotal:/{print int($2/2048)}' /proc/meminfo) + +case "$1" in +start) + /sbin/zram-init ${ZRAM_ALGO:+-a"$ZRAM_ALGO"} -Lzram_swap "$ZRAM_SIZE" + ;; +stop) + /sbin/zram-init 0 + ;; +restart|force-reload) + "$0" stop + "$0" start + ;; +status) + grep -q '^/dev/zram0 ' /proc/swaps + ;; +*) + echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 + exit 2 + ;; +esac diff --git a/recipes-extended/zram-init/zram-init_13.3.bb b/recipes-extended/zram-init/zram-init_13.3.bb index 648ece3..a591138 100644 --- a/recipes-extended/zram-init/zram-init_13.3.bb +++ b/recipes-extended/zram-init/zram-init_13.3.bb @@ -16,6 +16,7 @@ SRC_URI = "\ git://github.com/vaeth/zram-init;protocol=https;branch=main \ file://0001-zram_swap.service-Read-the-RAM-size-from-proc-meminf.patch \ file://0002-zram-init-Pass-the-device-number-to-hot_remove.patch \ + file://zram-init.init \ " SRCREV = "96579c79295da74cc1921270946b99baa035d0d3" @@ -39,8 +40,7 @@ do_install () { install -Dm 0644 ${S}/systemd/system/zram_swap.service ${D}${systemd_unitdir}/system/zram_swap.service fi if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then - install -Dm 0755 ${S}/openrc/init.d/${PN} ${D}/${sysconfdir}/init.d/${PN} - install -Dm 0644 ${S}/openrc/conf.d/${PN} ${D}${sysconfdir}/openrc/conf.d/${PN} + install -Dm 0755 ${UNPACKDIR}/zram-init.init ${D}${sysconfdir}/init.d/${PN} fi } From d8210606f51c7bcd1a19c96ebdc17929a1da01c0 Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Tue, 17 Nov 2026 15:46:38 -0300 Subject: [PATCH 15/16] oeqa/runtime: zram-init: Check the swap unit stops and restarts The test only covered start, so the broken ExecStop went unnoticed. Tested with testimage on qemux86-64 (oel). Signed-off-by: Luciano Dittgen (cherry picked from commit 561a5eb4d56274ff5834b794b03e4c14c4a4123b) --- lib/oeqa/runtime/cases/ossystems_zram_init.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/oeqa/runtime/cases/ossystems_zram_init.py b/lib/oeqa/runtime/cases/ossystems_zram_init.py index 1e1f1bd..68e728e 100644 --- a/lib/oeqa/runtime/cases/ossystems_zram_init.py +++ b/lib/oeqa/runtime/cases/ossystems_zram_init.py @@ -28,3 +28,16 @@ def test_zram_swap(self): status, output = self.target.run('cat /proc/swaps') self.assertIn('/dev/zram', output, msg='no zram swap active:\n%s' % output) + + # Stopping must tear the device down cleanly so it can start again. + status, output = self.target.run('systemctl stop zram_swap.service') + self.assertEqual(status, 0, msg=output) + status, output = self.target.run('systemctl is-failed zram_swap.service') + self.assertNotEqual(output.strip(), 'failed', + msg=self.target.run('systemctl status --full zram_swap.service')[1]) + status, output = self.target.run('cat /proc/swaps') + self.assertNotIn('/dev/zram', output, msg='zram swap still active after stop:\n%s' % output) + + status, output = self.target.run('systemctl start zram_swap.service') + self.assertEqual(status, 0, + msg=self.target.run('systemctl status --full zram_swap.service')[1]) From 512747c3f327969f7ebad924cb39abc0134f200e Mon Sep 17 00:00:00 2001 From: Luciano Dittgen Date: Tue, 17 Nov 2026 16:16:04 -0300 Subject: [PATCH 16/16] distro/oel: Opt in to default DISTRO_FEATURES explicitly The opt-out list mirrored OE-Core's DISTRO_FEATURES_DEFAULTS, so any feature OE-Core adds there was silently enabled in oel. oel-tiny's native/nativesdk relied on the full defaults; list the three features they actually take. Effective DISTRO_FEATURES and all task signatures of core-image-minimal (oel, oel-tiny) are unchanged. Signed-off-by: Luciano Dittgen (cherry picked from commit ff865355c80d92dc18a3e53787024af8d7b1f4a6) --- conf/distro/include/oel.inc | 9 ++++----- conf/distro/oel-tiny.conf | 9 +++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/conf/distro/include/oel.inc b/conf/distro/include/oel.inc index 54c0660..fbe1f15 100644 --- a/conf/distro/include/oel.inc +++ b/conf/distro/include/oel.inc @@ -69,11 +69,10 @@ INIT_MANAGER ?= "systemd" DISTRO_EXTRA_RDEPENDS += "${OEL_DEFAULT_EXTRA_RDEPENDS}" -DISTRO_FEATURES_OPTED_OUT ?= " \ - acl alsa bluetooth debuginfod ext2 \ - wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp pulseaudio \ - gobject-introspection-data ldconfig opengl ptest multiarch wayland vulkan \ -" +# Opt in to OE-Core's default features explicitly instead of opting out of +# the rest: a feature OE-Core later adds to its defaults stays off in oel +# until it is listed here. +DISTRO_FEATURES_DEFAULTS ?= "ipv4 ipv6" # Exclude DATE from DISTRO/SDK_VERSION checksums DISTRO_VERSION[vardepsexclude] = "DATE" diff --git a/conf/distro/oel-tiny.conf b/conf/distro/oel-tiny.conf index 96ae282..e4d5b09 100644 --- a/conf/distro/oel-tiny.conf +++ b/conf/distro/oel-tiny.conf @@ -68,8 +68,13 @@ DISTRO_FEATURES = " \ ${DISTRO_FEATURES_WIFI} \ " -DISTRO_FEATURES:class-native = "${DISTRO_FEATURES_DEFAULTS} ${OEL_DEFAULT_DISTRO_FEATURES}" -DISTRO_FEATURES:class-nativesdk = "${DISTRO_FEATURES_DEFAULTS} ${OEL_DEFAULT_DISTRO_FEATURES}" +# Native and nativesdk recipes take only the DISTRO_FEATURES_FILTER_NATIVE{,SDK} +# features from here (debuginfod opengl wayland), on top of +# DISTRO_FEATURES_NATIVE{,SDK}. Keep the ones OE-Core enables by default, as +# oel's DISTRO_FEATURES_DEFAULTS no longer carries them. +DISTRO_FEATURES_TINY_NATIVE = "debuginfod opengl wayland ${OEL_DEFAULT_DISTRO_FEATURES}" +DISTRO_FEATURES:class-native = "${DISTRO_FEATURES_TINY_NATIVE}" +DISTRO_FEATURES:class-nativesdk = "${DISTRO_FEATURES_TINY_NATIVE}" # Use tmpdevfs and the busybox runtime services VIRTUAL-RUNTIME_dev_manager = ""