diff --git a/README.md b/README.md index 8692f57..8362e23 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,65 @@ # meta-plcos +Yocto/Bitbake layer for building PLC-OS images -Yocto/Bitbake layer for building PLC-OS images \ No newline at end of file +PLC-OS is a project to make an open-source Operating System emphasizing real-time performance (low-jitter, reliable latency) for time-sensitive tasks, such as machine control. + +Please see the corresponding sections below for details. + +Dependencies +============ + + URI: meta-plcopen + branch: main + + +Patches +======= + +Please submit any patches against the meta-plcos layer to the Issues section on the git repository on which this project is hosted. Additionally, please e-mail the maintainer for a faster response: + +Maintainer: Vaughn Varma + +Table of Contents +================= + + I. Adding the meta-plcos layer to your build + II. AI Notice + III. Misc + + +I. Adding the meta-plcos layer to your build +================================================= + +Run 'bitbake-layers add-layer meta-plcos' + +II. AI Notice +=============== + +The maintainer of this project kindly requests that you not use an LLM (or any other generative AI) in any capacity in your interactions with this project. This includes, but is not limited to, the following: + +Training any LLM on the data in this repository, i.e. scraping +Asking an LLM to modify any files within, or in any other way, to contribute to, this project +Integrating an LLM into a system running PLC-OS, or otherwise shipping an LLM alongside PLC-OS +Deriving a version of this project (e.g. forking) in order to allow an LLM to interact with this project + + +III. Misc +========== + +PLC-OS is derived from Yocto Linux, and as such uses Bitbake to build both installer (.iso) and direct boot (.wic) images. The following architectures have been nominally tested: +Intel x86 +Generic x86 +64 bit ARM (specifically, Raspberry Pi 4*) + +*Testing on the Raspberry Pi 5 revealed latency behavior indicative of a non-realtime system; further testing and OS modification are required to ensure reasonable realtime performance. Until this time, it is recommended to avoid using the Raspberry Pi 5 with PLC-OS for real-time tasks. + +Real-time performance will depend on factors beyond just the CPU architecture, and so it is ultimately up to user to test any given hardware system with PLC-OS to verify the suitability of said system for the user's needs. + +The Preempt-RT patch was brought into the mainline linux kernel, but simply using a compatible kernel with full preemption enabled is not enough for reliable performance. Additional optimizations include, but are not limited to, the following: + + I. Core Isolation + II. IRQ Reassignment + +Even with these modifications, in its current state, PLC-OS can only reasonably be considered a "Soft" real-time OS, and is not suitable for applications with "Hard" real-time requirements or constraints. + +PLC-OS builds with PLCOpen v4 (not to be confused with OpenPLC), an open-source runtime environment for running PLC logic, and so this layer must also be included, unless it is removed from the list of packages to install. diff --git a/classes/buildstats-summary-native.bbclass b/classes/buildstats-summary-native.bbclass new file mode 100644 index 0000000..c5e8249 --- /dev/null +++ b/classes/buildstats-summary-native.bbclass @@ -0,0 +1,61 @@ +# Summarize sstate usage at the end of the build +python buildstats_summary () { + import collections + import os.path + + bsdir = e.data.expand("${BUILDSTATS_BASE}/${BUILDNAME}") + if not os.path.exists(bsdir): + return + + sstatetasks = (e.data.getVar('SSTATETASKS') or '').split() + built = collections.defaultdict(lambda: [set(), set(), set(), set()]) + for pf in os.listdir(bsdir): + taskdir = os.path.join(bsdir, pf) + if not os.path.isdir(taskdir): + continue + + tasks = os.listdir(taskdir) + for t in sstatetasks: + target_source, native_source, native_sstate, target_sstate = built[t] + if t in tasks and "-native" in pf: + native_source.add(pf) + elif t in tasks: + target_source.add(pf) + elif t + '_setscene' in tasks and "-native" in pf: + native_sstate.add(pf) + elif t + '_setscene' in tasks: + target_sstate.add(pf) + + header_printed = False + for t in sstatetasks: + target_source, native_source, native_sstate, target_sstate = built[t] + if target_source | native_source | native_sstate | target_sstate: + if not header_printed: + header_printed = True + bb.note("Build completion summary:") + + bb.note("{0}:".format(t)) + + target_sstate_count = len(target_sstate) + native_sstate_count = len(native_sstate) + target_source_count = len(target_source) + native_source_count = len(native_source) + bb.note("target from sstate {0}, native from sstate {1}, target from source {2}, native from source {3}".format(target_sstate_count, native_sstate_count, target_source_count, native_source_count)) + total_source_count = target_source_count + native_source_count + total_sstate_count = target_sstate_count + native_sstate_count + total_native_count = native_source_count + native_sstate_count + total_target_count = target_source_count + target_sstate_count + total_count = total_source_count + total_sstate_count + bb.note("total from source {0}, total from sstate {1}, total native {2}, total target {3}, sum total {4}".format(total_source_count, total_sstate_count, total_native_count, total_target_count, total_count)) + + #do_package_qa, do_packagedata, and do_package_write_rpm won't have native sstate, so declare them as 0% reuse + if native_sstate_count == 0: + bb.note("native from source {0} of {1} (0% sstate reuse), from source {2} of {3} ({4:.1f}% sstate reuse), {5} total".format(native_source_count, total_native_count, target_source_count, total_target_count, round(100 * target_sstate_count / total_target_count, 1), total_count)) + # Avoid division-by-zero if only native packages were built + elif total_target_count == 0: + bb.note("native from source {0} of {1} ({2:.1f}% sstate reuse), from source {3} of {4} (0% sstate reuse), {5} total".format(native_source_count, total_native_count, round(100 * native_sstate_count / total_native_count, 1), target_source_count, total_target_count, total_count)) + else: + bb.note("native from source {0} of {1} ({2:.1f}% sstate reuse), from source {3} of {4} ({5:.1f}% sstate reuse), {6} total".format(native_source_count, total_native_count, round(100 * native_sstate_count / total_native_count, 1), target_source_count, total_target_count, round(100 * target_sstate_count / total_target_count, 1), total_count)) +} +addhandler buildstats_summary +buildstats_summary[eventmask] = "bb.event.BuildCompleted" diff --git a/classes/deprecate.bbclass b/classes/deprecate.bbclass new file mode 100644 index 0000000..24a9766 --- /dev/null +++ b/classes/deprecate.bbclass @@ -0,0 +1,22 @@ +# +# +# e.g. +# In the depreated old recipe, write as follows: +# inherit dprecate +# ALTERNATIVE_NEW_RECIPE = "new_recipe_name" +# + +ALTERNATIVE_NEW_RECIPE ?= "" + +python do_warn_deprecate() { + pn = d.getVar('BPN') + alternative_new_recipe = d.getVar('ALTERNATIVE_NEW_RECIPE') + if alternative_new_recipe: + bb.warn("Deprecated recipe %s, use %s instead" % (pn, alternative_new_recipe)) + else: + bb.warn("Deprecated recipe %s") +} + +do_warn_deprecate[nostamp] = "1" + +addtask warn_deprecate before do_build diff --git a/classes/enable-vendor-revision.bbclass b/classes/enable-vendor-revision.bbclass new file mode 100644 index 0000000..766cbd9 --- /dev/null +++ b/classes/enable-vendor-revision.bbclass @@ -0,0 +1,152 @@ +# +# Copyright (C) 2024 Wind River Systems, Inc +# +# SPDX-License-Identifier: GPL-2.0 +# + +# To avoid confusions with PR Server +VENDOR_REVISION_PREFIX ??= ".vr" + +VENDOR_REVISION_SKIP ??= "" + +# Set it to "0" to enable VR for non-WRLinux provided recipes. +VENDOR_REVISION_WRLINUX_SUPPORTED_ONLY ??= "1" + +def get_src_patches(d): + import oe.patch + local_patches = set() + bb.fetch.get_hashvalue(d) + for patch in oe.patch.src_patches(d): + _, _, local, _, _, parm = bb.fetch.decodeurl(patch) + local_patches.add(local) + return local_patches + +def is_work_shared(d): + sharedworkdir = os.path.join(d.getVar('TMPDIR'), 'work-shared') + + # Due to meta-xilinx used the xlnx-embeddedsw class to hard link + # copy the source files from work share directory to the working + # directory. Add it as corner case of work-shared recipes + if bb.data.inherits_class("xlnx-embeddedsw", d): + return True + + return d.getVar('S').startswith(sharedworkdir) + +def vr_need_skip(d): + + # Only enable vr for supported recipes + if bb.utils.to_boolean(d.getVar('VENDOR_REVISION_WRLINUX_SUPPORTED_ONLY')): + # Check whether the recipe is from Wind River Linux layers + pf = d.getVar('PF') + layer = bb.utils.get_file_layer(d.getVar('FILE'), d) + if not layer in d.getVar('RECIPE_LIST_LAYERS_ORIG').split(): + bb.debug(1, 'Skipping VR for %s since it is not from a WRLinux layer.' % d.getVar('PF')) + return True + + bpn = d.getVar('BPN') + wrl_supported = d.getVar('WRLINUX_SUPPORTED_RECIPE') or d.getVar('WRLINUX_SUPPORTED_RECIPE:pn-%s' % bpn) + if (not wrl_supported) or wrl_supported.strip() != '1': + bb.debug(1, 'Skipping VR for %s since it is not a WRLinux supported recipe.' % pf) + return True + + + if bb.utils.to_boolean(d.getVar('VENDOR_REVISION_SKIP')): + return True + + if is_work_shared(d): + return False + + packages = d.getVar('PACKAGES') + if (not packages) or bb.data.inherits_class('nopackages', d) or \ + bb.data.inherits_class('nativesdk', d): + return True + + # Skip VR when no patches + if get_src_patches(d): + return False + else: + return True + +def get_var_short(var): + return '/'.join(var.split('/')[-4:]).replace('/', '_') + +def get_file_short(d): + return get_var_short(d.getVar('FILE')) + +def get_current_vendor_revision(d): + year_version = d.getVar('WRLINUX_YEAR_VERSION') + if not year_version: + bb.warn('Failed to get WRLINUX_YEAR_VERSION') + year_version = '0' + update_version = d.getVar('WRLINUX_UPDATE_VERSION') or '0' + if int(update_version) <10: + # Prepend 0 when less than 10 + update_version = '0%s' % update_version + + vendor_revision = '%s%s' % (year_version, update_version) + + vr_prefix = d.getVar('VENDOR_REVISION_PREFIX') or '' + if vr_prefix: + vendor_revision = vr_prefix + vendor_revision + + vr_suffix = d.getVar('VENDOR_REVISION_SUFFIX') or '' + if vr_suffix: + vendor_revision += vr_suffix + + return vendor_revision + +addhandler append_vr_to_pr +append_vr_to_pr[eventmask] = "bb.event.RecipeTaskPreProcess" +python append_vr_to_pr() { + """ + Set PR:append = "VENDOR_REVISION" for the recipes + """ + + pf = d.getVar('PF') + # Skip when WRLINUX_VENDOR_REVISION_FILE is NULL + if not d.getVar('WRLINUX_VENDOR_REVISION_FILE'): + bb.debug(1, 'Skipping VR for %s since WRLINUX_VENDOR_REVISION_FILE is NULL.' % pf) + return + + # Skip when gen-vendor-revision is inherited + if bb.data.inherits_class('gen-vendor-revision', d): + bb.debug(1, 'Skipping VR for %s since gen-vendor-revision is inherited' % pf) + return + + if vr_need_skip(d): + return + + # Directly use VENDOR_REVISION if the recipe sets it. + vr = d.getVar('VENDOR_REVISION') + if not vr: + file_short = get_file_short(d) + val = d.getVarFlag('VENDOR_REVISION', file_short) + if val: + # The first item is VENDOR_REVISION + vr = val.split()[0] + # The d.getVarFlag("VENDOR_REVISION", "tmp-glibc_work-shared_qemux86-64_kernel-source") + # return None when kernel doesn't have patches, and vr_need_skip() + # can't skip work-shared recipes. The None is a string here. + if vr == 'None': + return + + if not vr: + # It's a new recipe, defult to current VR + vr = get_current_vendor_revision(d) + + bb.debug(1, 'Appending VENDOR_REVISION %s to PR' % vr) + d.appendVar('PR', vr) +} + +GLOBAL_VENDOR_REVISION_WARN ??= '1' +addhandler warn_for_global_vr +warn_for_global_vr[eventmask] = "bb.event.ConfigParsed" +python warn_for_global_vr() { + # The VENDOR_REVISION should be set via recipe level, otherwise, there + # might be PR bombs or no effect, so warn for global VENDOR_REVISION + global_vr = d.getVar('VENDOR_REVISION') + if global_vr and bb.utils.to_boolean(d.getVar('GLOBAL_VENDOR_REVISION_WARN')): + bb.warn('The global VENDOR_REVISION (%s) may cause unneeded packages upgrading,' % global_vr) + bb.warn('or make VENDOR_REVISION invalid.') + bb.warn('The above warning can be disabled by GLOBAL_VENDOR_REVISION_WARN = "0"\n') +} diff --git a/classes/ext_secure_cflags.bbclass b/classes/ext_secure_cflags.bbclass new file mode 100644 index 0000000..4ca0c7c --- /dev/null +++ b/classes/ext_secure_cflags.bbclass @@ -0,0 +1,23 @@ +# transfer "SECURITY_CFLAGS:pn-recipe = ..." to +# "SECURITY_CFLAGS:pn-mlib-recipe = ..." and +# transfer "SECURITY_CFLAGS:pn-recipe:powerpc = ..." +# to "SECURITY_CFLAGS:pn-mlib-recipe:powerpc = ..." + +python transfer_security_cflags () { + mlprefix = e.data.getVar('MLPREFIX', True) + + if mlprefix: + pn = e.data.getVar('PN', True) + bpn = e.data.getVar('BPN', True) + cflags = e.data.getVar("SECURITY_CFLAGS:pn-%s" % bpn, True) + if cflags is not None: + e.data.setVar("SECURITY_CFLAGS:pn-%s" % pn, cflags) + + arch = e.data.getVar('HOST_ARCH', True) + cflags = e.data.getVar("SECURITY_CFLAGS:pn-%s:%s" %(bpn, arch), True) + if cflags is not None: + e.data.setVar("SECURITY_CFLAGS:pn-%s:%s" %(pn, arch), cflags) +} + +addhandler transfer_security_cflags +transfer_security_cflags[eventmask] = "bb.event.RecipeParsed" diff --git a/classes/flux-ota.bbclass b/classes/flux-ota.bbclass new file mode 100755 index 0000000..bf6f52b --- /dev/null +++ b/classes/flux-ota.bbclass @@ -0,0 +1,9 @@ +IMAGE_INSTALL:append = " ostree ostree-upgrade-mgr os-release" +IMAGE_CLASSES += "image_types_ostree image_types_ota" +IMAGE_FSTYPES += "otaimg " + +inherit image_types_ostree image_types_ota + +IMAGE_TYPEDEP:wic += "otaimg ostree" + +WKS_FILE_DEPENDS = "mtools-native dosfstools-native e2fsprogs-native parted-native" diff --git a/classes/gen-vendor-revision.bbclass b/classes/gen-vendor-revision.bbclass new file mode 100644 index 0000000..73dcf26 --- /dev/null +++ b/classes/gen-vendor-revision.bbclass @@ -0,0 +1,174 @@ +# +# Copyright (C) 2024 Wind River Systems, Inc +# +# SPDX-License-Identifier: GPL-2.0 +# + +inherit enable-vendor-revision + +VENDOR_REVISION_DIR ?= "${TMPDIR}/vendor-revisions/${MACHINE}" +VENDOR_REVISION_ALL ?= "${VENDOR_REVISION_DIR}/wrlinux-vendor-revision.conf" + +# For fixed RCPL users which can be set in their own conf file such as +# conf/layer.conf, for example, ccm01 to ccm99: +#VENDOR_REVISION_SUFFIX = ".ccm01" +VENDOR_REVISION_SUFFIX ??= "" + +addhandler gen_vr_fatal +gen_vr_fatal[eventmask] = "bb.event.BuildStarted" +python gen_vr_fatal() { + bb.fatal('Only bitbake -p is supported when gen-vendor-revision.bbclass is enabled!') +} + +addhandler gen_vr_prepare +gen_vr_prepare[eventmask] = "bb.event.CacheLoadStarted" +python gen_vr_prepare() { + vendor_revision_dir = d.getVar('VENDOR_REVISION_DIR') + # Need a fresh VENDOR_REVISION_DIR and CACHE dir + for k in ('VENDOR_REVISION_DIR', 'CACHE'): + value = d.getVar(k) + bb.note("Removing %s" % value) + bb.utils.remove(value, True) + bb.utils.mkdirhier(value) +} + +# Generate VENDOR_REVISION for each recipe +addhandler gen_vr_recipe_handler +gen_vr_recipe_handler[eventmask] = "bb.event.RecipeParsed" +python gen_vr_recipe_handler() { + """ + Generate VENDOR_REVISION for each recipe, the format is: + VENDOR_REVISION[recipe_file] ?= 'vr cveid1:patch1 notcve:patch2' + """ + + import hashlib + + # Only generate vr for supported recipes + bpn = d.getVar('BPN') + wrl_supported = d.getVar('WRLINUX_SUPPORTED_RECIPE') or d.getVar('WRLINUX_SUPPORTED_RECIPE:pn-%s' % bpn) + if wrl_supported and wrl_supported.strip() == '0': + return + + if vr_need_skip(d): + return + + def get_cve_patch(patch): + ret = [] + patch_bn = os.path.basename(patch) + # Open in 'text' mode doesn't work for very a few patches such as: + # hddtemp_0.3-beta15-52.diff: 'utf-8' codec can't decode byte 0xe8 in + # position 3851: invalid continuation byte + with open(patch, 'rb') as f: + # Get md5 + md5 = hashlib.md5() + md5.update(f.read()) + hash = md5.hexdigest() + patch_bn += ':%s' % md5.hexdigest() + # Reset file postion + f.seek(0, 0) + for line in f: + if not 'CVE:' in str(line): + continue + line = line.decode('utf-8') + if line.startswith('CVE:') and 'CVE-' in line: + line_split = line.split('CVE:') + for cveid in line_split[1].split(): + cveid = cveid.strip() + if cveid.startswith('CVE-'): + ret.append('%s:%s' % (cveid, patch_bn)) + if not ret: + ret.append('notcve:%s' % patch_bn) + return ret + + def update_vr(patches): + """ + Check whether recipe's VENDOR_REVISION need update or not + * If old_vr == new_vf + - No check is needed since they are in the same + RCPL, just update it. + + * If old_vr != new_vr: + - If the patches are the same: + Nothing changed, use the old_vr to avoid unneeded updates by dnf. + + - If the patches are different: + Update to the new_vr + """ + + patches.sort() + new_patches = ' '.join(patches) + + file_short = get_file_short(d) + vr = get_current_vendor_revision(d) + old_val = d.getVarFlag('VENDOR_REVISION', file_short) + + # No checking is needed in the following cases: + # - No old_val: It's a new vr, just update it + if old_val: + old_vr = old_val.split()[0] + if old_vr: + # In different RCPL, check whether need update + if old_vr != vr: + old_patches = ' '.join(old_val.split()[1:]) + # The patches are the same, no update is needed + if old_patches == new_patches: + vr = old_vr + + # Replace .vr -> ${VENDOR_REVISION_PREFIX} + vr_prefix = d.getVar("VENDOR_REVISION_PREFIX") or "" + vr = vr.removeprefix(vr_prefix) + vr = '${VENDOR_REVISION_PREFIX}%s' % vr + out_lines = [] + val = "" + if new_patches: + val = '%s %s' % (vr, new_patches) + out_lines.append("VENDOR_REVISION[%s] ??= '%s'" % (file_short, val)) + + if is_work_shared(d): + s_short = get_var_short(d.getVar('S')) + if val: + out_lines.append("VENDOR_REVISION[%s] ?= '%s'" % (s_short, val)) + else: + out_lines.append("VENDOR_REVISION[%s] ??= '${@d.getVarFlag(\"VENDOR_REVISION\", \"%s\")}'" \ + % (file_short, s_short)) + if out_lines: + out_file = os.path.join(d.getVar('VENDOR_REVISION_DIR'), file_short) + with open(out_file, 'w') as f: + f.write('%s\n' % '\n'.join(out_lines)) + + patches = [] + localdata = bb.data.createCopy(d) + localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES') + localdata.getVar('GEN_VENDOR_REVISION_OVERRIDES')) + for local in get_src_patches(localdata): + patches += get_cve_patch(local) + update_vr(patches) +} + +# Generate vendor-revision.conf +addhandler gen_vr_all_handler +gen_vr_all_handler[eventmask] = "bb.event.ParseCompleted" +python gen_vr_all_handler () { + """ + Collect each recipe's vendor revision in VENDOR_REVISION_DIR and save + to VENDOR_REVISION_ALL + """ + import glob + vendor_revision_dir = d.getVar('VENDOR_REVISION_DIR') + patches = [] + output = d.getVar('VENDOR_REVISION_ALL') + output_dir = os.path.dirname(output) + for recipe in glob.glob(os.path.join(vendor_revision_dir, '*')): + with open(recipe) as f: + for line in f: + if not line in (patches): + patches.append(line) + patches.sort() + with open(output, 'w') as f: + f.write('require %s\n\n' % "wrlinux-vendor-revision-manual.inc") + f.write(''.join(patches)) + bb.note('The recipes with patches are saved to %s' % output) +} + +# Workaround Exception during build_dependencies for fetcher_hashes_dummyfunc +# https://git.openembedded.org/openembedded-core/commit/?id=a8e7b0f932b9ea69b3a218fca18041676c65aba0 +fetcher_hashes_dummyfunc[vardepvalue] = "" diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass new file mode 100755 index 0000000..882bc41 --- /dev/null +++ b/classes/image_types_ostree.bbclass @@ -0,0 +1,567 @@ +# OSTree deployment + +OSTREE_GPG_DEP = "${@'' if (d.getVar('GPG_BIN', True) or '').startswith('/') else 'gnupg-native:do_populate_sysroot pinentry-native:do_populate_sysroot'}" +GPG_BIN ??= "" +GPG_PATH ??= "" +OSTREE_COMMIT_DEV ??= "0" +OSTREE_CREATE_TARBALL ??= "0" + +DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'policycoreutils-native', '', d)}" + +do_image_ostree[depends] = "ostree-native:do_populate_sysroot \ + openssl-native:do_populate_sysroot \ + coreutils-native:do_populate_sysroot \ + wic-tools:do_populate_sysroot \ + virtual/kernel:do_deploy \ + ${OSTREE_INITRAMFS_IMAGE}:do_image_complete \ + ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER_INCLUDE', True) == 'grub' else ''} \ + ${@'virtual/bootloader:do_deploy u-boot-tools-native:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER_INCLUDE', True) == 'u-boot' else ''}" + +do_prepare_recipe_sysroot[depends] += "${OSTREE_GPG_DEP}" + +#export REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "`date --date="20${WRLINUX_YEAR_VERSION}-01-01 +${WRLINUX_WW_VERSION}weeks" +%s`" +export BUILD_REPRODUCIBLE_BINARIES = "1" + +export OSTREE_REPO +export OSTREE_BRANCHNAME + +export SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" +export GRUB_USED = "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'grub', 'true', '')}" +export FLUXDATA = "${@bb.utils.contains('DISTRO_FEATURES', 'luks', 'luks_fluxdata', 'fluxdata', d)}" + +repo_apache_config () { + local _repo_path + local _repo_alias + + cd $OSTREE_REPO && _repo_path=$(pwd) && cd - + _repo_alias="/${OSTREE_OSNAME}/${MACHINE}/" + + echo "* Generating apache2 config fragment for $OSTREE_REPO..." + (echo "Alias \"$_repo_alias\" \"$_repo_path/\"" + echo "" + echo "" + echo " Options Indexes FollowSymLinks" + echo " Require all granted" + echo "") > ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.http.conf +} + +python ostree_check_rpm_public_key () { + gpg_path = d.getVar('GPG_PATH', True) + if not gpg_path: + gpg_path = d.getVar('TMPDIR', True) + '/.gnupg' + + if not os.path.exists(gpg_path): + status, output = oe.utils.getstatusoutput('mkdir -m 0700 -p %s' % gpg_path) + if status: + raise bb.fatal('Failed to create gpg keying %s: %s' % + (gpg_path, output)) + gpg_bin = d.getVar('GPG_BIN', True) or \ + bb.utils.which(os.getenv('PATH'), 'gpg') + gpg_keyid = d.getVar('OSTREE_GPGID', True) or '' + if gpg_keyid == "": + return + + # Check OSTREE_GPG_NAME and OSTREE_GPG_PASSPHRASE + cmd = "%s --homedir %s --list-keys \"%s\"" % \ + (gpg_bin, gpg_path, gpg_keyid) + bb.note(cmd) + status, output = oe.utils.getstatusoutput(cmd) + if not status: + return + + # Import RPM_GPG_NAME if not found + gpg_key = d.getVar('OSTREE_GPGDIR', True) + '/' + 'RPM-GPG-PRIVKEY-' + gpg_keyid + cmd = '%s --batch --homedir %s --passphrase %s --import "%s"' % \ + (gpg_bin, gpg_path, d.getVar('OSTREE_GPG_PASSPHRASE', True), gpg_key) + bb.note(cmd) + status, output = oe.utils.getstatusoutput(cmd) + if status: + bb.fatal('Could not import GPG key for ostree signing: %s' % output) +} +ostree_check_rpm_public_key[lockfiles] = "${TMPDIR}/gpg_key.lock" +do_package_write_rpm[prefuncs] += "ostree_check_rpm_public_key" +do_rootfs[prefuncs] += "ostree_check_rpm_public_key" + +selinux_set_labels (){ + touch ${OSTREE_ROOTFS}/usr/${sysconfdir}/selinux/fixfiles_exclude_dirs + echo "/ostree" >> ${OSTREE_ROOTFS}/usr/${sysconfdir}/selinux/fixfiles_exclude_dirs + echo "/sysroot" >> ${OSTREE_ROOTFS}/usr/${sysconfdir}/selinux/fixfiles_exclude_dirs + if [ -f ${OSTREE_ROOTFS}/.autorelabel ]; then + mv ${OSTREE_ROOTFS}/.autorelabel ${OSTREE_ROOTFS}/usr/${sysconfdir} + fi + + POL_TYPE=$(sed -n -e "s&^SELINUXTYPE[[:space:]]*=[[:space:]]*\([0-9A-Za-z_]\+\)&\1&p" ${OSTREE_ROOTFS}/usr/${sysconfdir}/selinux/config) + sed -i "\/bin\/rm/a \\\t/usr/sbin/setfiles -F -q /etc/selinux/${POL_TYPE}/contexts/files/file_contexts /etc" ${OSTREE_ROOTFS}/usr/bin/selinux-autorelabel.sh + sed -i "s/.autorelabel/etc\/.autorelabel/g" ${OSTREE_ROOTFS}/usr/bin/selinux-autorelabel.sh + + if ! setfiles -m -r ${OSTREE_ROOTFS} ${OSTREE_ROOTFS}/usr/${sysconfdir}/selinux/${POL_TYPE}/contexts/files/file_contexts ${OSTREE_ROOTFS} + then + bbfatal "selinux_set_labels error." + fi +} + +create_tarball_and_ostreecommit[vardepsexclude] = "DATETIME" +create_tarball_and_ostreecommit() { + local _image_basename=$1 + local _timestamp=$2 + + # The timestamp format of ostree requires + _timestamp=`LC_ALL=C date --date=@$_timestamp` + + if [ ${OSTREE_CREATE_TARBALL} = "1" ] ; then + # Create a tarball that can be then commited to OSTree repo + OSTREE_TAR=${DEPLOY_DIR_IMAGE}/${_image_basename}-${MACHINE}-${DATETIME}.rootfs.ostree.tar.bz2 + tar -C ${OSTREE_ROOTFS} --xattrs --xattrs-include='*' -cjf ${OSTREE_TAR} . + sync + + ln -snf ${_image_basename}-${MACHINE}-${DATETIME}.rootfs.ostree.tar.bz2 \ + ${DEPLOY_DIR_IMAGE}/${_image_basename}-${MACHINE}.rootfs.ostree.tar.bz2 + fi + + # Commit the result + if [ -z "${OSTREE_GPGID}" ]; then + bbwarn "You are using an unsupported configuration by using ostree repo without gpg. " \ + "This usually indicates a failure to find /usr/bin/gpg, " \ + "or you tried to use an invalid GPG database. " \ + "It could also be possible that OSTREE_GPGID, OSTREE_GPG_PASSPHRASE, " \ + "OSTREE_GPGDIR has a bad value." + ostree --repo=${OSTREE_REPO_TEMP} commit \ + --tree=dir=${OSTREE_ROOTFS} \ + --skip-if-unchanged \ + --branch=${_image_basename} \ + --timestamp="${_timestamp}" \ + --subject="Commit-id: ${_image_basename}-${MACHINE}-${DATETIME}" + # Pull new commmit into old repo + flock ${OSTREE_REPO}.lock ostree --repo=${OSTREE_REPO} pull-local ${OSTREE_REPO_TEMP} ${_image_basename} + else + # Setup gpg key for signing + if [ -n "${OSTREE_GPGID}" ] && [ -n "${OSTREE_GPG_PASSPHRASE}" ] && [ -n "$gpg_path" ] ; then + gpg_ver=`$gpg_bin --version | head -1 | awk '{ print $3 }' | awk -F. '{ print $1 }'` + echo '#!/bin/bash' > ${WORKDIR}/gpg + echo 'exarg=""' >> ${WORKDIR}/gpg + if [ "$gpg_ver" = "1" ] ; then + # GPGME has to be tricked into running a helper script to provide a passphrase when using gpg 1 + echo 'echo "$@" |grep -q batch && exarg="--passphrase ${OSTREE_GPG_PASSPHRASE}"' >> ${WORKDIR}/gpg + elif [ "$gpg_ver" = "2" ] ; then + gpg_connect=$(dirname $gpg_bin)/gpg-connect-agent + if [ ! -f $gpg_connect ] ; then + bb.fatal "ERROR Could not locate gpg-connect-agent at: $gpg_connect" + fi + if [ -f "$gpg_path/gpg-agent.conf" ] ; then + if ! grep -q allow-loopback-pin "$gpg_path/gpg-agent.conf" ; then + echo allow-loopback-pinentry >> "$gpg_path/gpg-agent.conf" + $gpg_connect --homedir $gpg_path reloadagent /bye + fi + else + echo allow-loopback-pinentry > "$gpg_path/gpg-agent.conf" + $gpg_connect --homedir $gpg_path reloadagent /bye + fi + $gpg_bin --homedir=$gpg_path -o /dev/null -u "${OSTREE_GPGID}" --pinentry=loopback --passphrase ${OSTREE_GPG_PASSPHRASE} -s /dev/null + fi + echo "exec $gpg_bin \$exarg \$@" >> ${WORKDIR}/gpg + chmod 700 ${WORKDIR}/gpg + fi + if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'Y', '', d)}" ]; then + PATH="${WORKDIR}:$PATH" ostree --repo=${OSTREE_REPO_TEMP} commit \ + --tree=dir=${OSTREE_ROOTFS} \ + --selinux-policy ${OSTREE_ROOTFS} \ + --skip-if-unchanged \ + --gpg-sign="${OSTREE_GPGID}" \ + --gpg-homedir=$gpg_path \ + --branch=${_image_basename} \ + --timestamp="${_timestamp}" \ + --subject="Commit-id: ${_image_basename}-${MACHINE}-${DATETIME}" + else + PATH="${WORKDIR}:$PATH" ostree --repo=${OSTREE_REPO_TEMP} commit \ + --tree=dir=${OSTREE_ROOTFS} \ + --skip-if-unchanged \ + --gpg-sign="${OSTREE_GPGID}" \ + --gpg-homedir=$gpg_path \ + --branch=${_image_basename} \ + --timestamp="${_timestamp}" \ + --subject="Commit-id: ${_image_basename}-${MACHINE}-${DATETIME}" + fi + # Pull new commmit into old repo + flock ${OSTREE_REPO}.lock ostree --repo=${OSTREE_REPO} pull-local ${OSTREE_REPO_TEMP} ${_image_basename} + + gpgconf=$(dirname $gpg_bin)/gpgconf + if [ ! -f $gpgconf ] ; then + bb.fatal "ERROR Could not find $gpgconf" + fi + GNUPGHOME="$gpg_path" flock ${OSTREE_REPO}.lock $gpgconf --kill gpg-agent + fi +} + +IMAGE_CMD:ostree () { + gpg_path="${GPG_PATH}" + if [ -z "$gpg_path" ] ; then + gpg_path="${TMPDIR}/.gnupg" + fi + gpg_bin="${GPG_BIN}" + if [ -z "$gpg_bin" ] ; then + gpg_bin=`which gpg` + fi + if [ "${gpg_bin#/}" = "$gpg_bin" ] ; then + bb.fatal "The GPG_BIN variable must be an absolute path to the gpg binary" + fi + + if [ -z "$OSTREE_REPO" ]; then + bbfatal "OSTREE_REPO should be set in your local.conf" + fi + + if [ -z "$OSTREE_BRANCHNAME" ]; then + bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" + fi + + OSTREE_REPO_TEMP="${WORKDIR}/ostree_repo.temp.$$" + OSTREE_ROOTFS=`mktemp -du ${WORKDIR}/ostree-root-XXXXX` + cp -a ${IMAGE_ROOTFS} ${OSTREE_ROOTFS} + if [ "${@oe.types.boolean(d.getVar('IS_FMU_ENABLED'))}" = "True" ]; then + rm -rf ${OSTREE_ROOTFS}${APP_DIRECTORY}/* + fi + chmod a+rx ${OSTREE_ROOTFS} + sync + + cd ${OSTREE_ROOTFS} + + # Create sysroot directory to which physical sysroot will be mounted + mkdir sysroot + ln -sf sysroot/ostree ostree + + rm -rf tmp/* + ln -sf sysroot/tmp tmp + + mkdir -p usr/rootdirs + + mv etc usr/ + # Implement UsrMove + dirs="bin sbin lib lib64" + + for dir in ${dirs} ; do + if [ -d ${dir} ] && [ ! -L ${dir} ] ; then + mv ${dir} usr/rootdirs/ + rm -rf ${dir} + ln -sf usr/rootdirs/${dir} ${dir} + fi + done + + if [ -n "$SYSTEMD_USED" ]; then + mkdir -p usr/etc/tmpfiles.d + tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf + echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf} + # disable the annoying logs on the console + echo "w /proc/sys/kernel/printk - - - - 3" >> ${tmpfiles_conf} + else + mkdir -p usr/etc/init.d + tmpfiles_conf=usr/etc/init.d/tmpfiles.sh + echo '#!/bin/sh' > ${tmpfiles_conf} + echo "mkdir -p /var/rootdirs; chmod 755 /var/rootdirs" >> ${tmpfiles_conf} + + ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh + fi + + # Preserve data in /home to be later copied to /var/home by + # sysroot generating procedure + mkdir -p usr/homedirs + if [ -d "home" ] && [ ! -L "home" ]; then + mv home usr/homedirs/home + mkdir var/home + ln -sf var/home home + echo "d /var/home 0755 root root -" >>${tmpfiles_conf} + fi + + echo "d /var/rootdirs/opt 0755 root root -" >>${tmpfiles_conf} + if [ -d opt ]; then + mkdir -p usr/rootdirs/opt + for dir in `ls opt`; do + mv opt/$dir usr/rootdirs/opt/ + echo "L /opt/$dir - - - - /usr/rootdirs/opt/$dir" >>${tmpfiles_conf} + done + fi + rm -rf opt + ln -sf var/rootdirs/opt opt + + if [ -d var/lib/rpm ]; then + mkdir -p usr/rootdirs/var/lib/ + mv var/lib/rpm usr/rootdirs/var/lib/ + echo "L /var/lib/rpm - - - - /usr/rootdirs/var/lib/rpm" >>${tmpfiles_conf} + fi + if [ -d var/lib/dnf ]; then + mkdir -p usr/rootdirs/var/lib/ + mv var/lib/dnf usr/rootdirs/var/lib/ + echo "L /var/lib/dnf - - - - /usr/rootdirs/var/lib/dnf " >>${tmpfiles_conf} + fi + + # Move persistent directories to /var + dirs="mnt media srv" + + for dir in ${dirs}; do + if [ -d ${dir} ] && [ ! -L ${dir} ]; then + if [ "$(ls -A $dir)" ]; then + bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" + fi + + if [ -n "$SYSTEMD_USED" ]; then + echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} + fi + rm -rf ${dir} + ln -sf var/rootdirs/${dir} ${dir} + fi + done + + if [ -d root ] && [ ! -L root ]; then + if [ "$(ls -A root)" ]; then + bberror "Data in /root directory is not preserved by OSTree." + fi + + if [ -n "$SYSTEMD_USED" ]; then + echo "d /var/rootdirs/root 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/rootdirs/root; chown 755 /var/rootdirs/root" >>${tmpfiles_conf} + fi + + rm -rf root + ln -sf var/rootdirs/root root + fi + + # deploy SOTA credentials + if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then + EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` + + if [ `date +%s` -ge `date -d "${EXPDATE}" +%s` ]; then + bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" + fi + + mkdir -p var/sota + cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12 + if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then + export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}` + fi + echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env + fi + + + # Creating boot directories is required for "ostree admin deploy" + + mkdir -p boot/loader.0 + mkdir -p boot/loader.1 + ln -sf boot/loader.0 boot/loader + + checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` + +# cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} +# cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} boot/initramfs-${checksum} + + #deploy the device tree file + mkdir -p usr/lib/ostree-boot + cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} usr/lib/ostree-boot/vmlinuz-${checksum} + cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} usr/lib/ostree-boot/initramfs-${checksum} + if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'efi-secure-boot', 'Y', '', d)}" ]; then + if [ -f ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL}.p7b ] ; then + cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL}.p7b usr/lib/ostree-boot/vmlinuz.p7b + cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT}.p7b usr/lib/ostree-boot/initramfs.p7b + fi + if [ -f ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL}.sig ] ; then + cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL}.sig usr/lib/ostree-boot/vmlinuz.sig + cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT}.sig usr/lib/ostree-boot/initramfs.sig + fi + fi + if [ -d boot/efi ]; then + cp -a boot/efi usr/lib/ostree-boot/ + fi + + if [ -f ${DEPLOY_DIR_IMAGE}/uEnv.txt ]; then + cp ${DEPLOY_DIR_IMAGE}/uEnv.txt usr/lib/ostree-boot/ + fi + + if [ -f ${DEPLOY_DIR_IMAGE}/boot.scr ]; then + cp ${DEPLOY_DIR_IMAGE}/boot.scr usr/lib/ostree-boot/boot.scr + # Modify the boot.scr + if [ -e usr/lib/ostree-boot/boot.scr ] ; then + tail -c+73 usr/lib/ostree-boot/boot.scr > usr/lib/ostree-boot/boot.scr.raw + if [ -e /bin/perl ] ; then + /bin/perl -p -i -e "s#^( *setenv BRANCH) .*#\$1 ${OSTREE_BRANCHNAME}# if (\$_ !~ /oBRANCH/) " usr/lib/ostree-boot/boot.scr.raw + else + /usr/bin/perl -p -i -e "s#^( *setenv BRANCH) .*#\$1 ${OSTREE_BRANCHNAME}# if (\$_ !~ /oBRANCH/) " usr/lib/ostree-boot/boot.scr.raw + fi + mkimage -A arm -T script -O linux -d usr/lib/ostree-boot/boot.scr.raw usr/lib/ostree-boot/boot.scr + if [ -f $DEPLOY_DIR_IMAGE/boot.itb ]; then + mkimage -A arm -T script -O linux -f auto -C none -d usr/lib/ostree-boot/boot.scr.raw usr/lib/ostree-boot/boot.itb + fi + rm -f usr/lib/ostree-boot/boot.scr.raw + fi + mkdir -p boot + cp usr/lib/ostree-boot/boot.scr boot/ + fi + + for i in ${KERNEL_DEVICETREE}; do + if [ -f ${DEPLOY_DIR_IMAGE}/$(basename $i) ]; then + if [ "$(dirname $i)" = "overlays" ] ; then + [ ! -d usr/lib/ostree-boot/overlays ] && mkdir -p usr/lib/ostree-boot/overlays + cp ${DEPLOY_DIR_IMAGE}/$(basename $i) usr/lib/ostree-boot/overlays + else + cp ${DEPLOY_DIR_IMAGE}/$(basename $i) usr/lib/ostree-boot/ + fi + fi + done + + #deploy the GPG pub key + if [ -n "${OSTREE_GPGID}" ]; then + if [ -f $gpg_path/pubring.gpg ]; then + cp $gpg_path/pubring.gpg usr/share/ostree/trusted.gpg.d/pubring.gpg + fi + if [ -f $gpg_path/pubring.kbx ]; then + cp $gpg_path/pubring.kbx usr/share/ostree/trusted.gpg.d/pubkbx.gpg + fi + fi + +# cp ${DEPLOY_DIR_IMAGE}/${MACHINE}.dtb usr/lib/ostree-boot + touch usr/lib/ostree-boot/.ostree-bootcsumdir-source + + # Copy image manifest + cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest + + # add the required mount + echo "LABEL=otaboot /boot auto defaults 0 0" >>usr/etc/fstab + if [ -n "${GRUB_USED}" ]; then + echo "LABEL=otaefi /boot/efi auto ro 0 0" >>usr/etc/fstab + fi + echo "LABEL=fluxdata /var auto defaults 0 0" >>usr/etc/fstab + if [ "${@oe.types.boolean(d.getVar('IS_FMU_ENABLED'))}" = "True" ]; then + echo "LABEL=apps /apps auto defaults 0 0" >>usr/etc/fstab + fi + + # Install a trap handler to remove the temporary ostree_repo + trap "rm -rf ${OSTREE_REPO_TEMP}" EXIT + cd ${WORKDIR} + + rm -rf ${OSTREE_REPO_TEMP} + ostree --repo=${OSTREE_REPO_TEMP} init --mode=bare + if [ ! -d ${OSTREE_REPO} ]; then + flock ${OSTREE_REPO}.lock ostree --repo=${OSTREE_REPO} init --mode=archive-z2 + else + ostree pull-local --repo=${OSTREE_REPO_TEMP} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} || (exit 0) + fi + + # Preserve OSTREE_BRANCHNAME for future information + mkdir -p ${OSTREE_ROOTFS}/usr/share/sota/ + + if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'Y', '', d)}" ]; then + selinux_set_labels + fi + + timestamp=`date +%s` + if [ "${OSTREE_COMMIT_DEV}" = "1" ] ; then + echo -n "${OSTREE_BRANCHNAME}-dev" > ${OSTREE_ROOTFS}/usr/share/sota/branchname + create_tarball_and_ostreecommit "${OSTREE_BRANCHNAME}-dev" "$timestamp" + fi + + if [ "${OSTREE_NORPMDATA}" = 1 ] || [ ! -e ${OSTREE_ROOTFS}/usr/bin/rpm ] ; then + # Clean up package management data for factory deploy + rm -rf ${OSTREE_ROOTFS}/usr/rootdirs/var/lib/rpm/* + rm -rf ${OSTREE_ROOTFS}/usr/rootdirs/var/lib/dnf/* + fi + + # Make factory older than development which is helpful for ostree admin upgrade + timestamp=`expr $timestamp - 1` + echo -n "${OSTREE_BRANCHNAME}" > ${OSTREE_ROOTFS}/usr/share/sota/branchname + create_tarball_and_ostreecommit "${OSTREE_BRANCHNAME}" "$timestamp" + + # Cleanup and remove trap handler + rm -rf ${OSTREE_REPO_TEMP} + trap - EXIT + + flock ${OSTREE_REPO}.lock ostree summary -u --repo=${OSTREE_REPO} + repo_apache_config + + rm -rf ${OSTREE_ROOTFS} +} + +python __anonymous() { + gpg_path = d.getVar('GPG_PATH', True) + if not gpg_path: + gpg_path = d.getVar('TMPDIR', True) + '/.gnupg' + if len(gpg_path) > 80: + msg = "The default GPG_PATH '%s'\n" % gpg_path + msg += "of %d characters is too long.\n" % len(gpg_path) + msg += "Due to GPG homedir path length limit, please set GPG_PATH shorter than 80 characters" + raise bb.parse.SkipRecipe(msg) +} + +def get_fluxdata_size(d): + import subprocess + + overhead_factor = float(d.getVar("IMAGE_OVERHEAD_FACTOR")) + fluxdata_dir = d.expand("${WORKDIR}/rootfs_ota_var") + output = subprocess.check_output(["du", "-ks", fluxdata_dir]) + size_kb = int(output.split()[0]) + base_size = size_kb * overhead_factor + bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor)) + + if base_size != int(base_size): + base_size = int(base_size + 1) + else: + base_size = int(base_size) + + # Extra 512MB for /var + base_size += 512*1024 + bb.debug(1, 'returning %d' % (base_size)) + return base_size + +def get_apps_size(d): + import subprocess + + overhead_factor = float(d.getVar("IMAGE_OVERHEAD_FACTOR")) + fluxdata_dir = d.expand("${WORKDIR}/rootfs_ota_apps") + output = subprocess.check_output(["du", "-ks", fluxdata_dir]) + size_kb = int(output.split()[0]) + base_size = size_kb * overhead_factor + bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor)) + + if base_size != int(base_size): + base_size = int(base_size + 1) + else: + base_size = int(base_size) + + # Extra 512MB for /apps + base_size += 512*1024 + bb.debug(1, 'returning %d' % (base_size)) + return base_size + +python do_write_wks_template:prepend() { + fluxdata_dir = d.expand("${WORKDIR}/rootfs_ota_var") + if os.path.exists(fluxdata_dir): + root_size = d.getVar("OSTREE_WKS_ROOT_SIZE") or None + if root_size is None: + # KB --> MB + _size = get_rootfs_size(d)//1024 + 1 + root_size = "--size=%dM --overhead-factor 1" % _size + d.setVar('OSTREE_WKS_ROOT_SIZE', root_size) + + if oe.types.boolean(d.getVar('IS_FMU_ENABLED')): + apps_size = d.getVar("OSTREE_WKS_APPS_SIZE") or None + if apps_size is None: + _size = get_apps_size(d) + apps_size = "--size=%dM --overhead-factor 1" % _size + d.setVar('OSTREE_WKS_APPS_SIZE', apps_size) + + fluxdata_size = d.getVar("OSTREE_WKS_FLUX_SIZE") or None + if fluxdata_size is None: + # KB --> MB + _size = get_fluxdata_size(d)//1024 + 1 + fluxdata_size = "--size=%dM --overhead-factor 1" % _size + d.setVar('OSTREE_WKS_FLUX_SIZE', fluxdata_size) +} + +# Need add do_write_wks_template firstly, otherwise +# do_write_wks_template:prepend doesn't work +python () { + if d.getVar('USING_WIC'): + wks_file_u = d.getVar('WKS_FULL_PATH', False) + wks_file = d.expand(wks_file_u) + base, ext = os.path.splitext(wks_file) + if ext == '.in' and os.path.exists(wks_file): + bb.build.addtask('do_write_wks_template', 'do_image_wic', 'do_image_otaimg', d) +} diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass new file mode 100755 index 0000000..1181c55 --- /dev/null +++ b/classes/image_types_ota.bbclass @@ -0,0 +1,236 @@ +# Image to use with u-boot as BIOS and OSTree deployment system + +#inherit image_types + +# Boot filesystem size in MiB +# OSTree updates may require some space on boot file system for +# boot scripts, kernel and initramfs images +# + +do_image_otaimg[depends] += "e2fsprogs-native:do_populate_sysroot \ + ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER_INCLUDE', True) == 'grub' else ''} \ + ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER_INCLUDE', True) == 'u-boot' else ''}" + +export FLUXDATA = "${@bb.utils.contains('DISTRO_FEATURES', 'luks', 'luks_fluxdata', 'fluxdata', d)}" +export ROOT_LABEL = "${@bb.utils.contains('DISTRO_FEATURES', 'luks', 'luks_otaroot', 'otaroot', d)}" + +calculate_size () { + BASE=$1 + SCALE=$2 + MIN=$3 + MAX=$4 + EXTRA=$5 + ALIGN=$6 + + SIZE=`echo "$BASE * $SCALE" | bc -l` + REM=`echo $SIZE | cut -d "." -f 2` + SIZE=`echo $SIZE | cut -d "." -f 1` + + if [ -n "$REM" -o ! "$REM" -eq 0 ]; then + SIZE=`expr $SIZE \+ 1` + fi + + if [ "$SIZE" -lt "$MIN" ]; then + $SIZE=$MIN + fi + + SIZE=`expr $SIZE \+ $EXTRA` + SIZE=`expr $SIZE \+ $ALIGN \- 1` + SIZE=`expr $SIZE \- $SIZE \% $ALIGN` + + if [ -n "$MAX" ]; then + if [ "$SIZE" -gt "$MAX" ]; then + return -1 + fi + fi + + echo "${SIZE}" +} + +export OSTREE_OSNAME +export OSTREE_BRANCHNAME +export OSTREE_REPO +export OSTREE_BOOTLOADER +export WKS_FULL_PATH + +IMAGE_CMD:otaimg () { + if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then + if [ -z "$OSTREE_REPO" ]; then + bbfatal "OSTREE_REPO should be set in your local.conf" + fi + + if [ -z "$OSTREE_OSNAME" ]; then + bbfatal "OSTREE_OSNAME should be set in your local.conf" + fi + + if [ -z "$OSTREE_BRANCHNAME" ]; then + bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" + fi + + PHYS_SYSROOT=`mktemp -d ${WORKDIR}/ota-sysroot-XXXXX` + + ostree admin --sysroot=${PHYS_SYSROOT} init-fs ${PHYS_SYSROOT} + ostree admin --sysroot=${PHYS_SYSROOT} os-init ${OSTREE_OSNAME} + ostree config --repo=${PHYS_SYSROOT}/ostree/repo set core.add-remotes-config-dir false + if [ "${OSTREE_SKIP_BOOT_DIFF}" != "0" ] ; then + ostree config --repo=${PHYS_SYSROOT}/ostree/repo set upgrade.skip-boot-diff ${OSTREE_SKIP_BOOT_DIFF} + fi + if [ "${OSTREE_USE_AB}" != 1 ] ; then + ostree config --repo=${PHYS_SYSROOT}/ostree/repo set upgrade.no-ab 1 + fi + ostree config --repo=${PHYS_SYSROOT}/ostree/repo set upgrade.branch ${OSTREE_BRANCHNAME} + if [ -n "${OSTREE_REMOTE_URL}" ] ; then + do_gpg="" + if [ "${OSTREE_GPGID}" = "" ] ; then + do_gpg=--no-gpg-verify + fi + if [ "${@oe.types.boolean(d.getVar('IS_FMU_ENABLED'))}" = "True" ] && + [ "${@oe.types.boolean(d.getVar('FMU_OSTREE_GPG_VERIFY'))}" = "False" ]; then + do_gpg=--no-gpg-verify + fi + ostree config --repo=${PHYS_SYSROOT}/ostree/repo set upgrade.remote ${OSTREE_REMOTE_NAME} + ostree remote --repo=${PHYS_SYSROOT}/ostree/repo add ${do_gpg} ${OSTREE_REMOTE_NAME} ${OSTREE_REMOTE_URL} + fi + + + mkdir -p ${PHYS_SYSROOT}/boot/loader.0 + ln -s loader.0 ${PHYS_SYSROOT}/boot/loader + + if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then + mkdir -p ${PHYS_SYSROOT}/boot/efi/EFI/BOOT + if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'efi-secure-boot', 'Y', '', d)}" ]; then + cp ${DEPLOY_DIR_IMAGE}/grubx64.efi ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/bootx64.efi + if [ -f ${DEPLOY_DIR_IMAGE}/grub.cfg.p7b ] ; then + cp ${DEPLOY_DIR_IMAGE}/grub.cfg.p7b ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/ + fi + if [ -f ${DEPLOY_DIR_IMAGE}/grub.cfg.sig ] ; then + cp ${DEPLOY_DIR_IMAGE}/grub.cfg.sig ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/ + fi + else + cp ${DEPLOY_DIR_IMAGE}/grub-efi-bootx64.efi ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/bootx64.efi + fi + cp ${DEPLOY_DIR_IMAGE}/grub.cfg ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/ + #create the OS vendor fallback boot dir + mkdir ${PHYS_SYSROOT}/boot/efi/EFI/${DISTRO} + cp ${DEPLOY_DIR_IMAGE}/grub.cfg ${PHYS_SYSROOT}/boot/efi/EFI/${DISTRO} + + # Create an empty GRUB Environment Block + echo "# GRUB Environment Block" > ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/boot.env + if [ "${OSTREE_USE_AB}" != "1" ] ; then + printf "ab=0\n" >> ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/boot.env + else + echo -n "#####" >> ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/boot.env + fi + printf "boot_tried_count=0\n" >> ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/boot.env + echo -n "###############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################" >> ${PHYS_SYSROOT}/boot/efi/EFI/BOOT/boot.env + elif [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then + touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt + else + bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}" + fi; + + ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} + export OSTREE_BOOT_PARTITION="/boot" + kargs_list="" + for arg in ${OSTREE_KERNEL_ARGS}; do + kargs_list="${kargs_list} --karg-append=$arg" + done + + ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME} + if [ "${OSTREE_USE_AB}" != "1" ] ; then + # Provide a rollback deployment when using a single disk + ostree admin --sysroot=${PHYS_SYSROOT} deploy --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME} + fi + + if [ -d ${PHYS_SYSROOT}/ostree/1/boot/efi ] ; then + cp -a ${PHYS_SYSROOT}/ostree/1/boot/efi ${PHYS_SYSROOT}/boot + fi + + if [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then + rm -rf ${WORKDIR}/rootfs_ota_uboot + mkdir -p ${WORKDIR}/rootfs_ota_uboot + + bootdir=$(grep ^bootdir= ${PHYS_SYSROOT}/boot/loader/uEnv.txt || echo "") + bootdir=${bootdir#bootdir=} + if [ "$bootdir" != "" ] && [ -e "${PHYS_SYSROOT}/boot$bootdir" ] ; then + cp -r ${PHYS_SYSROOT}/boot$bootdir/* ${WORKDIR}/rootfs_ota_uboot + fi + printf "123A" > ${WORKDIR}/rootfs_ota_uboot/boot_ab_flag + # The first 0 is the boot count, the second zero is the boot entry default + printf '00WR' > ${WORKDIR}/rootfs_ota_uboot/boot_cnt + if [ "${OSTREE_USE_AB}" != "1" ] ; then + printf '1' > ${WORKDIR}/rootfs_ota_uboot/no_ab + fi + + if [ "${OSTREE_COPY_IMAGE_BOOT_FILES}" = "1" ] ; then + # Copy IMAGE_BOOT_FILES + set -f + bfiles="${IMAGE_BOOT_FILES}" + for f in $bfiles; do + set +f + argFROM=$(echo "$f" |sed -e 's#;.*##') + argTO=$(echo "$f" |sed -e 's#.*;##') + if [ "$argFROM" != "$argTO" ] ; then + if [ ! -e ${WORKDIR}/rootfs_ota_uboot/$argTO ] ; then + d=$(dirname ${WORKDIR}/rootfs_ota_uboot/$argTO) + [ ! -d $d ] && mkdir $d + argFROM_head=`echo $argFROM | cut -b 1` + if [ "$argFROM_head" = "/" ]; then + cp $argFROM ${WORKDIR}/rootfs_ota_uboot/$argTO + else + cp ${DEPLOY_DIR_IMAGE}/$argFROM ${WORKDIR}/rootfs_ota_uboot/$argTO + fi + fi + else + cp ${DEPLOY_DIR_IMAGE}/$f ${WORKDIR}/rootfs_ota_uboot + fi + done + set +f + fi + # Modify the boot.scr + if [ -e ${WORKDIR}/rootfs_ota_uboot/boot.scr ] ; then + tail -c+73 ${WORKDIR}/rootfs_ota_uboot/boot.scr > ${WORKDIR}/rootfs_ota_uboot/boot.scr.raw + if [ -e /bin/perl ] ; then + /bin/perl -p -i -e "s#^( *setenv BRANCH) .*#\$1 ${OSTREE_BRANCHNAME}# if (\$_ !~ /oBRANCH/) " ${WORKDIR}/rootfs_ota_uboot/boot.scr.raw + else + /usr/bin/perl -p -i -e "s#^( *setenv BRANCH) .*#\$1 ${OSTREE_BRANCHNAME}# if (\$_ !~ /oBRANCH/) " ${WORKDIR}/rootfs_ota_uboot/boot.scr.raw + fi + mkimage -A arm -T script -O linux -d ${WORKDIR}/rootfs_ota_uboot/boot.scr.raw ${WORKDIR}/rootfs_ota_uboot/boot.scr + if [ -e $WORKDIR/rootfs_ota_uboot/boot.itb ] ; then + mkimage -A arm -T script -O linux -f auto -C none -d $WORKDIR/rootfs_ota_uboot/boot.scr.raw $WORKDIR/rootfs_ota_uboot/boot.itb + fi + rm -f ${WORKDIR}/rootfs_ota_uboot/boot.scr.raw + fi + fi + + #create an image with the free space equal the rootfs size + wic_deployed_var_path=$(find ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/deploy/ -maxdepth 2 -name "var"|head -1) + rm -rf ${WORKDIR}/rootfs_ota_var + cp ${wic_deployed_var_path} -ar ${WORKDIR}/rootfs_ota_var + + # rootfs data for EFI partition + if [ -d ${PHYS_SYSROOT}/boot/efi ]; then + rm -rf ${WORKDIR}/rootfs_ota_efi + mv ${PHYS_SYSROOT}/boot/efi ${WORKDIR}/rootfs_ota_efi + mkdir -p ${PHYS_SYSROOT}/boot/efi + fi + + # boot partition + # OSTREE needs to create symlinks to locate the real kernel image, and efi partition does not support symlinks + + rm -rf ${WORKDIR}/rootfs_ota_boot + mv ${PHYS_SYSROOT}/boot ${WORKDIR}/rootfs_ota_boot + mkdir -p ${PHYS_SYSROOT}/boot + + # rootfs partition + rm -rf ${WORKDIR}/rootfs_ota + mv ${PHYS_SYSROOT} ${WORKDIR}/rootfs_ota + + if [ "${@oe.types.boolean(d.getVar('IS_FMU_ENABLED'))}" = "True" ]; then + rm -rf ${WORKDIR}/rootfs_ota_apps + cp ${IMAGE_ROOTFS}${APP_DIRECTORY} -ar ${WORKDIR}/rootfs_ota_apps + fi + fi +} + +IMAGE_TYPEDEP:otaimg = "ostree" diff --git a/classes/nativesdk_multilib_header.bbclass b/classes/nativesdk_multilib_header.bbclass new file mode 100644 index 0000000..39c2c14 --- /dev/null +++ b/classes/nativesdk_multilib_header.bbclass @@ -0,0 +1,47 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +inherit siteinfo + +# If applicable on the architecture, this routine will rename the header and +# add a unique identifier to the name for the ABI/bitsize that is being used. +# A wrapper will be generated for the architecture that knows how to call +# all of the ABI variants for that given architecture. +# +oe_multilib_header:prepend:class-nativesdk() { + + case ${HOST_OS} in + *-musl*) + return + ;; + *) + esac + # For MIPS: "n32" is a special case, which needs to be + # distinct from both 64-bit and 32-bit. + case ${TARGET_ARCH} in + mips*) case "${MIPSPKGSFX_ABI}" in + "-n32") + ident=n32 + ;; + *) + ident=${SITEINFO_BITS} + ;; + esac + ;; + *) ident=${SITEINFO_BITS} + esac + for each_header in "$@" ; do + if [ ! -f "${D}/${includedir}/$each_header" ]; then + bberror "oe_multilib_header: Unable to find header $each_header." + continue + fi + stem=$(echo $each_header | sed 's#\.h$##') + # if mips64/n32 set ident to n32 + mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h + + sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header + done +} diff --git a/classes/packagefeed-stability.bbclass b/classes/packagefeed-stability.bbclass new file mode 100644 index 0000000..e86b7d4 --- /dev/null +++ b/classes/packagefeed-stability.bbclass @@ -0,0 +1,292 @@ +# Class to avoid copying packages into the feed if they haven't materially changed +# +# Copyright (C) 2015 Intel Corporation +# Released under the MIT license (see COPYING.MIT for details) +# +# This class effectively intercepts packages as they are written out by +# do_package_write_*, causing them to be written into a different +# directory where we can compare them to whatever older packages might +# be in the "real" package feed directory, and avoid copying the new +# package to the feed if it has not materially changed. The idea is to +# avoid unnecessary churn in the packages when dependencies trigger task +# reexecution (and thus repackaging). Enabling the class is simple: +# +# INHERIT += "packagefeed-stability" +# +# Caveats: +# 1) Latest PR values in the build system may not match those in packages +# seen on the target (naturally) +# 2) If you rebuild from sstate without the existing package feed present, +# you will lose the "state" of the package feed i.e. the preserved old +# package versions. Not the end of the world, but would negate the +# entire purpose of this class. +# +# Note that running -c cleanall on a recipe will purposely delete the old +# package files so they will definitely be copied the next time. + +# Skip comparing if PE, PV and PR are the same when set to 1 +PACKAGE_COMPARE_FAST ?= "0" + +python() { + if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d): + return + # Package backend agnostic intercept + # This assumes that the package_write task is called package_write_ + # and that the directory in which packages should be written is + # pointed to by the variable DEPLOY_DIR_ + for pkgclass in (d.getVar('PACKAGE_CLASSES') or '').split(): + if pkgclass.startswith('package_'): + pkgtype = pkgclass.split('_', 1)[1] + pkgwritefunc = 'do_package_write_%s' % pkgtype + sstate_outputdirs = d.getVarFlag(pkgwritefunc, 'sstate-outputdirs', False) + deploydirvar = 'DEPLOY_DIR_%s' % pkgtype.upper() + deploydirvarref = '${' + deploydirvar + '}' + pkgcomparefunc = 'do_package_compare_%s' % pkgtype + + if bb.data.inherits_class('image', d): + d.appendVarFlag('do_rootfs', 'recrdeptask', ' ' + pkgcomparefunc) + + if bb.data.inherits_class('populate_sdk_base', d): + d.appendVarFlag('do_populate_sdk', 'recrdeptask', ' ' + pkgcomparefunc) + + if bb.data.inherits_class('populate_sdk_ext', d): + d.appendVarFlag('do_populate_sdk_ext', 'recrdeptask', ' ' + pkgcomparefunc) + + if bb.data.inherits_class('nopackages', d) or d.getVarFlag(pkgwritefunc, 'noexec') or \ + not d.getVarFlag(pkgwritefunc, 'task'): + # Packaging is disabled for this recipe, we shouldn't do anything + continue + + d.appendVarFlag('do_build', 'recrdeptask', ' ' + pkgcomparefunc) + + if deploydirvarref in sstate_outputdirs: + deplor_dir_pkgtype = d.expand(deploydirvarref + '-prediff') + # Set intermediate output directory + d.setVarFlag(pkgwritefunc, 'sstate-outputdirs', sstate_outputdirs.replace(deploydirvarref, deplor_dir_pkgtype)) + # Update SSTATE_ALLOW_OVERLAP_FILES to avoid shared location conflicted error + d.appendVar('SSTATE_ALLOW_OVERLAP_FILES', ' %s' % deplor_dir_pkgtype) + + d.setVar(pkgcomparefunc, d.getVar('do_package_compare', False)) + d.setVarFlags(pkgcomparefunc, d.getVarFlags('do_package_compare', False)) + d.appendVarFlag(pkgcomparefunc, 'depends', ' build-compare-native:do_populate_sysroot') + # Target recipe uses gcc-cross' objdump, but nativesdk uses host's objdump + mlprefix = d.getVar('MLPREFIX') + if (not bb.utils.to_boolean(d.getVar('INHIBIT_DEFAULT_DEPS'))) and \ + (not bb.data.inherits_class('nativesdk', d)): + target_arch = d.getVar('TARGET_ARCH') + d.appendVarFlag(pkgcomparefunc, 'depends', ' %sgcc-cross-%s:do_populate_sysroot' % (mlprefix, target_arch)) + bb.build.addtask(pkgcomparefunc, 'do_build', 'do_packagedata ' + pkgwritefunc, d) +} + +# This isn't the real task function - it's a template that we use in the +# anonymous python code above +fakeroot python do_package_compare () { + currenttask = d.getVar('BB_CURRENTTASK') + pkgtype = currenttask.rsplit('_', 1)[1] + package_compare_impl(pkgtype, d) +} + +def package_compare_impl(pkgtype, d): + import errno + import fnmatch + import glob + import subprocess + import oe.sstatesig + + pn = d.getVar('PN') + deploydir = d.getVar('DEPLOY_DIR_%s' % pkgtype.upper()) + prepath = deploydir + '-prediff/' + + pkgwritetask = 'package_write_%s' % pkgtype + manifest, _ = oe.sstatesig.sstate_get_manifest_filename(pkgwritetask, d) + + # Skip comparing if PE, PV and PR are the same + skip = True + if bb.utils.to_boolean(d.getVar('PACKAGE_COMPARE_FAST')): + with open(manifest, 'r') as f: + for line in f.readlines(): + bn = os.path.basename(line.strip()) + line_new = os.path.join(deploydir, bn) + if not os.path.exists(line_new): + skip = False + break + if skip and bb.utils.to_boolean(d.getVar('PACKAGE_COMPARE_FAST')): + bb.note("Skipping package comparing since all packages' PE, PV and PR are the same") + return + + # Find out PKGR values are + pkgdatadir = d.getVar('PKGDATA_DIR') + packages = [] + try: + with open(os.path.join(pkgdatadir, pn), 'r') as f: + for line in f: + if line.startswith('PACKAGES:'): + packages = line.split(':', 1)[1].split() + break + except IOError as e: + if e.errno == errno.ENOENT: + pass + + if not packages: + bb.debug(2, '%s: no packages, nothing to do' % pn) + return + + pkgrvalues = {} + rpkgnames = {} + rdepends = {} + pkgvvalues = {} + for pkg in packages: + with open(os.path.join(pkgdatadir, 'runtime', pkg), 'r') as f: + for line in f: + if line.startswith('PKGR:'): + pkgrvalues[pkg] = line.split(':', 1)[1].strip() + if line.startswith('PKGV:'): + pkgvvalues[pkg] = line.split(':', 1)[1].strip() + elif line.startswith('PKG:%s:' % pkg): + rpkgnames[pkg] = line.split(':')[2].strip() + elif line.startswith('RDEPENDS:%s:' % pkg): + rdepends[pkg] = line.split(':', 1)[1].strip() + + # Prepare a list of the runtime package names for packages that were + # actually produced + rpkglist = [] + for pkg, rpkg in rpkgnames.items(): + if os.path.exists(os.path.join(pkgdatadir, 'runtime', pkg + '.packaged')): + rpkglist.append((rpkg, pkg)) + rpkglist.sort(key=lambda x: len(x[0]), reverse=True) + + pvu = d.getVar('PV', False) + if '$' + '{SRCPV}' in pvu: + pvprefix = pvu.split('$' + '{SRCPV}', 1)[0] + # Expand Var such as LINUX_VERSION + d.setVar('PACKAGE_COMPARE_PVPREFIX', pvprefix) + pvprefix = d.getVar('PACKAGE_COMPARE_PVPREFIX') + else: + pvprefix = None + + files = [] + docopy = False + mlprefix = d.getVar('MLPREFIX') + pcmanifest = os.path.join(prepath, d.expand('pkg-compare-manifest-${MULTIMACH_TARGET_SYS}-${PN}')) + pcmanifest_oldlines = [] + if os.path.exists(pcmanifest): + with open(pcmanifest, 'r') as f: + pcmanifest_oldlines = f.readlines() + # Copy recipe's all packages if one of the packages are different to make + # they have the same PR. + with open(manifest, 'r') as f: + for line in f: + if line.startswith(prepath): + srcpath = line.rstrip() + if os.path.isfile(srcpath): + destpath = os.path.join(deploydir, os.path.relpath(srcpath, prepath)) + + # This is crude but should work assuming the output + # package file name starts with the package name + # and rpkglist is sorted by length (descending) + pkgbasename = os.path.basename(destpath) + pkgname = None + for rpkg, pkg in rpkglist: + if mlprefix and pkgtype == 'rpm' and rpkg.startswith(mlprefix): + rpkg = rpkg[len(mlprefix):] + if pkgbasename.startswith(rpkg): + pkgr = pkgrvalues[pkg] + destpathspec = destpath.replace(pkgr, '*') + if pvprefix: + pkgv = pkgvvalues[pkg] + if pkgv.startswith(pvprefix): + destpathspec = destpathspec.replace(pkgv, pvprefix + "*") + pkgname = pkg + break + else: + bb.warn('Unable to map %s back to package' % pkgbasename) + destpathspec = destpath + + oldfile = None + oldfiles = sorted(glob.glob(destpathspec), key=os.path.getmtime) + if oldfiles: + oldfile = oldfiles[-1] + # Save old packages for removing in case this is a + # fresh build with old packges + for oldline in oldfiles: + oldline += '\n' + if not oldline in pcmanifest_oldlines: + with open(pcmanifest, 'a') as f: + f.write(oldline) + if not docopy: + if oldfile: + result = subprocess.call(['env', 'PSEUDO_DISABLED=1', 'pkg-diff.sh', oldfile, srcpath]) + if result != 0: + docopy = True + bb.note("%s and %s are different, will copy packages" % (oldfile, srcpath)) + else: + docopy = True + bb.note("No old packages found for %s, will copy packages" % pkgname) + + files.append((pkgname, pkgbasename, srcpath, destpath)) + + # Remove all the old files and copy again if docopy + if docopy: + bb.note('Copying packages for recipe %s' % pn) + try: + with open(pcmanifest, 'r') as f: + for line in f: + fn = line.rstrip() + if fn and os.path.exists(fn): + os.remove(fn) + bb.note('Removed old package %s' % fn) + except IOError as e: + if e.errno == errno.ENOENT: + pass + + # Create new manifest + with open(pcmanifest, 'w') as f: + for pkgname, pkgbasename, srcpath, destpath in files: + destdir = os.path.dirname(destpath) + bb.utils.mkdirhier(destdir) + # Remove allarch rpm pkg if it is already existed (for + # multilib), they're identical in theory, but sstate.bbclass + # copies it again, so keep align with that. + if os.path.exists(destpath) and pkgtype == 'rpm' \ + and d.getVar('PACKAGE_ARCH') == 'all': + os.unlink(destpath) + if (os.stat(srcpath).st_dev == os.stat(destdir).st_dev): + # Remove destpath in case it exists + if os.path.exists(destpath): + bb.note('Removing %s' % destpath) + os.unlink(destpath) + # Use a hard link to save space + os.link(srcpath, destpath) + else: + shutil.copyfile(srcpath, destpath) + f.write('%s\n' % destpath) + else: + # Remove pcmanifest if no package is copied + if os.path.exists(pcmanifest): + os.unlink(pcmanifest) + bb.note('Not copying packages for recipe %s' % pn) + +do_cleansstate[postfuncs] += "pfs_cleanpkgs" +python pfs_cleanpkgs () { + import errno + for pkgclass in (d.getVar('PACKAGE_CLASSES') or '').split(): + if pkgclass.startswith('package_'): + pkgtype = pkgclass.split('_', 1)[1] + deploydir = d.getVar('DEPLOY_DIR_%s' % pkgtype.upper()) + prepath = deploydir + '-prediff' + pcmanifest = os.path.join(prepath, d.expand('pkg-compare-manifest-${MULTIMACH_TARGET_SYS}-${PN}')) + try: + with open(pcmanifest, 'r') as f: + for line in f: + fn = line.rstrip() + if fn: + try: + os.remove(fn) + except OSError as e: + if e.errno == errno.ENOENT: + pass + os.remove(pcmanifest) + except IOError as e: + if e.errno == errno.ENOENT: + pass +} diff --git a/classes/rcpl-filter.bbclass b/classes/rcpl-filter.bbclass new file mode 100644 index 0000000..12aece9 --- /dev/null +++ b/classes/rcpl-filter.bbclass @@ -0,0 +1,88 @@ +# +# Copyright (C) 2024 Wind River Systems, Inc. +# +# Utilities for processing items depending on the Rolling Cumulative Patch Layer (RCPL) +# version being used. +# +# python function ifRcplInRange(d, first, last, tval, fval) returns tval +# if the RCPL is in a particular range, and fval if it is not. +# +# `first` must be specified. When `last` is provided, this function returns +# `tval` if the RCPL number is in range [first, last] (inclusive for both lower bound +# and upper bound) and `fval` if the RCPL number is outside the range. +# +# When `last` is not provided, this function returns `tval` if the RCPL number +# is >= `first` and `fval` if the RCPL number is < `first`. +# +# An anonymous python function processes values for SRC_URI_APPEND_RCPL[] flags and +# appends them to SRC_URI if the RCPL is in range. +# +# +# Example usages: +# +# inherit rcpl-filter +# +# SRC_URI = "... \ +# ${@ifRcplInRange(d,tval='file://CVE-2022-37434.patch',first=15)} \ +# ${@ifRcplInRange(d,13,13,'file://CVE-2023-45853.patch')} \ +# " +# +# Include the CVE-2022-37434 patch starting at RCPL0015 (including RCPL0015). +# Include the CVE-2023-45853 patch only for RCPL0013. Note that the following +# two lines are equivalent. +# +# ${@ifRcplInRange(d,15,tval='file://CVE-2022-37434.patch')} +# ${@ifRcplInRange(d,1,14,fval='file://CVE-2022-37434.patch')} +# +# Another way to do this is by using variable flags. +# +# RCPL 15 and above +# SRC_URI_APPEND_RCPL[15-] = "file://CVE-2022-37434.patch" +# only RCPL 13 +# SRC_URI_APPEND_RCPL[13] = "file://CVE-2023-45853.patch" +# RCPLs 13-18 +# SRC_URI_APPEND_RCPL[13-18] = "file://CVE-2023-45853.patch" +# +# The inline function is more general, and can be used to set values +# anywhere based on an RCPL range. +# + +# ifRcplInRange(d,first,last,tval,fval) +# first the lowest number RCPL in the range (inclusive) +# last the highest number RCPL in the range (inclusive) +# tval value returned when the RCPL is in the range +# fval value returned when the RCPL is not in the range +# +def ifRcplInRange(d, first, last=None, tval="", fval=""): + rcpl = int(d.getVar("WRLINUX_UPDATE_VERSION")) + return tval if rcpl >= first and (last is None or rcpl <= last) else fval + +python() { + # get a dictionary of flags and quit if there aren't any + # + flags = d.getVarFlags("SRC_URI_APPEND_RCPL") + if not flags: + return + + current_rcpl = int(d.getVar("WRLINUX_UPDATE_VERSION")) + + # process the dictionary entries + # the keys are of the form "m" or "m-n" + # + for i in flags.keys(): + range = i.split("-") + first = int(range[0]) + # assume "m-n" + try: + last = int(range[1]) + # "m" meaning "m only" + except IndexError: + last = first + # "m-" meaning "m and above" + except ValueError: + last = current_rcpl + + if current_rcpl >= first and current_rcpl <= last: + d.appendVar('SRC_URI', " "+flags[i]) + +} diff --git a/classes/rtopts.bbclass b/classes/rtopts.bbclass new file mode 100644 index 0000000..71f9af9 --- /dev/null +++ b/classes/rtopts.bbclass @@ -0,0 +1,21 @@ +#inherit wrlinux-image +rtopts_update_sudoers () { + sed -i 's/# %sudo/%sudo/' ${IMAGE_ROOTFS}/etc/sudoers +} + +rtopts_set_kernel_opts () { + mkdir -p ${IMAGE_ROOTFS}/etc/sysctl.d + echo 'kernel.sched_rt_runtime_us = -1' > ${IMAGE_ROOTFS}/etc/sysctl.d/kernel.sched_rt_runtime_us.conf +# echo '0' > ${IMAGE_ROOTFS}/sys/devices/system/machinecheck/machinecheck0/check_interval + echo 'kernel.timer_migration = 0' > ${IMAGE_ROOTFS}/etc/sysctl.d/kernel.timer_migration.conf + #echo 'processor.max_cstate = 1' > ${IMAGE_ROOTFS}/etc/sysctl.d/processor.max_cstate.conf + #echo 'intel.max_cstate = 1' > ${IMAGE_ROOTFS}/etc/sysctl.d/intel.max_cstate.conf + echo 'isolcpus = 2,3' > ${IMAGE_ROOTFS}/etc/sysctl.d/isolcpus.conf +} + +#not RT related directly, but required for linuxcnc build for RT testing +#rtopts_symlink_lib64 () { +# ln -s /lib ${IMAGE_ROOTFS}/lib64 +#} + +EXPORT_FUNCTIONS update_sudoers set_kernel_opts #symlink_lib64 diff --git a/classes/sls-purl.bbclass b/classes/sls-purl.bbclass new file mode 100644 index 0000000..991786e --- /dev/null +++ b/classes/sls-purl.bbclass @@ -0,0 +1,41 @@ +# +# Copyright (C) 2025 Wind River Systems, Inc. +# +# SPDX-License-Identifier: MIT +# + +python do_create_spdx:prepend() { + import oe.packagedata + + purl_qualifiers = "distro=%s-%s&arch=%s" % ("yocto" if d.getVar("DISTRO") == "poky" else d.getVar("DISTRO"), \ + d.getVar("DISTRO_VERSION"), \ + d.getVar("MACHINE"), \ + ) + purl_qualifiers_extend = d.getVar("SPDX_PURL_QUALIFIERS_EXTEND") + if purl_qualifiers_extend: + purl_qualifiers += "&%s" % purl_qualifiers_extend + + purl_type = d.getVar("IMAGE_PKGTYPE") + if purl_type == "ipk": + purl_type = "yocto" + purl_qualifiers = "file_extension=ipk&" + purl_qualifiers + + purl_subpath = d.getVar("SPDX_PURL_SUBPATH") + purl_subpath = "#" + purl_subpath if purl_subpath else "" + + bb.build.exec_func("read_subpackage_metadata", d) + + for package in d.getVar("PACKAGES", True).split(): + if not oe.packagedata.packaged(package, d): + continue + pkg_name = d.getVar("PKG:%s" % package) or package + purl = "pkg:%s/%s/%s@%s?%s%s" % (purl_type, \ + d.getVar("DISTRO"), \ + pkg_name, \ + d.getVar("EXTENDPKGV"), \ + purl_qualifiers, \ + purl_subpath \ + ) + + d.setVar("SPDX_PACKAGE_URL:%s" % package, purl) +} diff --git a/classes/wrlinux-image.bbclass b/classes/wrlinux-image.bbclass new file mode 100644 index 0000000..6fc0e4f --- /dev/null +++ b/classes/wrlinux-image.bbclass @@ -0,0 +1,64 @@ +# +# Copyright (C) 2012-2023 Wind River Systems, Inc. +# + +inherit core-image + +# +# Package groups must be defined here. Note convention: each group +# "xxx" has a single package dependency on a "packagegroup-xxx" package +# defined in ../packagegroups. +# +FEATURE_PACKAGES_wr-core-util = "packagegroup-wr-core-util" +FEATURE_PACKAGES_wr-core-sys-util = "packagegroup-wr-core-sys-util" +FEATURE_PACKAGES_wr-core-net = "packagegroup-wr-core-net" +FEATURE_PACKAGES_wr-core-interactive = "packagegroup-wr-core-interactive" +FEATURE_PACKAGES_wr-core-libs-extended = "packagegroup-wr-core-libs-extended" +FEATURE_PACKAGES_wr-core-db = "packagegroup-wr-core-db" +FEATURE_PACKAGES_wr-core-perl = "packagegroup-wr-core-perl" +FEATURE_PACKAGES_wr-core-python = "packagegroup-wr-core-python" +FEATURE_PACKAGES_wr-core-mail = "packagegroup-wr-core-mail" +FEATURE_PACKAGES_ssh-sftp-servers ??= "" +FEATURE_PACKAGES_wr-bsps = "packagegroup-wr-bsps" + +# ensure we have password and group files before we do_rootfs +check_for_passwd_group() { + if [ ! -f $D/${sysconfdir}/passwd -o ! -f $D/${sysconfdir}/group ]; then + bberror "Nothing provides ${sysconfdir}/passwd and/or ${sysconfdir}/group" + exit 1 + fi +} + +ROOTFS_POSTPROCESS_COMMAND:prepend = "check_for_passwd_group ; " + +WRPRELIMPKGDATADIR ?= "${TMPDIR}/pkgdata-prelim" +WRPKGDATADIR ?= "${TMPDIR}/pkgdata" + +python do_image_info() { + prelim_dirs = d.getVar('WRPRELIMPKGDATADIR', True) or "" + built_dirs = d.getVar('WRPKGDATADIR', True) or "" + + package_install = d.getVar('PACKAGE_INSTALL', True) or "" + package_install_attemptonly = d.getVar('PACKAGE_INSTALL_ATTEMPTONLY', True) or "" + + globs = d.getVar('IMAGE_INSTALL_COMPLEMENTARY', True) or "" + for translation in d.getVar('IMAGE_LINGUAS', True).split(): + translated = translation.split('-')[0] + globs += ' *-locale-%s' % translated + if translated != translation: + globs += ' *-locale-%s' % translation + + bb.plain('PKGDATA dirs: %s %s' % (prelim_dirs, built_dirs)) + bb.plain('INSTALL: %s' % package_install) + bb.plain('INSTALL ATTEMPT: %s' % package_install_attemptonly) + bb.plain('GLOBS: %s' % globs) +} + +addtask image_info +do_image_info[nostamp] = "1" + +python () { + if oe.types.boolean(d.getVar('FORCE_PASSWD_EXPIRE')): + for user in d.getVar('FORCE_EXPIRED_USERS').split(): + d.appendVar('EXTRA_USERS_PARAMS', f' passwd-expire {user};') +} diff --git a/classes/wrlinux-installer-banner.bbclass b/classes/wrlinux-installer-banner.bbclass new file mode 100644 index 0000000..06b137a --- /dev/null +++ b/classes/wrlinux-installer-banner.bbclass @@ -0,0 +1,27 @@ +target_build_msg = "The meta-anaconda layer has been included, and the \ +current build is a regular target build. After it is finished, create \ +a new installer build with DISTRO = 'wrlinux-installer', \ +INSTALLER_TARGET_BUILD = '|' \ +and INSTALLER_TARGET_IMAGE = '' in local.conf" + +target_build_warnmsg = "WARNING: The meta-anaconda layer has been included, \ +and the current build is a regular target build. It requires to enable \ +feature/installer-support template. Add option \ +--templates=feature/installer-support to setup.sh, or set WRTEMPLATE += \ +'feature/installer-support' in local.conf" + +installer_build_msg = "The meta-anaconda layer has been included, and the \ +current build is a installer build, if set INSTALLER_TARGET_BUILD = \ +'', and INSTALLER_TARGET_IMAGE = '' \ +the installer is to do RPMs install; if set INSTALLER_TARGET_BUILD = \ +'', the installer is to do image copy install." + +def get_installer_banner(d): + if d.getVar('DISTRO',True) == 'wrlinux-installer': + return d.getVar('installer_build_msg') + elif "feature/installer-support" in d.getVar("WRTEMPLATE").split(): + return d.getVar('target_build_msg') + else: + return d.getVar('target_build_warnmsg') + +CONFIG_BANNER[installer] = "${@get_installer_banner(d)}" diff --git a/classes/wrlinux-metadata_scm.bbclass b/classes/wrlinux-metadata_scm.bbclass new file mode 100644 index 0000000..a634ff9 --- /dev/null +++ b/classes/wrlinux-metadata_scm.bbclass @@ -0,0 +1,30 @@ +# +# Copyright (C) 2018 Wind River Systems, Inc. +# + +def base_get_metadata_git_branch(path, d): + """ + Try to return where m/master points to when HEAD isn't on any branch. + """ + import subprocess + + try: + cmd = 'git rev-parse --abbrev-ref HEAD'.split() + branch = subprocess.check_output(cmd, cwd=path).decode('utf-8').strip() + if branch == 'HEAD': + bb.debug(1, "Trying to get branch name from m/master...") + # Check whether HEAD == m/master + cmd1 = 'git rev-parse HEAD'.split() + cmd2 = 'git rev-parse m/master^0'.split() + if subprocess.check_output(cmd1, cwd=path) == subprocess.check_output(cmd2, cwd=path): + cmd = 'git rev-parse --abbrev-ref m/master'.split() + branch = subprocess.check_output(cmd, cwd=path).decode('utf-8') + if branch == 'HEAD': + bb.debug(1, "Trying to get tag name...") + cmd = 'git describe HEAD'.split() + branch = subprocess.check_output(cmd, cwd=path).decode('utf-8') + + except subprocess.CalledProcessError: + branch = '' + + return branch.strip().replace('base/', '') diff --git a/conf/distro/include/all-distro-settings.inc b/conf/distro/include/all-distro-settings.inc new file mode 100644 index 0000000..a35f6cd --- /dev/null +++ b/conf/distro/include/all-distro-settings.inc @@ -0,0 +1,68 @@ +# Add profiling optimization type +PROFILING_OPTIMIZATION = "${FULL_OPTIMIZATION} -fno-omit-frame-pointer -fvisibility=default" +SELECTED_OPTIMIZATION[vardeps] += "PROFILING_OPTIMIZATION" + +# Some packages have problems with PROFILING_OPTIMIZATION +# +# fix linking/relocating error +PROFILING_OPTIMIZATION:remove:pn-llvm:powerpc = "-fno-omit-frame-pointer" +# fix error: r7 cannot be used in asm here +PROFILING_OPTIMIZATION:remove:pn-pulseaudio:arm = "-fno-omit-frame-pointer" +# gcc-sanitizers makes extensive use of hidden visibility and frame pointer omission. +# Trying to override that can cause build failures. +PROFILING_OPTIMIZATION:pn-gcc-sanitizers = "${FULL_OPTIMIZATION}" +# Fix traps: python[550] trap invalid opcode ip:b7f80f00 sp:bfb09a10 error:0 in ld-2.30.so[b7f7b000+1c000] +PROFILING_OPTIMIZATION:remove:pn-glibc:x86 = "-fno-omit-frame-pointer" +# Fix | stress-enosys.c: In function 'exercise_syscall': +# | stress-enosys.c:230:1: error: bp cannot be used in 'asm' here +# | 230 | } +PROFILING_OPTIMIZATION:remove:pn-stress-ng:x86-64 = "-fno-omit-frame-pointer" +PROFILING_OPTIMIZATION:remove:pn-stress-ng:x86 = "-fno-omit-frame-pointer" + +# Set for SPDX 3 +SPDX_AUTHORS_openembedded_comment ??= "${DISTRO_NAME} ${DISTRO_VERSION}" +SPDX_PACKAGE_VERSION ?= "${EXTENDPKGV}" + +# PACKAGECONFIG settings for WRLinux +include conf/distro/include/wrlinux-packageconfigs.inc + +# MIRRORS are used only if we don't have a local copy, and the stated upstream +# is no longer available. +MIRRORS =+ "\ +git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +gitsm://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +hg://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +p4://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +svn://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +ftp://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +http://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \ +https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n" + +# dnsmasq and named (provided by bind) use the same default port 53: +# | dnsmasq: failed to create listening socket for port 53: Address already in use +# So disable the service by default, and if the user want to use both of them, +# it need to be set to a different port in dnsmasq.conf before starting the service. +INITSCRIPT_PARAMS:pn-dnsmasq = "stop 20 0 1 6 ." +SYSTEMD_AUTO_ENABLE:pn-dnsmasq = "disable" + +# Exclude download layers from eSDK. +SDK_LAYERS_EXCLUDE_PATTERN ?= ".*-dl$ .*-dl-[0-9.]+$" + +# do_kernel_version_sanity_check in oe-core checks if the defined version in +# metadata(LINUX_VERSION) matches the version written in the source code. For +# release branches we have Jenkins to take care of the version updating. For +# CI/CD branch we aim to use the latest source and directly use Yocto kernel +# source code which frequently gets updated. But oe-core does not tightly follow +# the latest version. We don't necessarily frequently manually bump up the +# version. +KERNEL_VERSION_SANITY_SKIP = "1" + +require conf/distro/include/plcos_security_flags.inc + +# Enable predictable network interface names. This was intentionally +# not supported in 10.22.33.x and earlier releases. +# +PNI_NAMES_FEATURES ??= "pni-names" +DISTRO_FEATURES:append = " ${PNI_NAMES_FEATURES}" + +EXTRA_IMAGEDEPENDS:remove:qemuriscv64:pn-${INITRAMFS_IMAGE} = "opensbi" diff --git a/conf/distro/include/lib32-64k-pagesize.inc b/conf/distro/include/lib32-64k-pagesize.inc new file mode 100644 index 0000000..851a3a6 --- /dev/null +++ b/conf/distro/include/lib32-64k-pagesize.inc @@ -0,0 +1,4 @@ +MAX_PAGE_SIZE_FLAGS ?= " -Wl,-z,max-page-size=0x10000" +MAX_PAGE_SIZE_FLAGS:pn-lib32-systemd-boot = "" +CFLAGS:append:virtclass-multilib-lib32 = "${MAX_PAGE_SIZE_FLAGS}" +LDFLAGS:append:virtclass-multilib-lib32 = "${MAX_PAGE_SIZE_FLAGS}" diff --git a/conf/distro/include/ostree-settings.inc b/conf/distro/include/ostree-settings.inc new file mode 100644 index 0000000..b847f8f --- /dev/null +++ b/conf/distro/include/ostree-settings.inc @@ -0,0 +1,139 @@ +OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" +OSTREE_REPO ??= "${DEPLOY_DIR_IMAGE}/ostree_repo" + +OSTREE_BRANCHNAME ??= "${IMAGE_BASENAME}" + +# This is set to the name of the loader to include into a disk image +# Not all BSPs will need this, so it can be unset by the BSP +OSTREE_BOOTLOADER_INCLUDE ??= "${OSTREE_BOOTLOADER}" +OSTREE_KERNEL_ARGS ??= "devmd=0" +OSTREE_INST_ARGS ??= "devmd=0" + +# The OSTREE_SKIP_BOOT_DIFF can be one of the following: +# 0 = Perform a full fsck and boot diff +# 1 = Skip the FSCK check +# 2 = Skip the FSCK and the boot +OSTREE_SKIP_BOOT_DIFF ??= "2" + +# Generate rootfs.ostree.tar.bz2 files which could be used to build a new repo +# OSTREE_CREATE_TARBALL = "1" + +# Configuration of image upgrade and install variables + +OSTREE_USE_AB ??= "0" +OSTREE_REMOTE_NAME ??= "${OSTREE_OSNAME}" +OSTREE_REMOTE_URL ??= "" + +# WIC wks configuration variables follow +# The selection of the wks file is: +# Bootloader - ab/noab + +OSTREE_ARCH_WKS:x86 ??= "ostree-grub" +OSTREE_ARCH_WKS:x86-64 ??= "ostree-grub" + +OSTREE_ARCH_WKS:arm ??= "ostree-uboot-sd" +OSTREE_ARCH_WKS:armv7 ??= "ostree-uboot-sd" +OSTREE_ARCH_WKS:armv7ve ??= "ostree-uboot-sd" +OSTREE_ARCH_WKS:aarch64 ??= "ostree-uboot-sd" + +OSTREE_AB_WKS ??= "${@oe.utils.conditional('OSTREE_USE_AB', '1', '-ab', '-noab', d)}" + +OSTREE_USE_FIT ??= "0" + +# Set a fixed size in the wks file for the various partitions from local.conf e.g. +#OSTREE_WKS_EFI_SIZE = "--size=32M --overhead-factor 1" +#OSTREE_WKS_BOOT_SIZE = "--size=300M --overhead-factor 1" +#OSTREE_WKS_ROOT_SIZE = "--size=1024M --overhead-factor 1" +#OSTREE_WKS_FLUX_SIZE = "--size=1024M --overhead-factor 1" + +OSTREE_WKS_EFI_SIZE ??= "--size=32M" +OSTREE_WKS_BOOT_SIZE ??= "" +OSTREE_WKS_ROOT_SIZE ??= "" +OSTREE_WKS_FLUX_SIZE ??= "" + +# Parition type for /var +OSTREE_FLUX_PART ??= "${@bb.utils.contains('DISTRO_FEATURES', 'luks', 'luksfluxdata', 'fluxdata',d)}" + +# Name of the boot loader to include in the file system +OSTREE_BOOTLOADER:x86 ??= 'grub' +OSTREE_BOOTLOADER:x86-64 ??= 'grub' +OSTREE_BOOTLOADER:arm ??= 'u-boot' +OSTREE_BOOTLOADER:armv7 ??= 'u-boot' +OSTREE_BOOTLOADER:armv7ve ??= 'u-boot' +OSTREE_BOOTLOADER:aarch64 ??= 'u-boot' + +# Define any special partitions required where loaders, firmware etc +# live It is intended that these are defined by the BSP as needed +OSTREE_SD_UBOOT_WIC1 ??= "part / --source rawcopy --sourceparams="file=${UBOOT_BINARY}" --ondisk mmcblk --no-table --align 1 --size 1" +OSTREE_SD_UBOOT_WIC2 ??= "" +OSTREE_SD_UBOOT_WIC3 ??= "" +OSTREE_SD_UBOOT_WIC4 ??= "" + +# The OSTREE_CONSOLE variable will control what kernel command line +# parameters are passed for the console these should be formatted for +# the boot loader specific to the BSP and the OSTREE_CONSOLE_AUX +# should end with a SPACE +OSTREE_CONSOLE_PRI ??= "console=tty1" +OSTREE_CONSOLE_PRI:arm ??= "console=\${console},\${baudrate}" +OSTREE_CONSOLE_PRI:armv7 ??= "console=\${console},\${baudrate}" +OSTREE_CONSOLE_PRI:armv7ve ??= "console=\${console},\${baudrate}" +OSTREE_CONSOLE_PRI:aarch64 ??= "console=\${console},\${baudrate}" + +OSTREE_CONSOLE_AUX ??= "console=ttyS0,115200 " +OSTREE_CONSOLE_AUX:x86 ??= "console=ttyS0,115200 " +OSTREE_CONSOLE_AUX:x86-64 ??= "console=ttyS0,115200 " +OSTREE_CONSOLE_AUX:arm ??= "console=tty0 " +OSTREE_CONSOLE_AUX:armv7 ??= "console=tty0 " +OSTREE_CONSOLE_AUX:armv7ve ??= "console=tty0 " +OSTREE_CONSOLE_AUX:aarch64 ??= "console=tty0 " + +OSTREE_CONSOLE ??= "${OSTREE_CONSOLE_AUX}${OSTREE_CONSOLE_PRI}" + +# This is set to the name of the loader to include into a disk image +# Not all BSPs will need this, so it can be unset by the BSP +OSTREE_SD_BOOT_ALIGN ??= "4" + +# Copy the IMAGE_BOOT_FILES when generating the ostree boot partition +OSTREE_COPY_IMAGE_BOOT_FILES ??= "0" + +# Use this WKS file with wic (WKS_FILE = "${OSTREE_WKS_FILE}" should be set in the feature +# template or local.conf +OSTREE_WKS_FILE ??= "${OSTREE_ARCH_WKS}${OSTREE_AB_WKS}.wks.in" + +# Below are additional variables that can be set in local.conf which are the +# defaults for the network installer + +# Boot Loader Magic block offset (where the first partition should start in sectors) +# NOTE: The FSZ, BSZ and RSZ are numeric in MB only e.g. OSTREE_FDISK_FSZ = "64" +OSTREE_FDISK_BLM ??= "2506" +# Size of the Fat / EFI partition +OSTREE_FDISK_FSZ ??= "32" +# Size of the Boot partition +OSTREE_FDISK_BSZ ??= "200" +# Size of the Root partition +OSTREE_FDISK_RSZ ??= "1400" +# Size of the /var partition 0 for fill disk +OSTREE_FDISK_VSZ ??= "0" + +# Allow the var directory to be erased via the initramfs boot, when +# using "ostree_upgrade.sh -e". The default is 1, but for very secure +# targets this could be a dangerous operation so it is configurable. +# OSTREE_ALLOW_RM_VAR = "0" + +# What uboot command should be used to start the kernel in the boot.scr file +# OSTREE_UBOOT_CMD ??= "bootz" + +# Use file system links for the ostree boot mounts (more secure and the default) +# OSTREE_BOOTSCR ??= "fs_links" +# Or read a uEnv.txt file from the disk which allows kernel args +# to be controlled via ostree (less secure) +# OSTREE_BOOTSCR ??= "env_import" + +# Allow a BSP to specify extra cmds in the boot.scr if needed +OSTREE_BOOTSCR_PRECMD ??= "" + +# Grub settings for ostree +OSTREE_GRUB_USER ??= "root" + +OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" +RAMDISK_EXT ?= ".${INITRAMFS_FSTYPES}" diff --git a/conf/distro/include/plcos-bsp-qemuarm64.inc b/conf/distro/include/plcos-bsp-qemuarm64.inc new file mode 100644 index 0000000..dce29b3 --- /dev/null +++ b/conf/distro/include/plcos-bsp-qemuarm64.inc @@ -0,0 +1,2 @@ +MULTILIBS ?= "multilib:lib32" +DEFAULTTUNE:virtclass-multilib-lib32 ?= "armv7vethf" diff --git a/conf/distro/include/plcos-bsp-qemux86-64.inc b/conf/distro/include/plcos-bsp-qemux86-64.inc new file mode 100644 index 0000000..498ece4 --- /dev/null +++ b/conf/distro/include/plcos-bsp-qemux86-64.inc @@ -0,0 +1,3 @@ +MULTILIBS ?= "multilib:lib32" +DEFAULTTUNE:virtclass-multilib-lib32 ?= "core2-32" + diff --git a/conf/distro/include/plcos-distro-settings.conf b/conf/distro/include/plcos-distro-settings.conf new file mode 100644 index 0000000..990acde --- /dev/null +++ b/conf/distro/include/plcos-distro-settings.conf @@ -0,0 +1 @@ +# The recipes which are needed adjust during the build diff --git a/conf/distro/include/plcos-lsb-distro-adjust.inc_ b/conf/distro/include/plcos-lsb-distro-adjust.inc_ new file mode 100644 index 0000000..ae4a54a --- /dev/null +++ b/conf/distro/include/plcos-lsb-distro-adjust.inc_ @@ -0,0 +1,20 @@ +# copied from meta-mentor/conf/distro/include/sstate.inc +def lsb_distro_adjust(distro_id, ver): + """This hook ensures that RHEL server, RHEL client, and CentOS all return + 'RedHat' for distro, and '5' for the version, as we know minor + versions for these distros are compatible, and these distros are + compatible with one another.""" + + if distro_id in ('RedHatEnterpriseClient', 'RedHatEnterpriseServer', + 'CentOS'): + distro_id = 'RedHat' + + try: + major_ver, _ = ver.split('.', 1) + except ValueError: + pass + else: + ver = major_ver + return distro_id, ver + +LSB_DISTRO_ADJUST = "lsb_distro_adjust" diff --git a/conf/distro/include/plcos_security_flags.inc b/conf/distro/include/plcos_security_flags.inc new file mode 100644 index 0000000..3e44be8 --- /dev/null +++ b/conf/distro/include/plcos_security_flags.inc @@ -0,0 +1,17 @@ +# Base on oe-core security flags +#include conf/distro/include/security_flags.inc + +# To override for multilib, use SECURITY_CFLAGS:pn-_pn--. +# If just SECURITY_CFLAGS:pn- is defined, it will be used for all +# multilib variants, too. + +# Reason: The recipe vdso-test located in wrlinux which has assemble code +SECURITY_CFLAGS:pn-vdso-test = "" + +# Reason: +# upstream meta-secure-core refuse to set var-SECURITY_STACK_PROTECTOR to +# LDFLAGS and upstream oe-core refuse to remove var-SECURITY_STACK_PROTECTOR +# from LDFLAGS +SECURITY_LDFLAGS:remove:pn-libsign = "-fstack-protector-strong" +SECURITY_LDFLAGS:remove:pn-cryptfs-tpm2 = "-fstack-protector-strong" + diff --git a/conf/distro/include/wrlinux-packageconfigs.inc b/conf/distro/include/wrlinux-packageconfigs.inc new file mode 100644 index 0000000..557248d --- /dev/null +++ b/conf/distro/include/wrlinux-packageconfigs.inc @@ -0,0 +1,12 @@ +# PACKAGECONFIG settings of recipes for WRLinux + +# Workaround for nmap possibly requiring python-pygtk which is not available +PACKAGECONFIG:remove:pn-nmap = "zenmap" + +# we usually use gnutls as the default PACKAGECONFIG of wpa-supplicant, but its sub-packege gnutls-openssl +# is GPLv3, so need this check to switch to openssl if GLPv3 is blacklisted. +PACKAGECONFIG:pn-wpa-supplicant ?= "${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-only', 'openssl', 'gnutls', d)}" + +PACKAGECONFIG:pn-sysstat ?= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} lm-sensors cron" + +PACKAGECONFIG:append:pn-mesa-demos = "${@bb.utils.contains('DISTRO_FEATURES', 'weston-demo', ' wayland ', ' ', d)}" diff --git a/conf/distro/plcos-graphics.conf b/conf/distro/plcos-graphics.conf new file mode 100644 index 0000000..f97db90 --- /dev/null +++ b/conf/distro/plcos-graphics.conf @@ -0,0 +1,7 @@ +# PLC-OS Real-Time Operating System (with Graphics Support) + +PLCOS_VARIANT = " Graphics" + +require conf/distro/plcos.conf + +DISTRO_FEATURES:append = " x11 opengl wayland vulkan polkit" diff --git a/conf/distro/plcos-installer.conf b/conf/distro/plcos-installer.conf new file mode 100644 index 0000000..6b5e8c0 --- /dev/null +++ b/conf/distro/plcos-installer.conf @@ -0,0 +1,15 @@ +# Anaconda-based Installer for PLC-OS + +require plcos-graphics.conf +require conf/distro/anaconda.conf + +PLCOS_VARIANT = " Installer" +DISTRO = "anaconda" + +IMAGE_FSTYPES:pn-wrlinux-image-installer:append = " live" + +CUSTOMIZE_LOGOS ?= "plcos-logos" + +#TODO remove all dependency on WRTEMPLATE +# clear WRTEMPLATE for installer image +WRTEMPLATE:anaconda = "" diff --git a/conf/distro/plcos-tiny.conf b/conf/distro/plcos-tiny.conf new file mode 100644 index 0000000..aaf60c9 --- /dev/null +++ b/conf/distro/plcos-tiny.conf @@ -0,0 +1,105 @@ +#lighter-weight version of PLC-OS with smaller footprint but fewer features + +# The following modifications to PLC-OS have been made or are planned for testing +# x Serial only (no graphics) +# x Basic IPV4 support (no IPV6) +# x Single user shell +# x Static images (no package management) +# x Read-only or RAMFS root filesystem + +# The current target for these efforts is: +# x Complete Image size: under 1GB +# + +PLCOS_VARIANT = " Tiny" + +require conf/distro/plcos.conf + +# Distro config is evaluated after the machine config, so we have to explicitly +# set the kernel provider to override a machine config. +#TODO create recipe for "linux-yocto-rt-tiny" +PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt" + +# Drop kernel-module-af-packet from RRECOMMENDS +PLCOS_DEFAULT_EXTRA_RRECOMMENDS = "" + +# Drop native language support. +# this removes a significant dependency chain, reducing final size significantly +USE_NLS = "no" +# XXX-dev packages require pkgconfig, and are not currently supported on plcos-tiny. +#This line disables pkgconfig +ASSUME_PROVIDED += "pkgconfig$" + +# Comment out any of the lines below to disable them in the build +# DISTRO_FEATURES options: +# alsa bluetooth ext2 irda pcmcia usbgadget usbhost wifi nfs zeroconf pci +DISTRO_FEATURES_TINY = "pci" +DISTRO_FEATURES_NET = "ipv4 ipv6" +DISTRO_FEATURES_USB = "usbhost" +#DISTRO_FEATURES_USBGADGET = "usbgadget" +DISTRO_FEATURES_WIFI = "wifi" + +DISTRO_FEATURES = "${DISTRO_FEATURES_TINY} \ + ${DISTRO_FEATURES_NET} \ + ${DISTRO_FEATURES_USB} \ + ${DISTRO_FEATURES_USBGADGET} \ + ${DISTRO_FEATURES_WIFI} \ + " + +# Enable LFS - see bug YOCTO #5865 +DISTRO_FEATURES:append:libc-musl = " largefile" + +# From poky: +PLCOS_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland vulkan" + +DISTRO_FEATURES:class-native = "${DISTRO_FEATURES_DEFAULT} ${WRLINUX_DEFAULT_DISTRO_FEATURES}" +DISTRO_FEATURES:class-nativesdk = "${DISTRO_FEATURES_DEFAULT} ${WRLINUX_DEFAULT_DISTRO_FEATURES}" + +# enable mdev/busybox for init +INIT_MANAGER = "mdev-busybox" +VIRTUAL-RUNTIME_no-busybox = "" + +# FIXME: Consider adding "modules" to MACHINE_FEATURES and using that in +# packagegroup-core-base to select modutils-initscripts or not. Similar with "net" and +# netbase. + +# By default we only support initramfs and tar.bz2. We don't build live as that +# pulls in a lot of dependencies for the live image and the installer, like +# udev, grub, etc. These pull in gettext, which fails to build with wide +# character support. +IMAGE_FSTYPES += "cpio.gz tar.bz2" + +# Drop v86d from qemu dependency list (we support serial) +# Drop grub from meta-intel BSPs +# FIXME: A different mechanism is needed here. We could define -tiny +# variants of all compatible machines, but that leads to a lot +# more machine configs to maintain long term. +MACHINE_ESSENTIAL_EXTRA_RDEPENDS = "" + +# The mtrace script included by glibc is a perl script. This means the system +# will build perl in case this package is installed. Since we don't care about +# this script for the purposes of tiny, remove the dependency from here. +RDEPENDS:${PN}-mtrace:pn-glibc = "" + +SKIP_RECIPE[build-appliance-image] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-base] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-clutter] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-full-cmdline] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-rt] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-rt-sdk] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-sato] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-sato-dev] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-sato-sdk] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-x11] = "not buildable with plcos-tiny" +SKIP_RECIPE[core-image-weston] = "not buildable with plcos-tiny" +SKIP_RECIPE[plcos-image-sato] = "not buildable with plcos-tiny" +SKIP_RECIPE[plcos-image-weston] = "not buildable with plcos-tiny" +SKIP_RECIPE[plcos-image-base] = "not buildable with plcos-tiny" +SKIP_RECIPE[plcos-image-dev] = "not buildable with plcos-tiny" + +# Disable python usage in opkg-utils since it won't build with tiny config +PACKAGECONFIG:pn-opkg-utils = "update-alternatives" +PACKAGECONFIG:pn-lib32-opkg-utils = "update-alternatives" + +TEMPLATES_PATH = "${LAYER_PATH_plcos}/plcos-distro/templates" +WRTEMPLATE:append = " feature/posix-timers" diff --git a/conf/distro/plcos.conf b/conf/distro/plcos.conf new file mode 100644 index 0000000..a56b398 --- /dev/null +++ b/conf/distro/plcos.conf @@ -0,0 +1,281 @@ + +#@TYPE: Distro +#@NAME: PLC-OS +#@DESCRIPTION: Open Source Realtime OS for running PLC logic (Full Featured Distribution) + +# we want to use rsyslog as the default syslog, but it's GPLv3, so need this +# check to switch to sysklogd if GLPv3 is blacklisted. +VIRTUAL-RUNTIME_syslog ?= "${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-only', 'sysklogd', 'rsyslog', d)}" +VIRTUAL-RUNTIME_base-utils-syslog ?= "${VIRTUAL-RUNTIME_syslog}" + +# 1. for xfce, The networkmanager is required by xfce4-power-manager, +# and it conflicts with connman. The setting can avoid connman-gnome +# be added to packagegroup-core-x11-sato's RDEPENDS (when build image plcos-image-glibc-std-sato). +# 2. for std-sato image, bind also conflicts with connman, this can avoid +# connman-gnome be added to packagegroup-core-x11-sato's RDEPENDS +NETWORK_MANAGER = "" + +# common plcos distro definitions +# +############################################################################################################# +# We need this to add multilib support to the built-in QEMU BSPs +include conf/distro/include/plcos-bsp-${MACHINE}.inc + +MAINTAINER = "Vaughn Varma " + +PLCOS_VARIANT ??= "" +PLCOS_NAME = "PLC-OS" +PLCOS_VERSION ??= "0.1" +PLCOS_UPDATE_VERSION = "0" +PLCOS_BRANCH ?= "" +#this may not be necessary, but is just for parity with poky +DISTRO = "plcos" +DISTRO_NAME ?= "${PLCOS_NAME}${PLCOS_VARIANT}" + +DISTRO_VERSION ?= "${PLCOS_VERSION}" +SDK_VERSION ?= "${PLCOS_VERSION}" +SDK_VERSION[vardepvalue] = "${SDK_VERSION}" +DISTRO_PRETTY_VERSION ?= "${PLCOS_VERSION}${@' Update ${PLCOS_UPDATE_VERSION}' if d.getVar('PLCOS_UPDATE_VERSION') != '0' else ''}" +#TODO release own distro codename +DISTRO_CODENAME ?= "wrynose" + +#TODO: build own SDK +#SDK_VENDOR = "-wrlinuxsdk" +SDK_VENDOR = "-pokysdk" +#TARGET_VENDOR = "-wrs" +#possible issue of this making full path names too long?? +TARGET_VENDOR = "-poky" + +# Append 'osv-wrlinux' to the DISTROOVERRIDE +DISTROOVERRIDES:append = "${@['', ':'][(d.getVar('DISTRO', True) != '')]}poky" + +LOCALCONF_VERSION = "2" + +#from wrlinux +#SDK_NAME = "${DISTRO}-${TCLIBC}-${SDK_ARCH}-${TARGET_ARCH}" +#SDK_PS1 ??= "(wrlinuxsdk-${SDK_ARCH}-${TARGET_ARCH}) \${PS1#(wrlinuxsdk-${SDK_ARCH}-${TARGET_ARCH}) }" +#from poky +SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}" +SDKPATHINSTALL = "/opt/${DISTRO}/${SDK_VERSION}" +#TCSDKMACH = "${@['', '_${SDK_OS}']['${SDK_OS}' != 'linux']}" +#TOOLCHAIN_OUTPUTNAME = "${DISTRO}-${DISTRO_VERSION}-${TCLIBC}-${SDK_ARCH}${TCSDKMACH}-${MACHINE_ARCH}-${PN}-sdk" +#TOOLCHAINEXT_OUTPUTNAME = "${DISTRO}-${DISTRO_VERSION}-${TCLIBC}-${SDK_ARCH}${TCSDKMACH}-${MACHINE_ARCH}-${PN}-sdk-ext" + +#TOOLCHAIN_OUTPUTNAME:pn-buildtools-tarball:forcevariable = "${SDK_ARCH}-buildtools-nativesdk-standalone-${DISTRO_VERSION}" + +# Workaround for extensible SDK +#TOOLCHAIN_OUTPUTNAME:pn-uninative-tarball = "${SDK_ARCH}-nativesdk-libc" +#ESDK_CLASS_INHERIT_DISABLE:append = " packagefeed-stability" + +# Override these in wrlinux based distros to modify DISTRO_* + + +#CORE_IMAGE_BASE_INSTALL:append = " packagegroup-core-boot-wrs " +PLCOS_DEFAULT_DISTRO_FEATURES = "multiarch ptest" +#PLCOS_DEFAULT_DISTRO_FEATURES = "largefile multiarch pulseaudio kvm virtualization" +PLCOS_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot packagegroup-plcos-core" +#PLCOS_DEFAULT_EXTRA_RDEPENDS += " packagegroup-core-boot-wrs" +PLCOS_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet" + +#DISTRO_FEATURES:append = "${DISTRO_FEATURES_DEFAULTS} ${PLCOS_DEFAULT_DISTRO_FEATURES}" +DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULTS} ${PLCOS_DEFAULT_DISTRO_FEATURES}" +#DISTRO_FEATURES:class-native ?= "${DISTRO_FEATURES_DEFAULTS} ${PLCOS_DEFAULT_DISTRO_FEATURES}" +#DISTRO_FEATURES:class-nativesdk ?= "${DISTRO_FEATURES_DEFAULTS} ${PLCOS_DEFAULT_DISTRO_FEATURES}" +DISTRO_EXTRA_RDEPENDS += " ${PLCOS_DEFAULT_EXTRA_RDEPENDS}" +DISTRO_EXTRA_RRECOMMENDS += " ${PLCOS_DEFAULT_EXTRA_RRECOMMENDS}" + +# do not include qemu-config by default +#WRLINUXQEMUDEPS = "${@bb.utils.contains("INCOMPATIBLE_LICENSE", "GPL-3.0-only", "", "qemu-config",d)}" +#WRLINUXQEMUDEPS = "" + +#DISTRO_EXTRA_RDEPENDS:append:qemuall = " ${WRLINUXQEMUDEPS}" + +#TCLIBCAPPEND = "" + +#default locale / local language processing settings +#IMAGE_LINGUAS ?= "" + +# The CONNECTIVITY_CHECK_URI's are used to test whether we can succesfully +# fetch from the network (and warn you if not). To disable the test set +# the variable to be empty. +#CONNECTIVITY_CHECK_URIS ?= "https://www.example.com/" + + +#TODO evaluate which of these are necessary, modify or replace them to ensure full open source compliance +#currently some of these files are from wrlinux +#require conf/distro/include/poky-world-exclude.inc +#require conf/distro/include/no-static-libs.inc +#require conf/distro/include/plcos-uninative.inc +#require packagegroup-core-base-utils.inc +#require conf/distro/include/plcos_security_flags.inc +#require conf/distro/include/plcos-space-optimize.inc + +# Default hash policy for distro +#BB_SIGNATURE_HANDLER ?= 'OEBasicHash' +BB_SIGNATURE_HANDLER ?= "OEEquivHash" +BB_HASHSERVE ??= "auto" +INIT_MANAGER ?= "systemd" + +# QA check settings - a little stricter than the OE-Core defaults +WARN_TO_ERROR_QA ?= "already-stripped compile-host-path install-host-path \ + installed-vs-shipped ldflags pn-overrides rpaths staticdev \ + unknown-configure-option useless-rpaths" +WARN_QA:remove = "${WARN_TO_ERROR_QA}" +ERROR_QA:append = " ${WARN_TO_ERROR_QA}" + +# Change base package dependency in -dbg packages from recommends to suggests +#RRECOMMENDS:${PN}-dbg = "" +#RSUGGESTS:${PN}-dbg = "${PN} (= ${EXTENDPKGV})" + + +# Make sure that ldconfig is only enabled when the user has added ldconfig +# to the DISTRO_FEATURES +#This was set to BACKFILL_CONSIDERED in previous yocto versions, it seems the change may be breaking something for intel-x86 +#DISTRO_FEATURES_OPTED_OUT += "ldconfig" + +# Make sure that X11 is only enabled in a graphics configuration +#DISTRO_FEATURES_OPTED_OUT += "x11" + +# Multilib configuration +MULTILIBS ?= "" +MULTILIB_CONF = "${@'conf/multilib.conf' if d.getVar('MULTILIBS') and d.getVar('PACKAGE_CLASSES').split()[0] != 'package_deb' else ''}" +require ${MULTILIB_CONF} + +# only support realtime kernels. This OS is focused on realtime performance +TARGET_SUPPORTED_KTYPES = "preempt-rt" +PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt" + +# Blacklisted Packages +#SKIP_RECIPE[xyz-abc] ?= "Recipe xyz-abc is blacklisted via SKIP_RECIPE" + +# SANITY_TESTED_DISTROS used to defined the distribution list which we used to build PLC-OS +SANITY_TESTED_DISTROS ?= " \ + ubuntu-24.04 \n \ + " + +# TODO: This works, but OE documentation recommends either working with the DISTRO_FEATURES variable, or with the DISTRO_FEATURES_OPTED_OUT variable +#Same with the MACHINE_FEATURES_OPTED_OUT +DISTRO_FEATURES_DEFAULTS:remove:class-target = "x11" +DISTRO_FEATURES_DEFAULTS:remove:class-target = "wayland" +DISTRO_FEATURES_DEFAULTS:remove:class-target = "vulkan" +DISTRO_FEATURES_DEFAULTS:remove:class-target = "3g" +DISTRO_FEATURES_DEFAULTS:remove:class-target = "nfc" +DISTRO_FEATURES_DEFAULTS:remove:class-target = "nfs" +MACHINE_FEATURES:remove:class-target = "3g" +MACHINE_FEATURES:remove:class-target = "nfc" + +#ran into an issue where leaving pcbios on meant that the installed EFI would boot into the installer USB by default, despite BIOS settings +MACHINE_FEATURES:remove:class-target = "pcbios" +#we are using grub-efi for tuned; this is automatically included in x86 and SystemReady ARM configurations, but must be included for *all* architectures, including non-SystemReady ARM devices such as raspberry pi, which must chain-load u-boot into efi +MACHINE_FEATURES:append = " efi" + +#PLCOS_DEFAULT_DISTRO_FEATURES += "pam" + +# Native sstate should not depend on multilib provider whitelist +#BB_MULTI_PROVIDER_ALLOWED:class-native:forcevariable = "" + +# Configure the root user's home directory +#ROOT_HOME ?= "/root" + +# initramfs image for plcos distro +#TODO investigate having own initramfs image; wrlinux has its own, but this one should be the yocto one +INITRD_IMAGE_LIVE ?= "${@d.getVar('INITRAMFS_IMAGE', True) if d.getVar('INITRAMFS_IMAGE', True) else 'core-image-minimal-initramfs'}" + +# The providers are fftwf, fftwl, fftw +PREFERRED_PROVIDER_virtual/fftw = "fftw" + +# Set the default psplash from psplash-default to psplash-windriver + +## Syslinux options for boot menus when using isolinux or linux live +SYSLINUX_TIMEOUT = "50" +#SYSLINUX_SPLASH = "${@oe.utils.conditional('WRLINUX_BRANCH', 'LTS', '${LAYER_PATH_plcos}/files/syslinux/bootloading-blue-wrl.png', '${LAYER_PATH_plcos}/files/syslinux/bootloading-gray-wrl.png', d)}" +SYSLINUX_SPLASH = "${LAYER_PATH_meta-realtime}/recipes-extended/psplash/files/psplash-plcos-img.png" +AUTO_SYSLINUXMENU = "1" + +## "1" = Have graphics and serial in the boot menu when use grub-efi in iso +GRUB_GFXSERIAL = "0" +GRUB_TIMEOUT = "5" + +# Possibly eliminate busybox from an image. The variables defined here +# are used by oe-core packagegroup-core-boot.bb. The overrides are +# DISTRO names. +VIRTUAL-RUNTIME_login_manager = "shadow" + +# We assume that we provide base-utils. This variable must +# empty or one item. +# +#VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils" + +# This runs the busybox-hwclock script during systemv +# init. This does NOT supply /sbin/hwclock, only a script! +# +VIRTUAL-RUNTIME_base-utils-hwclock = "busybox-hwclock" + +# Supply replacements for busybox functions we really, really need. +# +VIRTUAL-RUNTIME_no-busybox = "packagegroup-core-base-utils" + +#TODO: check if valuable, disabled for parity with poky +#IMAGE_INSTALL:append = " ${VIRTUAL-RUNTIME_no-busybox}" + +PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto-rt" + +INHERIT += "ext_secure_cflags wrlinux-metadata_scm" + +# Support distro features override +INHERIT += "distrooverrides" + +INHERIT += "poky-sanity" + +# Define WR sample keys directory +#WR_SAMPLE_KEYS_DIR ?= "${LAYER_PATH_plcos-distro}/files/sample-keys" + +# By default the sample keys are used +#WR_KEYS_DIR ?= "${WR_SAMPLE_KEYS_DIR}" + +PREFERRED_VERSION_linux-yocto ?= "6.18%" +PREFERRED_VERSION_linux-yocto-rt ?= "6.18%" +PREFERRED_VERSION_linux-yocto-tiny ?= "6.18%" + +# Third party download notice +#INHERIT += "third-party-dl" + + +# Enable VENDOR REVISION for CVE patches +#VENDOR_REVISION_PREFIX ?= ".wr" +#INHERIT += "enable-vendor-revision" + +# Extend CLANG_EXTRA_OE_DISTRO to make clang work well on plcos host. See usage in meta-clang. +# TODO: check if needed or helpful. removed for parity with poky +#CLANG_EXTRA_OE_DISTRO:append = " plcos-graphics:poky plcos:poky" + +#INHERIT += "uninative" +#INHERIT += "create-spdx" +# We need debug symbols so that SPDX license manifests for the kernel work +KERNEL_EXTRA_FEATURES:append = " features/debug/debug-kernel.scc" +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES:append = " tuning-and-support.scc" + +EFI_PROVIDER = "grub-efi" + +#default device hostname +hostname:pn-base-files = "plc" +WKS_FILE:x86 = "plcos-bootdisk-x86.wks.in" +WKS_FILE:x86-64 = "plcos-bootdisk-x86.wks.in" +WKS_FILE:intel-x86-common = "plcos-bootdisk-intel.wks.in" + +WKS_FILE:aarch64 = "plcos-bootdisk-arm.wks.in" + +DISTRO_FEATURES:append = " pam opengl usbhost largefile " +#DISTRO_FEATURES:append = " x11 wayland virtualization " + +#TODO remove WRLinux +# The overrides osv-wrlinux will enable wrlinux specific bbappend +OVERRIDES:append = ":osv-wrlinux" +INHERIT += "rtopts" +APPEND += "rcu_nocb_poll nmi-watchdog=0 processor.max_cstate=1 noefi irqaffinity=0" +ROOTFS_POSTPROCESS_COMMAND += " set_kernel_opts;" +TARGET_SUPPORTED_KTYPES:append = " preempt-rt" +DISTRO_FEATURES_DEFAULTS:append = " usbhost" +# use systemd as the default init manager +INIT_MANAGER = "systemd" diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..6a69270 --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,15 @@ +# 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 += "meta-realtime" +BBFILE_PATTERN_meta-realtime = "^${LAYERDIR}/" +BBFILE_PRIORITY_meta-realtime = "7" + +LAYERDEPENDS_meta-realtime = "core" + +LAYERSERIES_COMPAT_meta-realtime = "wrynose" +LAYER_PATH_meta-realtime = "${LAYERDIR}" diff --git a/conf/machine/raspberrypi-64.conf b/conf/machine/raspberrypi-64.conf new file mode 100644 index 0000000..6bb3f1b --- /dev/null +++ b/conf/machine/raspberrypi-64.conf @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: MIT + +#This whole file is a workaround for building under kernel 6.16, which does not provide dtb files for several raspberry pi versions supported in both previous and later kernel versions. + +require conf/machine/raspberrypi-armv8.conf + +MACHINEOVERRIDES =. "raspberrypi-armv8:" + + +RPI_KERNEL_DEVICETREE = " \ + broadcom/bcm2837-rpi-3-b.dtb \ + broadcom/bcm2711-rpi-4-b.dtb \ + broadcom/bcm2711-rpi-400.dtb \ + broadcom/bcm2712-rpi-5-b.dtb \ +" diff --git a/files/psplash-plcos-img.png.bak b/files/psplash-plcos-img.png.bak new file mode 100644 index 0000000..a50d611 Binary files /dev/null and b/files/psplash-plcos-img.png.bak differ diff --git a/files/psplash-plcos-img.svg.bak b/files/psplash-plcos-img.svg.bak new file mode 100644 index 0000000..9434b6b --- /dev/null +++ b/files/psplash-plcos-img.svg.bak @@ -0,0 +1,79 @@ + + + + + + + + + + + PLC OS + + + + + diff --git a/files/wic/plcos-bootdisk-arm.wks.in b/files/wic/plcos-bootdisk-arm.wks.in new file mode 100644 index 0000000..8a2e63d --- /dev/null +++ b/files/wic/plcos-bootdisk-arm.wks.in @@ -0,0 +1,13 @@ +# short-description: Create an EFI disk image with grub-efi +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. The selected bootloader is grub-efi. +# It also includes intel-microcode as an initrd for early update support. + +#part /boot --source bootimg-efi --sourceparams="loader=grub-efi,initrd=microcode.cpio" --label boot --active --align 1024 --use-uuid +part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 100 + +part / --source rootfs --fstype=ext4 --ondisk mmcblk0 --label root --align 4096 + +#part swap --ondisk sda --size 44 --label swap1 --fstype=swap --use-uuid + +#bootloader --ptable gpt --timeout=5 --append=" rootfstype=ext4 " diff --git a/files/wic/plcos-bootdisk-intel.wks.in b/files/wic/plcos-bootdisk-intel.wks.in new file mode 100644 index 0000000..e408320 --- /dev/null +++ b/files/wic/plcos-bootdisk-intel.wks.in @@ -0,0 +1,13 @@ +# short-description: Create an EFI disk image with grub-efi +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. The selected bootloader is grub-efi. +# It also includes intel-microcode as an initrd for early update support. + +part /boot --source bootimg-efi --sourceparams="loader=grub-efi,initrd=microcode.cpio" --label boot --active --align 1024 --use-uuid +#part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --label boot --active --align 1024 --use-uuid + +part / --source rootfs --fstype=ext4 --label root --align 1024 --use-uuid + +#part swap --ondisk sda --size 44 --label swap1 --fstype=swap --use-uuid + +bootloader --ptable gpt --timeout=5 --append=" rootfstype=ext4 " diff --git a/files/wic/plcos-bootdisk-x86.wks.in b/files/wic/plcos-bootdisk-x86.wks.in new file mode 100644 index 0000000..bcf387a --- /dev/null +++ b/files/wic/plcos-bootdisk-x86.wks.in @@ -0,0 +1,13 @@ +# short-description: Create an EFI disk image with grub-efi +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. The selected bootloader is grub-efi. +# It also includes intel-microcode as an initrd for early update support. + +#part /boot --source bootimg-efi --sourceparams="loader=grub-efi,initrd=microcode.cpio" --label boot --active --align 1024 --use-uuid +part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --label boot --active --align 1024 --use-uuid + +part / --source rootfs --fstype=ext4 --label root --align 1024 --use-uuid + +#part swap --ondisk sda --size 44 --label swap1 --fstype=swap --use-uuid + +bootloader --ptable gpt --timeout=5 --append=" rootfstype=ext4 " diff --git a/recipes-core/images/plcos-image-base.bb b/recipes-core/images/plcos-image-base.bb new file mode 100644 index 0000000..1bc9ee9 --- /dev/null +++ b/recipes-core/images/plcos-image-base.bb @@ -0,0 +1,98 @@ +SUMMARY = "Terminal-Only image with realtime optimizations" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r5" + +IMAGE_INSTALL = " \ + ${@bb.utils.contains('IMAGE_ENABLE_CONTAINER', '1', '', 'kernel-modules', d)} \ + packagegroup-base-extended \ + packagegroup-wr-base \ + packagegroup-wr-base-net \ + packagegroup-wr-base-discrete-tools \ + packagegroup-core-boot \ + packagegroup-plcos-core \ + hwlatdetect \ + tuned \ + openplc \ + rt-setup \ + i2c-tools \ + spitools \ + libgpiod \ + " +#nfs-utils-client +#packagegroup-wr-boot +#swap "boot install" to "install boot" to try and get install to show up first in grub.cfg for hands-off autoinstall +#install lines should be stripped during install-efi.sh anyway +LABELS_LIVE = "install boot" +inherit wrlinux-image +inherit rtopts + +############################################################# +#IMAGE_FEATURES += " package-management wr-core-db wr-core-interactive wr-core-net wr-core-perl wr-core-python wr-core-sys-util wr-core-util wr-core-mail wr-bsps " + +# ssh-server-openssh + +DISTRO_FEATURES += " polkit " +IMAGE_FEATURES += " splash package-management" +#IMAGE_FEATURES += " ssh-server-dropbear hwcodecs " +#CORE_IMAGE_BASE_INSTALL += " openssh" +#linuxcnc linuxcnc-doc" + +#DEPENDS += " cdrtools-native" + +QB_MEM = "-m 2048" + +IMAGE_FSTYPES += "wic wic.bmap" +#WKS_FILE = "sdimage_bootpart.wks mkefidisk.wks" + +inherit extrausers + +IMAGE_EFI_BOOT_FILES:append := "${KERNEL_IMAGETYPE}-*" +IMAGE_BOOT_FILES:append := "${KERNEL_IMAGETYPE}-*" +#TODO reference GRUB_IMAGE destination name via variables, otherwise this could break possible future 32 bit builds +IMAGE_BOOT_FILES:append:rpi = " \ + grub.cfg;EFI/BOOT/grub.cfg \ + bootaa64.efi;EFI/BOOT/bootaa64.efi \ +" +# ${EFI_PROVIDER}-bootaa64.efi:EFI/BOOT/bootaa64.efi +#IMAGE_EFI_BOOT_FILES:append := " boot" + +python do_bootimg:prepend() { + #import os + import glob + deploy_dir = d.getVar("DEPLOY_DIR_IMAGE") + os.system("install -d " + deploy_dir) + iso_dir = d.getVar("ISODIR") + os.system("install -d " + iso_dir) + hdd_dir = d.getVar("HDDDIR") + os.system("install -d " + hdd_dir) + img_type = d.getVar("KERNEL_IMAGETYPE") + files = glob.glob(deploy_dir + "/" + img_type + "-*") + for file in files: + os.system("install -m 644 -t " + iso_dir + " " + file + " | install -m 644 -t " + hdd_dir + " " + file ) +} +python do_image:append() { +# try: +# os.system("ln -s /boot/EFI/BOOT " + d.getVar("ROOTFS") + "/boot/grub") +# except E: +# pass +} +efi_iso_populate:append() { +# if [ ! -e "${EFIIMGDIR}/grub" ] ; then +# ln -s /boot/EFI/BOOT "${EFIIMGDIR}/grub" +# fi +} + +#below breaks something, it tries to make the file even when it already exists +efi_populate:append() { +# if [ ! -e "${DEST}/grub" ] ; then +# ln -s /boot/EFI/BOOT "${DEST}/grub" +# fi +} +populate_kernel:append() { +#mv $dest/${KERNEL_IMAGETYPE} $dest/${KERNEL_IMAGETYPE}- +} +#hostname:pn-base-files = "plc" diff --git a/recipes-core/images/plcos-image-dev.bb b/recipes-core/images/plcos-image-dev.bb new file mode 100644 index 0000000..ac19856 --- /dev/null +++ b/recipes-core/images/plcos-image-dev.bb @@ -0,0 +1,41 @@ +SUMMARY = "PLC-OS dev image" + +LICENSE = "CLOSED" + +IMAGE_INSTALL:append := " \ + lat-plot \ + stress-ng \ + efibootmgr \ + efivar \ + efitools \ + " +#nfs-utils-client + +inherit wrlinux-image +require plcos-image-base.bb +inherit extrausers + +IMAGE_FEATURES += " \ + ssh-server-openssh \ + " +PLCOS_VARIANT = " dev" + +DISTRO_FEATURES += "" +EXTRA_IMAGE_FEATURES += "allow-root-login" + +#CORE_IMAGE_BASE_INSTALL:append := " openssh" + +# The following options will build a companion 'debug filesystem' in addition +# to the normal deployable filesystem. This companion system allows a +# debugger to know the symbols and related sources. It can be used to +# debug a remote 'production' system without having to add the debug symbols +# and sources to remote system. If IMAGE_FSTYPES_DEBUGFS is not defined, it +# defaults to IMAGE_FSTYPES. +#IMAGE_GEN_DEBUGFS = "1" +#IMAGE_FSTYPES_DEBUGFS = "tar.bz2" +#linuxcnc linuxcnc-doc" + +EXTRA_USERS_PARAMS += " useradd plc-dev; \ + usermod -p '\$6\$TNPZD8XEuoDZWxLo\$WOIudv2UA5eePqcX0qgiS.o0feNZow1cAq9OnYLIZYsE6Jq2n.G/7792z73lx0h6EpBr/FUZpEqIDpWliK7Oy.' plc-dev; \ + usermod -p '\$6\$siB0EnTKa.T7axfN\$F.zJzll9xMkoe18TI0F8OknfCbsOfOw8hEcKM.6b1WIUqcAa3HyDwwMw.Yz4XrAFu.A1GfKG9dVUvuN/1rj2Y0' root; \ + usermod -a -G sudo plc-dev; " diff --git a/recipes-core/images/plcos-image-weston.bb b/recipes-core/images/plcos-image-weston.bb new file mode 100644 index 0000000..1b1de57 --- /dev/null +++ b/recipes-core/images/plcos-image-weston.bb @@ -0,0 +1,64 @@ +# PLC-OS Graphical Image with some utilities. Suitable for HMI's, operator consoles, etc. +# Although a best-attempt effort has been made to limit this effect, the introduction of graphics may nonetheless limit real-time performance. +# This effect may vary from platform to platform, depending on various decisions in a given platform's hardware architecture. +# This software is provided as-is, and so it is up to the user to ensure suiable perormance for a given use-case +SUMMARY = "PLC-OS graphical image with terminal and Firefox" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r0" +require plcos-image-base.bb + +IMAGE_INSTALL += " \ + packagegroup-base-extended \ + packagegroup-wr-base \ + packagegroup-wr-base-net \ + packagegroup-wr-base-discrete-tools \ + packagegroup-wr-boot \ + nfs-utils-client \ + readline \ + pcmanfm \ + gnuplot \ + matchbox-terminal \ + firefox \ + pulseaudio \ + " +#blt +# chocolate-doom + +inherit wrlinux-image +inherit rtopts + +DISTRO = "plcos-graphics" + +IMAGE_FEATURES += " \ + hwcodecs \ + ssh-server-openssh \ + wr-core-db \ + wr-core-interactive \ + wr-core-net \ + wr-core-perl \ + wr-core-python \ + wr-core-sys-util \ + wr-core-util \ + wr-core-mail \ + wr-bsps \ + " + + +#DISTRO_FEATURES += " x11 opengl wayland " +IMAGE_FEATURES += " splash package-management ssh-server-dropbear hwcodecs weston " + +CORE_IMAGE_BASE_INSTALL += " weston-xwayland matchbox-terminal pcmanfm vim firefox openssh" +#linuxcnc linuxcnc-doc" + +QB_MEM = "-m 2048" + +#IMAGE_FSTYPES = "wic +inherit extrausers +EXTRA_USERS_PARAMS += " usermod -p '\$6\$siB0EnTKa.T7axfN\$F.zJzll9xMkoe18TI0F8OknfCbsOfOw8hEcKM.6b1WIUqcAa3HyDwwMw.Yz4XrAFu.A1GfKG9dVUvuN/1rj2Y0' weston; \ + usermod -a -G sudo weston; " + +#CUSTOMER_RECIPES:multimedia-layer += 'vlc' diff --git a/recipes-core/images/wrlinux-image-rt-sway.bb_ b/recipes-core/images/wrlinux-image-rt-sway.bb_ new file mode 100644 index 0000000..725f7d0 --- /dev/null +++ b/recipes-core/images/wrlinux-image-rt-sway.bb_ @@ -0,0 +1,48 @@ +SUMMARY = "A very basic Wayland image with a terminal and Chromium" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r5" + +IMAGE_INSTALL = " \ + ${@bb.utils.contains('IMAGE_ENABLE_CONTAINER', '1', '', 'kernel-modules', d)} \ + packagegroup-base-extended \ + packagegroup-wr-base \ + packagegroup-wr-base-net \ + packagegroup-wr-base-discrete-tools \ + packagegroup-wr-boot \ + nfs-utils-client \ + " +inherit wrlinux-image +inherit rtopts + +IMAGE_FEATURES += " \ + package-management \ + ssh-server-openssh \ + wr-core-db \ + wr-core-interactive \ + wr-core-net \ + wr-core-perl \ + wr-core-python \ + wr-core-sys-util \ + wr-core-util \ + wr-core-mail \ + wr-bsps \ + " + + +DISTRO_FEATURES += " x11 opengl wayland pam " +IMAGE_FEATURES += " splash package-management ssh-server-dropbear hwcodecs " + +CORE_IMAGE_BASE_INSTALL += " matchbox-terminal pcmanfm vim sway firefox " +#linuxcnc linuxcnc-doc" + +QB_MEM = "-m 2048" + +#IMAGE_FSTYPES = "wic +inherit extrausers +EXTRA_USERS_PARAMS += " useradd sway; \ + usermod -p '\$6\$siB0EnTKa.T7axfN\$F.zJzll9xMkoe18TI0F8OknfCbsOfOw8hEcKM.6b1WIUqcAa3HyDwwMw.Yz4XrAFu.A1GfKG9dVUvuN/1rj2Y0' sway; \ + usermod -a -G sudo sway; " diff --git a/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend b/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend new file mode 100644 index 0000000..540b1e4 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend @@ -0,0 +1,4 @@ +# This file is generated automatically by wry +PACKAGEGROUP_BUSYBOX_REPLACEMENT_INC_WRLINUX = "" +PACKAGEGROUP_BUSYBOX_REPLACEMENT_INC_WRLINUX:osv-wrlinux = "packagegroup-core-base-utils_wrlinux.inc" +require ${PACKAGEGROUP_BUSYBOX_REPLACEMENT_INC_WRLINUX} diff --git a/recipes-core/packagegroups/packagegroup-core-base-utils_wrlinux.inc b/recipes-core/packagegroups/packagegroup-core-base-utils_wrlinux.inc new file mode 100644 index 0000000..7920e24 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-base-utils_wrlinux.inc @@ -0,0 +1,17 @@ +# +# Copyright (C) 2016 Wind River Systems Inc. +# + +RDEPENDS:${PN}:append = " \ + bc \ + debianutils-run-parts \ + dpkg-start-stop \ + fbset \ + kbd \ + netcat \ + ifupdown \ + iputils-ping \ + usleep \ + util-linux-flock \ + util-linux-mount \ + " diff --git a/recipes-core/packagegroups/packagegroup-core-boot-wrs.bb b/recipes-core/packagegroups/packagegroup-core-boot-wrs.bb new file mode 100644 index 0000000..c76e908 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-boot-wrs.bb @@ -0,0 +1,38 @@ +# +# Copyright (C) 2012-2013 Wind River Systems, Inc. +# +# Based on packagegroup-core-boot.bb of yocto +# + +DESCRIPTION = "Package Group for wrlinux - minimal bootable image" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +ALLOW_EMPTY:${PN} = "1" +PR = "r1" + +# Distro can override the following VIRTUAL-RUNTIME providers: +VIRTUAL-RUNTIME_dev_manager ?= "udev" +VIRTUAL-RUNTIME_keymaps ?= "keymaps" + +PACKAGES = "\ + packagegroup-core-boot-wrs \ + packagegroup-core-boot-wrs-dbg \ + packagegroup-core-boot-wrs-dev \ +" + +RDEPENDS:packagegroup-core-boot-wrs = "\ + base-files \ + base-passwd \ + busybox \ + ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${VIRTUAL-RUNTIME_initscripts}", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \ + modutils-initscripts \ + netbase \ + ${VIRTUAL-RUNTIME_login_manager} \ + ${VIRTUAL-RUNTIME_init_manager} \ + ${VIRTUAL-RUNTIME_dev_manager} \ + ${VIRTUAL-RUNTIME_update-alternatives} \ +" diff --git a/recipes-core/packagegroups/packagegroup-core-boot.bbappend b/recipes-core/packagegroups/packagegroup-core-boot.bbappend new file mode 100644 index 0000000..e52ff0e --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-boot.bbappend @@ -0,0 +1,3 @@ +PACKAGEGROUP_CORE_BOOT_INC_WRLINUX = "packagegroup-core-boot_wrlinux.inc" +require ${PACKAGEGROUP_CORE_BOOT_INC_WRLINUX} +RDEPENDS:${PN} += " packagegroup-core-boot-wrs " diff --git a/recipes-core/packagegroups/packagegroup-core-boot_wrlinux.inc b/recipes-core/packagegroups/packagegroup-core-boot_wrlinux.inc new file mode 100644 index 0000000..b8beae0 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-boot_wrlinux.inc @@ -0,0 +1,17 @@ + +PACKAGES:append = " packagegroup-wr-boot" + +WR_MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= "" +ALLOW_EMPTY:packagegroup-wr-boot = "1" +RDEPENDS:packagegroup-wr-boot = "${PN} ${WR_MACHINE_ESSENTIAL_EXTRA_RDEPENDS}" + +# add wr-init +RDEPENDS:${PN}:append = " ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','wr-init','',d)}" + +# Need these, but images may choose to pull them from various +# packages, e.g. busybox or bash+busybox-oe-min. +# The following only works with the RPM backend... +FILERDEPENDS_${PN} = "/bin/sh /usr/bin/run-parts /sbin/start-stop-daemon /sbin/ifup" + +# override the default in package-core-boot.bb +EFI_PROVIDER ??= "${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-only', '', 'grub-efi', d)}" diff --git a/recipes-core/packagegroups/packagegroup-plcos-core.bb b/recipes-core/packagegroups/packagegroup-plcos-core.bb new file mode 100644 index 0000000..5b5ef36 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-plcos-core.bb @@ -0,0 +1,59 @@ +DESCRIPTION = "PLC-OS core packagegroup" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + + +ALLOW_EMPTY:${PN} = "1" +STRACE = "strace" +STRACE:riscv32 = "" + + +RDEPENDS:${PN}:append = " \ + avahi-daemon \ + bind \ + bind-utils \ + curl \ + s-nail \ + msmtp \ + openssh-sftp-server \ + ppp \ + tcpdump \ + ${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-only', '', 'wget', d)} \ + util-linux-fsck \ + e2fsprogs-e2fsck \ + e2fsprogs-mke2fs \ + elfutils \ + hdparm \ + iproute2 \ + iptables \ + iputils \ + iw \ + ldd \ + lsof \ + lvm2 \ + mdadm \ + mtd-utils \ + ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-wheel', '', d)} \ + quota \ + sdparm \ + setserial \ + ${STRACE} \ + usbutils \ + watchdog \ + wireless-regdb-static \ + ${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-or-later', '', 'parted', d)} \ + python3 \ + python3-misc \ + python3-modules \ + grub-editenv \ + " +RRECOMMENDS:${PN} = " \ + mtd-utils-jffs2 \ + mtd-utils-ubifs \ + mtd-utils-misc \ + " + +RDEPENDS:${PN}:append:x86 = " acpica iasl" +RDEPENDS:${PN}:append:x86-64 = " acpica iasl" +RDEPENDS:${PN}:append:intel-x86 = " acpica iasl" diff --git a/recipes-core/packagegroups/packagegroup-self-host_wrlinux.inc b/recipes-core/packagegroups/packagegroup-self-host_wrlinux.inc new file mode 100644 index 0000000..7ffe2ba --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-self-host_wrlinux.inc @@ -0,0 +1,10 @@ +# +# Copyright (C) 2014 Wind River Systems, Inc. +# + +# The graphics packages in packagegroup-self-hosted-graphics +# are for Build Appliance usage in oe-core which are not +# needed in our self-hosted feature. +# So drop the graphics packagegroup. +PACKAGES:remove = "packagegroup-self-hosted-graphics" +RDEPENDS:packagegroup-self-hosted:remove = "packagegroup-self-hosted-graphics" diff --git a/recipes-core/packagegroups/packagegroup-self-hosted.bbappend b/recipes-core/packagegroups/packagegroup-self-hosted.bbappend new file mode 100644 index 0000000..be3dc3a --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-self-hosted.bbappend @@ -0,0 +1,2 @@ +PACKAGEGROUP_SELF_HOST_INC_WRLINUX = "packagegroup-self-host_wrlinux.inc" +require ${PACKAGEGROUP_SELF_HOST_INC_WRLINUX} diff --git a/recipes-core/packagegroups/packagegroup-wr-base.bb b/recipes-core/packagegroups/packagegroup-wr-base.bb new file mode 100644 index 0000000..d4c8b4d --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-base.bb @@ -0,0 +1,68 @@ +# +# Copyright (C) 2012-2016 Wind River Systems Inc. +# + +DESCRIPTION = "Core packages for Linux/GNU (non-busybox) runtime images" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +ALLOW_EMPTY:${PN} = "1" +ALLOW_EMPTY:${PN}-net = "1" +ALLOW_EMPTY:${PN}-discrete-tools = "1" + +PACKAGES += "${PN}-net ${PN}-net-dbg ${PN}-net-dev" +PACKAGES += "${PN}-discrete-tools ${PN}-discrete-tools-dbg ${PN}-discrete-tools-dev" + +# Core userspace package list based roughly on oe-core's +# packagegroup-core-initscripts and packagegroup-core-basic-utils: +VIRTUAL-RUNTIME_syslog ?= "sysklogd" +RDEPENDS:${PN} = "\ + acl \ + attr \ + bash \ + bc \ + coreutils \ + cpio \ + e2fsprogs \ + ed \ + findutils \ + gawk \ + grep \ + iproute2 \ + kmod \ + logrotate \ + mingetty \ + ncurses \ + procps \ + psmisc \ + sed \ + sudo \ + ${VIRTUAL-RUNTIME_syslog} \ + tar \ + time \ + udev \ + util-linux \ + util-linux-mount \ + util-linux-umount \ + util-linux-fstrim \ + util-linux-hwclock \ + util-linux-logger \ + vim \ + which \ + " + +# Minimal network environment +RDEPENDS:${PN}-net = "\ + dhcpcd \ + ethtool \ + net-tools \ + rfkill \ + " + +# Some subsitutes for busybox functions +RDEPENDS:${PN}-discrete-tools = "\ + adduser \ + debianutils-run-parts \ + ifupdown \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-bsps.bb b/recipes-core/packagegroups/packagegroup-wr-bsps.bb new file mode 100644 index 0000000..9464d17 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-bsps.bb @@ -0,0 +1,65 @@ +SUMMARY = "Packages required by bsp" + +# +# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH +# + +ALLOW_EMPTY:${PN} = "1" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit packagegroup + + +BSP_EXTRAS_PACKAGES ?= "" + +PROVIDES = "${PACKAGES}" +PACKAGES = ' \ + packagegroup-wr-bsps \ + ${@bb.utils.contains("MACHINE_FEATURES", "parser", "packagegroup-wr-bsps-parser", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "shell-tools", "packagegroup-wr-bsps-shell-tools", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "filesystem", "packagegroup-wr-bsps-filesystem-tools", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "profile", "packagegroup-wr-bsps-profile-tools", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "network", "packagegroup-wr-bsps-network-tools", "", d)} \ + \ + ${@bb.utils.contains("DISTRO_FEATURES", "bsp-extras", "packagegroup-wr-bsps-bsp-extras", "", d)} \ + ' + +# +# packagegroup-wr-bsps contain stuff needed by BSPs (machine related) +# +RDEPENDS:packagegroup-wr-bsps = "\ + ${@bb.utils.contains("MACHINE_FEATURES", "parser", "packagegroup-wr-bsps-parser", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "shell-tools", "packagegroup-wr-bsps-shell-tools", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "filesystem", "packagegroup-wr-bsps-filesystem-tools", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "profile", "packagegroup-wr-bsps-profile-tools", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "network", "packagegroup-wr-bsps-network-tools", "", d)} \ + \ + ${@bb.utils.contains("DISTRO_FEATURES", "bsp-extras", "packagegroup-wr-bsps-bsp-extras", "", d)} \ + " + +SUMMARY:packagegroup-wr-bsps-parser = "Parser Generator Support" +RDEPENDS:packagegroup-wr-bsps-parser = "\ + flex \ + bison" + +SUMMARY:packagegroup-wr-bsps-shell-tools = "Shell tools support" +RDEPENDS:packagegroup-wr-bsps-shell-tools = "\ + dialog" + +SUMMARY:packagegroup-wr-bsps-filesystem-tools = "Filesystem tools support" +RDEPENDS:packagegroup-wr-bsps-filesystem-tools = "\ + fio \ + smartmontools" + +SUMMARY:packagegroup-wr-bsps-profile-tools = "Profile tools support" +RDEPENDS:packagegroup-wr-bsps-profile-tools = "\ + ${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-only', '', 'perf', d)}" + +SUMMARY:packagegroup-wr-bsps-network-tools = "Network tools support" +RDEPENDS:packagegroup-wr-bsps-network-tools = "\ + iperf3" + +SUMMARY:packagegroup-wr-bsps-bsp-extras = "BSP related extras devices tools" +RDEPENDS:packagegroup-wr-bsps-bsp-extras = "\ + ${BSP_EXTRAS_PACKAGES} \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-db.bb b/recipes-core/packagegroups/packagegroup-wr-core-db.bb new file mode 100644 index 0000000..7e9fcf4 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-db.bb @@ -0,0 +1,19 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-db definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-db" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: db" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + db \ + sqlite3 \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-interactive.bb b/recipes-core/packagegroups/packagegroup-wr-core-interactive.bb new file mode 100644 index 0000000..1ea3639 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-interactive.bb @@ -0,0 +1,28 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-interactive definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-interactive" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: interactive" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r1" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + lrzsz \ + man \ + man-pages \ + minicom \ + ncurses-tools \ + vim \ + vim-common \ + vim-syntax \ + ${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-or-later', '', 'screen', d)} \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-mail.bb b/recipes-core/packagegroups/packagegroup-wr-core-mail.bb new file mode 100644 index 0000000..a11e651 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-mail.bb @@ -0,0 +1,18 @@ +# +# Copyright (C) 2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-mail definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-mail" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: mail" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + postfix \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-net.bb b/recipes-core/packagegroups/packagegroup-wr-core-net.bb new file mode 100644 index 0000000..5bb3873 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-net.bb @@ -0,0 +1,29 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-net definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-net" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: net" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r2" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + avahi-daemon \ + bind \ + bind-utils \ + curl \ + s-nail \ + msmtp \ + openssh-sftp-server \ + ppp \ + tcpdump \ + ${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-only', '', 'wget', d)} \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-perl.bb b/recipes-core/packagegroups/packagegroup-wr-core-perl.bb new file mode 100644 index 0000000..8096c2c --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-perl.bb @@ -0,0 +1,23 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-perl definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-perl" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: perl" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r1" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + perl \ + perl-misc \ + perl-modules \ + perl-pod \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-python.bb b/recipes-core/packagegroups/packagegroup-wr-core-python.bb new file mode 100644 index 0000000..3e26e2d --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-python.bb @@ -0,0 +1,22 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-python definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-python" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: python" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r1" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + python3 \ + python3-misc \ + python3-modules \ + " diff --git a/recipes-core/packagegroups/packagegroup-wr-core-security.bb b/recipes-core/packagegroups/packagegroup-wr-core-security.bb new file mode 100644 index 0000000..1267ac3 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-security.bb @@ -0,0 +1,73 @@ +# +# Copyright (C) 2012 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-security definition in +# core-image.bbclass that may be used to customize an image by +# adding "wr-core-security" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: security" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "\ + file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \ + " + +PR = "r2" + +PACKAGES = "${PN}-utils ${PN}-trust \ + ${PN}-access ${PN}-detection \ + ${PN}-crypto ${PN}-auth ${PN}" + +ALLOW_EMPTY:${PN}-utils = "1" +ALLOW_EMPTY:${PN}-trust = "1" +ALLOW_EMPTY:${PN}-access = "1" +ALLOW_EMPTY:${PN}-detection = "1" +ALLOW_EMPTY:${PN}-crypto = "1" +ALLOW_EMPTY:${PN}-auth = "1" +ALLOW_EMPTY:${PN} = "1" + +# afong: These two were originally in the package list, no apps were using them, removed. +# libgssglue +# libmhash +RDEPENDS:${PN} = "\ + ${PN}-utils \ + ${PN}-trust \ + ${PN}-access \ + ${PN}-detection \ + ${PN}-crypto \ + ${PN}-auth \ + " + +RDEPENDS:${PN}-utils = "\ + ${@bb.utils.contains('BBFILE_COLLECTIONS', 'integrity-layer', 'keyutils', '', d)} \ + nspr \ + ${@bb.utils.contains('BBFILE_COLLECTIONS', 'security', 'xmlsec1', '', d)} \ + " + +RDEPENDS:${PN}-trust = "\ + gnupg \ + " + +RDEPENDS:${PN}-access = "\ + ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'audit auditd', '', d)} \ + " + +RDEPENDS:${PN}-detection = "\ + ${@bb.utils.contains('BBFILE_COLLECTIONS', 'security', 'samhain', '', d)} \ + " + +RDEPENDS:${PN}-crypto = "\ + ${@bb.utils.contains('BBFILE_COLLECTIONS', 'security', 'ecryptfs-utils', '', d)} \ + gnutls \ + nss \ + " + +RDEPENDS:${PN}-auth = "\ + krb5 \ + pinentry \ + " + +# jjmac: (2012.05.17) +# Due back in security-core when package upreves are complete. +# pyetree diff --git a/recipes-core/packagegroups/packagegroup-wr-core-sys-util.bb b/recipes-core/packagegroups/packagegroup-wr-core-sys-util.bb new file mode 100644 index 0000000..147dcb1 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-sys-util.bb @@ -0,0 +1,53 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-sys-util definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-sys-util" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: sys-util" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r4" + +ALLOW_EMPTY:${PN} = "1" + +STRACE = "strace" +STRACE:riscv32 = "" + +RDEPENDS:${PN} = " \ + util-linux-fsck \ + e2fsprogs-e2fsck \ + e2fsprogs-mke2fs \ + elfutils \ + hdparm \ + iproute2 \ + iptables \ + iputils \ + iw \ + ldd \ + lsof \ + lvm2 \ + mdadm \ + mtd-utils \ + ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-wheel', '', d)} \ + quota \ + sdparm \ + setserial \ + ${STRACE} \ + usbutils \ + watchdog \ + wireless-regdb-static \ + ${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPL-3.0-or-later', '', 'parted', d)} \ + " +RRECOMMENDS:${PN} = " \ + mtd-utils-jffs2 \ + mtd-utils-ubifs \ + mtd-utils-misc \ + " + +RDEPENDS:${PN}:append:x86 = " acpica iasl" +RDEPENDS:${PN}:append:x86-64 = " acpica iasl" diff --git a/recipes-core/packagegroups/packagegroup-wr-core-trace-tools.bb b/recipes-core/packagegroups/packagegroup-wr-core-trace-tools.bb new file mode 100644 index 0000000..cdf21af --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-trace-tools.bb @@ -0,0 +1,21 @@ +# +# Copyright (C) 2013 Wind River Systems, Inc. +# +DESCRIPTION = "Trace tools packagegroup extending glibc_std." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PACKAGES = "\ + ${PN} \ + ${PN}-dbg \ + ${PN}-dev \ + " +PACKAGE_ARCH = "${MACHINE_ARCH}" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = "\ + socat \ +" diff --git a/recipes-core/packagegroups/packagegroup-wr-core-util.bb b/recipes-core/packagegroups/packagegroup-wr-core-util.bb new file mode 100644 index 0000000..9ace48a --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-wr-core-util.bb @@ -0,0 +1,30 @@ +# +# Copyright (C) 2012-2013 Wind River Systems Inc. +# +# This package matches a FEATURE_PACKAGES_packagegroup-wr-core-util definition in +# wrlinux-image.bbclass that may be used to customize an image by +# adding "wr-core-util" to IMAGE_FEATURES. +# + +DESCRIPTION = "Wind River Linux core package group: util" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PR = "r3" + +ALLOW_EMPTY:${PN} = "1" + +RDEPENDS:${PN} = " \ + at \ + bzip2 \ + cronie \ + diffutils \ + gzip \ + ncurses-terminfo \ + tcl \ + tzdata \ + unzip \ + which \ + zip \ + " diff --git a/recipes-extended/glibc/glibc_2.43.bbappend b/recipes-extended/glibc/glibc_2.43.bbappend new file mode 100644 index 0000000..7cf58f8 --- /dev/null +++ b/recipes-extended/glibc/glibc_2.43.bbappend @@ -0,0 +1,3 @@ +do_install:append() { +rm -f ${D}/etc/ld.so.cache +} diff --git a/recipes-extended/grub-bootconf/grub-bootconf%.bbappend b/recipes-extended/grub-bootconf/grub-bootconf%.bbappend new file mode 100644 index 0000000..3fe9127 --- /dev/null +++ b/recipes-extended/grub-bootconf/grub-bootconf%.bbappend @@ -0,0 +1,10 @@ +ROOT = "root=/dev/mmcblk0p2" +inherit deploy +addtask do_deploy after do_install before do_build +do_deploy() { + install -m 644 ${S}/grub-bootconf ${DEPLOY_DIR_IMAGE}/grub.cfg +} +#not sure why this is necessary as a result of the above +RPROVIDES:${PN} += "virtual-grub-bootconf" +PROVIDES:${PN} += "virtual-grub-bootconf" +#IMAGE_BOOT_FILES:rpi:append = "${EFI_FILES_PATH}/grub.cfg" diff --git a/recipes-extended/grub-efi/grub-efi%.bbappend b/recipes-extended/grub-efi/grub-efi%.bbappend new file mode 100644 index 0000000..a459ab1 --- /dev/null +++ b/recipes-extended/grub-efi/grub-efi%.bbappend @@ -0,0 +1,4 @@ +#do_deploy:append:rpi (){ +# install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} +#} +#IMAGE_BOOT_FILES:rpi:append = "${GRUB_IMAGE};${EFI_FILES_PATH}/${GRUB_IMAGE}" diff --git a/recipes-extended/grub/0004-grub.d-10_linux.in-add-oe-s-kernel-name.patch b/recipes-extended/grub/0004-grub.d-10_linux.in-add-oe-s-kernel-name.patch new file mode 100644 index 0000000..b8d0971 --- /dev/null +++ b/recipes-extended/grub/0004-grub.d-10_linux.in-add-oe-s-kernel-name.patch @@ -0,0 +1,54 @@ +From 3715ca04466dfa120e18650d2c481f40d2066ca9 Mon Sep 17 00:00:00 2001 +From: Vaughn Varma +Date: Wed, 24 Sep 2026 11:11:00 +0000 +Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name +Modified from Khem Raj's (raj.khem@gmail.com) original script (find alongside the .bb file +for grub) to include "Image" files. Also removed hyphens to handle +situations where e.g. bzImage is the only kernel file (no bzImage-distro-name etc) +Original description below: +Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so +that the grub-mkconfig and grub-install can work correctly. + +We only need add the bzImage to util/grub.d/10_linux.in, but also add it +to util/grub.d/20_linux_xen.in to keep compatibility. + +Upstream-Status: Inappropriate [OE specific] + +--- + util/grub.d/10_linux.in | 6 +++--- + util/grub.d/20_linux_xen.in | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 07649cd..d5ec745 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -166,12 +166,12 @@ machine=`uname -m` + case "x$machine" in + xi?86 | xx86_64) + list= +- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do ++ for i in /boot/Image* /boot/bzImage* /Image* /bzImage* /boot/vmlinuz* /vmlinuz* /boot/kernel* ; do + if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi + done ;; +- *) ++ *) + list= +- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do ++ for i in /boot/Image* /boot/bzImage* /boot/vmlinuz* /boot/vmlinux* /bzImage* /vmlinuz* /vmlinux* /boot/kernel-* ; do + if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi + done ;; + esac +diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in +index 27bff00..6cc7bfc 100644 +--- a/util/grub.d/20_linux_xen.in ++++ b/util/grub.d/20_linux_xen.in +@@ -181,7 +181,7 @@ EOF + } + + linux_list= +-for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do ++for i in /boot/Image* /Image* /boot/bzImage[xz]* /bzImage[xz]* /boot/vmlinu[xz]* /vmlinu[xz]* /boot/kernel*; do + if grub_file_is_not_garbage "$i"; then + basename=$(basename $i) + version=$(echo $basename | sed -e "s,^[^0-9]*-,,g") diff --git a/recipes-extended/grub/grub_%.bbappend b/recipes-extended/grub/grub_%.bbappend new file mode 100644 index 0000000..d3d6cf7 --- /dev/null +++ b/recipes-extended/grub/grub_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}:" +SRC_URI:remove = "file://0003-grub.d-10_linux.in-add-oe-s-kernel-name.patch " +SRC_URI:prepend = "file://0004-grub.d-10_linux.in-add-oe-s-kernel-name.patch " diff --git a/recipes-extended/initrdscripts/initramfs-module-install-efi_%.%.bbappend b/recipes-extended/initrdscripts/initramfs-module-install-efi_%.%.bbappend new file mode 100644 index 0000000..05e874c --- /dev/null +++ b/recipes-extended/initrdscripts/initramfs-module-install-efi_%.%.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/module-install-efi:" diff --git a/recipes-extended/initrdscripts/module-install-efi/init-install-efi.sh b/recipes-extended/initrdscripts/module-install-efi/init-install-efi.sh new file mode 100644 index 0000000..32fa56b --- /dev/null +++ b/recipes-extended/initrdscripts/module-install-efi/init-install-efi.sh @@ -0,0 +1,287 @@ +#!/bin/sh -e +# +# Copyright (c) 2012, Intel Corporation. +# All rights reserved. +# +# install.sh [device_name] [rootfs_name] +# + +# Automatically installs PLC-OS to the first valid block device detected + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# figure out how big of a boot partition we need +boot_size=$(du -ms /run/media/$1/ | awk '{print $1}') +# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot +if [ -e /run/media/$1/$2 ]; then + boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') )) +fi +# remove initrd from size since its not currently installed +if [ -e /run/media/$1/initrd ]; then + boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') )) +fi +# add 10M to provide some extra space for users and account +# for rounding in the above subtractions +boot_size=$(( boot_size + 10 )) + +# 5% for swap +swap_ratio=5 + +# Get a list of hard drives +hdnamelist="" +live_dev_name=`cat /proc/mounts | grep ${1%/} | awk '{print $1}'` +live_dev_name=${live_dev_name#\/dev/} +# Only strip the digit identifier if the device is not an mmc +case $live_dev_name in + mmcblk*) + ;; + nvme*) + ;; + *) + live_dev_name=${live_dev_name%%[0-9]*} + ;; +esac + +echo "Searching for hard drives ..." + +# Some eMMC devices have special sub devices such as mmcblk0boot0 etc +# we're currently only interested in the root device so pick them wisely +devices=`ls /sys/block/ | grep -v mmcblk` || true +mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true +devices="$devices $mmc_devices" + +for device in $devices; do + case $device in + loop*) + # skip loop device + ;; + sr*) + # skip CDROM device + ;; + ram*) + # skip ram device + ;; + *) + # skip the device LiveOS is on + # Add valid hard drive name to the list + case $device in + $live_dev_name*) + # skip the device we are running from + ;; + *) + hdnamelist="$hdnamelist $device" + ;; + esac + ;; + esac +done + +if [ -z "${hdnamelist}" ]; then + echo "You need another device (besides the live device /dev/${live_dev_name}) to install the image. Installation aborted." + exit 1 +fi + +TARGET_DEVICE_NAME="" +for hdname in $hdnamelist; do + # Display found hard drives and their basic info + echo "-------------------------------" + echo /dev/$hdname + if [ -r /sys/block/$hdname/device/vendor ]; then + echo -n "VENDOR=" + cat /sys/block/$hdname/device/vendor + fi + if [ -r /sys/block/$hdname/device/model ]; then + echo -n "MODEL=" + cat /sys/block/$hdname/device/model + fi + if [ -r /sys/block/$hdname/device/uevent ]; then + echo -n "UEVENT=" + cat /sys/block/$hdname/device/uevent + fi + echo +done + +# Get user choice + TARGET_DEVICE_NAME=$(echo $hdnamelist | cut -f1 -d" ") + +if [ -n "$TARGET_DEVICE_NAME" ]; then + echo "Installing image on /dev/$TARGET_DEVICE_NAME ..." +else + echo "No hard drive selected. Installation aborted." + exit 1 +fi + +device=/dev/$TARGET_DEVICE_NAME + +# +# The udev automounter can cause pain here, kill it +# +rm -f /etc/udev/rules.d/automount.rules +rm -f /etc/udev/scripts/mount* + +# +# Unmount anything the automounter had mounted +# +umount ${device}* 2> /dev/null || /bin/true + +mkdir -p /tmp + +# Create /etc/mtab if not present +if [ ! -e /etc/mtab ] && [ -e /proc/mounts ]; then + ln -sf /proc/mounts /etc/mtab +fi + +disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") + +swap_size=$((disk_size*swap_ratio/100)) +rootfs_size=$((disk_size-boot_size-swap_size)) + +rootfs_start=$((boot_size)) +rootfs_end=$((rootfs_start+rootfs_size)) +swap_start=$((rootfs_end)) + +# MMC devices are special in a couple of ways +# 1) they use a partition prefix character 'p' +# 2) they are detected asynchronously (need rootwait) +rootwait="" +part_prefix="" +if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \ + [ ! "${device#/dev/nvme}" = "${device}" ]; then + part_prefix="p" + rootwait="rootwait" +fi + +# USB devices also require rootwait +if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then + rootwait="rootwait" +fi + +bootfs=${device}${part_prefix}1 +rootfs=${device}${part_prefix}2 +swap=${device}${part_prefix}3 + +echo "*****************" +echo "Boot partition size: $boot_size MB ($bootfs)" +echo "Rootfs partition size: $rootfs_size MB ($rootfs)" +echo "Swap partition size: $swap_size MB ($swap)" +echo "*****************" +echo "Deleting partition table on ${device} ..." +dd if=/dev/zero of=${device} bs=512 count=35 + +echo "Creating new partition table on ${device} ..." +parted ${device} mklabel gpt + +echo "Creating boot partition on $bootfs" +parted ${device} mkpart boot fat32 0% $boot_size +parted ${device} set 1 boot on + +echo "Creating rootfs partition on $rootfs" +parted ${device} mkpart root ext4 $rootfs_start $rootfs_end + +echo "Creating swap partition on $swap" +parted ${device} mkpart swap linux-swap $swap_start 100% + +parted ${device} print + +echo "Waiting for device nodes..." +C=0 +while [ $C -ne 3 ] && [ ! -e $bootfs -o ! -e $rootfs -o ! -e $swap ]; do + C=$(( C + 1 )) + sleep 1 +done + +echo "Formatting $bootfs to vfat..." +mkfs.vfat $bootfs + +#TODO mkfs.ext4 may require -F -F or -FF to overwrite functioning partition +echo "Formatting $rootfs to ext4..." +mkfs.ext4 -F $rootfs + +echo "Formatting swap partition...($swap)" +mkswap $swap + +mkdir /tgt_root +mkdir /src_root +mkdir -p /boot + +# Handling of the target root partition +mount $rootfs /tgt_root +mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root +echo "Copying rootfs files..." +cp -a /src_root/* /tgt_root +if [ -d /tgt_root/etc/ ] ; then + boot_uuid=$(blkid -o value -s UUID ${bootfs}) + swap_part_uuid=$(blkid -o value -s PARTUUID ${swap}) + echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab + echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab + # We dont want udev to mount our root device while we're booting... + if [ -d /tgt_root/etc/udev/ ] ; then + echo "${device}" >> /tgt_root/etc/udev/mount.ignorelist + fi +fi + +umount /src_root + +# Handling of the target boot partition +mount $bootfs /boot +echo "Preparing boot partition..." + +EFIDIR="/boot/EFI/BOOT" +mkdir -p $EFIDIR +# Copy the efi loader +cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR + +if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then + root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs}) + GRUBCFG="$EFIDIR/grub.cfg" + cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG + # Update grub config for the installed image + # Delete the install entry + sed -i "/menuentry 'install/,/^}/d" $GRUBCFG + # Delete the initrd lines + sed -i "/initrd /d" $GRUBCFG + # Delete any LABEL= strings + sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG + # Replace root= and add additional standard boot options + # We use root as a sentinel value, as vmlinuz is no longer guaranteed + sed -i "s/ root=[^ ]*/ root=PARTUUID=$root_part_uuid rw $rootwait quiet /g" $GRUBCFG +fi + +if [ -d /run/media/$1/loader ]; then + rootuuid=$(blkid -o value -s PARTUUID ${rootfs}) + SYSTEMDBOOT_CFGS="/boot/loader/entries/*.conf" + # copy config files for systemd-boot + cp -dr /run/media/$1/loader /boot + # delete the install entry + rm -f /boot/loader/entries/install.conf + # delete the initrd lines + sed -i "/initrd /d" $SYSTEMDBOOT_CFGS + # delete any LABEL= strings + sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS + # delete any root= strings + sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS + # add the root= and other standard boot options + sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $SYSTEMDBOOT_CFGS +fi + +umount /tgt_root + +# copy any extra files needed for ESP +if [ -d /run/media/$1/esp ]; then + cp -r /run/media/$1/esp/* /boot +fi + +# Copy kernel artifacts. To add more artifacts just add to types +# For now just support kernel types already being used by something in OE-core +for types in bzImage zImage vmlinux vmlinuz fitImage; do + for kernel in `find /run/media/$1/ -name $types*`; do + cp $kernel /boot + done +done + +umount /boot + +sync + +echo "Rebooting..." +reboot -f diff --git a/recipes-extended/ncurses/ncurses_6.6.bbappend b/recipes-extended/ncurses/ncurses_6.6.bbappend new file mode 100644 index 0000000..864eeda --- /dev/null +++ b/recipes-extended/ncurses/ncurses_6.6.bbappend @@ -0,0 +1,2 @@ +LD_LIBRARY_PATH:intel-x86:prepend = "${STAGING_DIR}${libdir}" +LD_PRELOAD:intel-x86:prepend = "${STAGING_DIR}${libdir}/libc.so.6" diff --git a/recipes-extended/networkmanager/networkmanager%.bbappend b/recipes-extended/networkmanager/networkmanager%.bbappend new file mode 100644 index 0000000..f067f0a --- /dev/null +++ b/recipes-extended/networkmanager/networkmanager%.bbappend @@ -0,0 +1,3 @@ +EXTRA_OEMAKE += " -Wno-implicit-function-declaration " +TARGET_CFLAGS += " -Wno-implicit-function-declaration " +TARGET_CXXFLAGS += " -Wno-implicit-function-declaration " diff --git a/recipes-extended/openssh/openssh_%.bbappend b/recipes-extended/openssh/openssh_%.bbappend new file mode 100644 index 0000000..e47a46c --- /dev/null +++ b/recipes-extended/openssh/openssh_%.bbappend @@ -0,0 +1 @@ +EXTRA_OECONF += "--without-openssl-header-check --build=''" diff --git a/recipes-extended/packagegroups/packagegroup-core-base-utils.bbappend b/recipes-extended/packagegroups/packagegroup-core-base-utils.bbappend new file mode 100644 index 0000000..aa5a44d --- /dev/null +++ b/recipes-extended/packagegroups/packagegroup-core-base-utils.bbappend @@ -0,0 +1,14 @@ +RDEPENDS:${PN}:append = " \ + bc \ + debianutils-run-parts \ + dpkg-start-stop \ + fbset \ + kbd \ + netcat \ + ifupdown \ + iputils-ping \ + usleep \ + util-linux-flock \ + util-linux-mount \ + " + diff --git a/recipes-extended/pam/libpam/0002-modules-pam_postgresok-change-uid-to-28.patch b/recipes-extended/pam/libpam/0002-modules-pam_postgresok-change-uid-to-28.patch new file mode 100644 index 0000000..9ec598a --- /dev/null +++ b/recipes-extended/pam/libpam/0002-modules-pam_postgresok-change-uid-to-28.patch @@ -0,0 +1,31 @@ +From 232757d8dc40384db38281bd2d0f99f1d94ddd9e Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Thu, 26 Dec 2024 15:31:15 +0800 +Subject: [PATCH] modules/pam_postgresok: change uid to 28 + +The default uid for postgres user is 28 in meta-oe rather than 26 in +redhat linux. + +Upstream-Status: Inappropriate [WRLinux Specific] + +Signed-off-by: Yi Zhao +--- + modules/pam_postgresok/pam_postgresok.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/pam_postgresok/pam_postgresok.c b/modules/pam_postgresok/pam_postgresok.c +index 0961b72..786a233 100644 +--- a/modules/pam_postgresok/pam_postgresok.c ++++ b/modules/pam_postgresok/pam_postgresok.c +@@ -69,7 +69,7 @@ int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc + uid = getuid(); + pw = pam_modutil_getpwuid(pamh, uid); + +- if ((uid == 26) && (pw != NULL) && (strcmp(pw->pw_name, "postgres") == 0)) ++ if ((uid == 28) && (pw != NULL) && (strcmp(pw->pw_name, "postgres") == 0)) + retval = PAM_SUCCESS; + + if (ctrl & PAM_DEBUG_ARG) { +-- +2.25.1 + diff --git a/recipes-extended/pam/libpam/pam_faillock_add_uid.patch b/recipes-extended/pam/libpam/pam_faillock_add_uid.patch new file mode 100644 index 0000000..3fa979b --- /dev/null +++ b/recipes-extended/pam/libpam/pam_faillock_add_uid.patch @@ -0,0 +1,130 @@ +From aa752cb9d30072912dd3b5d51a86ab2fe6f08970 Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Mon, 11 Jan 2021 15:40:21 +0800 +Subject: [PATCH] pam_faillock: add option to accept uid as argument + +Add options '--uid' for command pam_faillock to accept uid as argument. + +Upstream-Status: Submitted [https://github.com/linux-pam/linux-pam/pull/595] + +Signed-off-by: Changqing Li +--- + modules/pam_faillock/main.c | 62 ++++++++++++++++++++++++++++++++++--- + 1 file changed, 58 insertions(+), 4 deletions(-) + +diff --git a/modules/pam_faillock/main.c b/modules/pam_faillock/main.c +index c6dd19c..ff0e647 100644 +--- a/modules/pam_faillock/main.c ++++ b/modules/pam_faillock/main.c +@@ -56,10 +56,29 @@ + #include "faillock.h" + #include "faillock_config.h" + ++static int get_uid (const char *uidstr, uid_t *uid) ++{ ++ long long int val; ++ char *endptr; ++ ++ errno = 0; ++ val = strtoll (uidstr, &endptr, 10); ++ if ( ('\0' == *uidstr) ++ || ('\0' != *endptr) ++ || (ERANGE == errno) ++ || (val != (uid_t)val)) { ++ return 0; ++ } ++ ++ *uid = (uid_t)val; ++ return 1; ++} ++ + static int + args_parse(int argc, char **argv, struct options *opts) + { + int i; ++ int cline_user = 0; + int rv; + const char *dir = NULL; + const char *conf = NULL; +@@ -67,6 +86,7 @@ args_parse(int argc, char **argv, struct options *opts) + memset(opts, 0, sizeof(*opts)); + + opts->progname = argv[0]; ++ opts->uid = (uid_t)-1; + + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "--conf") == 0) { +@@ -94,6 +114,24 @@ args_parse(int argc, char **argv, struct options *opts) + return -1; + } + opts->user = argv[i]; ++ cline_user++; ++ } ++ else if (strcmp(argv[i], "--uid") == 0) { ++ ++i; ++ if(i >= argc || strlen(argv[i]) == 0) { ++ fprintf(stderr, "%s: No user id supplied.\n", argv[0]); ++ return -1; ++ } ++ uid_t user_id = (uid_t)-1; ++ if ( (get_uid (argv[i], &user_id) ==0) ++ || (user_id == (uid_t)-1)) { ++ fprintf (stderr, ++ _("%s: invalid user ID '%s'\n"), ++ argv[0], argv[i]); ++ return -1; ++ } ++ opts->uid = user_id; ++ cline_user++; + } + else if (strcmp(argv[i], "--reset") == 0) { + opts->reset = 1; +@@ -121,6 +159,10 @@ args_parse(int argc, char **argv, struct options *opts) + } + } + ++ if (cline_user > 1) { ++ fprintf(stderr, "--user and --uid are mutually exclusive options!\n"); ++ return -1; ++ } + return 0; + } + +@@ -129,8 +171,8 @@ usage(const char *progname) + { + fprintf(stderr, + _("Usage: %s [--dir /path/to/tally-directory]" +- " [--user username] [--reset] [--legacy-output]\n"), progname); +- ++ " [--user username] [--uid userid] [--reset] [--legacy-output]\n"), progname); ++ fprintf(stderr, "NOTE: --user and --uid are mutually exclusive options, userid must be non-negative.\n"); + } + + static int +@@ -323,9 +365,21 @@ main (int argc, char *argv[]) + return 1; + } + +- if (opts.user == NULL) { ++ if (opts.user == NULL && opts.uid == (uid_t)-1) { + return do_allusers(&opts); + } + +- return do_user(&opts, opts.user); ++ if (opts.user != NULL) { ++ return do_user(&opts, opts.user); ++ } ++ else { ++ errno = 0; ++ struct passwd *pwd = getpwuid(opts.uid); ++ if (pwd) { ++ return do_user(&opts, pwd->pw_name); ++ } ++ else { ++ fprintf(stderr, "%s: No matching passwd found, errno: %d\n", opts.progname, errno); ++ } ++ } + } +-- +2.25.1 + diff --git a/recipes-extended/pam/libpam/wrlinux-redhat-pam-modules.patch b/recipes-extended/pam/libpam/wrlinux-redhat-pam-modules.patch new file mode 100644 index 0000000..83c638f --- /dev/null +++ b/recipes-extended/pam/libpam/wrlinux-redhat-pam-modules.patch @@ -0,0 +1,20 @@ +Upstream-Status: Inappropriate [WRLinux Specific] +diff --git a/modules/meson.build b/modules/meson.build +index 68a7a63..cbe5c8a 100644 +--- a/modules/meson.build ++++ b/modules/meson.build +@@ -1,5 +1,6 @@ + subdir('pam_access') + subdir('pam_canonicalize_user') ++subdir('pam_chroot') + subdir('pam_debug') + subdir('pam_deny') + subdir('pam_echo') +@@ -23,6 +24,7 @@ subdir('pam_motd') + subdir('pam_namespace') + subdir('pam_nologin') + subdir('pam_permit') ++subdir('pam_postgresok') + subdir('pam_pwhistory') + subdir('pam_rhosts') + subdir('pam_rootok') diff --git a/recipes-extended/pam/libpam_%.bbappend b/recipes-extended/pam/libpam_%.bbappend new file mode 100644 index 0000000..3044442 --- /dev/null +++ b/recipes-extended/pam/libpam_%.bbappend @@ -0,0 +1,4 @@ +# This file is generated automatically by wry +LIBPAM_INC_WRLINUX = "" +LIBPAM_INC_WRLINUX = "libpam_wrlinux.inc" +require ${LIBPAM_INC_WRLINUX} diff --git a/recipes-extended/pam/libpam_wrlinux.inc b/recipes-extended/pam/libpam_wrlinux.inc new file mode 100644 index 0000000..ff142d6 --- /dev/null +++ b/recipes-extended/pam/libpam_wrlinux.inc @@ -0,0 +1,68 @@ +# +# Add a few "redhat" modules to pam. Some have been accepted upstream and +# are part of the distribution, but not the three we add here. +# + +PAM_PV = "1.3.1" +PAM_SRCREV = "ac815ddc575d8fe4762352e4f78adf0179f3bf5780d2e5da27f52ffc0157f0c2985726efb4ff3a31ceb42071afddb9c9cd72c0ce79699ae40f9633b927c808f2" + +FILESEXTRAPATHS:prepend := "${THISDIR}/libpam:" + +SRC_URI += "https://src.fedoraproject.org/repo/pkgs/pam/pam-redhat-${PAM_PV}.tar.xz/sha512/${PAM_SRCREV}/pam-redhat-${PAM_PV}.tar.xz;name=redhat \ + file://wrlinux-redhat-pam-modules.patch \ + file://0002-modules-pam_postgresok-change-uid-to-28.patch \ + ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'file://pam_faillock_add_uid.patch', '', d)} \ + " + +SRC_URI[redhat.sha256sum] = "894213fafbb557d40fba28dcc66f557fa0b4bf0ab32b0e4931b1d2be47e381fc" + +# If necessary, move pam-redhat modules to where they will be built. +# We create a local function and use sh. +# +do_lcl_rh_move () { + SAVED_PWD=`pwd`; cd ${S} + if [ ! -e modules/pam_chroot ] ; then + mv ${UNPACKDIR}/pam-redhat-${PAM_PV}/* modules/ + fi + cd ${SAVED_PWD} +} + +# Now, we define our own do_patch. We rely on the fact +# that the default do_patch just invokes patch_do_patch. +# +python do_patch () { + bb.build.exec_func('do_lcl_rh_move', d) + bb.build.exec_func('patch_do_patch', d) +} + +do_install:append() { + if ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'true', 'false', d)}; then + sed -i '/end of pam-auth-update config/i \ +# faillock is required to reset the fail count on success\ +account required pam_faillock.so' \ + ${D}${sysconfdir}/pam.d/common-account + sed -i '/pam_unix.so/i \ +auth required pam_faillock.so preauth deny=5 even_deny_root unlock_time=60' \ + ${D}${sysconfdir}/pam.d/common-auth + sed -i '/pam_unix.so/a \ +auth [default=die] pam_faillock.so authfail deny=5 even_deny_root unlock_time=60 \ +auth sufficient pam_faillock.so authsucc deny=5 even_deny_root unlock_time=60' \ + ${D}${sysconfdir}/pam.d/common-auth + fi + + if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/console 0755 root root - -" >> ${D}${sysconfdir}/tmpfiles.d/pam.conf + if ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'true', 'false', d)}; then + echo "d /run/faillock 0755 root root - -" >> ${D}${sysconfdir}/tmpfiles.d/pam.conf + fi + else + echo "d root root 0755 /var/run/console none" >> ${D}${sysconfdir}/default/volatiles/99_pam + if ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'true', 'false', d)}; then + echo "d root root 0755 /var/run/faillock none" >> ${D}${sysconfdir}/default/volatiles/99_pam + fi + fi +} + +PACKAGECONFIG[faillock] = ",,," +RDEPENDS:${PN}-runtime += "${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'pam-plugin-faillock', '', d)}" diff --git a/recipes-extended/psplash/files/psplash-colors.h b/recipes-extended/psplash/files/psplash-colors.h new file mode 100644 index 0000000..a6e405e --- /dev/null +++ b/recipes-extended/psplash/files/psplash-colors.h @@ -0,0 +1,35 @@ +/* + * psplash - a lightweight framebuffer splashscreen for embedded devices. + * + * Copyright (c) 2012 sleep(5) ltd + * Author: Tomas Frydrych + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _HAVE_PSPLASH_COLORS_H +#define _HAVE_PSPLASH_COLORS_H + +/* This is the overall background color */ +//#define PSPLASH_BACKGROUND_COLOR 0xec,0xec,0xe1 +#define PSPLASH_BACKGROUND_COLOR 0x18,0x16,0x13 + +/* This is the color of any text output */ +#define PSPLASH_TEXT_COLOR 0xaf,0xdd,0xe9 + +/* This is the color of the progress bar indicator */ +#define PSPLASH_BAR_COLOR 0xaf,0xdd,0xe9 + +/* This is the color of the progress bar background */ +#define PSPLASH_BAR_BACKGROUND_COLOR 0x18,0x16,0x13 + +#endif diff --git a/recipes-extended/psplash/files/psplash-plcos-img.png b/recipes-extended/psplash/files/psplash-plcos-img.png new file mode 100644 index 0000000..a50d611 Binary files /dev/null and b/recipes-extended/psplash/files/psplash-plcos-img.png differ diff --git a/recipes-extended/psplash/files/psplash-plcos-img.svg b/recipes-extended/psplash/files/psplash-plcos-img.svg new file mode 100644 index 0000000..9434b6b --- /dev/null +++ b/recipes-extended/psplash/files/psplash-plcos-img.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + PLC OS + + + + + diff --git a/recipes-extended/psplash/psplash%.bbappend b/recipes-extended/psplash/psplash%.bbappend new file mode 100644 index 0000000..0f1469a --- /dev/null +++ b/recipes-extended/psplash/psplash%.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SRC_URI += "file://psplash-colors.h" +SPLASH_IMAGES = "file://psplash-plcos-img.png;outsuffix=default" +do_configure:append () { + cp ${S}/../psplash-colors.h ${S} +} diff --git a/recipes-extended/rpi-config/rpi-config%.bbappend b/recipes-extended/rpi-config/rpi-config%.bbappend new file mode 100644 index 0000000..294adee --- /dev/null +++ b/recipes-extended/rpi-config/rpi-config%.bbappend @@ -0,0 +1,4 @@ +do_deploy:append() { +# sed -i "/#kernel=\"\"/ c\kernel=\"${SDIMG_KERNELIMAGE}\"" $CONFIG + sed -i "s/dtoverlay=vc4/#dtoverlay=vc4/g" $CONFIG +} diff --git a/recipes-extended/sudo/sudo%.bbappend b/recipes-extended/sudo/sudo%.bbappend new file mode 100644 index 0000000..2892e8f --- /dev/null +++ b/recipes-extended/sudo/sudo%.bbappend @@ -0,0 +1,5 @@ +do_install:append() { + sed -i 's/# %sudo/%sudo/' ${D}/etc/sudoers +} +#ROOTFS_POSPROCESS_COMMAND += " update_sudoers;" + diff --git a/recipes-extended/wrlinux/kernelconf._cfg b/recipes-extended/wrlinux/kernelconf._cfg new file mode 100644 index 0000000..4cd3ab9 --- /dev/null +++ b/recipes-extended/wrlinux/kernelconf._cfg @@ -0,0 +1 @@ +CONFIG_NO_HZ_FULL=y diff --git a/recipes-extended/wrlinux/wrlinux%._bbappend b/recipes-extended/wrlinux/wrlinux%._bbappend new file mode 100644 index 0000000..b91b79b --- /dev/null +++ b/recipes-extended/wrlinux/wrlinux%._bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}:" +SRC_URI += "file://kernelconf.cfg" diff --git a/recipes-kernel/linux/extra-kernel-src.inc b/recipes-kernel/linux/extra-kernel-src.inc new file mode 100644 index 0000000..ffc4c66 --- /dev/null +++ b/recipes-kernel/linux/extra-kernel-src.inc @@ -0,0 +1,5 @@ +EXTRA_KERNEL_FILES ?= "" +EXTRA_KERNEL_SRC_URI ?= "" + +FILESEXTRAPATHS:prepend := "${EXTRA_KERNEL_FILES}:" +SRC_URI:append = " ${EXTRA_KERNEL_SRC_URI}" diff --git a/recipes-kernel/linux/linux-yocto-dev-extra-kernel-src.inc b/recipes-kernel/linux/linux-yocto-dev-extra-kernel-src.inc new file mode 100644 index 0000000..e5ae9ea --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-dev-extra-kernel-src.inc @@ -0,0 +1,9 @@ +TEMP_KERNEL_FILES ?= "" +TEMP_KERNEL_SRC_URI ?= "" + +TEMP_KERNEL_FILES:qemux86 = "${THISDIR}/linux-yocto:" +TEMP_KERNEL_FILES:qemux86-64 = "${THISDIR}/linux-yocto:" +TEMP_KERNEL_FILES:intel-x86-64 = "${THISDIR}/linux-yocto:" + +EXTRA_KERNEL_FILES =. "${TEMP_KERNEL_FILES}" +EXTRA_KERNEL_SRC_URI += "${TEMP_KERNEL_SRC_URI}" diff --git a/recipes-kernel/linux/linux-yocto-extra-kernel-src.inc b/recipes-kernel/linux/linux-yocto-extra-kernel-src.inc new file mode 100644 index 0000000..b0d407b --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-extra-kernel-src.inc @@ -0,0 +1,8 @@ +EXTRA_KERNEL_FILES =. "${THISDIR}/linux-yocto:" +EXTRA_KERNEL_SRC_URI += "file://0001-tools-build-make-in-target-rule-robust-against-too-l.patch" +EXTRA_KERNEL_SRC_URI:append:bcm-2xxx-rpi4 = " \ + file://0001-Revert-Revert-mmc-sdhci-Mask-spurious-interrupts.patch \ +" + +FILESEXTRAPATHS:prepend := "${EXTRA_KERNEL_FILES}:" +SRC_URI:append = " ${EXTRA_KERNEL_SRC_URI}" diff --git a/recipes-kernel/linux/linux-yocto-rt/0001-Revert-Revert-mmc-sdhci-Mask-spurious-interrupts.patch b/recipes-kernel/linux/linux-yocto-rt/0001-Revert-Revert-mmc-sdhci-Mask-spurious-interrupts.patch new file mode 100644 index 0000000..892291d --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt/0001-Revert-Revert-mmc-sdhci-Mask-spurious-interrupts.patch @@ -0,0 +1,36 @@ +From aaa9ed2dc16c67c576721e3d7951e4c265df866b Mon Sep 17 00:00:00 2001 +From: Jason Wessel +Date: Thu, 16 Jul 2020 20:11:07 -0700 +Subject: [PATCH] Revert "Revert "mmc: sdhci: Mask "spurious" interrupts"" + +This reverts commit a8913cf2ebc7a5bda92b2737271f8869741f6b18 in order +to fix the problem with small mmc cards where the kernel is printing +the message: + +mmc0: Got data interrupt 0x00000002 even though no data operation was in progress. + +Upstream-Status: Pending + +Signed-off-by: Jason Wessel +--- + drivers/mmc/host/sdhci.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c +index 070f7dc42294..2e30fca8b44c 100644 +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -3104,6 +3104,10 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) + result = IRQ_WAKE_THREAD; + } + ++ if ((intmask & SDHCI_INT_DATA_END) && !host->data && ++ host->cmd && (host->cmd == host->cmd->mrq->stop)) ++ intmask &= ~SDHCI_INT_DATA_END; ++ + if (intmask & SDHCI_INT_CMD_MASK) + sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK, &intmask); + +-- +2.17.1 + diff --git a/recipes-kernel/linux/linux-yocto-rt/0001-tools-build-make-in-target-rule-robust-against-too-l.patch b/recipes-kernel/linux/linux-yocto-rt/0001-tools-build-make-in-target-rule-robust-against-too-l.patch new file mode 100644 index 0000000..4379000 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt/0001-tools-build-make-in-target-rule-robust-against-too-l.patch @@ -0,0 +1,49 @@ +From 577a25e1cf79039c01a275bb1a7e630c35af91ae Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Mon, 28 Jul 2025 16:48:24 +0800 +Subject: [PATCH] tools/build: make in-target rule robust against too long + argument error + +The command length of in-target scales with the depth of the directory +times the number of objects in the Makefile. When there are many +objects, and O=[absolute_path] is set, and the absolute_path is +relatively long. It is possile that this line "$(call +if_changed,$(host)ld_multi)" will report error: +"make[4]: /bin/sh: Argument list too long" + +For example, build perf tools with O=/long/output/path + +Like built-in.a and *.mod rules in scripts/Makefile.build, add +$(objpredix)/ by the shell command instead of by Make's builtin +function. + +Upstream-Status: Submitted [https://lore.kernel.org/lkml/20250728093153.2330009-1-changqing.li@windriver.com/] + +Signed-off-by: Changqing Li +--- + tools/build/Makefile.build | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build +index ffe988867703..e26a6c1928b3 100644 +--- a/tools/build/Makefile.build ++++ b/tools/build/Makefile.build +@@ -90,11 +90,13 @@ quiet_cmd_gen = GEN $@ + # If there's nothing to link, create empty $@ object. + quiet_cmd_ld_multi = LD $@ + cmd_ld_multi = $(if $(strip $(obj-y)),\ +- $(LD) -r -o $@ $(filter $(obj-y),$^),rm -f $@; $(AR) rcs $@) ++ printf "$(objprefix)%s " $(patsubst $(objprefix)%,%,$(filter $(obj-y),$^)) | \ ++ xargs $(LD) -r -o $@,rm -f $@; $(AR) rcs $@) + + quiet_cmd_host_ld_multi = HOSTLD $@ + cmd_host_ld_multi = $(if $(strip $(obj-y)),\ +- $(HOSTLD) -r -o $@ $(filter $(obj-y),$^),rm -f $@; $(HOSTAR) rcs $@) ++ printf "$(objprefix)%s " $(patsubst $(objprefix)%,%,$(filter $(obj-y),$^)) | \ ++ xargs $(HOSTLD) -r -o $@,rm -f $@; $(HOSTAR) rcs $@) + + ifneq ($(filter $(obj),$(hostprogs)),) + host = host_ +-- +2.34.1 + diff --git a/recipes-kernel/linux/linux-yocto-rt/tuning-and-support.cfg b/recipes-kernel/linux/linux-yocto-rt/tuning-and-support.cfg new file mode 100644 index 0000000..ab23c30 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt/tuning-and-support.cfg @@ -0,0 +1,411 @@ +CONFIG_LOCALVERSION_AUTO=y +CONFIG_DEFAULT_HOSTNAME="plc" +# CONFIG_NO_HZ_IDLE is not set +CONFIG_NO_HZ_FULL=y +CONFIG_CONTEXT_TRACKING_USER=y +# CONFIG_CONTEXT_TRACKING_USER_FORCE is not set +CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=100 +CONFIG_VIRT_CPU_ACCOUNTING=y +CONFIG_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_RCU_NOCB_CPU=y +# CONFIG_RCU_NOCB_CPU_DEFAULT_ALL is not set +CONFIG_RCU_NOCB_CPU_CB_BOOST=y +# CONFIG_RCU_LAZY is not set +CONFIG_BOOT_CONFIG=y +# CONFIG_BOOT_CONFIG_FORCE is not set +# CONFIG_BOOT_CONFIG_EMBED is not set +CONFIG_X86_CPU_RESCTRL=y +CONFIG_BLK_CGROUP_IOPRIO=y +# CONFIG_NET_EMATCH_CANID is not set +CONFIG_NET_RX_BUSY_POLL=y +# CONFIG_NETCONSOLE is not set +# /////////////////////////// +CONFIG_NUMA_BALANCING=y +# /////////////////////////// +CONFIG_CAN=y +CONFIG_CAN_RAW=y +CONFIG_CAN_BCM=y +CONFIG_CAN_GW=y +# CONFIG_CAN_J1939 is not set +# CONFIG_CAN_ISOTP is not set +# CONFIG_RFKILL_GPIO is not set +CONFIG_NET_SELFTESTS=y +CONFIG_EFI_BOOTLOADER_CONTROL=y +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_TI_ST is not set +# CONFIG_INTEL_MEI_VSC_HW is not set +# CONFIG_GP_PCI1XXXX is not set +# CONFIG_SPI_AX88796C is not set +CONFIG_CX_ECAT=y +# CONFIG_DM9051 is not set +CONFIG_TSNEP=y +# CONFIG_TSNEP_SELFTESTS is not set +CONFIG_NET_VENDOR_ADI=y +# CONFIG_KS8851 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set +# CONFIG_LAN865X is not set +# CONFIG_OA_TC6 is not set +# CONFIG_MSE102X is not set +CONFIG_PHYLIB=y +CONFIG_FIXED_PHY=y +# CONFIG_MICREL_KS8995MA is not set +CONFIG_CAN_DEV=y +# CONFIG_CAN_VCAN is not set +# CONFIG_CAN_VXCAN is not set +CONFIG_CAN_NETLINK=y +CONFIG_CAN_CALC_BITTIMING=y +# CONFIG_CAN_CAN327 is not set +# CONFIG_CAN_KVASER_PCIEFD is not set +# CONFIG_CAN_SLCAN is not set +# CONFIG_CAN_C_CAN is not set +# CONFIG_CAN_CC770 is not set +# CONFIG_CAN_CTUCANFD_PCI is not set +# CONFIG_CAN_ESD_402_PCI is not set +# CONFIG_CAN_IFI_CANFD is not set +# CONFIG_CAN_M_CAN is not set +# CONFIG_CAN_PEAK_PCIEFD is not set +# CONFIG_CAN_SJA1000 is not set +CONFIG_CAN_SOFTING=y + +# +# CAN SPI interfaces +# +# CONFIG_CAN_HI311X is not set +# CONFIG_CAN_MCP251X is not set +# CONFIG_CAN_MCP251XFD is not set +# end of CAN SPI interfaces + +# +# CAN USB interfaces +# +# CONFIG_CAN_8DEV_USB is not set +# CONFIG_CAN_EMS_USB is not set +# CONFIG_CAN_ESD_USB is not set +# CONFIG_CAN_ETAS_ES58X is not set +# CONFIG_CAN_F81604 is not set +# CONFIG_CAN_GS_USB is not set +# CONFIG_CAN_KVASER_USB is not set +# CONFIG_CAN_MCBA_USB is not set +# CONFIG_CAN_PEAK_USB is not set +# CONFIG_CAN_UCAN is not set +# end of CAN USB interfaces + +# CONFIG_CAN_DEBUG_DEVICES is not set +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_BUS=y +CONFIG_FWNODE_MDIO=y +CONFIG_ACPI_MDIO=y +CONFIG_MDIO_DEVRES=y +# CONFIG_WILC1000_SPI is not set +# CONFIG_KEYBOARD_APPLESPI is not set +# CONFIG_KEYBOARD_GPIO is not set +# CONFIG_KEYBOARD_GPIO_POLLED is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_SPI is not set +# CONFIG_TOUCHSCREEN_MSG2638 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_RM_TS is not set +# CONFIG_TOUCHSCREEN_SIS_I2C is not set +# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_DECODER is not set +# CONFIG_INPUT_GPIO_VIBRA is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_PWM_VIBRA is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_SERIO_GPIO_PS2 is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +CONFIG_SERIAL_MCTRL_GPIO=y +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_GPIO is not set +CONFIG_I3C=y +# CONFIG_CDNS_I3C_MASTER is not set +# CONFIG_DW_I3C_MASTER is not set +# CONFIG_SVC_I3C_MASTER is not set +# CONFIG_MIPI_I3C_HCI is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y +# CONFIG_SPI_MEM is not set + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_BUTTERFLY is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_CH341 is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_LM70_LLP is not set +# CONFIG_SPI_MICROCHIP_CORE is not set +# CONFIG_SPI_MICROCHIP_CORE_QSPI is not set +# CONFIG_SPI_LANTIQ_SSC is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PCI1XXXX is not set +# CONFIG_SPI_PXA2XX is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_SIFIVE is not set +# CONFIG_SPI_MXIC is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_AMD is not set + +# +# SPI Multiplexer support +# +# CONFIG_SPI_MUX is not set + +# +# SPI Protocol Masters +# +# CONFIG_SPI_SPIDEV is not set +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y +CONFIG_HSI=y +CONFIG_HSI_BOARDINFO=y + +# +# HSI controllers +# + +# +# HSI clients +# +# CONFIG_HSI_CHAR is not set +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +CONFIG_PINCTRL_AMD=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_FASTPATH_LIMIT=512 +CONFIG_GPIO_ACPI=y +CONFIG_GPIOLIB_IRQCHIP=y +# CONFIG_DEBUG_GPIO is not set +# CONFIG_GPIO_SYSFS is not set +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_CDEV_V1=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_AMDPT is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EXAR is not set +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_GRANITERAPIDS is not set +# CONFIG_GPIO_MB86S7X is not set +# CONFIG_GPIO_AMD_FCH is not set +# end of Memory mapped GPIO drivers + +# +# Port-mapped I/O GPIO drivers +# +# CONFIG_GPIO_VX855 is not set +# CONFIG_GPIO_F7188X is not set +# CONFIG_GPIO_IT87 is not set +# CONFIG_GPIO_SCH311X is not set +# CONFIG_GPIO_WINBOND is not set +# CONFIG_GPIO_WS16C48 is not set +# end of Port-mapped I/O GPIO drivers + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_FXL6408 is not set +# CONFIG_GPIO_DS4520 is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCA9570 is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_TPIC2810 is not set +# end of I2C GPIO expanders + +# +# MFD GPIO expanders +# +# CONFIG_GPIO_ELKHARTLAKE is not set +# end of MFD GPIO expanders + +# +# PCI GPIO expanders +# +# CONFIG_GPIO_AMD8111 is not set +# CONFIG_GPIO_BT8XX is not set +# CONFIG_GPIO_ML_IOH is not set +# CONFIG_GPIO_PCI_IDIO_16 is not set +# CONFIG_GPIO_PCIE_IDIO_24 is not set +# CONFIG_GPIO_RDC321X is not set +# end of PCI GPIO expanders + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_MAX3191X is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set +# CONFIG_GPIO_XRA1403 is not set +# end of SPI GPIO expanders + +# +# USB GPIO expanders +# +# end of USB GPIO expanders + +# +# Virtual GPIO drivers +# +# CONFIG_GPIO_AGGREGATOR is not set +# CONFIG_GPIO_LATCH is not set +# CONFIG_GPIO_MOCKUP is not set +# CONFIG_GPIO_VIRTIO is not set +# CONFIG_GPIO_SIM is not set +# end of Virtual GPIO drivers + +# +# GPIO Debugging utilities +# +# CONFIG_GPIO_SLOPPY_LOGIC_ANALYZER is not set +# CONFIG_GPIO_VIRTUSER is not set +# end of GPIO Debugging utilities + +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_LT3651 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_BQ25980 is not set +# CONFIG_CHARGER_BQ256XX is not set +# CONFIG_CHARGER_RT9455 is not set +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_LTC2947_SPI is not set +# CONFIG_SENSORS_LTC2992 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX31722 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_PWM_FAN is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_MEN_A21_WDT is not set +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_OCELOT is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_TPS65010 is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS6594_SPI is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_CS40L50_SPI is not set +# CONFIG_MFD_INTEL_M10_BMC_SPI is not set +# CONFIG_DRM_PANEL_AUO_A030JTN01 is not set +# CONFIG_DRM_PANEL_ILITEK_ILI9341 is not set +# CONFIG_DRM_PANEL_ORISETECH_OTA5601A is not set +# CONFIG_DRM_PANEL_WIDECHIPS_WS2401 is not set +# CONFIG_DRM_PANEL_MIPI_DBI is not set +# CONFIG_TINYDRM_HX8357D is not set +# CONFIG_TINYDRM_ILI9163 is not set +# CONFIG_TINYDRM_ILI9225 is not set +# CONFIG_TINYDRM_ILI9341 is not set +# CONFIG_TINYDRM_ILI9486 is not set +# CONFIG_TINYDRM_MI0283QT is not set +# CONFIG_TINYDRM_REPAPER is not set +# CONFIG_TINYDRM_ST7586 is not set +# CONFIG_TINYDRM_ST7735R is not set +# CONFIG_FB_VIA is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_BACKLIGHT_KTD253 is not set +# CONFIG_BACKLIGHT_PWM is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_MP3309C is not set +# CONFIG_BACKLIGHT_GPIO is not set +CONFIG_SND_SPI=y +# CONFIG_HID_GOODIX_SPI is not set +# CONFIG_HID_MCP2200 is not set +# CONFIG_USB_CONN_GPIO is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_MMC_SPI is not set +# CONFIG_LEDS_GPIO is not set +# CONFIG_LEDS_LP3952 is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_SPI_BYTE is not set +# CONFIG_LEDS_TRIGGER_GPIO is not set +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1302 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6916 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +# CONFIG_SURFACE3_WMI is not set +# CONFIG_SURFACE_HOTPLUG is not set +# CONFIG_ASUS_TF103C_DOCK is not set +# CONFIG_INTEL_INT0002_VGPIO is not set +# CONFIG_MEEGOPAD_ANX7428 is not set +# CONFIG_PCENGINES_APU2 is not set +# CONFIG_BARCO_P50_GPIO is not set +# CONFIG_LMK04832 is not set +# CONFIG_COMMON_CLK_PWM is not set +CONFIG_PWM=y +# CONFIG_PWM_DEBUG is not set +CONFIG_PWM_CLK=y +# CONFIG_PWM_DWC is not set +CONFIG_PWM_GPIO=y +# CONFIG_PWM_LPSS_PCI is not set +# CONFIG_PWM_LPSS_PLATFORM is not set +# CONFIG_PWM_PCA9685 is not set +CONFIG_GENERIC_PHY=y +CONFIG_PHY_CAN_TRANSCEIVER=y +CONFIG_MULTIPLEXER=y + +# +# Multiplexer drivers +# +# CONFIG_MUX_ADG792A is not set +# CONFIG_MUX_ADGS1408 is not set +# CONFIG_MUX_GPIO is not set +# end of Multiplexer drivers + +CONFIG_COUNTER=y +# CONFIG_INTEL_QEP is not set +# CONFIG_INTERRUPT_CNT is not set +CONFIG_HTE=y +CONFIG_PROC_CPU_RESCTRL=y +# /////////////////////////// +CONFIG_WATCHDOG=y +# /////////////////////////// diff --git a/recipes-kernel/linux/linux-yocto-rt/tuning-and-support.scc b/recipes-kernel/linux/linux-yocto-rt/tuning-and-support.scc new file mode 100644 index 0000000..4602615 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt/tuning-and-support.scc @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +define KFEATURE_DESCRIPTION "enable options for Tuned, EFI autoinstaller, and PLC-relevant GPIO/networking support" +define KFEATURE_COMPATIBILITY all + +kconf hardware tuning-and-support.cfg diff --git a/recipes-kernel/linux/linux-yocto-rt_%.bbappend b/recipes-kernel/linux/linux-yocto-rt_%.bbappend new file mode 100644 index 0000000..956354c --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt_%.bbappend @@ -0,0 +1,11 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +KCONFIG_MODE = "alldefconfig" + +SRC_URI += "file://tuning-and-support.cfg \ + file://tuning-and-support.scc \ +" + +KERNEL_ARTIFACT_NAME = "${KERNEL_VERSION_NAME}" +KERNEL_ARTIFACT_BIN_EXT = "" + + diff --git a/recipes-kernel/linux/linux-yocto-rt_6.%.bbappend b/recipes-kernel/linux/linux-yocto-rt_6.%.bbappend new file mode 100644 index 0000000..d435023 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt_6.%.bbappend @@ -0,0 +1,55 @@ +require wrlinux-yocto-intel-x86.inc + +KBRANCH:intel-x86 = "v6.18/standard/preempt-rt/x86" + +#LINUX_VERSION:intel-x86 ?= "6.18.x" +#6.16.11 +#SRCREV_machine:intel-x86 ?= "5802335e048e47fafcca382486f56315f4ddae1a" + +#6.18 +SRCREV_machine:intel-x86 ?= "5a22348e2f48abb5778f99812dd3c440b4c92b6f" + +require wrlinux-yocto-bcm-2xxx-rpi.inc + +#bcm-2xxx-rpi4-preempt-rt +KMACHINE:rpi = "bcm-2xxx-rpi4" +KARCH:rpi = "arm64" +KBRANCH:rpi = "v6.18/standard/preempt-rt/bcm-2xxx-rpi" +LINUX_RPI_KMETA_BRANCH ?= "yocto-6.18" +LINUX_RPI_BRANCH:rpi ?= "rpi-6.18.y" +LINUX_VERSION:rpi ?= "6.18.28" +#KBUILD_DEFCONFIG:raspberrypi5 ?= "bcm2712_defconfig" + +#KMACHINE is searched for here: https://git.yoctoproject.org/yocto-kernel-cache +KMACHINE:raspberrypi-armv8 = "bcm-2xxx-rpi4" +KARCH:raspberrypi-armv8 = "arm64" +KBRANCH:raspberrypi-armv8 = "v6.18/standard/preempt-rt/bcm-2xxx-rpi" +LINUX_RPI_KMETA_BRANCH ?= "yocto-6.18" +LINUX_RPI_BRANCH:raspberrypi-armv8 ?= "rpi-6.18.y" +LINUX_VERSION:raspberrypi-armv8 ?= "6.18.28" + +#6.16.11 +#SRCREV_machine:rpi ?= "3c53d9a36daa297863d0bac2a1b43f9beefd6614" + +#6.18 +#SRCREV_machine:raspberrypi-armv8 ?= "1127de0ceda6cc5918779c2e9c55345dd27264b0" + +#6.18.28 +SRCREV_machine:raspberrypi-armv8 = "d9479085d6d955c8ef5541d2262714e1ee8def71" +#SRCREV_machine-pi = "66318c5b5cd8145a662303af12ed39ac07eb27cc" +SRCREV_meta:raspberrypi-armv8 = "4ad2f82ee14f9560019f67eb9ddcff1d9e2790f5" + +KBRANCH:arm = "v6.18/standard/preempt-rt/genericarm64" +#LINUX_VERSION:arm ?= "6.16.x" +#6.16.11 +#SRCREV_machine:arm ?= "2562b280a4de0654df5010b49785cb5ce26bb894" + +#6.18 +SRCREV_machine:arm ?= "67be18a7a6b529aacdae063de37a788e498d7378" +#require linux-yocto-wrlinux.inc +#include srcrev.inc +require linux-yocto-extra-kernel-src.inc + +#TARGET_SUPPORTED_KTYPES:append:qemuall = " preempt-rt" + +KERNEL_VERSION_SANITY_SKIP ?= "1" diff --git a/recipes-kernel/linux/linux-yocto-rt_6.18.bbappend b/recipes-kernel/linux/linux-yocto-rt_6.18.bbappend new file mode 100644 index 0000000..7382c52 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-rt_6.18.bbappend @@ -0,0 +1,11 @@ +COMPATIBLE_MACHINE:genericarm64 = "genericarm64" +COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto" +COMPATIBLE_MACHINE:genericx86 = "genericx86" +COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64" + +KMACHINE:beaglebone-yocto ?= "beaglebone" +KMACHINE:genericx86 ?= "common-pc" +KMACHINE:genericx86-64 ?= "common-pc-64" + +KBRANCH:genericarm64 ?= "v6.18/standard/preempt-rt/genericarm64" +SRCREV_machine:genericarm64 ?= "d9b25dac99fc12c4fa33d7c53ed819d1671e07fd" diff --git a/recipes-kernel/linux/linux-yocto-wrlinux.inc b/recipes-kernel/linux/linux-yocto-wrlinux.inc new file mode 100644 index 0000000..cd98b8e --- /dev/null +++ b/recipes-kernel/linux/linux-yocto-wrlinux.inc @@ -0,0 +1,82 @@ +# We need to change the SRC_URI to point to the bare git report in our layer. +# Otherwise the system may decide to fall back to the yoctoproject URL in some +# cases. This would end up causing problems either due to incorrect SRCREV +# entries or by missing critical patches. +addhandler linux_yocto_rewrite_uri +linux_yocto_rewrite_uri[eventmask] = "bb.event.RecipePreFinalise" + +# Disable shallow tarball for kernel +BB_GIT_SHALLOW = "0" + +python linux_yocto_rewrite_uri() { + pass +} + +python linux_yocto_rewrite_uri:osv-wrlinux() { + d = e.data + + layer_path="${LAYER_PATH_wrlinux}" + + if not d.getVar("LAYER_PATH_wrlinux"): + bb.warn("Unable to replace SRC_URI paths with wrlinux layer paths. LAYER_PATH_wrlinux is not defined.") + return + + # We only care about the SRC_URI as it is defined right now. We do NOT + # want to expand it. + src_uri=d.getVar("SRC_URI", False) + + # We need the -file- PV, not the actual PV... + pv = d.expand("${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or 'dev'}") + + # Replace the kernel URI. + if os.path.exists("%s/git/linux-yocto.git" % (d.expand(layer_path))): + src_uri = src_uri.replace("git://git.yoctoproject.org/linux-yocto.git", "git://${LAYER_PATH_wrlinux}/git/linux-yocto.git;protocol=file") + src_uri = src_uri.replace(";protocol=https", "") + + if os.path.exists("%s/git/linux-yocto-dev.git" % (d.expand(layer_path))): + src_uri = src_uri.replace("git://git.yoctoproject.org/linux-yocto-dev.git", "git://${LAYER_PATH_wrlinux}/git/linux-yocto-dev.git;protocol=file") + src_uri = src_uri.replace(";protocol=https", "") + + if os.path.exists("%s/git/linux-yocto-%s.git" % (d.expand(layer_path), pv)): + src_uri = src_uri.replace("git://git.yoctoproject.org/linux-yocto.git", "git://${LAYER_PATH_wrlinux}/git/linux-yocto-%s.git;protocol=file" % (pv)) + src_uri = src_uri.replace("git://git.yoctoproject.org/linux-yocto-%s.git" % (pv), "git://${LAYER_PATH_wrlinux}/git/linux-yocto-%s.git;protocol=file" % (pv)) + src_uri = src_uri.replace(";protocol=https", "") + + # Replace the kernel-cache URI. + if os.path.exists("%s/git/yocto-kernel-cache.git" % d.expand(layer_path)): + src_uri = src_uri.replace("git://git.yoctoproject.org/yocto-kernel-cache", "git://${LAYER_PATH_wrlinux}/git/yocto-kernel-cache.git;protocol=file") + src_uri = src_uri.replace(";protocol=https", "") + + # The kernel-cache branch is hard coded by oe-core. We need to make this adjutable. + if d.getVar("KERNEL_CACHE_BRANCH_%s" % pv): + import re + src_uri = re.sub('(yocto-kernel-cache.*;branch=)([^;]*)', '\\1${KERNEL_CACHE_BRANCH_%s}' % pv, src_uri) + + if d.getVar("SRCREV_meta_%s" % pv): + d.setVar("SRCREV_meta", d.getVar("SRCREV_meta_%s" % pv)) + + if d.getVar("LINUX_VERSION_%s" % pv): + d.setVar("LINUX_VERSION", d.getVar("LINUX_VERSION_%s" % pv)) + + d.setVar("SRC_URI", src_uri) +} + +# +# Verify that the defined KTYPE is in TARGET_SUPPORTED_KTYPES (if defined) +# +# This will help detect non-supported/non-tested configurations. +# +python () { + kernel_type = d.getVar('LINUX_KERNEL_TYPE') + supported_types = d.getVar('TARGET_SUPPORTED_KTYPES') + + # Skip checking, as supported types is blank + if not supported_types or not kernel_type: + return + + if kernel_type not in supported_types.split(): + raise bb.parse.SkipPackage('(version %s) The defined LINUX_KERNEL_TYPE (%s) used by\ + this recipe is not in TARGET_SUPPORTED_KTYPES (%s). To override add the type\ + to the supported list in your local.conf, such as:\ + TARGET_SUPPORTED_KTYPES:append = " %s"' % (d.getVar('PV'), kernel_type, supported_types, kernel_type)) +} diff --git a/recipes-kernel/linux/linux-yocto.inc b/recipes-kernel/linux/linux-yocto.inc new file mode 100644 index 0000000..4d0a726 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto.inc @@ -0,0 +1,97 @@ +SUMMARY = "Linux kernel" +SECTION = "kernel" +LICENSE = "GPL-2.0-with-Linux-syscall-note" +HOMEPAGE = "https://www.yoctoproject.org/" + +LIC_FILES_CHKSUM ?= "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+\.\d+(\.\d+)*)" + +RECIPE_NO_UPDATE_REASON = "Recipe is updated through a separate process" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required +# by the use of AUTOREV SRCREVs, which are the default for this recipe. +python () { + if d.getVar("KERNEL_PACKAGE_NAME") == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != d.getVar("PN"): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN"))) +} + +DEPENDS += "xz-native bc-native" +DEPENDS:append:aarch64 = " libgcc" +KERNEL_CC:append:aarch64 = " ${TOOLCHAIN_OPTIONS}" +KERNEL_LD:append:aarch64 = " ${TOOLCHAIN_OPTIONS}" + +DEPENDS:append:nios2 = " libgcc" +KERNEL_CC:append:nios2 = " ${TOOLCHAIN_OPTIONS}" +KERNEL_LD:append:nios2 = " ${TOOLCHAIN_OPTIONS}" + +DEPENDS:append:arc = " libgcc" +KERNEL_CC:append:arc = " ${TOOLCHAIN_OPTIONS}" +KERNEL_LD:append:arc = " ${TOOLCHAIN_OPTIONS}" + +KERNEL_FEATURES:append:qemuall = " features/debug/printk.scc features/taskstats/taskstats.scc" + +KERNEL_FEATURES:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'efi', 'cfg/efi.scc', '', d)}" +KERNEL_FEATURES:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'numa', 'features/numa/numa.scc', '', d)}" +KERNEL_FEATURES:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'vfat', 'cfg/fs/vfat.scc', '', d)}" + +KERNEL_FEATURES_RISCV = "\ + arch/riscv/tunes/riscv-isa-clear.scc \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'rv 32 i m a', 'arch/riscv/tunes/riscv-isa-rv32i.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'rv 64 i m a', 'arch/riscv/tunes/riscv-isa-rv64i.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'f d', 'arch/riscv/tunes/riscv-isa-fpu.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'c', 'arch/riscv/tunes/riscv-isa-c.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'v', 'arch/riscv/tunes/riscv-isa-v.scc', '', d)} \ + ${@bb.utils.contains_any('TUNE_FEATURES', 'b zba', 'arch/riscv/tunes/riscv-isa-zba.scc', '', d)} \ + ${@bb.utils.contains_any('TUNE_FEATURES', 'b zbb', 'arch/riscv/tunes/riscv-isa-zbb.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'zbc', 'arch/riscv/tunes/riscv-isa-zbc.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'zicbom', 'arch/riscv/tunes/riscv-isa-zicbom.scc', '', d)} \ + " + +KERNEL_FEATURES:append:riscv32 = " ${KERNEL_FEATURES_RISCV}" +KERNEL_FEATURES:append:riscv64 = " ${KERNEL_FEATURES_RISCV}" + +# A KMACHINE is the mapping of a yocto $MACHINE to what is built +# by the kernel. This is typically the branch that should be built, +# and it can be specific to the machine or shared +# KMACHINE = "UNDEFINED" + +LINUX_VERSION_EXTENSION ??= "-yocto-${LINUX_KERNEL_TYPE}" + +# Pick up shared functions +inherit kernel +inherit kernel-yocto + +B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build" + +do_install:append(){ + if [ -n "${KMETA}" ]; then + rm -rf ${STAGING_KERNEL_DIR}/${KMETA} + fi +} + +# enable kernel-sample for oeqa/runtime/cases's ksample.py test +KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc" + +KERNEL_DEBUG ?= "" +# These used to be version specific, but are now common dependencies. New +# tools / dependencies will continue to be added in version specific recipes. +DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}' +DEPENDS += "openssl-native util-linux-native" +DEPENDS += "gmp-native libmpc-native" + +# Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme +do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}' + +EXTRA_OEMAKE += '${@bb.utils.contains("KERNEL_DEBUG", "True", "", "PAHOLE=false", d)}' + +do_devshell:prepend() { + # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) + d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig") + d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig") + d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}") + d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1") + d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR") +} diff --git a/recipes-kernel/linux/srcrev.inc b/recipes-kernel/linux/srcrev.inc new file mode 100644 index 0000000..5bcdff9 --- /dev/null +++ b/recipes-kernel/linux/srcrev.inc @@ -0,0 +1,81 @@ +# +# This file is generated based on: +# linux-yocto-6.12 +# yocto-kernel-cache +# +# Any manual changes will be overwritten. +# +# This will cause SRCREV_machine:kb- take priority over SRCREV_machine: +MACHINEOVERRIDES .= ":kb-${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/kernel', 'linux-yocto-dev', 'dev-', '', d)}${@d.getVar('KBRANCH', True).replace("/", "-")}" + +# linux-yocto-6.12 entries + +# linux-yocto-6.12 branch entries +SRCREV_machine:kb-master ?= "0bcda530593bba114c23c9e6fa9f268062975390" +LINUX_VERSION:kb-master = "6.12" +SRCREV_machine:kb-v6.12-base ?= "fcd03f7736b1fa2b2181a7306d14008aa36b66ed" +LINUX_VERSION:kb-v6.12-base = "6.12.53" +SRCREV_machine:kb-v6.12-standard-arm-versatile-926ejs ?= "e646fbdc560660a283cb67b585c37ae73610c31b" +LINUX_VERSION:kb-v6.12-standard-arm-versatile-926ejs = "6.12.55" +SRCREV_machine:kb-v6.12-standard-base ?= "c77f4d163458157a4c88d9cd9e175543a5d20140" +LINUX_VERSION:kb-v6.12-standard-base = "6.12.55" +SRCREV_machine:kb-v6.12-standard-bcm-2xxx-rpi ?= "b659edeccbae65cf8137f265a6e2c6f1eba76a6e" +LINUX_VERSION:kb-v6.12-standard-bcm-2xxx-rpi = "6.12.55" +SRCREV_machine:kb-v6.12-standard-beaglebone ?= "c77f4d163458157a4c88d9cd9e175543a5d20140" +LINUX_VERSION:kb-v6.12-standard-beaglebone = "6.12.55" +SRCREV_machine:kb-v6.12-standard-intel-socfpga ?= "8faea548ade849fd24182a234d54efa1fd4c268c" +LINUX_VERSION:kb-v6.12-standard-intel-socfpga = "6.12.55" +SRCREV_machine:kb-v6.12-standard-mti-malta32 ?= "b1b7883585a3e1adce260c566b8986b5c8d5a12e" +LINUX_VERSION:kb-v6.12-standard-mti-malta32 = "6.12.55" +SRCREV_machine:kb-v6.12-standard-mti-malta64 ?= "74368748436dddfe2b5cef23fe9f4c149709cc97" +LINUX_VERSION:kb-v6.12-standard-mti-malta64 = "6.12.55" +SRCREV_machine:kb-v6.12-standard-nvidia-sdk-5.15-nvidia-soc ?= "3addb0eef4c10a266b8bca1a5bb6a619c30a42f5" +LINUX_VERSION:kb-v6.12-standard-nvidia-sdk-5.15-nvidia-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-nxp-sdk-6.12-nxp-soc ?= "2d27eadebae92d56bb69704dcac123290b76d73a" +LINUX_VERSION:kb-v6.12-standard-nxp-sdk-6.12-nxp-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-nxp-sdk-6.6-nxp-s32g ?= "4628e3f8a1542aa854d27eafea12751b331cdd47" +LINUX_VERSION:kb-v6.12-standard-nxp-sdk-6.6-nxp-s32g = "6.12.55" +SRCREV_machine:kb-v6.12-standard-octeon ?= "4c154a90a70706ae46933eaa5f71c2a13fe913ba" +LINUX_VERSION:kb-v6.12-standard-octeon = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-arm-versatile-926ejs ?= "d74a69ac9d434abbae5021e514e83ea813775891" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-arm-versatile-926ejs = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-base ?= "014bc4e5637527525b6f97f58a09f2207c140293" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-base = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-bcm-2xxx-rpi ?= "cee95b89d5e5358215a9570de5d7e9faeeec378e" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-bcm-2xxx-rpi = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-intel-socfpga ?= "b5077648775ff6e6c57fe394486eaa0eb9d7ee5c" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-intel-socfpga = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-nvidia-sdk-5.15-nvidia-soc ?= "6ea93a77cbc05d80f522e30755ae8e2a6c20440d" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-nvidia-sdk-5.15-nvidia-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-nxp-sdk-6.12-nxp-soc ?= "a464b62e9b8fcac1887970df64388f4544acbd55" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-nxp-sdk-6.12-nxp-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-nxp-sdk-6.6-nxp-s32g ?= "8a13f422f9dfb002f1497c8b98314f5fc05a67a9" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-nxp-sdk-6.6-nxp-s32g = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-octeon ?= "66dc0481a93a7192ec8adbf459d09ce70a091a77" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-octeon = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-ti-soc ?= "97f11b7ffed8aff9cf01f555cd7aa1f33b361874" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-ti-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-x86 ?= "d16dcac5c2c71dfb181d17b1ed3e85082ec78b13" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-x86 = "6.12.55" +SRCREV_machine:kb-v6.12-standard-preempt-rt-xlnx-soc ?= "78500a88b0637f3fa86d838f3d3498658d1c164a" +LINUX_VERSION:kb-v6.12-standard-preempt-rt-xlnx-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-qemuppc ?= "c77f4d163458157a4c88d9cd9e175543a5d20140" +LINUX_VERSION:kb-v6.12-standard-qemuppc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-ti-soc ?= "4c3c5837e32a22365967f3c4b4b66c64afd2f586" +LINUX_VERSION:kb-v6.12-standard-ti-soc = "6.12.55" +SRCREV_machine:kb-v6.12-standard-tiny-arm-versatile-926ejs ?= "15565008bcd072d528a893adf6ae16dbfdc88dfa" +LINUX_VERSION:kb-v6.12-standard-tiny-arm-versatile-926ejs = "6.12.55" +SRCREV_machine:kb-v6.12-standard-tiny-base ?= "c77f4d163458157a4c88d9cd9e175543a5d20140" +LINUX_VERSION:kb-v6.12-standard-tiny-base = "6.12.55" +SRCREV_machine:kb-v6.12-standard-tiny-x86 ?= "c77f4d163458157a4c88d9cd9e175543a5d20140" +LINUX_VERSION:kb-v6.12-standard-tiny-x86 = "6.12.55" +SRCREV_machine:kb-v6.12-standard-x86 ?= "feb5948c4a93aacabf8ab95d75b09490ae14175b" +LINUX_VERSION:kb-v6.12-standard-x86 = "6.12.55" +SRCREV_machine:kb-v6.12-standard-xilinx-zynqmp ?= "c77f4d163458157a4c88d9cd9e175543a5d20140" +LINUX_VERSION:kb-v6.12-standard-xilinx-zynqmp = "6.12.55" +SRCREV_machine:kb-v6.12-standard-xlnx-soc ?= "943e14e768b4dbc38c0089910c6e4b91a7730cda" +LINUX_VERSION:kb-v6.12-standard-xlnx-soc = "6.12.55" + +# yocto-kernel-cache entries +KERNEL_CACHE_BRANCH_6.12 = "yocto-6.12" +SRCREV_meta_6.12 = "cdfa30c73acdf1f1c341047eb747fe94e97a2e8f" diff --git a/recipes-kernel/linux/wrlinux-yocto-bcm-2xxx-rpi.inc b/recipes-kernel/linux/wrlinux-yocto-bcm-2xxx-rpi.inc new file mode 100644 index 0000000..f62cac8 --- /dev/null +++ b/recipes-kernel/linux/wrlinux-yocto-bcm-2xxx-rpi.inc @@ -0,0 +1,10 @@ +# +# Copyright (C) 2019 Wind River Systems, Inc. +# + +# TARGET_SUPPORTED_KTYPES:rpi = "standard preempt-rt" +# COMPATIBLE_MACHINE:rpi = "(bcm-2xxx-rpi4|bcm-2xxx-rpi5)" +# KMACHINE:rpi = "bcm-2xxx-rpi4" + +inherit siteinfo +KERNEL_DTC_FLAGS:append:rpi = " -@ -H epapr" diff --git a/recipes-kernel/linux/wrlinux-yocto-intel-x86.inc b/recipes-kernel/linux/wrlinux-yocto-intel-x86.inc new file mode 100644 index 0000000..d622bd8 --- /dev/null +++ b/recipes-kernel/linux/wrlinux-yocto-intel-x86.inc @@ -0,0 +1,30 @@ +COMPATIBLE_MACHINE:intel-x86-64 = "intel-x86-64" + +#add the depends of cdrtools-native to make sure it is +#always built to support the usb-image & iso-image UEFI +#booting by default without explicitly add the configure +#option of "--enable-bootimage=iso" + +DEPENDS:append:intel-x86-64 = " cdrtools-native" + +# A method to install/update for bzImage on a deployed target +KERNELLOADEREXTENSION:append:intel-x86-64 = " kernel-grub" + +TARGET_SUPPORTED_KTYPES:intel-x86 = "standard preempt-rt" + +# When using qat17 or qat20 as the provider of virtual/qat, the out-of-tree QAT drivers will conflict +# with the in-tree ones. So remove in-tree QAT drivers when using qat17 or qat20 in template feature/intel-qat. +do_install:append:intel-x86() { + if [ -n "${@bb.utils.contains_any('PREFERRED_PROVIDER_virtual/qat', [ 'qat17', 'qat20' ], '1', '', d)}" ];then + rm -rf ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/crypto/intel/qat + if [ "`ls -A ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/crypto/intel`" = "" ];then + rm -rf ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/crypto/intel + fi + if [ "`ls -A ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/crypto`" = "" ];then + rm -rf ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/crypto + fi + fi +} + +# Set the maximum supported CPU count to 512 +KERNEL_FEATURES:append:intel-x86-64 = " cfg/cpu_nr_512.scc" diff --git a/recipes-rt/README b/recipes-rt/README new file mode 100644 index 0000000..0144d68 --- /dev/null +++ b/recipes-rt/README @@ -0,0 +1,13 @@ +The recipes-rt recipes provide package and image recipes for using and testing +the PREEMPT_RT kernel. The core-image-rt*.bb images are minimal images with +a couple extra packages, including rt-tests. In order to build the image with +the linux-yocto-rt kernel, be sure to include the following line in your +local.conf, bblayers.conf, or your $MACHINE.conf. + +PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt" + +If you are creating a new BSP which should use linux-yocto-rt by default, +use the line above in the $MACHINE.conf in your BSP layer, and specify the +following in a linux-yocto-rt bbappend recipe: + +COMPATIBLE_MACHINE:$MACHINE = $MACHINE diff --git a/recipes-rt/images/core-image-rt-sdk.bb b/recipes-rt/images/core-image-rt-sdk.bb new file mode 100644 index 0000000..fbe617c --- /dev/null +++ b/recipes-rt/images/core-image-rt-sdk.bb @@ -0,0 +1,20 @@ +require recipes-core/images/core-image-minimal.bb + +# Skip processing of this recipe if linux-yocto-rt is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers. +python () { + if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") +} + +DESCRIPTION = "Small image capable of booting a device with a test suite and \ +tools for real-time use. It includes the full meta-toolchain, development \ +headers and libraries to form a standalone SDK." +DEPENDS += "linux-yocto-rt" + +IMAGE_FEATURES += "dev-pkgs tools-sdk tools-debug eclipse-debug tools-profile tools-testapps" + +IMAGE_INSTALL += "rt-tests hwlatdetect kernel-dev" + +LICENSE = "MIT" diff --git a/recipes-rt/images/core-image-rt.bb b/recipes-rt/images/core-image-rt.bb new file mode 100644 index 0000000..053d232 --- /dev/null +++ b/recipes-rt/images/core-image-rt.bb @@ -0,0 +1,17 @@ +require recipes-core/images/core-image-minimal.bb + +# Skip processing of this recipe if linux-yocto-rt is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers. +python () { + if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") +} + +DESCRIPTION = "A small image just capable of allowing a device to boot plus a \ +real-time test suite and tools appropriate for real-time use." +DEPENDS += "linux-yocto-rt" + +IMAGE_INSTALL += "rt-tests hwlatdetect" + +LICENSE = "MIT" diff --git a/recipes-rt/rt-tests/files/0001-Makefile-Allow-for-CC-and-AR-to-be-overridden.patch b/recipes-rt/rt-tests/files/0001-Makefile-Allow-for-CC-and-AR-to-be-overridden.patch new file mode 100644 index 0000000..fface76 --- /dev/null +++ b/recipes-rt/rt-tests/files/0001-Makefile-Allow-for-CC-and-AR-to-be-overridden.patch @@ -0,0 +1,29 @@ +From 7cf4cf097895bd4c3f3d3a6f783c766b3173cf1a Mon Sep 17 00:00:00 2001 +From: Randy Witt +Date: Fri, 16 Oct 2020 16:54:30 -0700 +Subject: [PATCH] Makefile: Allow for CC and AR to be overridden + +The Makefile previously allowed for this but it was removed upstream in +commit 7763cf316d7896fa05b816a46998f0827ab6e6eb. + +Signed-off-by: Randy Witt + +Upstream-Status: Inappropriate [other] + +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 223a839..a735584 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,6 +2,6 @@ + VERSION = 2.8 +-CC = $(CROSS_COMPILE)gcc +-AR = $(CROSS_COMPILE)ar ++CC ?= $(CROSS_COMPILE)gcc ++AR ?= $(CROSS_COMPILE)ar + + OBJDIR = bld + diff --git a/recipes-rt/rt-tests/files/rt_bmark.py b/recipes-rt/rt-tests/files/rt_bmark.py new file mode 100755 index 0000000..5d22623 --- /dev/null +++ b/recipes-rt/rt-tests/files/rt_bmark.py @@ -0,0 +1,412 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C) 2015 Enea Software AB +# Author: Thomas Lundström + +# The script measures interrupt latency together with different types of +# system load. This is done using the programs cyclictest and stress. +# +# The main output is: +# +# Best case (min) latency +# This has very limited value, but is presented since it can be done +# easily +# +# Average latency +# This value is of interrest for throughput oriented systems. Limited +# value for a real-time system. Also presented because it is easy to do. +# +# Worst case (max) latency +# This is the interesting number for a real-time system. The number +# presented is (of cource) the largest number observed. The challenge +# is to know how the observed worst case relates to the actual worst case. +# +# To get an indication of the confidence, the following method is used: +# 1) Instead of one long run, the measurement is made as a set of shorter +# runs. The number of runs must be a power of 2 for reasons that will +# shorlty be obvious +# +# 2) First, a list of the max values are created. +# +# 3) The smallest value in that list is recorded. +# +# 4) Then a new list is create by taking the max value of each pair of +# values in the original list. In this list the smallest value is +# recorded. +# +# 5) Step 3 is repeated until there is only one value in the list. See +# example below: +# +# Samples: +# | 44 | | | | | +# | 77 | 77 | | | | +# | 118 | | | | | +# | 119 | 119 | 119 | | | +# | 138 | | | | | +# | 57 | 138 | | | | +# | 175 | | | | | +# | 130 | 175 | 175 | 175 | | +# | 54 | | | | | +# | 150 | 150 | | | | +# | 47 | | | | | +# | 59 | 59 | 150 | | | +# | 199 | | | | | +# | 115 | 199 | | | | +# | 177 | | | | | +# | 129 | 177 | 199 | 199 | 199 | +# +# Smallest value: +# | 44 | 59 | 119 | 175 | 199 | +# +# 6) The generated list of smallest values is analyzed. In this case, it +# can be observed that the values are increasing significantly through +# the entire list, which leads to the conclusion that the number of +# samples is too small. +# If instead the list had been (167, 191, 196, 199, 199), there had +# been a very small, or no, increase at the end of the list. We might +# then suspect that the number of samples is probably large enough. +# There is however no guarantee for that. +# +# Steps 1-2 are done in run_cyclictest_suite +# Steps 3-5 are done in gen_minmax_list. +# Step 6 needs to be done manually since there is (yet) no well defined +# FAIL criterion and a theoretically solid PASS criterion may never be +# available. + +import multiprocessing +import os +import re +import signal +import subprocess +import time +import traceback + +# See comment on the function set_hung_tmo +has_hung_task_detection = True + +#------------------------------------------------------------------------------- + +class TestFail(Exception): + def __init__(self, msg): + self.msg = msg + + def __str__(self): + return "Test failure: (" + self.msg + ")" + +#------------------------------------------------------------------------------- + +def tc_name(sub_name): + return "rt_bmark.intlat." + sub_name + +#------------------------------------------------------------------------------- +# log() does the same job as print except that a '#' is added at the beginning +# of each line. This causes TEFEL to ignore it + +def log(*msg): + tmp = "".join(map(str, msg)) # 'map(str, ...' allows numbers + for line in tmp.splitlines(): + print("#", line) + +#------------------------------------------------------------------------------- +# Like log(), but with a timestamp added + +def log_ts(*msg): + ts = time.localtime() + stamp = "%2d:%02d:%02d: " % (ts.tm_hour, ts.tm_min, ts.tm_sec) + log(stamp, *msg) + +#------------------------------------------------------------------------------- + +def log_test_header(seq_no, nr_of_tests, name): + log("=" * 78) + log() + log(" Test case (%d/%d): %s" % (seq_no, nr_of_tests, tc_name(name))) + log() + log("." * 78) + log() + +#------------------------------------------------------------------------------- + +def start_stress(*args): + stress_cmd = [ "stress-ng" ] + added_stress_types = [] + req_stress_types = set(args) + cpu_cnt = str(multiprocessing.cpu_count()) + + # The function cond_add_stress appends the options to the stress + # command if the stress type is in the set of requested stress types + + def cond_add_stress(stress_type, options): + if stress_type in req_stress_types: + req_stress_types.remove(stress_type) + added_stress_types.append(stress_type) + stress_cmd.extend(options) + + #---------- + + cond_add_stress("io", ["-i", cpu_cnt]) + cond_add_stress("cpu", ["-c", cpu_cnt]) + cond_add_stress("hdd", ["-d", cpu_cnt, "--hdd-bytes", "20M"]) + cond_add_stress("vm", ["-m", cpu_cnt, "--vm-bytes", "10M"]) + + unknown = ", ".join(req_stress_types) + if unknown != "": + raise TestFail("Unknown stress type(s): %s" % unknown) + + if not added_stress_types: + log("No stress requested") + return None + + added = "+".join(added_stress_types) + stress_cmd_str = " ".join(stress_cmd) + + log("Starting stress(", added, ")") + log(" Command: '", stress_cmd_str, "'") + log() + + # start_new_session causes stress to be executed in a separate + # session, => it gets a new process group (incl. children). It + # can then be terminated using os.killpg in end_stress without + # terminating this script. + + p = subprocess.Popen(stress_cmd, start_new_session=True) + + return p + +#------------------------------------------------------------------------------- + +def end_stress(p): + if p is None: + # The value None indicates that no stress scenario was started + return + + if p.poll() is not None: + raise TestFail("stress prematurely terminated.") + + os.killpg(os.getpgid(p.pid), signal.SIGTERM) + log("Terminated stress") + +#------------------------------------------------------------------------------- + +def us2hms_str(us): + s = (us+500000) // 1000000 # Round microseconds to s + m = s//60 + s -= 60*m; + h = m//60 + m -= 60*h + + return "%d:%02d:%02d" % (h, m, s) + +#------------------------------------------------------------------------------- +# Sometime the hung task supervision is triggered during execution of +# cyclictest (cyclictest starves stress). To avoid that, the supervision +# is temporarily disabled + +def set_hung_tmo(new_tmo): + global has_hung_task_detection + + tmo_file = "/proc/sys/kernel/hung_task_timeout_secs" + + if not has_hung_task_detection: + return + + if not os.access(tmo_file, os.W_OK): + log("Hung task detection not supported") + log(" (File ", tmo_file, " not found)") + has_hung_task_detection = False + return + + orig_tmo = int(subprocess.check_output(["cat", tmo_file]).strip()) + if new_tmo != orig_tmo: + cmd = ( "echo " + str(new_tmo) + " > " + tmo_file ) + subprocess.check_output(cmd, shell=True) + log("Changed timeout for detection of hung tasks: ", + orig_tmo, " -> ", new_tmo) + + return orig_tmo + +#------------------------------------------------------------------------------- + +def gen_minmax_list(max_list): + res = [min(max_list)] + + while True: + tmp = max_list + max_list = [] + while tmp: + max_list.append(max(tmp.pop(0), tmp.pop(0))) + + res.append(min(max_list)) + + if len(max_list) < 2: + return res + +#------------------------------------------------------------------------------- +# Parameters for cyclictest: +# +# On the -S option (from cyclictest.c): +# -S implies options -a -t -n and same priority of all threads +# -a: One thread per core +# -n: use clock_nanosleep instead of posix interval timers +# -t: (without argument) Set number of threads to the number +# of cpus + +interval_core_0 = 100 # Timer interval on core 0 [us] +interval_delta = 20 # Interval increment for each core [us] +loop_count = 30000 # Number of loops (on core 0). + +cmd = ("cyclictest", + "-S", # Standard SMP testing. See below + "-p", "99", # RT priority 99 + "-q", # Quiet mode, i.e. print only a summary + "-i", str(interval_core_0), + "-d", str(interval_delta), + "-l", str(loop_count) + ) +rex = re.compile(r"C:\s*(\d+).*Min:\s*(\d+).*Avg:\s*(\d+).*Max:\s*(\d+)") + +def run_cyclictest_once(): + res = subprocess.check_output(cmd) + + # minlist and maxlist are lists with the extremes for each core + # avg_cnt is the sum of cycles for all cores + # avg_sum is the sum of (cycle count*average) for each core + # Since cyclictest runs different number of cycles on + # different cores, avg_sum/avg_cnt gives a more accurate + # value of the overall average than just taking the average + # of each core's averages + + minlist = [] + maxlist = [] + avg_sum = 0 + avg_cnt = 0 + + for line in res.splitlines(): + m = rex.search(line.decode('utf-8')) + if m is not None: + minlist.append(int(m.group(2))) + maxlist.append(int(m.group(4))) + n = int(m.group(1)) + avg_sum += n * int(m.group(3)) + avg_cnt += n + + return min(minlist), [avg_sum, avg_cnt], max(maxlist) + +#------------------------------------------------------------------------------- +# A precondition for the tracking of min-max values is that +# the suite size os a power of 2. + +N = 5 +suite_size = 2**N + +est_exec_time_once = interval_core_0 * loop_count +est_exec_time_suite = suite_size * est_exec_time_once + +def run_cyclictest_suite(): + log("Starting cyclictest") + log(" Command : ", " ".join(cmd)) + log(" Number of cycles : ", loop_count*suite_size, + " (", suite_size, " sets of ", loop_count, " cycles)") + log(" Exec. time (est) : ", us2hms_str(est_exec_time_suite)) + log() + + orig_tmo = set_hung_tmo(0) # 0 => Disable + + # float('inf') emulates infinity. At least in the sense that it is + # guaranteed to be larger than any actual number. + ack_min = float('inf') + ack_avg = [0, 0] + + log() + log_ts("Start of execution") + t = time.time() + max_list = [] + + for i in range(0, suite_size): + tmp_min, tmp_avg, tmp_max = run_cyclictest_once() + + msg = "%2d/%2d:" % (i+1, suite_size) + msg += " min: %4d" % tmp_min + msg += " avg: %5.1f" % (float(tmp_avg[0])/tmp_avg[1]) + msg += " max: %4d" % tmp_max + log_ts(msg) + + # Track minimum value + if tmp_min < ack_min: + ack_min = tmp_min + + # Track smallest max value + max_list.append(tmp_max) + + ack_avg[0] += tmp_avg[0] + ack_avg[1] += tmp_avg[1] + + t = time.time()-t + log_ts("Cyclictest completed. Actual execution time:", + us2hms_str(t*1000000)) + log() + set_hung_tmo(orig_tmo) + + return ack_min, float(ack_avg[0])/ack_avg[1], gen_minmax_list(max_list) + +#------------------------------------------------------------------------------- + +class cyclictest_runner: + def run_test(self, seq_no, nr_of_tests, name, stressparams): + + try: + log_test_header(seq_no, nr_of_tests, name) + + p = start_stress(*stressparams) + + bm_min, bm_avg, bm_max_list = run_cyclictest_suite() + + end_stress(p) + + bm_max = bm_max_list[-1] + + log() + log("Min: %d us" % bm_min) + log("Avg: %.1f us" % bm_avg) + log("Max: %d us" % bm_max) + log() + log("Max list: ", bm_max_list) + log() + log("PASS") + + print() + print(tc_name(name), "[Min/us,Avg/us,Max/us]:",) + print("%d,%.1f,%d" % (bm_min,bm_avg, bm_max)) + print("PASS:", tc_name(name)) + print() + + except Exception: + log() + log("Exception!") + log() + log("Traceback:", traceback.format_exc()) + log() + log("WD: ", os.getcwd()) + log() + log("FAIL") + print() + print("FAIL:", tc_name(name)) + print() + +#------------------------------------------------------------------------------- + +runner = cyclictest_runner() + +tests = (("no_stress", []), + ("cpu", ["cpu"]), + ("hdd", ["hdd"]), + ("io", ["io"]), + ("vm", ["vm"]), + ("full", ["io", "cpu", "hdd", "vm"]), + ) + +nr_of_tests = len(tests) +for seq_no, params in enumerate(tests, start=1): + runner.run_test(seq_no, nr_of_tests, *params) diff --git a/recipes-rt/rt-tests/files/run-ptest b/recipes-rt/rt-tests/files/run-ptest new file mode 100644 index 0000000..b7c5e29 --- /dev/null +++ b/recipes-rt/rt-tests/files/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +python3 ./rt_bmark.py diff --git a/recipes-rt/rt-tests/hwlatdetect_git.bb b/recipes-rt/rt-tests/hwlatdetect_git.bb new file mode 100644 index 0000000..2dcc809 --- /dev/null +++ b/recipes-rt/rt-tests/hwlatdetect_git.bb @@ -0,0 +1,26 @@ +SUMMARY = "Hardware latency detector" +DESCRIPTION = "Python utility for controlling the kernel hardware latency detection module (hwlat_detector.ko)." +HOMEPAGE = "https://rt.wiki.kernel.org/index.php/Cyclictest" +SECTION = "tests" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" + +require rt-tests.inc +inherit python3-dir + +EXTRA_OEMAKE += "PYLIB=${libdir}/python${PYTHON_BASEVERSION}/dist-packages" + +do_compile() { + oe_runmake hwlatdetect +} + +do_install() { + oe_runmake install_hwlatdetect DESTDIR=${D} SBINDIR=${sbindir} \ + MANDIR=${mandir} INCLUDEDIR=${includedir} + + sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${libdir}/python${PYTHON_BASEVERSION}/dist-packages/hwlatdetect.py +} + +FILES:${PN} += "${libdir}/python${PYTHON_BASEVERSION}/dist-packages/hwlatdetect.py" +RDEPENDS:${PN} = "python3-core " +RRECOMMENDS:${PN} = "kernel-module-hwlat-detector" diff --git a/recipes-rt/rt-tests/rt-tests.inc b/recipes-rt/rt-tests/rt-tests.inc new file mode 100644 index 0000000..2042768 --- /dev/null +++ b/recipes-rt/rt-tests/rt-tests.inc @@ -0,0 +1,6 @@ +SRCREV = "9166c3f0bb9c5d3e31dc80aff165a5073b5ac5be" +PV = "2.9" +PE = "1" + +SRC_URI = "git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git;branch=main;protocol=https;tag=v${PV}" + diff --git a/recipes-rt/rt-tests/rt-tests_git.bb b/recipes-rt/rt-tests/rt-tests_git.bb new file mode 100644 index 0000000..1f48e14 --- /dev/null +++ b/recipes-rt/rt-tests/rt-tests_git.bb @@ -0,0 +1,36 @@ +SUMMARY = "Real-Time preemption testcases" +HOMEPAGE = "https://wiki.linuxfoundation.org/realtime/documentation/start" +DESCRIPTION = "The main aim of the PREEMPT_RT patch is to minimize the amount of kernel code that is non-preemptible Therefore several substitution mechanisms and new mechanisms are implemented." +SECTION = "tests" +DEPENDS = "linux-libc-headers virtual/libc numactl" +LICENSE = "GPL-2.0-only & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" + +require rt-tests.inc +inherit ptest + +SRC_URI += " \ + file://run-ptest \ + file://rt_bmark.py \ + file://0001-Makefile-Allow-for-CC-and-AR-to-be-overridden.patch \ + " + +# rt-tests needs PI mutex support in libc +COMPATIBLE_HOST:libc-musl = 'null' + +# Do not install hwlatdetect +EXTRA_OEMAKE += "PYLIB=''" + +do_install() { + oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} \ + INCLUDEDIR=${includedir} +} + +do_install_ptest() { + cp ${UNPACKDIR}/rt_bmark.py ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += " stress-ng python3 python3-multiprocessing python3-datetime python3-misc" + +FILES:${PN} += "${prefix}/src/backfire" +RDEPENDS:${PN} += "bash" diff --git a/recipes-utils/lat-plot/files/lat-plot b/recipes-utils/lat-plot/files/lat-plot new file mode 100644 index 0000000..6ec2dbb --- /dev/null +++ b/recipes-utils/lat-plot/files/lat-plot @@ -0,0 +1,90 @@ +#!/bin/sh + +##modifiable variables +#high-level parameters +runtime=3600 +corelist=-1 +interval=200 +full_test=0 +do_stress=1 +mode="svg" +out_dir=$(pwd) + +#stress parameters +c_hogs=2 +v_hogs=2 +v_mem="128M" +d_hogs=1 +i_hogs=2 + +#constants +start_dir=$(pwd) +work_dir="/tmp/tuned" +hist_max=400 + +#handle optional arguments + + +#end option handling +c_str="" +v_str="" +d_str="" +i_str="" + +if [ $c_hogs -gt 0 ]; then + c_str="-c $c_hogs" +fi +if [ $v_hogs -gt 0 ]; then + v_str="--vm $v_hogs --vm-bytes $v_mem" +fi +if [ $d_hogs -gt 0 ]; then + d_str="-d $d_hogs" +fi +if [ $i_hogs -gt 0 ]; then + i_str="-i $i_hogs" +fi + +n_intervals=$(($runtime*1000000/$interval)) + +mkdir -p $work_dir && cd $work_dir +if [ $do_stress = 1 ]; then + stress $c_str $v_str $d_str $i_str -t $((runtime+1)) & +fi +sudo cyclictest -m -t -a2-3 -c1 -p98 -i$interval -h$hist_max -l$n_intervals --mainaffinity=0 -q >output +max=`grep "Max Latencies" output | tr " " "\n" | sort -n | tail -1 | sed s/^0*//` +grep -v -e "^#" -e "^$" output | tr " " "\t" >histogram +ncores=2 +fn="plot."$mode +for j in `seq 1 $ncores` +do + column=`expr $j + 1` + cut -f1,$column histogram >histogram$j +done +echo -n -e "set title \"Latency plot\"\n\ +set terminal $mode\n\ +set xlabel \"Latency (us), max $max us\"\n\ +set logscale y\n\ +set xrange [0:$hist_max]\n\ +set yrange [0.8:*]\n\ +set ylabel \"Number of latency samples\"\n\ +set output \"$fn\"\n\ +plot " >plotcmd +for j in `seq 1 $ncores` +do + if test $j != 1 + then + echo -n ", " >>plotcmd + fi + cpuno=`expr $j - 1` + if test $cpuno -lt 10 + then + title=" CPU$cpuno" + else + title="CPU$cpuno" + fi + echo -n "\"histogram$j\" using 1:2 title \"$title\" with histeps" >>plotcmd +done +gnuplot -persist = "1" ]; then +# N_RT_REQ=$1 +#fi + +REALTIME_RESTART_THRESHOLD=1 +RESTART_FILE="/var/tmp/realtime_setup_restarts" +GRUB_FILE="/boot/EFI/BOOT/grub.cfg" +GRUB_LINUX_CFG="/etc/grub.d/10_linux" + +touch /var/tmp/realtime_setup_restarts +num_restarts=$(cat "$RESTART_FILE" | tr -dc '0-9') +curProfile=$(tuned-adm active | grep "realtime") +#TODO use tuned-adm verify instead, as active profile doesn't mean it has all parameters set correctly +if [[ -z "$num_restarts" ]] || [[ ! -z "$curProfile" ]]; then + num_restarts=0 + echo "0" > $RESTART_FILE +fi +if [[ -z "$curProfile" ]] && (( $num_restarts <= $REALTIME_RESTART_THRESHOLD )); then + #TODO actually check grub file and only overwrite if it is not generated by grub-mkconfig + echo "updating GRUB file: $GRUB_FILE" + sed -i 's/GRUB_DISABLE_LINUX_PARTUUID=true/GRUB_DISABLE_LINUX_PARTUUID=false/g' $GRUB_LINUX_CFG + grub-mkconfig > $GRUB_FILE + sed -i '/\tload_video/d' $GRUB_FILE + sed -i '/gzio/d' $GRUB_FILE + sed -i '/echo/d' $GRUB_FILE + tuned-adm profile realtime + num_restarts=$((num_restarts+1)) + echo "$num_restarts" > $RESTART_FILE + systemctl reboot --message="applied realtime profile; rebooting" +fi +if (( $num_restarts > $REALTIME_RESTART_THRESHOLD )); then + echo "unable to set real-time Tuned profile after $num_restarts system restarts" + return 1 +fi + +echo 0 > /sys/devices/system/machinecheck/machinecheck0/check_interval + +#TODO the following should really adjust dynamically based on the actual cores allocated by tuned +pqos -R +pqos -e 'l2:0=0x0f;l2:1=0xf0' +pqos -a 'llc:0=0,1;llc:2=2,3' +for i in $(cat /proc/interrupts | grep '^ *[0-9]*[0-9]:' | awk {'print $1'} | sed 's/:$//'); +do + if [ "$i" = "0" ]; then + continue + fi + if [ "$i" = "2" ]; then + continue + fi + echo 1 > /proc/irq/$i/smp_affinity +done +for i in $(pgrep rcu); +do + flags=$(cut -f 9 -d ' ' /proc/$i/stat) + if [ ! $((flags & 0x04000000)) ]; then + taskset -pc 0 $i > /dev/null + fi +done diff --git a/recipes-utils/rt-setup/files/rt.service b/recipes-utils/rt-setup/files/rt.service new file mode 100644 index 0000000..c7b3630 --- /dev/null +++ b/recipes-utils/rt-setup/files/rt.service @@ -0,0 +1,8 @@ +[Unit] +Description=Initialize RT Cores + +[Service] +ExecStart=/bin/bash /usr/bin/rt-setup + +[Install] +WantedBy=multi-user.target diff --git a/recipes-utils/rt-setup/rt-setup_0.0.bb b/recipes-utils/rt-setup/rt-setup_0.0.bb new file mode 100644 index 0000000..592f9cc --- /dev/null +++ b/recipes-utils/rt-setup/rt-setup_0.0.bb @@ -0,0 +1,58 @@ +LICENSE = "MIT" +#MY_FILES = +LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit systemd +SYSTEMD_AUTO_ENABLE:${PN} = "enable" +SYSTEMD_SERVICE:${PN} = "rt.service" + + +SRC_URI:append = "file://rt-setup \ + file://rt.service \ + file://COPYING.MIT \ + " + +# python3targetconfig: configuration for the target machine is accessible (such as correct installation directories) +# autotools-brokensep: autotools build process (without support for building outside of ${S}) +# pkgconfig: standard way to get header and library information by using pkg-config +#inherit autotools-brokensep pkgconfig python3native + +# Modify these as desired +PV = "0.0" +#SRCREV = "bcbf35634ccf49ff39261b291f01ca0c4a5fddd5" + +#S = "${WORKDIR}/git" +# LinuxCNC build separation is broken, so we need to build in src +#B = "${S}/src" +S = '${UNPACKDIR}' +TARGET_CC_ARCH += " ${LDFLAGS}" +####################################################### +# autotools fixes +####################################################### +#AUTOTOOLS_SCRIPT_PATH = "${B}" + +# We need to replace autotools_preconfigure with our own, because it deletes ${B} otherwise +# since S != B in our case (but B is still *inside* S) +#DEPENDS += " tk8 tcl8 tcl8-native tk8-native freetype" +#RDEPENDS:${PN} += " rt-tests " +#PREFERRED_VERSION:tk8 = "8.6.%" +RDEPENDS:${PN} += " bash " + +#inherit autotools + +FILES:${PN} += " /usr/bin/rt-setup \ + ${systemd_unitdir}/system/rt.service \ +" +FILES:${PN}-dev = " " +FILES:${PN}-dbg = " " + + + +do_install () { + install -d ${D}/usr/bin + #install -d ${D}${sysconfdir}/init.d + install -d ${D}${systemd_unitdir}/system + install -m 0755 ${UNPACKDIR}/rt.service ${D}${systemd_unitdir}/system/rt.service + install -m 0755 ${UNPACKDIR}/rt-setup ${D}/usr/bin/rt-setup + #update-rc.d -r ${D} rt-setup start 03 S . +} diff --git a/recipes-utils/tuned/files/10_linux b/recipes-utils/tuned/files/10_linux new file mode 100755 index 0000000..03b7eb9 --- /dev/null +++ b/recipes-utils/tuned/files/10_linux @@ -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@ +} + diff --git a/recipes-utils/tuned/files/grubenv_location.patch b/recipes-utils/tuned/files/grubenv_location.patch new file mode 100644 index 0000000..935a725 --- /dev/null +++ b/recipes-utils/tuned/files/grubenv_location.patch @@ -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 diff --git a/recipes-utils/tuned/files/tuned-boot-path.patch b/recipes-utils/tuned/files/tuned-boot-path.patch new file mode 100644 index 0000000..42a00f5 --- /dev/null +++ b/recipes-utils/tuned/files/tuned-boot-path.patch @@ -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 diff --git a/recipes-utils/tuned/files/tuned-dev.patch b/recipes-utils/tuned/files/tuned-dev.patch new file mode 100644 index 0000000..830c4bb --- /dev/null +++ b/recipes-utils/tuned/files/tuned-dev.patch @@ -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 diff --git a/recipes-utils/tuned/tuned_2.26.bb b/recipes-utils/tuned/tuned_2.26.bb new file mode 100644 index 0000000..5e385ae --- /dev/null +++ b/recipes-utils/tuned/tuned_2.26.bb @@ -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"