diff --git a/COPYING.MIT b/LICENSE similarity index 83% rename from COPYING.MIT rename to LICENSE index 89de3547..52f1e28f 100644 --- a/COPYING.MIT +++ b/LICENSE @@ -1,3 +1,9 @@ +The MIT License (MIT) + +Copyright (c) Common Horizon Community and Contributors + +All rights reserved. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -5,13 +11,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README b/README deleted file mode 100644 index a5ad7e23..00000000 --- a/README +++ /dev/null @@ -1,25 +0,0 @@ -OpenEmbedded/Yocto DISTRO Layer for TorizonCore -=============================================== - -TorizonCore is an embedded Linux distribution for the Torizon platform. It -features, among other essential services, a container runtime and components -for secure remote over-the-air (OTA) updates. - -This layer provides the necessary metadata to build the TorizonCore Linux -distribution on top of Toradex's BSP Linux reference image. - -Building -======== - -To build TorizonCore, see the following article: - -https://developer.toradex.com/knowledge-base/build-torizoncore - -License -======= - -All metadata is MIT licensed unless otherwise stated. Source code and -binaries included in tree for individual recipes is under the LICENSE -stated in each recipe (.bb file) unless otherwise stated. - -This README document is Copyright (C) 2019 Toradex AG. diff --git a/README.md b/README.md new file mode 100644 index 00000000..9ddfd0ec --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# Common Torizon OS + +![Common Torizon cover image](https://github.com/commontorizon/Documentation/blob/main/assets/img/commonTorizonCore800.png?raw=true) + +Common Torizon OS is an embedded Linux distribution for the [Torizon Cloud](https://app.torizon.io/). It +features, among other essential services, a container runtime and components +for secure remote over-the-air (OTA) updates. + +This layer provides the necessary metadata to build the Common Torizon OS Linux +distribution. + +> ⚠️ **DISCLAIMER:** this is a derivative work from Torizon OS open source project. Torizon™ is a registered trademark of Toradex Group AG. This derivative work have not been reviewed or approved by Toradex. Common Torizon community does not talk on behalf of Toradex. +> +>⚠️ **This software is provided experimentally as-is.** + +## Building + +General documentation for the community can be found here: + +## Feature Support + +Our goal is to have Common Torizon OS in feature parity with Torizon OS. The table below shows the current status of each key feature: + +| Feature | Toradex SoM | Rpi3 | Rpi4 | Nezha D1 | x86-64 | Beagle Bone Black | Rpi Zero W2 | BeaglePlay | Rpi Zero W | QEMU x86-64 | QEMU arm64 | +| ---------------------------- | ----------- | ---- | ---- | -------- | ------ | ----------------- | ----------- | ---------- | ---------- | ----------- | ---------- | +| OTA Update OS Image | ✅ | ✅ | ✅ | | ✅ | | ✅ | | ✅ | ✅ | | +| OTA Update Container App | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| OTA Update Bootloader | ✅ | | | | | | | | | | | +| Device Monitoring | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| LTS Hardware & BSP | ✅ | | | | | | | | | | | +| Free Technical Support | ✅ | | | | | | | | | | | +| Prebuilt Torizon OS Image | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| QA Approved Releases | ✅ | | | | | | | | | | | +| Provisioning with TEZI* | ✅ | | | | | | | | | | | +| Image Customizing with TCB** | ✅ | | | | | | | | | | | +| VS Code extension 2 support | ✅ | ✅ | ✅ | ⚠️*** | ⚠️*** | ✅ | ✅ | ✅ | ⚠️*** | ⚠️*** | ✅ | + +> ⚠️* **TEZI**: Toradex Easy Installer +⚠️** **TCB**: TorizonCore Builder +⚠️*** **VS Code Extension**: are not all the templates that support RISC-V and x86-64 architectures + +## License + +All metadata is [MIT licensed](./LICENSE) unless otherwise stated. Source code and +binaries included in tree for individual recipes is under the LICENSE +stated in each recipe unless otherwise stated. diff --git a/classes/image_type_torizon.bbclass b/classes/image_type_torizon.bbclass index 054b24af..e88dd28a 100644 --- a/classes/image_type_torizon.bbclass +++ b/classes/image_type_torizon.bbclass @@ -28,7 +28,7 @@ EXTRA_IMAGECMD:ota-ext4:qemuarm64 = "-O ^64bit,^metadata_csum -L otaroot -i 4096 IMAGE_CMD:ota:prepend() { if [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then - cp -a ${DEPLOY_DIR_IMAGE}/boot.scr-${MACHINE} ${OTA_SYSROOT}/boot.scr + cp -a ${DEPLOY_DIR_IMAGE}/boot.scr-${MACHINE} ${OTA_SYSROOT}/boot.scr fi } do_image_ota[depends] += "${@'u-boot-default-script:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}" @@ -39,7 +39,8 @@ def get_tdx_ostree_purpose(purpose): TDX_OSTREE_PURPOSE ?= "${@get_tdx_ostree_purpose(d.getVar('TDX_PURPOSE'))}" # Use new branch naming -OSTREE_BRANCHNAME = "${TDX_MAJOR}/${MACHINE}/${DISTRO}/${IMAGE_BASENAME}/${TDX_OSTREE_PURPOSE}" +OSTREE_BRANCHNAME = "${TDX_RELEASE}-${MACHINE}" +GARAGE_TARGET_VERSION = "${TDX_RELEASE}" # Force ostree summary to be updated OSTREE_UPDATE_SUMMARY = "1" @@ -479,7 +480,7 @@ get_torizon_prov_data2() { # but may have different permissions; make sure they are correct. chmod 0750 "${destdir}/import/repo" || true chmod 0750 "${destdir}/import/director" || true - + if [ "${TORIZON_SOTA_PROV_MODE}" = "online" ]; then tmp="${destdir}/tmp/provision.json" dst="${destdir}/auto-provisioning.json" diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass new file mode 100644 index 00000000..18311dff --- /dev/null +++ b/classes/image_types_ostree.bbclass @@ -0,0 +1,290 @@ +# OSTree deployment +inherit features_check + +REQUIRED_DISTRO_FEATURES = "usrmerge" + +OSTREE_ROOTFS ??= "${WORKDIR}/ostree-rootfs" +OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" +OSTREE_COMMIT_BODY ??= "" +OSTREE_COMMIT_VERSION ??= "${DISTRO_VERSION}" +OSTREE_UPDATE_SUMMARY ??= "0" + +BUILD_OSTREE_TARBALL ??= "1" + +GARAGE_PUSH_RETRIES ??= "3" +GARAGE_PUSH_RETRIES_SLEEP ??= "0" + +SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd', 'true', '')}" + +IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" +CONVERSION_CMD:tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${TAR_IMAGE_ROOTFS} . || [ $? -eq 1 ]" +CONVERSIONTYPES:append = " tar" + +TAR_IMAGE_ROOTFS:task-image-ostree = "${OSTREE_ROOTFS}" + +do_image_ostree[dirs] = "${OSTREE_ROOTFS}" +do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" +do_image_ostree[depends] = "coreutils-native:do_populate_sysroot virtual/kernel:do_deploy ${INITRAMFS_IMAGE}:do_image_complete" +IMAGE_CMD:ostree () { + # Copy required as we change permissions on some files. + tar --xattrs --xattrs-include='*' -cf - -S -C ${IMAGE_ROOTFS} -p . | tar --xattrs --xattrs-include='*' -xf - -C ${OSTREE_ROOTFS} + + for d in var/*; do + if [ "${d}" != "var/local" ]; then + rm -rf ${d} + fi + done + + # Create sysroot directory to which physical sysroot will be mounted + mkdir sysroot + ln -sf sysroot/ostree ostree + + mkdir -p usr/rootdirs + + mv etc usr/ + + 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} + 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 OSTREE_BRANCHNAME for future information + mkdir -p usr/share/sota/ + echo -n "${OSTREE_BRANCHNAME}" > usr/share/sota/branchname + + # home directories get copied from the OE root later to the final sysroot + # Create a symlink to var/rootdirs/home to make sure the OSTree deployment + # redirects /home to /var/rootdirs/home. + rm -rf home/ + ln -sf var/rootdirs/home home + + # Move persistent directories to /var + dirs="opt 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 + rm -rf ${dir} + fi + + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/rootdirs/${dir}; chmod 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} + fi + ln -sf var/rootdirs/${dir} ${dir} + done + + if [ -d root ] && [ ! -L root ]; then + if [ "$(ls -A root)" ]; then + bbfatal "Data in /root directory is not preserved by OSTree." + fi + + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/roothome 0700 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/roothome; chmod 700 /var/roothome" >>${tmpfiles_conf} + fi + + rm -rf root + ln -sf var/roothome root + fi + + if [ -d usr/local ] && [ ! -L usr/local ]; then + if [ "$(ls -A usr/local)" ]; then + bbfatal "Data in /usr/local directory is not preserved by OSTree." + fi + rm -rf usr/local + fi + + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/usrlocal 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/usrlocal; chmod 755 /var/usrlocal" >>${tmpfiles_conf} + fi + + dirs="bin etc games include lib man sbin share src" + + for dir in ${dirs}; do + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/usrlocal/${dir} 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/usrlocal/${dir}; chmod 755 /var/usrlocal/${dir}" >>${tmpfiles_conf} + fi + done + + ln -sf ../var/usrlocal usr/local + + # Copy image manifest + cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest +} + +IMAGE_TYPEDEP:ostreecommit = "ostree" +do_image_ostreecommit[depends] += "ostree-native:do_populate_sysroot" +do_image_ostreecommit[lockfiles] += "${OSTREE_REPO}/ostree.lock" +IMAGE_CMD:ostreecommit () { + if ! ostree --repo=${OSTREE_REPO} refs 2>&1 > /dev/null; then + ostree --repo=${OSTREE_REPO} init --mode=archive-z2 + fi + + # Commit the result + ostree_target_hash=$(ostree --repo=${OSTREE_REPO} commit \ + --tree=dir=${OSTREE_ROOTFS} \ + --skip-if-unchanged \ + --branch=${OSTREE_BRANCHNAME} \ + --subject="${OSTREE_COMMIT_SUBJECT}" \ + --body="${OSTREE_COMMIT_BODY}" \ + --add-metadata-string=version="${OSTREE_COMMIT_VERSION}" \ + ${EXTRA_OSTREE_COMMIT}) + + echo $ostree_target_hash > ${WORKDIR}/ostree_manifest + + if [ ${@ oe.types.boolean('${OSTREE_UPDATE_SUMMARY}')} = True ]; then + ostree --repo=${OSTREE_REPO} summary -u + fi +} + +IMAGE_TYPEDEP:ostreepush = "ostreecommit" +do_image_ostreepush[depends] += "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot" +do_image_ostreepush[lockfiles] += "${OSTREE_REPO}/ostree.lock" +do_image_ostreepush[network] = "1" +IMAGE_CMD:ostreepush () { + + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then + garage-push --loglevel 0 --repo=${OSTREE_REPO} \ + --ref=${OSTREE_BRANCHNAME} \ + --credentials=${SOTA_PACKED_CREDENTIALS} \ + --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt + else + bbwarn "Torizon SOTA_PACKED_CREDENTIALS file does not exist." + fi + else + bbwarn "Torizon SOTA_PACKED_CREDENTIALS not set. Please add SOTA_PACKED_CREDENTIALS." + fi +} + +IMAGE_TYPEDEP:garagesign = "ostreepush" +do_image_garagesign[depends] += "unzip-native:do_populate_sysroot" +# This lock solves OTA-1866, which is that removing GARAGE_SIGN_REPO while using +# garage-sign simultaneously for two images often causes problems. +do_image_garagesign[lockfiles] += "${DEPLOY_DIR_IMAGE}/garagesign.lock" +do_image_garagesign[network] = "1" +IMAGE_CMD:garagesign () { + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + # if credentials are issued by a server that doesn't support offline signing, exit silently + unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 + + java_version=$( java -version 2>&1 | awk -F '"' '/version/ {print $2}' ) + if [ "${java_version}" = "" ]; then + bbfatal "Java is required for synchronization with update backend, but is not installed on the host machine" + elif [ "${java_version}" \< "1.8" ]; then + bbfatal "Java version >= 8 is required for synchronization with update backend" + fi + + rm -rf ${GARAGE_SIGN_REPO} + garage-sign init --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} \ + --credentials ${SOTA_PACKED_CREDENTIALS} + + ostree_target_hash=$(cat ${WORKDIR}/ostree_manifest) + + # Use OSTree target hash as version if none was provided by the user + target_version=${ostree_target_hash} + if [ -n "${GARAGE_TARGET_VERSION}" ]; then + target_version=${GARAGE_TARGET_VERSION} + bbwarn "Target version is overriden with GARAGE_TARGET_VERSION variable. This is a dangerous operation! See https://docs.ota.here.com/ota-client/latest/build-configuration.html#_overriding_target_version" + elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then + target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version") + bbwarn "Target version is overriden with target_version file. This is a dangerous operation! See https://docs.ota.here.com/ota-client/latest/build-configuration.html#_overriding_target_version" + fi + + # Push may fail due to race condition when multiple build machines try to push simultaneously + # in which case targets.json should be pulled again and the whole procedure repeated + push_success=0 + target_url="" + if [ -n "${GARAGE_TARGET_URL}" ]; then + target_url="--url ${GARAGE_TARGET_URL}" + fi + target_expiry="" + if [ -n "${GARAGE_TARGET_EXPIRES}" ] && [ -n "${GARAGE_TARGET_EXPIRE_AFTER}" ]; then + bbfatal "Both GARAGE_TARGET_EXPIRES and GARAGE_TARGET_EXPIRE_AFTER are set. Only one can be set at a time." + elif [ -n "${GARAGE_TARGET_EXPIRES}" ]; then + target_expiry="--expires ${GARAGE_TARGET_EXPIRES}" + elif [ -n "${GARAGE_TARGET_EXPIRE_AFTER}" ]; then + target_expiry="--expire-after ${GARAGE_TARGET_EXPIRE_AFTER}" + else + target_expiry="--expire-after 1M" + fi + + for push_retries in $( seq ${GARAGE_PUSH_RETRIES} ); do + garage-sign targets pull --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} + garage-sign targets add --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} \ + --name ${GARAGE_TARGET_NAME} \ + --format OSTREE \ + --version ${target_version} \ + --length 0 \ + ${target_url} \ + --sha256 ${ostree_target_hash} \ + --hardwareids ${SOTA_HARDWARE_ID} + if [ -n "${GARAGE_CUSTOMIZE_TARGET}" ]; then + bbplain "Running command(${GARAGE_CUSTOMIZE_TARGET}) to customize target" + ${GARAGE_CUSTOMIZE_TARGET} \ + ${GARAGE_SIGN_REPO}/tufrepo/roles/unsigned/targets.json \ + ${GARAGE_TARGET_NAME}-${target_version} + fi + garage-sign targets sign --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} \ + ${target_expiry} \ + --key-name=targets + errcode=0 + garage-sign targets push --repo tufrepo \ + --home-dir ${GARAGE_SIGN_REPO} || errcode=$? + if [ "$errcode" -eq "0" ]; then + push_success=1 + break + else + bbwarn "Push to garage repository has failed with errcode ${errcode}, retrying ${push_retries}/${GARAGE_PUSH_RETRIES}" + if [ "${GARAGE_PUSH_RETRIES_SLEEP}" -ne "0" ]; then + ramdom="$(date +%s%N | cut -b10-19)" + sleep="$(expr ${ramdom} % ${GARAGE_PUSH_RETRIES_SLEEP} + 1)" + bbdebug 1 "Push to garage repository in ${sleep} seconds" + sleep ${sleep} + fi + fi + done + rm -rf ${GARAGE_SIGN_REPO} + + if [ "$push_success" -ne "1" ]; then + bbfatal_log "Couldn't push to garage repository" + fi + fi +} + +IMAGE_TYPEDEP:garagecheck = "garagesign" +do_image_garagecheck[network] = "1" +IMAGE_CMD:garagecheck () { + if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then + # if credentials are issued by a server that doesn't support offline signing, exit silently + unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 + + ostree_target_hash=$(cat ${WORKDIR}/ostree_manifest) + + garage-check --ref=${ostree_target_hash} \ + --credentials=${SOTA_PACKED_CREDENTIALS} \ + --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt + fi +} +# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/classes/rust-target-config.bbclass b/classes/rust-target-config.bbclass index 21a56ede..e564b54a 100644 --- a/classes/rust-target-config.bbclass +++ b/classes/rust-target-config.bbclass @@ -245,6 +245,13 @@ TARGET_POINTER_WIDTH[riscv64gc] = "64" TARGET_C_INT_WIDTH[riscv64gc] = "64" MAX_ATOMIC_WIDTH[riscv64gc] = "64" +## riscv64-unknown-linux-{gnu, musl} +DATA_LAYOUT[riscv64] = "e-m:e-p:64:64-i64:64-i128:128-n64-S128" +TARGET_ENDIAN[riscv64] = "little" +TARGET_POINTER_WIDTH[riscv64] = "64" +TARGET_C_INT_WIDTH[riscv64] = "64" +MAX_ATOMIC_WIDTH[riscv64] = "64" + ## loongarch64-unknown-linux-{gnu, musl} DATA_LAYOUT[loongarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128" TARGET_ENDIAN[loongarch64] = "little" diff --git a/conf/common/sanity.inc b/conf/common/sanity.inc new file mode 100644 index 00000000..80cee704 --- /dev/null +++ b/conf/common/sanity.inc @@ -0,0 +1,19 @@ +addhandler common_torizon_sanity_handler +common_torizon_sanity_handler[eventmask] = "bb.event.ParseCompleted" + +python common_torizon_sanity_handler() { + tdx_debug = d.getVar("TDX_DEBUG", "0") + tdx_image = d.getVar("TDX_IMAGE", "torizon-core-common-docker") + machine = d.getVar("MACHINE", "undefined") + + if tdx_image == "torizon-core-common-docker-dev": + if tdx_debug != "1": + bb.fatal(f"You are trying to build a development image with TDX_DEBUG={tdx_debug}\n\n") + else: + # for common Torizon OS we are only allowing to build development images + bb.fatal( + f"\n\nYou are trying to build {machine} with TDX_IMAGE={tdx_image}" \ + "\nPlease build with TDX_IMAGE=torizon-core-common-docker-dev" \ + "\nhttps://github.com/commontorizon/Documentation/blob/main/BUILDING.md\n\n" + ) +} diff --git a/conf/distro/include/torizon-os-version.inc b/conf/distro/include/torizon-os-version.inc new file mode 100644 index 00000000..139ec29c --- /dev/null +++ b/conf/distro/include/torizon-os-version.inc @@ -0,0 +1,8 @@ + +TDX_MAJOR = "6" +TDX_MINOR = "7" +TDX_PATCH = "0" + +TDX_RELEASE = "${TDX_MAJOR}.${TDX_MINOR}.${TDX_PATCH}-common" + +TDX_COMMON = "1" diff --git a/conf/distro/include/torizon.inc b/conf/distro/include/torizon.inc index 839e1f36..8cf1d7f3 100644 --- a/conf/distro/include/torizon.inc +++ b/conf/distro/include/torizon.inc @@ -51,12 +51,15 @@ IMAGE_BOOT_FILES_REMOVE:sota = "boot.scr-${MACHINE};boot.scr overlays.txt overla IMAGE_BOOT_FILES_REMOVE:append:apalis-imx8 = " hdmitxfw.bin dpfw.bin" DISTRO_FEATURES:append = " virtualization stateless-system" +# FIXME: We need the opengl for beagleplay, but this can be an issue for +# upstream, so I'm comenting here to not forget in the next rebase DISTRO_FEATURES:remove = "3g alsa irda pcmcia nfc ldconfig pulseaudio wayland x11 ptest multiarch vulkan" -DISTRO_FEATURES:imx-generic-bsp:remove = "opengl" +# FIXME: This can be an issue for the upstream, so we are only commenting +# instead of removing it. # No need for x11 even for native -DISTRO_FEATURES_NATIVE:imx-generic-bsp:remove = "x11" -DISTRO_FEATURES_NATIVESDK:imx-generic-bsp:remove = "x11" +# DISTRO_FEATURES_NATIVE:remove = "x11" +# DISTRO_FEATURES_NATIVESDK:remove = "x11" # Note, enable or disable the useradd-staticids in a configured system, # the TMPDIR/DEPLOY_DIR/SSTATE_DIR may contain incorrect uid/gid values. @@ -72,6 +75,8 @@ BBMASK += " \ /meta-freescale/recipes-graphics/cairo \ /openembedded-core/meta/recipes-devtools/cargo \ /openembedded-core/meta/recipes-devtools/rust \ + /openembedded-core/meta/recipes-connectivity/connman \ + /meta-updater/recipes-connectivity/connman/ \ " # machines where TorizonCore is experimental diff --git a/conf/distro/torizon-xenomai3.conf b/conf/distro/torizon-xenomai3.conf new file mode 100644 index 00000000..84381dce --- /dev/null +++ b/conf/distro/torizon-xenomai3.conf @@ -0,0 +1,11 @@ +require conf/distro/torizon.conf + +DISTRO = "torizon-xenomai3" +DISTRO_NAME = "TorizonCore with Xenomai 3" + +DISTRO_FLAVOUR = " (XENOMAI3)" +DISTRO_FLAVOUR:experimental = " (XENOMAI3 EXPERIMENTAL)" + +DISTROOVERRIDES .= ":xenomai3" + +IMAGE_BASENAME_SUFFIX = "-xenomai3" diff --git a/conf/distro/torizon-xenomai4.conf b/conf/distro/torizon-xenomai4.conf new file mode 100644 index 00000000..5342fe8d --- /dev/null +++ b/conf/distro/torizon-xenomai4.conf @@ -0,0 +1,11 @@ +require conf/distro/torizon.conf + +DISTRO = "torizon-xenomai4" +DISTRO_NAME = "TorizonCore with Xenomai 4" + +DISTRO_FLAVOUR = " (XENOMAI4)" +DISTRO_FLAVOUR:experimental = " (XENOMAI4 EXPERIMENTAL)" + +DISTROOVERRIDES .= ":xenomai4" + +IMAGE_BASENAME_SUFFIX = "-xenomai4" diff --git a/conf/layer.conf b/conf/layer.conf index 4cde3346..34a8b807 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -4,9 +4,16 @@ BBPATH .= ":${LAYERDIR}" # We have a recipes directory, add to BBFILES BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend" -BBFILE_COLLECTIONS += "meta-toradex-torizon" -BBFILE_PATTERN_meta-toradex-torizon := "^${LAYERDIR}/" -BBFILE_PRIORITY_meta-toradex-torizon = "90" +BBFILE_COLLECTIONS += "meta-common-torizon" +BBFILE_PATTERN_meta-common-torizon := "^${LAYERDIR}/" +BBFILE_PRIORITY_meta-common-torizon = "90" -LAYERDEPENDS_meta-toradex-torizon = "freescale-layer toradex-bsp-common-layer meta-toradex-distro sota meta-toradex-security" -LAYERSERIES_COMPAT_meta-toradex-torizon = "kirkstone" +LAYERDEPENDS_meta-common-torizon = "toradex-bsp-common-layer meta-toradex-distro sota meta-toradex-security" +LAYERSERIES_COMPAT_meta-common-torizon = "kirkstone" + +BBFILES_DYNAMIC += " \ + intel:${LAYERDIR}/dynamic-layers/intel/*/*/*.bbappend \ + riscv-layer:${LAYERDIR}/dynamic-layers/riscv/*/*/*.bbappend \ + raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bbappend \ + meta-ti-bsp:${LAYERDIR}/dynamic-layers/ti/*/*/*.bbappend \ +" diff --git a/conf/machine/include/beaglebone-yocto.inc b/conf/machine/include/beaglebone-yocto.inc new file mode 100644 index 00000000..be26c6fc --- /dev/null +++ b/conf/machine/include/beaglebone-yocto.inc @@ -0,0 +1,69 @@ +# taken from meta-freescale/conf/machine/include/utilities.inc +def make_dtb_boot_files(d): + # Generate IMAGE_BOOT_FILES entries for device tree files listed in + # KERNEL_DEVICETREE. + # Use only the basename for dtb files: + alldtbs = d.getVar('KERNEL_DEVICETREE') + + + # DTBs may be built out of kernel with devicetree.bbclass + if not alldtbs: + return '' + + def transform(dtb): + if not (dtb.endswith('dtb') or dtb.endswith('dtbo')): + # eg: whatever/bcm2708-rpi-b.dtb has: + # DEPLOYDIR file: bcm2708-rpi-b.dtb + # destination: bcm2708-rpi-b.dtb + bb.error("KERNEL_DEVICETREE entry %s is not a .dtb or .dtbo file." % (dtb) ) + return os.path.basename(dtb) + + return ' '.join([transform(dtb) for dtb in alldtbs.split() if dtb]) + +WKS_FILE = "beaglebone-yocto.wks" +WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" +CORE_IMAGE_BASE_INSTALL:append = "resize-helper" + +# beaglebone +KERNEL_BUILTIN_WIREGUARD:beaglebone-yocto = "1" +CORE_IMAGE_BASE_INSTALL:remove = "kernel-module-wireguard wireguard-tools" +PREFERRED_PROVIDER_virtual/bootloader = "u-boot" +PREFERRED_PROVIDER_virtual/bootloader:sota = "u-boot" +PREFERRED_PROVIDER_virtual/bootloader:beaglebone-yocto = "u-boot" +PREFERRED_PROVIDER_u-boot:beaglebone-yocto = "u-boot" +PREFERRED_PROVIDER_virtual/dtb = "" +WKS_FILE_DEPENDS_BOOTLOADERS:beaglebone-yocto = "virtual/bootloader" +WKS_FILE_DEPENDS:append:beaglebone-yocto = " u-boot-default-script" +PREFERRED_PROVIDER_u-boot-default-script:beaglebone-yocto = "u-boot-distro-boot" +PREFERRED_PROVIDER_u-boot-default-script:sota:beaglebone-yocto = "u-boot-distro-boot" + +PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv" +PREFERRED_RPROVIDER_u-boot-fw-utils = "libubootenv" + +IMAGE_FSTYPES:remove:beaglebone-yocto = "ext3 jffs2 teziimg" + +# We need ota-ext4 and wic for beagle +IMAGE_FSTYPES_REMOVE = "" +IMAGE_BOOT_FILES:beaglebone-yocto = "u-boot.img MLO ${@make_dtb_boot_files(d)} boot.scr uEnv.txt " +IMAGE_BOOT_FILES:sota:beaglebone-yocto = "u-boot.img MLO ${@make_dtb_boot_files(d)} " +IMAGE_BOOT_FILES_REMOVE:sota:remove = "boot.scr-${MACHINE};boot.scr" +IMAGE_BOOT_FILES:append = " boot.scr-${MACHINE};boot.scr " + +OSTREE_KERNEL:beaglebone-yocto = "zImage" +OSTREE_DEPLOY_DEVICETREE:beaglebone-yocto = "0" +KERNEL_IMAGETYPE:beaglebone-yocto = "zImage" +KERNEL_IMAGETYPE:sota:beaglebone-yocto = "zImage" + +LINUX_VERSION_EXTENSION = "-torizon-${LINUX_KERNEL_TYPE}" + +## same bahavior +# This boot arguments are the same from torizon.bbclass +OSTREE_KERNEL_ARGS:sota:append:beaglebone-yocto = "console=ttyS0,115200 root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash " + +UBOOT_BINARY_OTA_IGNORE:beaglebone-yocto = "1" + +BBMASK += " \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex \ + meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex_%.bbappend \ +" diff --git a/conf/machine/include/beagleplay.inc b/conf/machine/include/beagleplay.inc new file mode 100644 index 00000000..791f9d30 --- /dev/null +++ b/conf/machine/include/beagleplay.inc @@ -0,0 +1,75 @@ +# taken from meta-freescale/conf/machine/include/utilities.inc +def make_dtb_boot_files(d): + # Generate IMAGE_BOOT_FILES entries for device tree files listed in + # KERNEL_DEVICETREE. + # Use only the basename for dtb files: + alldtbs = d.getVar('KERNEL_DEVICETREE') + + + # DTBs may be built out of kernel with devicetree.bbclass + if not alldtbs: + return '' + + def transform(dtb): + if not (dtb.endswith('dtb') or dtb.endswith('dtbo')): + # eg: whatever/bcm2708-rpi-b.dtb has: + # DEPLOYDIR file: bcm2708-rpi-b.dtb + # destination: bcm2708-rpi-b.dtb + bb.error("KERNEL_DEVICETREE entry %s is not a .dtb or .dtbo file." % (dtb) ) + return os.path.basename(dtb) + + return ' '.join([transform(dtb) for dtb in alldtbs.split() if dtb]) + +WKS_FILE = "sdimage-2part.wks" +WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" +CORE_IMAGE_BASE_INSTALL:append = "resize-helper" + +KERNEL_BUILTIN_WIREGUARD:beagleplay = "1" +CORE_IMAGE_BASE_INSTALL:remove = "kernel-module-wireguard wireguard-tools" +PREFERRED_PROVIDER_virtual/bootloader = "u-boot-bb.org" +PREFERRED_PROVIDER_virtual/bootloader:sota = "u-boot-bb.org" +PREFERRED_PROVIDER_virtual/bootloader:beagleplay = "u-boot-bb.org" +PREFERRED_PROVIDER_u-boot:beagleplay = "u-boot-bb.org" +PREFERRED_PROVIDER_virtual/dtb = "" +WKS_FILE_DEPENDS_BOOTLOADERS:beagleplay = "virtual/bootloader" +WKS_FILE_DEPENDS:append:beagleplay = " u-boot-default-script" +PREFERRED_PROVIDER_u-boot-default-script:beagleplay = "u-boot-distro-boot" +PREFERRED_PROVIDER_u-boot-default-script:sota:beagleplay = "u-boot-distro-boot" + +PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv" +PREFERRED_RPROVIDER_u-boot-fw-utils = "libubootenv" + +IMAGE_FSTYPES:remove:beagleplay = "ext3 jffs2 teziimg" + +# We need ota-ext4 and wic for beagle +IMAGE_FSTYPES_REMOVE = "" +IMAGE_BOOT_FILES:beagleplay = "u-boot.img tispl.bin tiboot3.bin ${@make_dtb_boot_files(d)} " +IMAGE_BOOT_FILES:sota:beaglebone-yocto = "u-boot.img tispl.bin tiboot3.bin ${@make_dtb_boot_files(d)} " +IMAGE_BOOT_FILES_REMOVE:sota:remove = "boot.scr-${MACHINE};boot.scr" +IMAGE_BOOT_FILES:append = " boot.scr-${MACHINE};boot.scr " + +LINUX_VERSION_EXTENSION = "-torizon-${LINUX_KERNEL_TYPE}" + +## same bahavior +# This boot arguments are the same from torizon.bbclass +OSTREE_KERNEL_ARGS:sota:append:beagleplay = "console=ttyS2,115200 root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash " + +UBOOT_BINARY_OTA_IGNORE:beagleplay = "1" +OSTREE_DEPLOY_DEVICETREE:beagleplay = "0" + +PREFERRED_PROVIDER_virtual/mesa = "mesa-pvr" +PREFERRED_PROVIDER_virtual/egl = "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgles1 = "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgles2 = "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgles3 = "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgbm = "mesa-pvr" +PREFERRED_PROVIDER_virtual/libglx = "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgl = "mesa-pvr" + +INITRAMFS_MAXSIZE = "315400" + +BBMASK += " \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex \ + meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex_%.bbappend \ +" diff --git a/conf/machine/include/intel-corei7-64.inc b/conf/machine/include/intel-corei7-64.inc new file mode 100644 index 00000000..62d1b524 --- /dev/null +++ b/conf/machine/include/intel-corei7-64.inc @@ -0,0 +1,42 @@ + +WKS_FILE:intel-corei7-64:sota = "efiimage-sota.wks" +WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" + +CORE_IMAGE_BASE_INSTALL:append = "resize-helper docker-binfmt" + +OSTREE_KERNEL_ARGS:sota:append:intel-corei7-64 = "console=ttyS0,115200 root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:10 " + +XENOMAI_KERNEL_ARGS = "audit=0 hpet=disable clocksource=tsc tsc=reliable intel_pstate=disable intel_idle.max_cstate=0 intel.max_cstate=0 processor.max_cstate=0 processor_idle.max_cstate=0 \ + rcupdate.rcu_cpu_stall_suppress=1 mce=off nmi_watchdog=0 nosoftlockup noht numa_balancing=disable hugepages=1024 rcu_nocb_poll=1024 irqaffinity=0 isolcpus=1,3 rcu_nocbs=1,3 nohz_full=1,3 \ + i915.enable_rc6=0 i915.enable_dc=0 i915.disable_power_well=0 " +OSTREE_KERNEL_ARGS:sota:append:intel-corei7-64:xenomai3 = " ${XENOMAI_KERNEL_ARGS} " +OSTREE_KERNEL_ARGS:sota:append:intel-corei7-64:xenomai4 = " ${XENOMAI_KERNEL_ARGS} " + +OSTREE_BOOTLOADER:intel-corei7-64 = "grub" +OSTREE_DEPLOY_DEVICETREE:intel-corei7-64 = "0" +EFI_PROVIDER:intel-corei7-64 = "grub-efi" +SOTA_CLIENT_FEATURES:remove = "ubootenv" +UBOOT_BINARY_OTA_IGNORE:intel-corei7-64 = "1" + +IMAGE_FSTYPES_REMOVE = "hddimg teziimg" +IMAGE_FSTYPES:append = " wic.vmdk wic.vdi" + +hostname:pn-base-files = "torizon-x86" +CORE_IMAGE_BASE_INSTALL:remove = "set-hostname" + +PREFERRED_PROVIDER_u-boot-default-script = "" +PREFERRED_PROVIDER_virtual/dtb = "" + +PREFERRED_PROVIDER_virtual/kernel = "linux-intel" +PREFERRED_VERSION_linux-intel = "5.10.%" + +PREFERRED_PROVIDER_virtual/kernel:xenomai3 = "linux-xenomai-3" +PREFERRED_VERSION_linux-xenomai-3 = "5.10.%" + +PREFERRED_PROVIDER_virtual/kernel:xenomai4 = "linux-xenomai-4" +PREFERRED_VERSION_linux-xenomai-4 = "5.10.%" + +IMAGE_INSTALL:remove = " minnowboard-efi-startup" +LINUX_VERSION_EXTENSION ?= "-torizon-${LINUX_KERNEL_TYPE}" +LINUX_VERSION_EXTENSION:xenomai3 ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai3" +LINUX_VERSION_EXTENSION:xenomai4 ?= "-torizon-${LINUX_KERNEL_TYPE}-xenomai4" diff --git a/conf/machine/include/nezha-allwinner-d1.inc b/conf/machine/include/nezha-allwinner-d1.inc new file mode 100644 index 00000000..450d2a26 --- /dev/null +++ b/conf/machine/include/nezha-allwinner-d1.inc @@ -0,0 +1,45 @@ + +WKS_FILE:nezha-allwinner-d1 = "nezha.wks" +WIC_CREATE_EXTRA_ARGS = "" +WKS_FILE:sota:nezha-allwinner-d1 = "nezha-sota.wks" +WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" +CORE_IMAGE_BASE_INSTALL:append = "resize-helper" + +OSTREE_KERNEL_ARGS:sota:append:nezha-allwinner-d1 = " earlycon=sbi clk_ignore_unused initcall_debug=0 console=ttyS0,115200 loglevel=8 root=LABEL=otaroot rootfstype=ext4 root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash " +SOTA_CLIENT_FEATURES:append:nezha-allwinner-d1 = " ubootenv" +WKS_FILE_DEPENDS_BOOTLOADERS:nezha-allwinner-d1 = "virtual/bootloader" +WKS_FILE_DEPENDS:append:nezha-allwinner-d1 = " u-boot-default-script" +PREFERRED_PROVIDER_u-boot-default-script:nezha-allwinner-d1 = "u-boot-distro-boot" +PREFERRED_PROVIDER_u-boot-default-script:sota:nezha-allwinner-d1 = "u-boot-distro-boot" + +OSTREE_DEPLOY_DEVICETREE:nezha-allwinner-d1 = "0" + +PREFERRED_PROVIDER_virtual/dtb = "" + +KERNEL_BUILTIN_WIREGUARD:nezha-allwinner-d1 = "1" +KERNEL_IMAGETYPE:nezha-allwinner-d1 = "Image" +KERNEL_IMAGETYPE:sota:nezha-allwinner-d1 = "Image" +OSTREE_KERNEL:nezha-allwinner-d1 = "Image" +#KERNEL_DEVICETREE:nezha-allwinner-d1:sota ?= " allwinner/sun20i-d1-nezha.dtb" +UBOOT_BINARY_OTA_IGNORE:nezha-allwinner-d1 = "1" +KERNEL_BOOTCMD = "booti" + +LINUX_VERSION_EXTENSION = "-torizon-${LINUX_KERNEL_TYPE}" + +IMAGE_FSTYPES_REMOVE = "hddimg teziimg" + +CORE_IMAGE_BASE_INSTALL:remove = "kernel-module-wireguard wireguard-tools" +IMAGE_BOOT_FILES:nezha-allwinner-d1 = "${KERNEL_IMAGETYPE} sun20i-d1-nezha.dtb boot.scr.uimg" +IMAGE_BOOT_FILES:sota:nezha-allwinner-d1 = "${KERNEL_IMAGETYPE} sun20i-d1-nezha.dtb boot.scr-${MACHINE};boot.scr.uimg" + +hostname:pn-base-files = "torizon-nezha" +# FIXME: rac does not compile for riscv64, https://github.com/briansmith/ring/issues/1182 +CORE_IMAGE_BASE_INSTALL:remove = "set-hostname rac" + +# Use meta-lmp but maintain compatibility +BBMASK += " \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex \ + meta-common-torizon/recipes-bsp/u-boot/libubootenv_* \ + meta-toradex-bsp-common/recipes-bsp/u-boot/libubootenv_* \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex_%.bbappend \ +" diff --git a/conf/machine/include/qemuarm64.inc b/conf/machine/include/qemuarm64.inc index 75b21cb6..ef8acc5d 100644 --- a/conf/machine/include/qemuarm64.inc +++ b/conf/machine/include/qemuarm64.inc @@ -4,6 +4,8 @@ UBOOT_ENTRYPOINT = "0x40080000" WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" WKS_FILE:sota:qemuarm64 = "torizon-sota.wks" +CORE_IMAGE_BASE_INSTALL:append = "resize-helper" + OSTREE_KERNEL_ARGS:qemuarm64 = "quiet logo.nologo plymouth.ignore-serial-consoles splash console=ttyAMA0 root=LABEL=otaroot rootfstype=ext4" OSTREE_DEPLOY_DEVICETREE:qemuarm64 = "0" @@ -29,3 +31,5 @@ PREFERRED_PROVIDER_virtual/kernel:qemuarm64 = "linux-yocto" PREFERRED_PROVIDER_virtual/kernel:qemuarm64:preempt-rt = "linux-yocto-rt" PREFERRED_PROVIDER_u-boot-default-script:qemuarm64 = "u-boot-distro-boot" + +OSTREE_KERNEL_ARGS:sota:append:qemuarm64 = "console=ttyAMA0 root=LABEL=otaroot rootfstype=ext4 logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:10 " diff --git a/conf/machine/include/qemux86-64.inc b/conf/machine/include/qemux86-64.inc new file mode 100644 index 00000000..5f011163 --- /dev/null +++ b/conf/machine/include/qemux86-64.inc @@ -0,0 +1,23 @@ + +WKS_FILE:qemux86-64:sota = "efiimage-sota.wks" +WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" + +CORE_IMAGE_BASE_INSTALL:append = "resize-helper docker-binfmt" + +OSTREE_KERNEL_ARGS:qemux86-64 = "console=ttyS0,115200 root=LABEL=otaroot rootfstype=ext4 logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:10 quiet " +OSTREE_BOOTLOADER:qemux86-64 = "grub" +OSTREE_DEPLOY_DEVICETREE:qemux86-64 = "0" +EFI_PROVIDER:qemux86-64 = "grub-efi" +SOTA_CLIENT_FEATURES:remove = "ubootenv" +UBOOT_BINARY_OTA_IGNORE:qemux86-64 = "1" + +IMAGE_FSTYPES_REMOVE = "hddimg teziimg" +IMAGE_FSTYPES:append = " wic" + +hostname:pn-base-files = "${MACHINE}" +CORE_IMAGE_BASE_INSTALL:remove = "set-hostname" + +PREFERRED_PROVIDER_u-boot-default-script = "" +PREFERRED_PROVIDER_virtual/dtb = "" + +LINUX_VERSION_EXTENSION ?= "-torizon-${LINUX_KERNEL_TYPE}" diff --git a/conf/machine/include/raspberrypi-common.inc b/conf/machine/include/raspberrypi-common.inc new file mode 100644 index 00000000..88750675 --- /dev/null +++ b/conf/machine/include/raspberrypi-common.inc @@ -0,0 +1,56 @@ + +WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb" + +CORE_IMAGE_BASE_INSTALL:append = "resize-helper" + +# Raspberry Pi +KERNEL_BUILTIN_WIREGUARD:rpi = "1" +CORE_IMAGE_BASE_INSTALL:remove = "kernel-module-wireguard wireguard-tools" +PREFERRED_PROVIDER_virtual/bootloader = "u-boot" +PREFERRED_PROVIDER_virtual/bootloader:sota = "u-boot" +PREFERRED_PROVIDER_virtual/bootloader:rpi = "u-boot" +PREFERRED_PROVIDER_u-boot:rpi = "u-boot" +PREFERRED_PROVIDER_virtual/dtb = "" +WKS_FILE_DEPENDS_BOOTLOADERS:rpi = "virtual/bootloader" +WKS_FILE_DEPENDS:append:rpi = " u-boot-default-script" +PREFERRED_PROVIDER_u-boot-default-script:rpi = "u-boot-distro-boot" +PREFERRED_PROVIDER_u-boot-default-script:sota:rpi = "u-boot-distro-boot" + +PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv" +PREFERRED_RPROVIDER_u-boot-fw-utils = "libubootenv" + +IMAGE_FSTYPES:remove:rpi = "ext3 rpi-sdimg teziimg" + +# We need ota-ext4 and wic for rpi +IMAGE_FSTYPES_REMOVE = "" +IMAGE_BOOT_FILES:rpi = "${BOOTFILES_DIR_NAME}/* u-boot.bin;${SDIMG_KERNELIMAGE} ${@make_dtb_boot_files(d)} boot.scr uEnv.txt " +IMAGE_BOOT_FILES:sota:rpi = "${BOOTFILES_DIR_NAME}/* u-boot.bin;${SDIMG_KERNELIMAGE} ${@make_dtb_boot_files(d)} " +IMAGE_BOOT_FILES_REMOVE:sota:remove = "boot.scr-${MACHINE};boot.scr" +IMAGE_BOOT_FILES:append = " boot.scr-${MACHINE};boot.scr " + +OSTREE_KERNEL:rpi = "Image" +OSTREE_DEPLOY_DEVICETREE:rpi = "0" +KERNEL_IMAGETYPE:rpi = "Image" +KERNEL_IMAGETYPE:sota:rpi = "Image" + +LINUX_VERSION_EXTENSION ?= "-torizon-${LINUX_KERNEL_TYPE}" + +## Mimic meta-raspberrypi behavior +ENABLE_UART:rpi = "1" +SERIAL_CONSOLES = "115200;ttyAMA0" +KERNEL_SERIAL:sota:rpi = "${@oe.utils.conditional("ENABLE_UART", "1", "console=ttyS0,115200", "", d)}" +OSTREE_KERNEL_ARGS:sota = " 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=614 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 ${KERNEL_SERIAL} usbhid.mousepoll=0 " +# This boot arguments are the same from torizon.bbclass +OSTREE_KERNEL_ARGS:sota:append:rpi = " root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:10 " + +## U-Boot entrypoints for rpi +UBOOT_ENTRYPOINT:rpi = "0x00008000" +UBOOT_DTB_LOADADDRESS:rpi = "0x02600000" +UBOOT_DTBO_LOADADDRESS:rpi = "0x026d0000" +UBOOT_BINARY_OTA_IGNORE:rpi = "1" + +BBMASK += " \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex \ + meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend \ + meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex_%.bbappend \ +" diff --git a/conf/machine/include/raspberrypi0-2w-64.inc b/conf/machine/include/raspberrypi0-2w-64.inc new file mode 100644 index 00000000..cfc4f971 --- /dev/null +++ b/conf/machine/include/raspberrypi0-2w-64.inc @@ -0,0 +1,3 @@ +require raspberrypi-common.inc + +KERNEL_DEVICETREE:raspberrypi0-2w-64:sota ?= " broadcom/bcm2710-rpi-zero-2.dtb overlays/vc4-fkms-v3d.dtbo overlays/rpi-ft5406.dtbo" diff --git a/conf/machine/include/raspberrypi0-wifi.inc b/conf/machine/include/raspberrypi0-wifi.inc new file mode 100644 index 00000000..61bb6df2 --- /dev/null +++ b/conf/machine/include/raspberrypi0-wifi.inc @@ -0,0 +1,9 @@ +require raspberrypi-common.inc + +KERNEL_DEVICETREE:raspberrypi0-wifi:sota ?= " bcm2708-rpi-zero-w.dtb overlays/vc4-fkms-v3d.dtbo overlays/rpi-ft5406.dtbo" +OSTREE_KERNEL:raspberrypi0-wifi = "zImage" +KERNEL_IMAGETYPE:raspberrypi0-wifi = "zImage" +KERNEL_IMAGETYPE:sota:raspberrypi0-wifi = "zImage" +KERNEL_BOOTCMD:raspberrypi0-wifi = "bootz" + +OSTREE_KERNEL_ARGS:sota:append:rpi = " plymouth.ignore-udev " diff --git a/conf/machine/include/raspberrypi3-64.inc b/conf/machine/include/raspberrypi3-64.inc new file mode 100644 index 00000000..82d1fd67 --- /dev/null +++ b/conf/machine/include/raspberrypi3-64.inc @@ -0,0 +1 @@ +require raspberrypi-common.inc \ No newline at end of file diff --git a/conf/machine/include/raspberrypi4-64.inc b/conf/machine/include/raspberrypi4-64.inc new file mode 100644 index 00000000..218b6755 --- /dev/null +++ b/conf/machine/include/raspberrypi4-64.inc @@ -0,0 +1,7 @@ +require raspberrypi-common.inc + +SOTA_DT_OVERLAYS:raspberrypi4-64 ?= "vc4-fkms-v3d-pi4.dtbo rpi-ft5406.dtbo" +VC4DTBO:raspberrypi4-64 ?= "vc4-fkms-v3d-pi4" +KERNEL_DEVICETREE:raspberrypi4-64:sota ?= " broadcom/bcm2711-rpi-4-b.dtb overlays/vc4-fkms-v3d-pi4.dtbo overlays/rpi-ft5406.dtbo" +KERNEL_BOOTCMD:raspberrypi4-64 = "booti" +KERNEL_SERIAL:sota:raspberrypi4-64 = "${@oe.utils.conditional("ENABLE_UART", "1", "console=ttyAMA0,115200", "", d)}" diff --git a/conf/template/bblayers.conf b/conf/template/bblayers.conf index ff67798b..d3f0aae7 100644 --- a/conf/template/bblayers.conf +++ b/conf/template/bblayers.conf @@ -18,27 +18,44 @@ BASELAYERS ?= " \ ${OEROOT}/layers/meta-updater \ " -# These layers hold machine specific content, aka Board Support Packages -BSPLAYERS ?= " \ - ${OEROOT}/layers/meta-toradex-nxp \ - ${OEROOT}/layers/meta-freescale \ - ${OEROOT}/layers/meta-freescale-3rdparty \ - ${OEROOT}/layers/meta-yocto/meta-yocto-bsp \ - ${OEROOT}/layers/meta-yocto/meta-poky \ - ${OEROOT}/layers/meta-security \ - ${OEROOT}/layers/meta-toradex-ti \ +# Dynamically included machine layers +RPI_LAYERS = " \ + ${OEROOT}/layers/meta-raspberrypi \ +" +BEAGLEPLAY_LAYERS = " \ ${OEROOT}/layers/meta-arm/meta-arm-toolchain \ ${OEROOT}/layers/meta-arm/meta-arm \ ${OEROOT}/layers/meta-ti/meta-ti-bsp \ ${OEROOT}/layers/meta-ti/meta-ti-extras \ " +RISCV_LAYERS = " \ + ${OEROOT}/layers/meta-riscv \ +" +YOCTOBSP_LAYERS = " \ + ${OEROOT}/layers/meta-yocto/meta-yocto-bsp \ +" +INTEL_LAYERS = " \ + ${OEROOT}/layers/meta-intel \ +" + +# These layers hold machine specific content, aka Board Support Packages +BSPLAYERS ?= " \ + ${@'${RPI_LAYERS}' if '${MACHINE}'.startswith('raspberrypi') else ''} \ + ${@'${BEAGLEPLAY_LAYERS}' if '${MACHINE}' == 'beagleplay' else ''} \ + ${@'${RISCV_LAYERS}' if '${MACHINE}' == 'nezha-allwinner-d1' else ''} \ + ${@'${YOCTOBSP_LAYERS}' if '${MACHINE}' == 'genericx86-64' else ''} \ + ${@'${YOCTOBSP_LAYERS}' if '${MACHINE}' == 'beaglebone-yocto' else ''} \ + ${@'${INTEL_LAYERS}' if '${MACHINE}' == 'intel-corei7-64' else ''} \ + ${OEROOT}/layers/meta-yocto/meta-poky \ + ${OEROOT}/layers/meta-security \ +" # Add your overlay location to EXTRALAYERS # Make sure to have a conf/layers.conf in there EXTRALAYERS ?= "" BBLAYERS = " \ - ${OEROOT}/layers/meta-toradex-torizon \ + ${OEROOT}/layers/meta-common-torizon \ ${OEROOT}/layers/meta-toradex-security \ ${OEROOT}/layers/meta-toradex-distro \ ${OEROOT}/layers/meta-toradex-bsp-common \ diff --git a/conf/template/local.conf b/conf/template/local.conf index a3cb8a45..3bfb431b 100644 --- a/conf/template/local.conf +++ b/conf/template/local.conf @@ -1,3 +1,4 @@ +require conf/distro/include/torizon-os-version.inc # CONF_VERSION is increased each time build/conf/ changes incompatibly CONF_VERSION = "2" @@ -105,4 +106,10 @@ PARALLEL_MAKE ?= "-j ${@oe.utils.cpu_count()}" #TORIZON_PROV_SHARED_DATA ?= "${WORKDIR}/prov/shared-data.tar.gz" #TORIZON_PROV_ONLINE_DATA ?= "${ONLINE_PROV_DATA}" +# to enable TorizonCore custom debug features set it to 1 +#TDX_DEBUG ?= "0" + +# store the image name in a variable +TDX_IMAGE = "torizon-core-common-docker" + include conf/machine/include/${MACHINE}.inc diff --git a/dynamic-layers/intel/recipes-kernel/linux/files/intel-corei7-64.cfg b/dynamic-layers/intel/recipes-kernel/linux/files/intel-corei7-64.cfg new file mode 100644 index 00000000..a55cf936 --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/files/intel-corei7-64.cfg @@ -0,0 +1,59 @@ +CONFIG_I2C_ALGOBIT=y +CONFIG_CEC_CORE=y +CONFIG_DRM=y +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_SCHED=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_DRM_PANEL_SIMPLE=y +# CHECK CONFIG +CONFIG_NETFILTER_XT_MATCH_IPVS=m +CONFIG_CGROUP_SCHED=y +CONFIG_BLK_CGROUP=y +CONFIG_BLK_DEV_THROTTLING=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_IP_VS=m +CONFIG_IP_VS_NFCT=y +CONFIG_IP_VS_PROTO_TCP=y +CONFIG_IP_VS_PROTO_UDP=y +CONFIG_IP_VS_RR=m +CONFIG_SECURITY_SELINUX=y +CONFIG_SECURITY_APPARMOR=y +CONFIG_BRIDGE_VLAN_FILTERING=y +CONFIG_IPVLAN=m +CONFIG_AUFS_FS=m +# INTEL +CONFIG_DRM_I915=y +# INTEL NETWORK +CONFIG_IGC=m +# AMD +CONFIG_DRM_AMDGPU=y +CONFIG_DRM_AMDGPU_SI=y +CONFIG_DRM_AMDGPU_CIK=y +CONFIG_DRM_AMDGPU_USERPTR=y +CONFIG_DRM_AMD_ACP=y +CONFIG_DRM_AMD_DC=y +CONFIG_DRM_AMD_DC_DCN=y +CONFIG_DRM_AMD_DC_HDCP=y +CONFIG_DRM_AMD_DC_SI=y +CONFIG_DRM_AMD_SECURE_DISPLAY=y +# VMWARE +CONFIG_DRM_VMWGFX=y +CONFIG_DRM_VMWGFX_FBCON=y +# VIRTUAL BOX +CONFIG_DRM_VBOXVIDEO=y +CONFIG_VBOXGUEST=m +CONFIG_VBOXSF_FS=m +# QEMU +CONFIG_DRM_CIRRUS_QEMU=y +# USB +CONFIG_USB_SERIAL_WWAN=m +CONFIG_USB_SERIAL_OPTION=m \ No newline at end of file diff --git a/dynamic-layers/intel/recipes-kernel/linux/files/xenomai-common.cfg b/dynamic-layers/intel/recipes-kernel/linux/files/xenomai-common.cfg new file mode 100644 index 00000000..1dc46406 --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/files/xenomai-common.cfg @@ -0,0 +1,51 @@ +# +# IRQ subsystem +# +CONFIG_IRQ_PIPELINE=y + +# +# Timers subsystem +# +CONFIG_CONTEXT_TRACKING=y +# CONFIG_CONTEXT_TRACKING_FORCE is not set +CONFIG_NO_HZ=n + +# +# CPU/Task time and stats accounting +# +CONFIG_VIRT_CPU_ACCOUNTING=y +# CONFIG_TICK_CPU_ACCOUNTING is not set +CONFIG_VIRT_CPU_ACCOUNTING_GEN=y + +# +# RCU Subsystem +# +CONFIG_RCU_EXPERT=y +CONFIG_RCU_FANOUT=64 +CONFIG_RCU_FANOUT_LEAF=16 +# CONFIG_RCU_FAST_NO_HZ is not set +# CONFIG_RCU_BOOST is not set +CONFIG_RCU_NOCB_CPU=y +# CONFIG_TASKS_TRACE_RCU_READ_MB is not set + +CONFIG_DOVETAIL=y +CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE=y + +# +# Power management and ACPI options +# +CONFIG_SUSPEND=n +CONFIG_PM=n + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ_STAT=n +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=n +CONFIG_CPU_FREQ_GOV_ONDEMAND=n + +CONFIG_DEBUG_IRQ_PIPELINE=y +# CONFIG_IRQ_PIPELINE_TORTURE_TEST is not set +CONFIG_DEBUG_DOVETAIL=y +CONFIG_RAW_PRINTK=y diff --git a/dynamic-layers/intel/recipes-kernel/linux/files/xenomai3.cfg b/dynamic-layers/intel/recipes-kernel/linux/files/xenomai3.cfg new file mode 100644 index 00000000..62f65b48 --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/files/xenomai3.cfg @@ -0,0 +1,117 @@ +# +# General architecture-dependent options +# +CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM=y +# end of General architecture-dependent options + +CONFIG_XENOMAI=y +CONFIG_XENO_ARCH_FPU=y +CONFIG_XENO_ARCH_SYS3264=y + +# +# Core features +# +# CONFIG_XENO_OPT_SCHED_CLASSES is not set +CONFIG_XENO_OPT_STATS=y +# CONFIG_XENO_OPT_SHIRQ is not set +CONFIG_XENO_OPT_RR_QUANTUM=1000 +CONFIG_XENO_OPT_AUTOTUNE=y +# CONFIG_XENO_OPT_SCALABLE_SCHED is not set +# CONFIG_XENO_OPT_TIMER_LIST is not set +CONFIG_XENO_OPT_TIMER_RBTREE=y +CONFIG_XENO_OPT_VFILE=y +# end of Core features + +# +# Sizes and static limits +# +CONFIG_XENO_OPT_REGISTRY_NRSLOTS=512 +CONFIG_XENO_OPT_SYS_HEAPSZ=4096 +CONFIG_XENO_OPT_PRIVATE_HEAPSZ=256 +CONFIG_XENO_OPT_SHARED_HEAPSZ=256 +CONFIG_XENO_OPT_NRTIMERS=256 +# end of Sizes and static limits + +# +# Latency settings +# +CONFIG_XENO_OPT_TIMING_SCHEDLAT=0 +CONFIG_XENO_OPT_TIMING_KSCHEDLAT=0 +CONFIG_XENO_OPT_TIMING_IRQLAT=0 +# end of Latency settings + +# CONFIG_XENO_OPT_DEBUG is not set + +# +# Drivers +# +CONFIG_XENO_OPT_RTDM_COMPAT_DEVNODE=y +CONFIG_XENO_DRIVERS_AUTOTUNE=y + +# +# Serial drivers +# +# CONFIG_XENO_DRIVERS_16550A is not set +# end of Serial drivers + +# +# Testing drivers +# +CONFIG_XENO_DRIVERS_TIMERBENCH=y +CONFIG_XENO_DRIVERS_SWITCHTEST=y +CONFIG_XENO_DRIVERS_HEAPCHECK=y +# CONFIG_XENO_DRIVERS_RTDMTEST is not set +# end of Testing drivers + +# +# CAN drivers +# +# CONFIG_XENO_DRIVERS_CAN is not set +# end of CAN drivers + +# +# RTnet +# +# CONFIG_XENO_DRIVERS_NET is not set +# end of RTnet + +# +# ANALOGY drivers +# +# CONFIG_XENO_DRIVERS_ANALOGY is not set +# end of ANALOGY drivers + +# +# Real-time IPC drivers +# +# CONFIG_XENO_DRIVERS_RTIPC is not set +# end of Real-time IPC drivers + +# +# UDD support +# +# CONFIG_XENO_DRIVERS_UDD is not set +# end of UDD support + +# +# Real-time GPIO drivers +# +# CONFIG_XENO_DRIVERS_GPIO is not set +# end of Real-time GPIO drivers + +# +# GPIOPWM support +# +# CONFIG_XENO_DRIVERS_GPIOPWM is not set +# end of GPIOPWM support + +# +# Real-time SPI master drivers +# +# end of Real-time SPI master drivers +# end of Drivers + +CONFIG_XENO_VERSION_MAJOR=3 +CONFIG_XENO_VERSION_MINOR=2 +CONFIG_XENO_REVISION_LEVEL=4 +CONFIG_XENO_VERSION_STRING="3.2.4" diff --git a/dynamic-layers/intel/recipes-kernel/linux/files/xenomai4.cfg b/dynamic-layers/intel/recipes-kernel/linux/files/xenomai4.cfg new file mode 100644 index 00000000..b3623c75 --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/files/xenomai4.cfg @@ -0,0 +1,39 @@ +# +# Processor type and features +# +CONFIG_EVL=y +CONFIG_EVL_SCHED_QUOTA=y +CONFIG_EVL_SCHED_TP=y +CONFIG_EVL_SCHED_TP_NR_PART=4 +# CONFIG_EVL_HIGH_PERCPU_CONCURRENCY is not set +CONFIG_EVL_RUNSTATS=y +# CONFIG_EVL_NET is not set + +# +# Fixed sizes and limits +# +CONFIG_EVL_COREMEM_SIZE=2048 +CONFIG_EVL_NR_THREADS=256 +CONFIG_EVL_NR_MONITORS=512 +CONFIG_EVL_NR_CLOCKS=8 +CONFIG_EVL_NR_XBUFS=128 +CONFIG_EVL_NR_PROXIES=64 +CONFIG_EVL_NR_OBSERVABLES=64 +# end of Fixed sizes and limits + +# +# Pre-calibrated latency +# +CONFIG_EVL_LATENCY_USER=0 +CONFIG_EVL_LATENCY_KERNEL=0 +CONFIG_EVL_LATENCY_IRQ=0 +# end of Pre-calibrated latency + +# CONFIG_EVL_DEBUG is not set + +# +# Out-of-band device drivers +# +CONFIG_EVL_LATMUS=y +CONFIG_EVL_HECTIC=y +# end of Out-of-band device drivers diff --git a/dynamic-layers/intel/recipes-kernel/linux/linux-intel%.bbappend b/dynamic-layers/intel/recipes-kernel/linux/linux-intel%.bbappend new file mode 100644 index 00000000..97cabdca --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/linux-intel%.bbappend @@ -0,0 +1,8 @@ + +require recipes-kernel/linux/common.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = "\ + file://0001-i915-hwmon-dgfx-check.patch \ +" diff --git a/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-3-dovetail.inc b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-3-dovetail.inc new file mode 100644 index 00000000..28900d9b --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-3-dovetail.inc @@ -0,0 +1,30 @@ +# from meta-intel +require recipes-kernel/linux/linux-yocto.inc +require recipes-kernel/linux/meta-intel-compat-kernel.inc + +# from common-torizon +require recipes-kernel/linux/common.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +KERNEL_CONFIG_URI ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA}" + +SRC_URI = " \ + git://source.denx.de/Xenomai/linux-dovetail.git;protocol=https;branch=${KBRANCH};name=machine; \ + git://source.denx.de/Xenomai/xenomai.git;protocol=https;branch=${XENBRANCH};name=xenomai;destsuffix=xenomai; \ + ${KERNEL_CONFIG_URI} \ + file://xenomai-common.cfg \ + file://xenomai3.cfg \ + " + +LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +KMETA = "kernel-meta" +KCONF_BSP_AUDIT_LEVEL = "2" + +COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)" + +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}" diff --git a/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-3_5.10.bb b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-3_5.10.bb new file mode 100644 index 00000000..b9d2c103 --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-3_5.10.bb @@ -0,0 +1,32 @@ +require linux-xenomai-3-dovetail.inc + +SUMMARY = "Linux kernel for Xenomai 3 with Dovetail and the Cobalt core patches" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers, e.g. as dependency of +# core-image-rt-sdk, core-image-rt. +python () { + if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-xenomai-3": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-xenomai-3 to enable it") +} + +KBRANCH = "v5.10.y-dovetail" +KMETA_BRANCH = "yocto-5.10" +XENBRANCH = "stable/v3.2.x" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +DEPENDS += "elfutils-native openssl-native util-linux-native" + +LINUX_VERSION ?= "5.10.209" +SRCREV_machine ?= "e2e46a0e4e4bf82d418f589a23a8d04df996b480" +SRCREV_meta ?= "603507f09e4a22a650e37fb9dcfbcb69ceb36841" +SRCREV_xenomai ?= "704ea7dab109c6ced8dee3a8377fbf72a977a0fc" + +# Functionality flags +KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc" + +do_patch:append () { + ${WORKDIR}/xenomai/scripts/prepare-kernel.sh --linux=${STAGING_KERNEL_DIR} --arch=x86 +} diff --git a/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-4-evl.inc b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-4-evl.inc new file mode 100644 index 00000000..373d092f --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-4-evl.inc @@ -0,0 +1,29 @@ +# from meta-intel +require recipes-kernel/linux/linux-yocto.inc +require recipes-kernel/linux/meta-intel-compat-kernel.inc + +# from common-torizon +require recipes-kernel/linux/common.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +KERNEL_CONFIG_URI ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA}" + +SRC_URI = " \ + git://source.denx.de/Xenomai/xenomai4/linux-evl.git;protocol=https;branch=${KBRANCH};name=machine; \ + ${KERNEL_CONFIG_URI} \ + file://xenomai-common.cfg \ + file://xenomai4.cfg \ + " + +LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +KMETA = "kernel-meta" +KCONF_BSP_AUDIT_LEVEL = "2" + +COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)" + +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}" diff --git a/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-4_5.10.bb b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-4_5.10.bb new file mode 100644 index 00000000..1230634a --- /dev/null +++ b/dynamic-layers/intel/recipes-kernel/linux/linux-xenomai-4_5.10.bb @@ -0,0 +1,26 @@ +require linux-xenomai-4-evl.inc + +SUMMARY = "Linux kernel with Xenomai 4 patches and the EVL core" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers, e.g. as dependency of +# core-image-rt-sdk, core-image-rt. +python () { + if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-xenomai-4": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-xenomai-4 to enable it") +} + +KBRANCH = "v5.10.y-evl-rebase" +KMETA_BRANCH = "yocto-5.10" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +DEPENDS += "elfutils-native openssl-native util-linux-native" + +LINUX_VERSION ?= "5.10.209" +SRCREV_machine ?= "a48a4304d51f6d106e9b6e95ff63e95d3e502b03" +SRCREV_meta ?= "603507f09e4a22a650e37fb9dcfbcb69ceb36841" + +# Functionality flags +KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc" diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.15.bbappend b/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.15.bbappend new file mode 100644 index 00000000..d9f094e7 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.15.bbappend @@ -0,0 +1,14 @@ + +LINUX_VERSION = "5.15.92" + +# use microhobby kernel Disable bt and use PL011 as console +SRCREV_machine = "361db6f664a26ca785fedf55f4d021a3fbdfd6dd" + +SRC_URI = " \ + git://github.com/microhobby/linus-tree.git;name=machine;branch=${LINUX_RPI_BRANCH};protocol=https \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${LINUX_RPI_KMETA_BRANCH};destsuffix=${KMETA} \ + file://powersave.cfg \ + file://android-drivers.cfg \ +" + +require recipes-kernel/linux/common.inc diff --git a/dynamic-layers/riscv/recipes-kernel/linux/linux-nezha-%.bbappend b/dynamic-layers/riscv/recipes-kernel/linux/linux-nezha-%.bbappend new file mode 100644 index 00000000..8549c62c --- /dev/null +++ b/dynamic-layers/riscv/recipes-kernel/linux/linux-nezha-%.bbappend @@ -0,0 +1,2 @@ + +require recipes-kernel/linux/common.inc diff --git a/dynamic-layers/ti/recipes-kernel/linux/linux-bb.org_%.bbappend b/dynamic-layers/ti/recipes-kernel/linux/linux-bb.org_%.bbappend new file mode 100644 index 00000000..8549c62c --- /dev/null +++ b/dynamic-layers/ti/recipes-kernel/linux/linux-bb.org_%.bbappend @@ -0,0 +1,2 @@ + +require recipes-kernel/linux/common.inc diff --git a/recipes-bsp/grub/grub-efi_%.bbappend b/recipes-bsp/grub/grub-efi_%.bbappend index f7b5ecc6..4fa00d3f 100644 --- a/recipes-bsp/grub/grub-efi_%.bbappend +++ b/recipes-bsp/grub/grub-efi_%.bbappend @@ -1,16 +1,2 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI:append = " \ - file://0001-fs-fat-Don-t-error-when-mtime-is-0.patch \ -" - -RDEPENDS:${PN}:class-target:remove:sota = "virtual-grub-bootconf" - -GRUB_BUILDIN += "reboot" - -# Create startup.nsh so it can be consumed by wic -do_deploy:append:class-target() { - DEST_IMAGE=$(echo ${GRUB_IMAGE} | sed -e 's/^grub-efi-//') - echo 'fs0:\\EFI\\BOOT\\'${DEST_IMAGE} > startup.nsh - install -m 755 ${B}/startup.nsh ${DEPLOYDIR} -} +# Add regexp command to GRUB +GRUB_BUILDIN += "regexp" diff --git a/recipes-bsp/u-boot/libubootenv/fw_env.config b/recipes-bsp/u-boot/libubootenv/fw_env.config new file mode 100644 index 00000000..49d312e2 --- /dev/null +++ b/recipes-bsp/u-boot/libubootenv/fw_env.config @@ -0,0 +1 @@ +/var/rootdirs/media/boot/uboot.env 0x0000 0x4000 diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/beaglebone-yocto/boot.cmd.in b/recipes-bsp/u-boot/u-boot-distro-boot/beaglebone-yocto/boot.cmd.in new file mode 100644 index 00000000..c8aabfbb --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/beaglebone-yocto/boot.cmd.in @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0+ OR MIT +# +# Copyright 2023 MicroHobby +# +# TorizonCore boot script. + +setenv bootlimit 3 +setenv devtype mmc +setenv devnum 0 +setenv bootdevice 0 +setenv otaroot 2 + +if test -z "${altbootcmd}" +then + env set altbootcmd 'env set rollback 1; run bootcmd' + env save +fi + +if test "${rollback}" = "1" && test "${upgrade_available}" = "1" +then + # Make sure to reset upgrade_available to avoid unnecessary wear + # Note this also makes rollback permanent. aktualizr will reset rollback + # when a new (hopefully better) update comes in. + env set upgrade_available 0 + env save +fi + +# save default U-Boot devicetree file to use in a rollback situation +env set fdtfile2 "${fdtfile}" +env set fdtfile "am335x-boneblack.dtb" + +if test -n "${loadaddr}" +then + ext4load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize} +else + ext4load ${devtype} ${devnum}:${otaroot} ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize} +fi + +if test "${debug}" = "1" +then + echo "Enabling kernel debug" + env set tdxargs "${tdxargs} rodata=off nokaslr maxcpus=1 kgdboc=ttymxc0,115200" +fi + +# now that we have all the environment variables, we can set the bootcmd +setenv bootargs "${defargs} ${bootargs} ${tdxargs}" + +ext4load ${devtype} ${devnum}:${otaroot} ${kernel_addr_r} /boot${kernel_image} +ext4load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} /boot${ramdisk_image} +env set ramdisk_size ${filesize} +load ${devtype} ${devnum}:1 ${fdt_addr_r} ${fdtfile} + +@@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r} diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/beaglebone-yocto/uEnv.txt.in b/recipes-bsp/u-boot/u-boot-distro-boot/beaglebone-yocto/uEnv.txt.in new file mode 100644 index 00000000..ccbe6963 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/beaglebone-yocto/uEnv.txt.in @@ -0,0 +1,6 @@ +kernel_image_type=@@KERNEL_IMAGETYPE@@ +overlays_file="overlays.txt" +bootlimit=3 +devtype=mmc +devnum=0 +otaroot=2 diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/boot.cmd.in b/recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/boot.cmd.in new file mode 100644 index 00000000..76a14ca5 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/boot.cmd.in @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0+ OR MIT +# +# Copyright 2023 MicroHobby +# +# TorizonCore boot script. + +setenv bootlimit 3 +setenv devtype mmc +setenv devnum 1 +setenv bootdevice 0 +setenv otaroot 2 + +if test -z "${altbootcmd}" +then + env set altbootcmd 'env set rollback 1; run bootcmd' + env save +fi + +if test "${rollback}" = "1" && test "${upgrade_available}" = "1" +then + # Make sure to reset upgrade_available to avoid unnecessary wear + # Note this also makes rollback permanent. aktualizr will reset rollback + # when a new (hopefully better) update comes in. + env set upgrade_available 0 + env save +fi + +# save default U-Boot devicetree file to use in a rollback situation +env set fdtfile "k3-am625-beagleplay.dtb" + +if test -n "${loadaddr}" +then + ext4load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize} +else + ext4load ${devtype} ${devnum}:${otaroot} ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize} +fi + +if test "${debug}" = "1" +then + echo "Enabling kernel debug" + env set tdxargs "${tdxargs} rodata=off nokaslr maxcpus=1 kgdboc=ttymxc0,115200" +fi + +# now that we have all the environment variables, we can set the bootcmd +setenv bootargs "${defargs} ${bootargs} ${tdxargs}" + +ext4load ${devtype} ${devnum}:${otaroot} ${kernel_addr_r} /boot${kernel_image} +ext4load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} /boot${ramdisk_image} +env set ramdisk_size ${filesize} +load ${devtype} ${devnum}:1 ${fdt_addr_r} ${fdtfile} + +@@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r} diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/uEnv.txt.in b/recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/uEnv.txt.in new file mode 100644 index 00000000..5d66f6eb --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/uEnv.txt.in @@ -0,0 +1,6 @@ +kernel_image_type=@@KERNEL_IMAGETYPE@@ +overlays_file="overlays.txt" +bootlimit=3 +devtype=mmc +devnum=1 +otaroot=2 diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in b/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in index 710a9e25..7658e7e7 100644 --- a/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in +++ b/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in @@ -29,4 +29,10 @@ else ext4load ${devtype} ${devnum}:1 ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize} fi +if test "${debug}" = "1" +then + echo "Enabling kernel debug" + env set tdxargs "${tdxargs} rodata=off nokaslr maxcpus=1 kgdboc=ttymxc0,115200" +fi + run bootcmd_run diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/nezha-allwinner-d1/boot.cmd.in b/recipes-bsp/u-boot/u-boot-distro-boot/nezha-allwinner-d1/boot.cmd.in new file mode 100644 index 00000000..80daf54b --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/nezha-allwinner-d1/boot.cmd.in @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0+ OR MIT +# +# Copyright 2023 MicroHobby +# +# TorizonCore boot script. + +setenv bootlimit 3 +setenv devtype mmc +setenv devnum 0 +setenv bootdevice 0 +setenv otaroot 2 + +if test -z "${altbootcmd}" +then + env set altbootcmd 'env set rollback 1; run bootcmd' + env save +fi + +if test "${rollback}" = "1" && test "${upgrade_available}" = "1" +then + # Make sure to reset upgrade_available to avoid unnecessary wear + # Note this also makes rollback permanent. aktualizr will reset rollback + # when a new (hopefully better) update comes in. + env set upgrade_available 0 + env save +fi + +# save default U-Boot devicetree file to use in a rollback situation +env set fdtfile2 "${fdtfile}" + +if test -n "${loadaddr}" +then + ext4load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize} +else + ext4load ${devtype} ${devnum}:${otaroot} ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize} +fi + +if test "${debug}" = "1" +then + echo "Enabling kernel debug" + env set tdxargs "${tdxargs} rodata=off nokaslr maxcpus=1 kgdboc=ttymxc0,115200" +fi + +# now that we have all the environment variables, we can set the bootcmd +setenv bootargs "${defargs} ${bootargs} ${tdxargs}" + +ext4load ${devtype} ${devnum}:${otaroot} ${kernel_addr_r} /boot${kernel_image} +ext4load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} /boot${ramdisk_image} +env set ramdisk_size ${filesize} + +@@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdtcontroladdr} diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/nezha-allwinner-d1/uEnv.txt.in b/recipes-bsp/u-boot/u-boot-distro-boot/nezha-allwinner-d1/uEnv.txt.in new file mode 100644 index 00000000..ccbe6963 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/nezha-allwinner-d1/uEnv.txt.in @@ -0,0 +1,6 @@ +kernel_image_type=@@KERNEL_IMAGETYPE@@ +overlays_file="overlays.txt" +bootlimit=3 +devtype=mmc +devnum=0 +otaroot=2 diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/raspberrypi4-64/uEnv.txt.in b/recipes-bsp/u-boot/u-boot-distro-boot/raspberrypi4-64/uEnv.txt.in new file mode 100644 index 00000000..cf78662b --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/raspberrypi4-64/uEnv.txt.in @@ -0,0 +1,36 @@ +kernel_image_type=@@KERNEL_IMAGETYPE@@ +overlays_file="overlays.txt" +bootlimit=3 +devtype=mmc +devnum=0 +otaroot=2 + +set_bootargs=env set bootargs "${defargs} ${bootargs} ${tdxargs}" + +bootcmd_load_k=ext4load ${devtype} ${devnum}:${otaroot} ${kernel_addr_r} /boot${kernel_image} + +bootcmd_load_r=ext4load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} /boot${ramdisk_image}; env set ramdisk_size ${filesize} + +# for rpi we need to overlay some u-boot info into the device tree +# this device tree was loaded by the Broadcom bootloader +uboot_info_overlay= \ + fdt addr ${fdt_addr} ; \ + fdt resize ; \ + fdt chosen + +# check kernel_image2 to avoid booting from other then default emmc in case of +# bootlimit is reached and there is no other deployed image +check_rollback_needed=if test -n "${kernel_image2}" && test "${rollback}" = "1"; then \ + echo "Rollback enabled. Booting previously deployed version."; \ + env set kernel_image ${kernel_image2}; \ + env set ramdisk_image ${ramdisk_image2}; \ + env set bootargs "${bootargs2}"; \ +fi || true + +bootcmd_boot=if test ${bootscript_debug} != 1; then \ + @@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr}; \ + fi || true + +bootcmd_run=run check_rollback_needed && run set_bootargs && \ + run uboot_info_overlay && \ + run bootcmd_load_k && run bootcmd_load_r && run bootcmd_boot diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/rpi/boot.cmd.in b/recipes-bsp/u-boot/u-boot-distro-boot/rpi/boot.cmd.in new file mode 100644 index 00000000..1bd30253 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/rpi/boot.cmd.in @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0+ OR MIT +# +# Copyright 2023 MicroHobby +# +# TorizonCore boot script. + +setenv bootlimit 3 +setenv devtype mmc +setenv devnum 0 +setenv otaroot 2 + +if test -z "${altbootcmd}" +then + env set altbootcmd 'env set rollback 1; run bootcmd' + env save +fi + +if test "${rollback}" = "1" && test "${upgrade_available}" = "1" +then + # Make sure to reset upgrade_available to avoid unnecessary wear + # Note this also makes rollback permanent. aktualizr will reset rollback + # when a new (hopefully better) update comes in. + env set upgrade_available 0 + env save +fi + +# save default U-Boot devicetree file to use in a rollback situation +env set fdtfile2 "${fdtfile}" + +if test -n "${loadaddr}" +then + ext4load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize} +else + ext4load ${devtype} ${devnum}:${otaroot} ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize} +fi + +if test "${debug}" = "1" +then + echo "Enabling kernel debug" + env set tdxargs "${tdxargs} rodata=off nokaslr maxcpus=1 kgdboc=ttyAMA0,115200" +fi + +run bootcmd_run diff --git a/recipes-bsp/u-boot/u-boot-distro-boot/rpi/uEnv.txt.in b/recipes-bsp/u-boot/u-boot-distro-boot/rpi/uEnv.txt.in new file mode 100644 index 00000000..cf78662b --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-distro-boot/rpi/uEnv.txt.in @@ -0,0 +1,36 @@ +kernel_image_type=@@KERNEL_IMAGETYPE@@ +overlays_file="overlays.txt" +bootlimit=3 +devtype=mmc +devnum=0 +otaroot=2 + +set_bootargs=env set bootargs "${defargs} ${bootargs} ${tdxargs}" + +bootcmd_load_k=ext4load ${devtype} ${devnum}:${otaroot} ${kernel_addr_r} /boot${kernel_image} + +bootcmd_load_r=ext4load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} /boot${ramdisk_image}; env set ramdisk_size ${filesize} + +# for rpi we need to overlay some u-boot info into the device tree +# this device tree was loaded by the Broadcom bootloader +uboot_info_overlay= \ + fdt addr ${fdt_addr} ; \ + fdt resize ; \ + fdt chosen + +# check kernel_image2 to avoid booting from other then default emmc in case of +# bootlimit is reached and there is no other deployed image +check_rollback_needed=if test -n "${kernel_image2}" && test "${rollback}" = "1"; then \ + echo "Rollback enabled. Booting previously deployed version."; \ + env set kernel_image ${kernel_image2}; \ + env set ramdisk_image ${ramdisk_image2}; \ + env set bootargs "${bootargs2}"; \ +fi || true + +bootcmd_boot=if test ${bootscript_debug} != 1; then \ + @@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr}; \ + fi || true + +bootcmd_run=run check_rollback_needed && run set_bootargs && \ + run uboot_info_overlay && \ + run bootcmd_load_k && run bootcmd_load_r && run bootcmd_boot diff --git a/recipes-bsp/u-boot/u-boot-ota/debug.cfg b/recipes-bsp/u-boot/u-boot-ota/debug.cfg new file mode 100644 index 00000000..2153634a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-ota/debug.cfg @@ -0,0 +1,3 @@ +# CONFIG_SPL_WATCHDOG is not set +# CONFIG_IMX_WATCHDOG is not set +# CONFIG_SYSRESET_WATCHDOG is not set diff --git a/recipes-bsp/u-boot/u-boot-ota/verdin-imx8mp/bootcommand.cfg b/recipes-bsp/u-boot/u-boot-ota/verdin-imx8mp/bootcommand.cfg deleted file mode 100644 index 95ae2727..00000000 --- a/recipes-bsp/u-boot/u-boot-ota/verdin-imx8mp/bootcommand.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="run bootcmd_mmc2" diff --git a/recipes-bsp/u-boot/u-boot/0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch b/recipes-bsp/u-boot/u-boot/0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch new file mode 100644 index 00000000..c375c406 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot/0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch @@ -0,0 +1,50 @@ +From: Mauro Salvini +To: u-boot@lists.denx.de +Subject: [PATCH] rpi: always set fdt_addr with firmware-provided FDT address +Date: Wed, 12 May 2021 14:39:45 +0200 [thread overview] +Message-ID: <20210512123945.25649-1-m.salvini@koansoftware.com> (raw) + +Raspberry firmware prepares the FDT blob in memory at an address +that depends on both the memory size and the blob size [1]. +After commit ade243a211d6 ("rpi: passthrough of the firmware provided FDT +blob") this FDT is passed to kernel through fdt_addr environment variable, +handled in set_fdt_addr() function in board file. + +When u-boot environment is persistently saved, if a change happens +in loaded FDT (e.g. for a new overlay applied), firmware produces a FDT +address different from the saved one, but u-boot still use the saved +one because set_fdt_addr() function does not overwrite the fdt_addr +variable. So, for example, if there is a script that uses fdt commands for +e.g. manipulate the bootargs, boot hangs with error + +libfdt fdt_check_header(): FDT_ERR_BADMAGIC + +Removing the fdt_addr variable in saved environment allows to boot. + +With this patch set_fdt_addr() function always overwrite fdt_addr value. + +[1] https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=134018 + +Signed-off-by: Mauro Salvini +Cc: C?dric Schieli +Cc: Matthias Brugger +--- + board/raspberrypi/rpi/rpi.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c +index df52a4689f..611013471e 100644 +--- a/board/raspberrypi/rpi/rpi.c ++++ b/board/raspberrypi/rpi/rpi.c +@@ -318,9 +318,6 @@ static void set_fdtfile(void) + */ + static void set_fdt_addr(void) + { +- if (env_get("fdt_addr")) +- return; +- + if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) + return; + +-- +2.17.1 \ No newline at end of file diff --git a/recipes-bsp/u-boot/u-boot_%.bbappend b/recipes-bsp/u-boot/u-boot_%.bbappend index e1d71732..265e8fa5 100644 --- a/recipes-bsp/u-boot/u-boot_%.bbappend +++ b/recipes-bsp/u-boot/u-boot_%.bbappend @@ -1 +1,11 @@ require u-boot-ota.inc + +SRCREV = "f9a043e55c78d894db01006ce442387b758e53ad" + +SRC_URI = "git://github.com/commontorizon/u-boot.git;protocol=https;branch=kirkstone" + +FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot:" + +SRC_URI:append:rpi = " file://0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch" + +DEPENDS:append:rpi = " u-boot-default-script" diff --git a/recipes-containers/docker-compose-up/files/docker-compose.service b/recipes-containers/docker-compose-up/files/docker-compose.service index 7c33b72d..8a153fa8 100644 --- a/recipes-containers/docker-compose-up/files/docker-compose.service +++ b/recipes-containers/docker-compose-up/files/docker-compose.service @@ -1,7 +1,8 @@ [Unit] Description=Docker Compose service with docker compose Requires=docker.service -After=docker.service +After=docker.service plymouth-quit.service +Wants=plymouth-quit.service ConditionPathExists=/var/sota/storage/docker-compose/docker-compose.yml ConditionPathExists=!/var/sota/storage/docker-compose/docker-compose.yml.tmp OnFailure=docker-integrity-checker.service diff --git a/recipes-containers/docker/docker-ce/0003-dynbinary-use-go-cross-compiler.patch b/recipes-containers/docker/docker-ce/0003-dynbinary-use-go-cross-compiler.patch new file mode 100644 index 00000000..c32bb87e --- /dev/null +++ b/recipes-containers/docker/docker-ce/0003-dynbinary-use-go-cross-compiler.patch @@ -0,0 +1,13 @@ +--- a/src/import/hack/make/.binary 2022-09-08 02:43:54.569047202 -0300 ++++ b/src/import/hack/make/.binary 2022-09-08 02:46:11.612879337 -0300 +@@ -67,6 +67,10 @@ + export CC="${CC:-x86_64-linux-gnu-gcc}" + export CGO_ENABLED=1 + ;; ++ linux/riscv64) ++ export CC="${CC:-riscv64-linux-gnu-gcc}" ++ export CGO_ENABLED=1 ++ ;; + esac + fi + diff --git a/recipes-containers/docker/docker-ce/0004-libnetwork-use-GO-instead-of-go.patch b/recipes-containers/docker/docker-ce/0004-libnetwork-use-GO-instead-of-go.patch new file mode 100644 index 00000000..9141eb5d --- /dev/null +++ b/recipes-containers/docker/docker-ce/0004-libnetwork-use-GO-instead-of-go.patch @@ -0,0 +1,13 @@ +--- git.orig/libnetwork/Makefile 2022-09-08 02:50:43.820948164 -0300 ++++ git/libnetwork/Makefile 2022-09-08 03:04:06.522681472 -0300 +@@ -82,8 +82,8 @@ + + cross-local: + @echo "🐳 $@" +- @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy +- @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet ++ @$(GO) build $(GOBUILDFLAGS) -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy ++ @$(GO) build $(GOBUILDFLAGS) -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet + + # Rebuild protocol buffers. + # These may need to be rebuilt after vendoring updates, so .proto files are declared .PHONY so they are always rebuilt. diff --git a/recipes-containers/docker/docker-ce_git.bbappend b/recipes-containers/docker/docker-ce_git.bbappend index 6383ccbc..2aae930c 100644 --- a/recipes-containers/docker/docker-ce_git.bbappend +++ b/recipes-containers/docker/docker-ce_git.bbappend @@ -3,6 +3,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" SRC_URI:append = " \ file://0001-dockerd-daemon-use-default-system-config-when-none-i.patch \ file://0002-cli-config-support-default-system-config.patch \ + file://0003-dynbinary-use-go-cross-compiler.patch \ " require docker-torizon.inc diff --git a/recipes-core/base-files/base-files/motd b/recipes-core/base-files/base-files/motd new file mode 100644 index 00000000..3c08c59c --- /dev/null +++ b/recipes-core/base-files/base-files/motd @@ -0,0 +1,3 @@ +This is an Experimental Common Torizon Image +Check for more info: +https://github.com/commontorizon/Documentation/blob/main/PRE-BUILT-DEV.md  diff --git a/recipes-core/base-files/base-files/x86/fstab b/recipes-core/base-files/base-files/x86/fstab new file mode 100644 index 00000000..ce8b86bb --- /dev/null +++ b/recipes-core/base-files/base-files/x86/fstab @@ -0,0 +1,12 @@ +# stock fstab - you probably want to override this with a machine specific one + +/dev/root / auto defaults 1 1 +LABEL=efi /var/rootdirs/media/efi vfat defaults 0 2 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs defaults 0 0 + +# uncomment this if your device has a SD/MMC/Transflash slot +#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0 + diff --git a/recipes-core/base-files/base-files_%.bbappend b/recipes-core/base-files/base-files_%.bbappend index f9b65cb9..308ba85e 100644 --- a/recipes-core/base-files/base-files_%.bbappend +++ b/recipes-core/base-files/base-files_%.bbappend @@ -2,6 +2,10 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" hostname = "" +SRC_URI += " \ + file://x86/fstab \ +" + # This deviates a bit from what OE-core is doing. Especially we want the full # distro version (with date) in /etc/issue. From what I understand the filtering # has been mainly done to avoid inconsistency, but since we anyway rebuild @@ -14,6 +18,11 @@ do_install_basefilesissue () { printf "%s %%h\n\n" "${DISTRO_VERSION}" >> ${D}${sysconfdir}/issue.net } +# This is needed because we are adding the env file on the x86 +do_install:append:x86-64() { + install -m 0644 ${WORKDIR}/x86/fstab ${D}${sysconfdir}/fstab +} + do_install:append:cfs-support () { # Get rid of the /dev/root entry in fstab to avoid errors from # systemd-remount-fs. diff --git a/recipes-core/images/initramfs-ostree-torizon-image.bb b/recipes-core/images/initramfs-ostree-torizon-image.bb index 2dd7cba7..1e9b8a52 100644 --- a/recipes-core/images/initramfs-ostree-torizon-image.bb +++ b/recipes-core/images/initramfs-ostree-torizon-image.bb @@ -9,6 +9,10 @@ PACKAGE_INSTALL:append:cfs-support = "\ initramfs-module-composefs \ " +PACKAGE_INSTALL:append:apalis-imx8 = "\ + firmware-imx-hdmi \ +" + SYSTEMD_DEFAULT_TARGET = "initrd.target" # Do not pollute the initrd image with rootfs features diff --git a/recipes-core/initramfs-framework/initramfs-framework_1.0.bbappend b/recipes-core/initramfs-framework/initramfs-framework_1.0.bbappend index e8a4ce93..cebe8fa8 100644 --- a/recipes-core/initramfs-framework/initramfs-framework_1.0.bbappend +++ b/recipes-core/initramfs-framework/initramfs-framework_1.0.bbappend @@ -45,6 +45,12 @@ FILES:initramfs-module-kmod = "\ /etc/modules-load.d/* \ " +SUMMARY:initramfs-module-firmware = "initramfs support for HDMI firmware" +RDEPENDS:initramfs-module-firmware = "${PN}-base firmware-imx-hdmi" +FILES:initramfs-module-firmware = "\ + /usr/lib/firmware/* \ +" + do_install:append() { install -m 0755 ${WORKDIR}/plymouth ${D}/init.d/02-plymouth install -m 0755 ${WORKDIR}/ostree ${D}/init.d/95-ostree @@ -80,8 +86,8 @@ do_install:append:mx8-nxp-bsp() { install -m 0755 ${WORKDIR}/50-imx8-graphics.conf ${D}/etc/modules-load.d/50-imx8-graphics.conf } -SRC_URI:append:ti-soc = " file://50-am62-graphics.conf" -RDEPENDS:initramfs-module-kmod:append:ti-soc = " \ +SRC_URI:append:verdin-am62 = " file://50-am62-graphics.conf" +RDEPENDS:initramfs-module-kmod:append:verdin-am62 = " \ kernel-module-pwm-tiehrpwm \ kernel-module-fb-sys-fops \ kernel-module-sysimgblt \ @@ -95,8 +101,7 @@ RDEPENDS:initramfs-module-kmod:append:ti-soc = " \ kernel-module-ti-sn65dsi83 \ kernel-module-lontium-lt8912b \ " - -do_install:append:ti-soc() { +do_install:append:verdin-am62() { install -d ${D}/etc/modules-load.d/ install -m 0755 ${WORKDIR}/50-am62-graphics.conf ${D}/etc/modules-load.d/50-am62-graphics.conf } diff --git a/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend b/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend new file mode 100644 index 00000000..61534e30 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend @@ -0,0 +1,5 @@ +RDEPENDS:${PN}:remove = "\ + connman-tools \ + connman-tests \ + connman-client \ + " diff --git a/recipes-core/plymouth/files/commontorizonlogo-dev.png b/recipes-core/plymouth/files/commontorizonlogo-dev.png new file mode 100644 index 00000000..b649db63 Binary files /dev/null and b/recipes-core/plymouth/files/commontorizonlogo-dev.png differ diff --git a/recipes-core/plymouth/files/commontorizonlogo.png b/recipes-core/plymouth/files/commontorizonlogo.png new file mode 100644 index 00000000..2517c6ed Binary files /dev/null and b/recipes-core/plymouth/files/commontorizonlogo.png differ diff --git a/recipes-core/plymouth/files/spinner.plymouth b/recipes-core/plymouth/files/spinner.plymouth index 17f0eae3..8b5e3b10 100644 --- a/recipes-core/plymouth/files/spinner.plymouth +++ b/recipes-core/plymouth/files/spinner.plymouth @@ -12,7 +12,7 @@ DialogVerticalAlignment=.382 TitleHorizontalAlignment=.5 TitleVerticalAlignment=.382 HorizontalAlignment=.5 -VerticalAlignment=.7 +VerticalAlignment=.9 WatermarkHorizontalAlignment=.5 WatermarkVerticalAlignment=.45 Transition=none diff --git a/recipes-core/plymouth/files/torizon-splash-dev-new.png b/recipes-core/plymouth/files/torizon-splash-dev-new.png new file mode 100644 index 00000000..c0d8cdad Binary files /dev/null and b/recipes-core/plymouth/files/torizon-splash-dev-new.png differ diff --git a/recipes-core/plymouth/files/torizon-splash-dev.png b/recipes-core/plymouth/files/torizon-splash-dev.png new file mode 100644 index 00000000..51d5e439 Binary files /dev/null and b/recipes-core/plymouth/files/torizon-splash-dev.png differ diff --git a/recipes-core/plymouth/files/torizon-splash-new.png b/recipes-core/plymouth/files/torizon-splash-new.png new file mode 100644 index 00000000..14df6f60 Binary files /dev/null and b/recipes-core/plymouth/files/torizon-splash-new.png differ diff --git a/recipes-core/plymouth/files/torizon-splash.png b/recipes-core/plymouth/files/torizon-splash.png new file mode 100644 index 00000000..4b025959 Binary files /dev/null and b/recipes-core/plymouth/files/torizon-splash.png differ diff --git a/recipes-core/plymouth/files/torizonlogo-white.png b/recipes-core/plymouth/files/torizonlogo-white.png deleted file mode 100644 index c9cda484..00000000 Binary files a/recipes-core/plymouth/files/torizonlogo-white.png and /dev/null differ diff --git a/recipes-core/plymouth/plymouth_%.bbappend b/recipes-core/plymouth/plymouth_%.bbappend index 5ecaa47f..47c51efd 100644 --- a/recipes-core/plymouth/plymouth_%.bbappend +++ b/recipes-core/plymouth/plymouth_%.bbappend @@ -2,8 +2,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI += " \ file://0001-disable-boot-splash-later.patch \ + file://torizon-splash.png \ + file://torizon-splash-new.png \ + file://torizon-splash-dev-new.png \ + file://torizon-splash-dev.png \ + file://commontorizonlogo.png \ + file://commontorizonlogo-dev.png \ file://0001-themes-only-install-spinner.patch \ - file://torizonlogo-white.png \ file://spinner.plymouth \ " @@ -12,6 +17,17 @@ PACKAGECONFIG = "drm" EXTRA_OECONF += "--with-udev --with-runtimedir=/run" do_install:append () { - install -m 0644 ${WORKDIR}/torizonlogo-white.png ${D}${datadir}/plymouth/themes/spinner/watermark.png + # use the labs logo if we are building the engineering image + if [ "${TDX_DEBUG}" = "1" ]; then + install -m 0644 ${WORKDIR}/torizon-splash-dev-new.png ${D}${datadir}/plymouth/themes/spinner/watermark.png + else + install -m 0644 ${WORKDIR}/torizon-splash-new.png ${D}${datadir}/plymouth/themes/spinner/watermark.png + fi + install -m 0644 ${WORKDIR}/spinner.plymouth ${D}${datadir}/plymouth/themes/spinner/spinner.plymouth + + # remove the renderers/drm.so if we do not support drm + if [ "${MACHINE}" = "raspberrypi0-wifi" ]; then + rm -f ${D}${libdir}/plymouth/renderers/drm.so + fi } diff --git a/recipes-core/systemd/systemd-conf_%.bbappend b/recipes-core/systemd/systemd-conf_%.bbappend index 6d098962..25362d1f 100644 --- a/recipes-core/systemd/systemd-conf_%.bbappend +++ b/recipes-core/systemd/systemd-conf_%.bbappend @@ -20,6 +20,6 @@ do_install:append() { sed -i "s/@@MACHINE@@/${MACHINE}/g" ${D}${systemd_unitdir}/system.conf.d/10-${BPN}.conf } -do_install:append:ti-soc() { +do_install:append:verdin-am62() { sed -i '$ d' ${D}${systemd_unitdir}/system.conf.d/10-${BPN}.conf } diff --git a/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch b/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch index 9a255103..b27f52a6 100644 --- a/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch +++ b/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch @@ -37,7 +37,7 @@ index 66ef5ce..fb7448a 100644 @@ -183,7 +183,7 @@ func ExtraEnvVarsCostly() []cfg.EnvVar { } }() - + - cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}) + cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false) if err != nil { @@ -50,7 +50,7 @@ index 67d1193..62e1774 100644 @@ -223,6 +223,8 @@ func (b *Builder) Do(ctx context.Context, root *Action) { writeActionGraph() } - + +var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != "" + // buildActionID computes the action ID for a build action. @@ -71,7 +71,7 @@ index 67d1193..62e1774 100644 fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo")) - cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p) + cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true) - + - ccExe := b.ccExe() + ccExe := filterCompilerFlags(b.ccExe(), true) fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags) @@ -101,12 +101,12 @@ index 67d1193..62e1774 100644 - fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo) + //fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo) } - + // Configuration specific to compiler toolchain. @@ -2989,8 +2991,25 @@ func envList(key, def string) []string { return args } - + +var filterFlags = os.Getenv("CGO_PEDANTIC") == "" + +func filterCompilerFlags(flags []string, keepfirst bool) []string { @@ -141,11 +141,11 @@ index 67d1193..62e1774 100644 + fflags = filterCompilerFlags(fflags, false) + ldflags = filterCompilerFlags(ldflags, false) + } - + return } @@ -3021,7 +3047,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`) - + func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) { p := a.Package - cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p) @@ -154,7 +154,7 @@ index 67d1193..62e1774 100644 return nil, nil, err } @@ -3577,7 +3603,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) { - + // Run SWIG on one SWIG input file. func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) { - cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p) @@ -162,6 +162,6 @@ index 67d1193..62e1774 100644 if err != nil { return "", "", err } --- +-- 2.30.2 diff --git a/recipes-devtools/lshw/lshw_%.bbappend b/recipes-devtools/lshw/lshw_%.bbappend index a271958e..ddaeaee8 100644 --- a/recipes-devtools/lshw/lshw_%.bbappend +++ b/recipes-devtools/lshw/lshw_%.bbappend @@ -1,5 +1,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" +COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64|riscv64).*-linux" + SRC_URI += "\ file://0001-code-clean-up-for-read-3.patch \ " diff --git a/recipes-devtools/python/python3-cryptography_%.bbappend b/recipes-devtools/python/python3-cryptography_%.bbappend new file mode 100644 index 00000000..febaf394 --- /dev/null +++ b/recipes-devtools/python/python3-cryptography_%.bbappend @@ -0,0 +1,5 @@ + +# fix the wrong triple +do_compile:prepend() { + export CARGO_BUILD_TARGET="${RUST_HOST_SYS}" +} diff --git a/recipes-extended/fluent-bit/fluent-bit_git.bb b/recipes-extended/fluent-bit/fluent-bit_git.bb index 798302c8..9d4cc810 100644 --- a/recipes-extended/fluent-bit/fluent-bit_git.bb +++ b/recipes-extended/fluent-bit/fluent-bit_git.bb @@ -54,6 +54,10 @@ EXTRA_OECMAKE += "-DFLB_OUT_KAFKA=On -DWITH_CURL=Off " inherit cmake systemd pkgconfig +# for risc-v +TARGET_CC_ARCH:append:nezha-allwinner-d1 = " ${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH:remove:nezha-allwinner-d1 = "-D_FORTIFY_SOURCE=2" + SYSTEMD_SERVICE:${PN} = "fluent-bit.service" do_install:append() { diff --git a/recipes-extended/ostree/files/0001-ostree-grub-generator-allow-adding-custom-scripts-to.patch b/recipes-extended/ostree/files/0001-ostree-grub-generator-allow-adding-custom-scripts-to.patch new file mode 100644 index 00000000..8b3fd52e --- /dev/null +++ b/recipes-extended/ostree/files/0001-ostree-grub-generator-allow-adding-custom-scripts-to.patch @@ -0,0 +1,56 @@ +From 9db2364ceb4febc3f5d2d13ad798c372920a5e06 Mon Sep 17 00:00:00 2001 +From: Eduardo Ferreira +Date: Thu, 21 Dec 2023 10:04:54 -0300 +Subject: [PATCH] ostree-grub-generator: allow adding custom scripts to + grub.cfg + +This changes allow us to customize grub.cfg without manually editing it. + +Now, whatever files found under /etc/ostree.d are added (in alphabetical +order) between the cfg header and its menuentries. + +Upstream-Status: Pending + +Signed-off-by: Eduardo Ferreira +--- + src/boot/grub2/ostree-grub-generator | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/boot/grub2/ostree-grub-generator b/src/boot/grub2/ostree-grub-generator +index d1436b65..f644fd8a 100644 +--- a/src/boot/grub2/ostree-grub-generator ++++ b/src/boot/grub2/ostree-grub-generator +@@ -25,6 +25,7 @@ script=$(basename ${0}) + # Atomically safe location where to generete grub.cfg when executing system upgrade. + new_grub2_cfg=${2} + entries_path=$(dirname $new_grub2_cfg)/entries ++custom_scripts="/etc/ostree.d" + + read_config() + { +@@ -105,10 +106,22 @@ timeout=10 + EOF + } + ++populate_custom_section() ++{ ++if [ -d "$custom_scripts" ]; then ++ for script in $(ls -v $custom_scripts/*); do ++ echo -e "\n### BEGIN ${script} ###" >> ${new_grub2_cfg} ++ cat ${script} >> ${new_grub2_cfg} ++ echo -e "\n### END ${script} ###\n" >> ${new_grub2_cfg} ++ done ++fi ++} ++ + generate_grub2_cfg() + { + populate_warning + populate_header ++ populate_custom_section + populate_menu + } + +-- +2.34.1 + diff --git a/recipes-extended/ostree/ostree-2021.6/0001-update-default-grub-cfg-header.patch b/recipes-extended/ostree/ostree-2021.6/0001-update-default-grub-cfg-header.patch index ab8850f9..f03c9df6 100644 --- a/recipes-extended/ostree/ostree-2021.6/0001-update-default-grub-cfg-header.patch +++ b/recipes-extended/ostree/ostree-2021.6/0001-update-default-grub-cfg-header.patch @@ -9,7 +9,7 @@ index 97ef4d69..b418c2fb 100644 -default=boot -timeout=10 +default=0 -+timeout=1 ++timeout=0 EOF } diff --git a/recipes-extended/ostree/ostree-torizon.inc b/recipes-extended/ostree/ostree-torizon.inc index d30fdd4f..e1f650f5 100644 --- a/recipes-extended/ostree/ostree-torizon.inc +++ b/recipes-extended/ostree/ostree-torizon.inc @@ -34,7 +34,8 @@ def is_ti(d): return False def get_deps(d): - if is_ti(d): # TI + # NOTE: beagleplay is TI but does not use the Toradex BSP + if is_ti(d) and ('beagleplay' not in d.getVar('MACHINE')) : # TI return 'u-boot-toradex-ti' if d.getVar('PREFERRED_PROVIDER_u-boot') else '' else: # NXP/x86 generic/QEMU return 'u-boot-default-script' if d.getVar('PREFERRED_PROVIDER_u-boot-default-script') else '' diff --git a/recipes-extended/procps/procps_%.bbappend b/recipes-extended/procps/procps_%.bbappend new file mode 100644 index 00000000..2fcae046 --- /dev/null +++ b/recipes-extended/procps/procps_%.bbappend @@ -0,0 +1,13 @@ +# in the engineering build, we need to enable break to debug by kernel.sysrq +do_install:append() { + if [ "${TDX_DEBUG}" = "1" ]; then + for keyword in \ + kernel.sysrq \ + ; do + # enabled + sed -i 's,'"$keyword"'=.*,'"$keyword"'=1,' ${D}${sysconfdir}/sysctl.conf + # uncomment + sed -i '/kernel.sysrq/s/^#//' ${D}${sysconfdir}/sysctl.conf + done + fi +} diff --git a/recipes-images/images/torizon-core-common-docker-dev.bb b/recipes-images/images/torizon-core-common-docker-dev.bb new file mode 100644 index 00000000..e7fc5cdc --- /dev/null +++ b/recipes-images/images/torizon-core-common-docker-dev.bb @@ -0,0 +1,9 @@ +require torizon-core-docker.bb +require torizon-core-dev.inc + +CORE_IMAGE_BASE_INSTALL:append = " \ + telemetry \ +" + +DESCRIPTION = "TorizonCore Linux development image" +IMAGE_VARIANT = "Common Docker Development" diff --git a/recipes-images/images/torizon-core-common-docker.bb b/recipes-images/images/torizon-core-common-docker.bb new file mode 100644 index 00000000..b0072ace --- /dev/null +++ b/recipes-images/images/torizon-core-common-docker.bb @@ -0,0 +1,21 @@ +SUMMARY = "TorizonCore" +DESCRIPTION = "TorizonCore Linux with no containers pre-provisioned." + +require torizon-core-common.inc + +CORE_IMAGE_BASE_INSTALL:append = " \ + docker-ce \ + docker-compose \ + docker-compose-up \ + docker-integrity-checker \ + docker-watchdog \ + docker-auto-prune \ +" + +IMAGE_VARIANT = "Common Docker" + +inherit extrausers + +EXTRA_USERS_PARAMS += "\ +usermod -a -G docker torizon; \ +" diff --git a/recipes-images/images/torizon-core-common.inc b/recipes-images/images/torizon-core-common.inc index 3c5a4629..b2581221 100644 --- a/recipes-images/images/torizon-core-common.inc +++ b/recipes-images/images/torizon-core-common.inc @@ -1,3 +1,5 @@ +require ../../conf/common/sanity.inc + LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -71,6 +73,12 @@ CORE_IMAGE_BASE_INSTALL:append:tdx = " \ CORE_IMAGE_BASE_INSTALL:append:sota = " \ auto-provisioning \ rac \ + provision-device \ +" + +# Update fallback for GRUB (for now only on x86 machines) +CORE_IMAGE_BASE_INSTALL:append:x86-64 = " \ + grub-ota-fallback \ " CORE_IMAGE_BASE_INSTALL:append:mx8-nxp-bsp = " \ diff --git a/recipes-images/images/torizon-core-dev.inc b/recipes-images/images/torizon-core-dev.inc index 2eb63dac..2dda2daa 100644 --- a/recipes-images/images/torizon-core-dev.inc +++ b/recipes-images/images/torizon-core-dev.inc @@ -1,9 +1,7 @@ CORE_IMAGE_BASE_INSTALL:append = "\ strace \ - ltrace \ tcpdump \ gdbserver \ - valgrind \ perf \ trace-cmd \ " diff --git a/recipes-images/images/torizon-core-docker-dev.bb b/recipes-images/images/torizon-core-docker-dev.bb index 672e3705..6da1693e 100644 --- a/recipes-images/images/torizon-core-docker-dev.bb +++ b/recipes-images/images/torizon-core-docker-dev.bb @@ -1,3 +1,4 @@ require torizon-core-docker.bb require torizon-core-dev.inc -DESCRIPTION = "TorizonCore Linux with no containers pre-provisioned (with debugging tools)." + +DESCRIPTION = "TorizonCore Linux engineering image" diff --git a/recipes-kernel/linux/common.inc b/recipes-kernel/linux/common.inc new file mode 100644 index 00000000..af610a77 --- /dev/null +++ b/recipes-kernel/linux/common.inc @@ -0,0 +1,21 @@ + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://debug.cfg \ + file://${MACHINE}.cfg \ +" + +do_configure:append() { + # machine fragment + if [ -f ${WORKDIR}/${MACHINE}.cfg ]; then + cat ${WORKDIR}/${MACHINE}.cfg >> ${B}/.config + else + bbfatal "No machine specific config fragment found for ${MACHINE}" + fi + + # debug fragment + if [ "${TDX_DEBUG}" = "1" ]; then + cat ${WORKDIR}/debug.cfg >> ${B}/.config + fi +} diff --git a/recipes-kernel/linux/files/0001-i915-hwmon-dgfx-check.patch b/recipes-kernel/linux/files/0001-i915-hwmon-dgfx-check.patch new file mode 100644 index 00000000..6fff5e07 --- /dev/null +++ b/recipes-kernel/linux/files/0001-i915-hwmon-dgfx-check.patch @@ -0,0 +1,30 @@ +From 73f7adae5b49685c7e18f811039c8de543cdf0ac Mon Sep 17 00:00:00 2001 +From: Matheus Castello +Date: Sun, 15 Oct 2023 17:39:14 -0300 +Subject: [PATCH] i915: hwmon: Add check for the dGfx platform + +The hwmon should be available only for dGfx platform + +Signed-off-by: Matheus Castello +--- + drivers/gpu/drm/i915/i915_hwmon.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c +index 6e0944af3131..d0ee493f1e7c 100644 +--- a/drivers/gpu/drm/i915/i915_hwmon.c ++++ b/drivers/gpu/drm/i915/i915_hwmon.c +@@ -500,6 +500,10 @@ void i915_hwmon_register(struct drm_i915_private *i915) + struct device *hwmon_dev; + struct i915_hwmon_drvdata *ddat; + ++ /* hwmon is available only for dGfx */ ++ if (!IS_DGFX(i915)) ++ return; ++ + hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL); + if (!hwmon) + return; +-- +2.42.0 + diff --git a/recipes-kernel/linux/files/beaglebone-yocto.cfg b/recipes-kernel/linux/files/beaglebone-yocto.cfg new file mode 100644 index 00000000..a1fb79a8 --- /dev/null +++ b/recipes-kernel/linux/files/beaglebone-yocto.cfg @@ -0,0 +1,11 @@ +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_PCM=y +CONFIG_SND_SOC=y +CONFIG_SND_SIMPLE_CARD_UTILS=y +CONFIG_SND_SIMPLE_CARD=y +CONFIG_SND_SOC_DAVINCI_MCASP=y +CONFIG_SND_SOC_TI_EDMA_PCM=y +CONFIG_SND_SOC_TI_SDMA_PCM=y +CONFIG_SND_SOC_TI_UDMA_PCM=y +CONFIG_SND_SOC_HDMI_CODEC=y diff --git a/recipes-kernel/linux/files/beaglebone-yocto/am335x-boneblack-hdmi.dtsi b/recipes-kernel/linux/files/beaglebone-yocto/am335x-boneblack-hdmi.dtsi new file mode 100644 index 00000000..ee6c799a --- /dev/null +++ b/recipes-kernel/linux/files/beaglebone-yocto/am335x-boneblack-hdmi.dtsi @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/ + */ + +#include +#include + +&am33xx_pinmux { + nxp_hdmi_bonelt_pins: nxp_hdmi_bonelt_pins { + pinctrl-single,pins = < + AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLDOWN, MUX_MODE3) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT_PULLDOWN, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0) + >; + }; + + nxp_hdmi_bonelt_off_pins: nxp_hdmi_bonelt_off_pins { + pinctrl-single,pins = < + AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLDOWN, MUX_MODE3) + >; + }; + + mcasp0_pins: mcasp0_pins { + pinctrl-single,pins = < + AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLUP, MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */ + AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_OUTPUT_PULLDOWN, MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/ + AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_OUTPUT_PULLUP, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_OUTPUT_PULLDOWN, MUX_MODE7) /* gpmc_a11.GPIO1_27 */ + >; + }; +}; + +&lcdc { + status = "okay"; + + /* If you want to get 24 bit RGB and 16 BGR mode instead of + * current 16 bit RGB and 24 BGR modes, set the propety + * below to "crossed" and uncomment the video-ports -property + * in tda19988 node. + */ + blue-and-red-wiring = "crossed"; + + port { + lcdc_0: endpoint@0 { + remote-endpoint = <&hdmi_0>; + }; + }; +}; + +&i2c0 { + tda19988: tda19988@70 { + compatible = "nxp,tda998x"; + reg = <0x70>; + nxp,calib-gpios = <&gpio1 25 0>; + interrupts-extended = <&gpio1 25 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names = "default", "off"; + pinctrl-0 = <&nxp_hdmi_bonelt_pins>; + pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>; + + /* Convert 24bit BGR to RGB, e.g. cross red and blue wiring */ + video-ports = <0x234501>; + + #sound-dai-cells = <0>; + audio-ports = < TDA998x_I2S 0x03>; + + ports { + port@0 { + hdmi_0: endpoint@0 { + remote-endpoint = <&lcdc_0>; + }; + }; + }; + }; +}; + +&mcasp0 { + #sound-dai-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcasp0_pins>; + status = "okay"; + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 0 + >; + tx-num-evt = <32>; + rx-num-evt = <32>; +}; + +/ { + clk_mcasp0_fixed: clk_mcasp0_fixed { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <24576000>; + }; + + clk_mcasp0: clk_mcasp0 { + #clock-cells = <0>; + compatible = "gpio-gate-clock"; + clocks = <&clk_mcasp0_fixed>; + enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */ + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "TI BeagleBone Black"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&dailink0_master>; + simple-audio-card,frame-master = <&dailink0_master>; + + dailink0_master: simple-audio-card,cpu { + sound-dai = <&mcasp0>; + clocks = <&clk_mcasp0>; + }; + + simple-audio-card,codec { + sound-dai = <&tda19988>; + }; + }; +}; diff --git a/recipes-kernel/linux/files/beagleplay.cfg b/recipes-kernel/linux/files/beagleplay.cfg new file mode 100644 index 00000000..d99548d7 --- /dev/null +++ b/recipes-kernel/linux/files/beagleplay.cfg @@ -0,0 +1,6 @@ +# CONFIG_REMOTEPROC is not set +# CONFIG_PRU_REMOTEPROC is not set +# CONFIG_TI_K3_DSP_REMOTEPROC is not set +# CONFIG_TI_K3_R5_REMOTEPROC is not set +# CONFIG_TI_K3_M4_REMOTEPROC is not set +# CONFIG_WATCHDOG is not set diff --git a/recipes-kernel/linux/files/debug.cfg b/recipes-kernel/linux/files/debug.cfg new file mode 100644 index 00000000..46b1d58e --- /dev/null +++ b/recipes-kernel/linux/files/debug.cfg @@ -0,0 +1,28 @@ +# kgdb +# CONFIG_STRICT_KERNEL_RWX is not set +# CONFIG_DEBUG_INFO_REDUCED is not set +CONFIG_DEBUG_KERNEL=y +CONFIG_DEBUG_INFO=y +CONFIG_FRAME_POINTER=y +CONFIG_STACK_TRACER=y +CONFIG_KGDB=y +CONFIG_KGDB_SERIAL_CONSOLE=y +# CONFIG_KGDB_KDB is not set +# CONFIG_KDB_KEYBOARD is not set +CONFIG_GDB_SCRIPTS=y +# CONFIG_RANDOMIZE_BASE is not set +# for toradex the watchdog and the imx2+ wdt need to be disable +# to be possible to use kgdb +# CONFIG_IMX2_WDT is not set +# for toradex we need to enable all sysrq keys +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 + +# make sure to have config.gz +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y + +# kdump +CONFIG_KEXEC_FILE=y +CONFIG_KEXEC=y +CONFIG_CRASH_DUMP=y +CONFIG_PROC_VMCORE=y diff --git a/recipes-kernel/linux/files/genericx86-64.cfg b/recipes-kernel/linux/files/genericx86-64.cfg new file mode 100644 index 00000000..72ad6e77 --- /dev/null +++ b/recipes-kernel/linux/files/genericx86-64.cfg @@ -0,0 +1,43 @@ +# enable qemuarm drm +CONFIG_DRM=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DRM_CIRRUS_QEMU=y +CONFIG_DRM_VBOXVIDEO=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +CONFIG_FB=y +CONFIG_FIRMWARE_EDID=y +CONFIG_FB_DDC=m +CONFIG_FB_BOOT_VESA_SUPPORT=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_DEFERRED_IO=y +CONFIG_FB_HECUBA=m +CONFIG_FB_SVGALIB=m +CONFIG_FB_BACKLIGHT=m +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y +CONFIG_FB_CIRRUS=y +CONFIG_FB_ARC=y +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +CONFIG_FB_VGA16=y +CONFIG_FB_UVESA=y +CONFIG_FB_VESA=y +CONFIG_FB_SIMPLE=y +CONFIG_DRM_VMWGFX=m +CONFIG_DRM_VMWGFX_FBCON=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_CONSOLE=y +CONFIG_USB_SERIAL_CP210X=y +CONFIG_USB_SERIAL_WWAN=m +CONFIG_USB_SERIAL_OPTION=m diff --git a/recipes-kernel/linux/files/nezha-allwinner-d1.cfg b/recipes-kernel/linux/files/nezha-allwinner-d1.cfg new file mode 100644 index 00000000..e69de29b diff --git a/recipes-kernel/linux/files/qemuarm64.cfg b/recipes-kernel/linux/files/qemuarm64.cfg new file mode 100644 index 00000000..258bf88f --- /dev/null +++ b/recipes-kernel/linux/files/qemuarm64.cfg @@ -0,0 +1,41 @@ +# enable qemuarm drm +CONFIG_DRM=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DRM_CIRRUS_QEMU=y +CONFIG_DRM_VBOXVIDEO=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +CONFIG_FB=y +CONFIG_FIRMWARE_EDID=y +CONFIG_FB_DDC=m +CONFIG_FB_BOOT_VESA_SUPPORT=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_DEFERRED_IO=y +CONFIG_FB_HECUBA=m +CONFIG_FB_SVGALIB=m +CONFIG_FB_BACKLIGHT=m +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y +CONFIG_FB_CIRRUS=y +CONFIG_FB_ARC=y +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +CONFIG_FB_VGA16=y +CONFIG_FB_UVESA=y +CONFIG_FB_VESA=y +CONFIG_FB_SIMPLE=y +CONFIG_DRM_VMWGFX=m +CONFIG_DRM_VMWGFX_FBCON=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_CONSOLE=y +CONFIG_USB_SERIAL_CP210X=y diff --git a/recipes-kernel/linux/files/qemux86-64.cfg b/recipes-kernel/linux/files/qemux86-64.cfg new file mode 100644 index 00000000..72ad6e77 --- /dev/null +++ b/recipes-kernel/linux/files/qemux86-64.cfg @@ -0,0 +1,43 @@ +# enable qemuarm drm +CONFIG_DRM=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DRM_CIRRUS_QEMU=y +CONFIG_DRM_VBOXVIDEO=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +CONFIG_FB=y +CONFIG_FIRMWARE_EDID=y +CONFIG_FB_DDC=m +CONFIG_FB_BOOT_VESA_SUPPORT=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_DEFERRED_IO=y +CONFIG_FB_HECUBA=m +CONFIG_FB_SVGALIB=m +CONFIG_FB_BACKLIGHT=m +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y +CONFIG_FB_CIRRUS=y +CONFIG_FB_ARC=y +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +CONFIG_FB_VGA16=y +CONFIG_FB_UVESA=y +CONFIG_FB_VESA=y +CONFIG_FB_SIMPLE=y +CONFIG_DRM_VMWGFX=m +CONFIG_DRM_VMWGFX_FBCON=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_CONSOLE=y +CONFIG_USB_SERIAL_CP210X=y +CONFIG_USB_SERIAL_WWAN=m +CONFIG_USB_SERIAL_OPTION=m diff --git a/recipes-kernel/linux/files/raspberrypi0-2w-64.cfg b/recipes-kernel/linux/files/raspberrypi0-2w-64.cfg new file mode 100644 index 00000000..fada48e3 --- /dev/null +++ b/recipes-kernel/linux/files/raspberrypi0-2w-64.cfg @@ -0,0 +1,22 @@ +CONFIG_I2C_ALGOBIT=y +CONFIG_CEC_CORE=y +CONFIG_DRM=y +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_SCHED=y +CONFIG_DRM_V3D=y +CONFIG_SND=y +CONFIG_SND_SOC=y +CONFIG_SND_BCM2835=y +CONFIG_DRM_VC4=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y diff --git a/recipes-kernel/linux/files/raspberrypi0-wifi.cfg b/recipes-kernel/linux/files/raspberrypi0-wifi.cfg new file mode 100644 index 00000000..fada48e3 --- /dev/null +++ b/recipes-kernel/linux/files/raspberrypi0-wifi.cfg @@ -0,0 +1,22 @@ +CONFIG_I2C_ALGOBIT=y +CONFIG_CEC_CORE=y +CONFIG_DRM=y +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_SCHED=y +CONFIG_DRM_V3D=y +CONFIG_SND=y +CONFIG_SND_SOC=y +CONFIG_SND_BCM2835=y +CONFIG_DRM_VC4=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y diff --git a/recipes-kernel/linux/files/raspberrypi3-64.cfg b/recipes-kernel/linux/files/raspberrypi3-64.cfg new file mode 100644 index 00000000..fada48e3 --- /dev/null +++ b/recipes-kernel/linux/files/raspberrypi3-64.cfg @@ -0,0 +1,22 @@ +CONFIG_I2C_ALGOBIT=y +CONFIG_CEC_CORE=y +CONFIG_DRM=y +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_SCHED=y +CONFIG_DRM_V3D=y +CONFIG_SND=y +CONFIG_SND_SOC=y +CONFIG_SND_BCM2835=y +CONFIG_DRM_VC4=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y diff --git a/recipes-kernel/linux/files/raspberrypi4-64.cfg b/recipes-kernel/linux/files/raspberrypi4-64.cfg new file mode 100644 index 00000000..fada48e3 --- /dev/null +++ b/recipes-kernel/linux/files/raspberrypi4-64.cfg @@ -0,0 +1,22 @@ +CONFIG_I2C_ALGOBIT=y +CONFIG_CEC_CORE=y +CONFIG_DRM=y +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_SCHED=y +CONFIG_DRM_V3D=y +CONFIG_SND=y +CONFIG_SND_SOC=y +CONFIG_SND_BCM2835=y +CONFIG_DRM_VC4=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y diff --git a/recipes-kernel/linux/linux-toradex%.bbappend b/recipes-kernel/linux/linux-toradex%.bbappend index 5ee21a22..caa6b4fc 100644 --- a/recipes-kernel/linux/linux-toradex%.bbappend +++ b/recipes-kernel/linux/linux-toradex%.bbappend @@ -1,2 +1,8 @@ + +# Make sure to override LOCALVERSION in linux-imx.inc +LOCALVERSION = "-${TDX_VERSION}-labs" + + require linux-torizon.inc require linux-toradex-kmeta.inc +require common.inc diff --git a/recipes-kernel/linux/linux-yocto%.bbappend b/recipes-kernel/linux/linux-yocto%.bbappend index 3f86f152..c6697ed2 100644 --- a/recipes-kernel/linux/linux-yocto%.bbappend +++ b/recipes-kernel/linux/linux-yocto%.bbappend @@ -7,3 +7,6 @@ SRC_URI += "\ " inherit toradex-kernel-localversion + +require common.inc +require specific.inc diff --git a/recipes-kernel/linux/specific.inc b/recipes-kernel/linux/specific.inc new file mode 100644 index 00000000..95aeb781 --- /dev/null +++ b/recipes-kernel/linux/specific.inc @@ -0,0 +1,10 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://${MACHINE}/ \ +" + +# prepend custom device trees +do_configure:prepend:beaglebone-yocto() { + cp ${WORKDIR}/${MACHINE}/*.dts* ${S}/arch/arm/boot/dts +} diff --git a/recipes-sota/config/aktualizr-default-sec.bb b/recipes-sota/config/aktualizr-default-sec.bb index ff4f1d81..0de1178b 100644 --- a/recipes-sota/config/aktualizr-default-sec.bb +++ b/recipes-sota/config/aktualizr-default-sec.bb @@ -14,6 +14,8 @@ SRC_URI = " \ RDEPENDS:${PN} += "bash coreutils jq util-linux mmc-utils sed u-boot-fw-utils" RDEPENDS:${PN}:remove:genericx86-64 = "u-boot-fw-utils" +RDEPENDS:${PN}:remove:qemux86-64 = "u-boot-fw-utils" +RDEPENDS:${PN}:remove:intel-corei7-64 = "u-boot-fw-utils" do_install:append () { install -m 0700 -d ${D}${libdir}/sota/conf.d diff --git a/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic b/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic new file mode 100644 index 00000000..cb029058 --- /dev/null +++ b/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic @@ -0,0 +1,53 @@ +# GRUB can't add, so we hack an increment +set inc_range="0,1 1,2 2,3" +function inc_bootcount { + set incr="" + regexp --set=1:incr "${bootcount},([0-9]+)" "${inc_range}" + set bootcount=$incr +} + +function inc_default { + set incr="" + regexp --set=1:incr "${default},([0-9]+)" "${inc_range}" + set default=$incr +} + +# Load all the variables needed +load_env + +if [ "${rollback}" == "0" -a "${upgrade_available}" = "1" ]; then + # Make sure to reset default whenever we already performed a rollback + # and deployed a new image. This way we'll be able to boot this new image + # and test it. If all fails we can still fallback. + set default=0 + save_env default +fi + +if [ "${rollback}" == "1" -a "${upgrade_available}" = "1" ]; then + # Make sure to reset upgrade_available to avoid unnecessary wear + # Note this also makes rollback permanent. aktualizr will reset rollback + # when a new (hopefully better) update comes in. + set upgrade_available=0 + save_env upgrade_available +fi + +if [ "${bootcount}" == "${bootlimit}" ]; then + # We've reached our retry limit, marking for OS rollback + set rollback=1 + save_env rollback +else + inc_bootcount + save_env bootcount +fi + +if [ "${upgrade_available}" == "1" ]; then + if [ "${rollback}" == 1 ]; then + # We need to rollback, so we reset 'bootcount' and increase default value. + # Since entries are ordered from newest to oldest, increasing default is + # rolling back to the last entry. + inc_default + set bootcount=0 + save_env default + save_env bootcount + fi +fi diff --git a/recipes-sota/grub-ota-fallback/grub-ota-fallback/fw_printenv b/recipes-sota/grub-ota-fallback/grub-ota-fallback/fw_printenv new file mode 100644 index 00000000..b5569a9b --- /dev/null +++ b/recipes-sota/grub-ota-fallback/grub-ota-fallback/fw_printenv @@ -0,0 +1,8 @@ +#!/bin/bash + +# Aliasing grub-editenv to U-Boot's fw_setenv +if [[ $# -ne 1 ]]; then + grub-editenv /var/rootdirs/media/efi/EFI/BOOT/grubenv list +else + grub-editenv /var/rootdirs/media/efi/EFI/BOOT/grubenv list | grep "^$1=" || echo "$1=" +fi \ No newline at end of file diff --git a/recipes-sota/grub-ota-fallback/grub-ota-fallback/fw_setenv b/recipes-sota/grub-ota-fallback/grub-ota-fallback/fw_setenv new file mode 100644 index 00000000..f01651ee --- /dev/null +++ b/recipes-sota/grub-ota-fallback/grub-ota-fallback/fw_setenv @@ -0,0 +1,6 @@ +#!/bin/bash + +# Aliasing grub-editenv to U-Boot's fw_setenv +if [[ $# -eq 2 ]]; then + grub-editenv /var/rootdirs/media/efi/EFI/BOOT/grubenv set "$1"="$2" +fi \ No newline at end of file diff --git a/recipes-sota/grub-ota-fallback/grub-ota-fallback/grubenv-create.service b/recipes-sota/grub-ota-fallback/grub-ota-fallback/grubenv-create.service new file mode 100644 index 00000000..c99ed932 --- /dev/null +++ b/recipes-sota/grub-ota-fallback/grub-ota-fallback/grubenv-create.service @@ -0,0 +1,13 @@ +[Unit] +Description=Check and create grubenv if not present +After=boot-complete.target +Requires=boot-complete.target +ConditionPathExists=|!/var/rootdirs/media/efi/EFI/BOOT/grubenv + +[Service] +Type=oneshot +WorkingDirectory=/var/rootdirs/media/efi/EFI/BOOT/ +ExecStart=/usr/bin/grub-editenv ./grubenv create ; /usr/bin/grub-editenv ./grubenv set bootcount=0 bootlimit=3 rollback=0 upgrade_available=0 + +[Install] +WantedBy=multi-user.target diff --git a/recipes-sota/grub-ota-fallback/grub-ota-fallback_1.0.bb b/recipes-sota/grub-ota-fallback/grub-ota-fallback_1.0.bb new file mode 100644 index 00000000..85018939 --- /dev/null +++ b/recipes-sota/grub-ota-fallback/grub-ota-fallback_1.0.bb @@ -0,0 +1,37 @@ +SUMMARY = "Adds fallback logic to GRUB boot script" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "\ + file://99_fallback_logic \ + file://grubenv-create.service \ + file://fw_printenv \ + file://fw_setenv \ +" + +S = "${WORKDIR}" + +inherit systemd + +RDEPENDS:${PN} = "bash" + +SYSTEMD_SERVICE:${PN} = "grubenv-create.service" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/fw_printenv ${D}${bindir}/fw_printenv + install -m 0755 ${WORKDIR}/fw_setenv ${D}${bindir}/fw_setenv + + install -d ${D}${sysconfdir}/ostree.d + install -m 0755 ${WORKDIR}/99_fallback_logic ${D}${sysconfdir}/ostree.d/99_fallback_logic + + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/grubenv-create.service ${D}${systemd_unitdir}/system/grubenv-create.service +} + +FILES:${PN} += "\ + ${systemd_unitdir}/system/grubenv-create.service \ + ${bindir}/fw_printenv \ + ${bindir}/fw_setenv \ +" \ No newline at end of file diff --git a/recipes-sota/provision-device/provision-device/provision-device b/recipes-sota/provision-device/provision-device/provision-device new file mode 100644 index 00000000..48af1178 --- /dev/null +++ b/recipes-sota/provision-device/provision-device/provision-device @@ -0,0 +1,189 @@ +#!/usr/bin/env bash + +function GetDeviceID() { + cat "${SYSROOT_PATH_PREFIX}"/etc/hostname +} + +function RegisterDevice() { + + echo "== Registering device (deviceID: ${DEVICE_ID}) in system, and downloading credentials." + cd "$(mktemp -d)" || exit 1 + http_code=$(curl -s -w '%{http_code}' --max-time 30 -X POST -H "Authorization: Bearer $PROVISIONING_TOKEN" "$AUTOPROV_URL" -d "{\"device_id\": \"${DEVICE_ID}\", \"device_name\": \"${DEVICE_NAME}\"}" -o device.zip) + + if [[ ! $http_code -eq 200 ]]; then + # if we failed, device.zip will be a text file with the errors + echo -e "${RED}" + echo "Failed to download token :(" + echo "HTTP ERROR ${http_code}" + cat device.zip + echo -e "${NC}" + exit 1 + fi +} + +function BackupOldCredentials() { + echo "== Backing up any existing ota device creds" + ### move/backup any existing ota device creds + #BACKUP_DIR=$SOTA_DIR/backup/$(date +"%Y-%m-%d_%Hh%Mm%Ss") + BACKUP_DIR="$SOTA_DIR"/backup/$(jq -r .deviceUuid "$SOTA_DIR"/import/info.json)-$(jq -r .registeredName "$SOTA_DIR"/import/info.json) + mkdir -p "$BACKUP_DIR" + + ### If it doesn't already exist + mkdir -p "$SOTA_DIR"/import + + # WE don't care about failures here since there might not be any data + mv "$SOTA_DIR"/import/* "$BACKUP_DIR"/ &> /dev/null + mv "$SOTA_DIR"/sql.db "$BACKUP_DIR"/ &> /dev/null +} + +function WriteCredentials() { + echo "== Extracing device credentials from archive" + unzip device.zip -d "$SOTA_DIR"/import/ || { + echo "Failed to extract zip file" + exit 1 + } + + # Delete the sql.db in case aktualizr re-created it? + rm "$SOTA_DIR"/sql.db &> /dev/null && sync && sleep 3 + + ### WriteOut gateway.url + echo "== Creating new gateway.url ($GW_URL)" + echo "$GW_URL" > "$SOTA_DIR"/import/gateway.url || { + echo "Failed to create gateway.url" + exit 1 + } + + echo "" + echo "== Success!" + echo "Device has been registered with the system and credentials are in place!" + echo -e "${GREEN}" + jq . "$SOTA_DIR"/import/info.json + echo -e "${NC}" + +} + +function EnableDeviceMetrics() { + if [ -d "/som_sysroot" ]; then + # if we're in a container, we can't actually run aktualizr, so instead we just run strings. Ugly, but it works. + strings "${SYSROOT_PATH_PREFIX}"/usr/bin/aktualizr-torizon | grep -q "enable-data-proxy" || DISABLE_DEVICE_METRICS=1 + else + aktualizr-torizon --help | grep -q "enable-data-proxy" || DISABLE_DEVICE_METRICS=1 + fi + + ### Create (or delete) fluent-bit enabling file + if [ -z "$DISABLE_DEVICE_METRICS" ]; then + touch "${SYSROOT_PATH_PREFIX}"/etc/fluent-bit/enabled + else + rm "${SYSROOT_PATH_PREFIX}"/etc/fluent-bit/enabled &> /dev/null + fi + +} + +function StartServices() { + echo "== Restarting services..." + + echo "Restarting aktualizr..." + systemctl restart aktualizr + + if [ -z "$DISABLE_DEVICE_METRICS" ]; then + echo "Restarting fluent-bit..." + systemctl restart fluent-bit + else + echo "" + echo "Skipping fluent-bit because device metrics are disabled..." + fi +} + + +function usage { + cat < -g -t -d -n + + Optional arguments: + -u URL of provisioning endpoint + -g URL of device gateway + -d A device ID to use. If not set, will be generated based on /etc/hostname + -p Opt out of sending device metrics + -n A device Name to use. If not set, it will be autogenerated on the server side + + Required arguments: + -t Your secret token, provided by the OTA server + + Prerequisites: curl, jq, unzip +EOF +} + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' + +NC='\033[0m' # No Color + +# check if we're running in the provisioning container with the SOM sysroot mounted at the expected location +if [ -d "/som_sysroot" ]; then + SYSROOT_PATH_PREFIX=/som_sysroot +fi + +# set default values unless environment variables are set +[ -z "$AUTOPROV_URL" ] && AUTOPROV_URL=https://app.torizon.io/api/accounts/devices +[ -z "$GW_URL" ] && GW_URL=https://ota-ce.torizon.io +[ -z "$DEVICE_ID" ] && DEVICE_ID=$(GetDeviceID) +[ -z "$DEVICE_NAME" ] && DEVICE_NAME='' + +SOTA_DIR="${SYSROOT_PATH_PREFIX}"/var/sota + +while getopts ":hpu:g:t:d:n:" opt; do + case $opt in + h) + usage + exit 0 + ;; + p) + DISABLE_DEVICE_METRICS=1 + ;; + u) + AUTOPROV_URL=$OPTARG + ;; + g) + GW_URL=$OPTARG + ;; + t) + PROVISIONING_TOKEN=$OPTARG + ;; + d) + DEVICE_ID=$OPTARG + ;; + n) + DEVICE_NAME=$OPTARG + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + exit 1 + ;; + esac +done + +if [ -z "$PROVISIONING_TOKEN" ]; then + echo "Error: provisioning token not provided" >&2 + echo "" + usage + exit 1 +fi + +RegisterDevice +BackupOldCredentials +WriteCredentials +EnableDeviceMetrics +if [ -d "/som_sysroot" ]; then + echo "Running in a container, not restarting services..." +else + StartServices +fi + +echo "" +echo -e " Aktualizr should automatically connect with the server. For logs run: ${YELLOW}sudo journalctl -f -u aktualizr*${NC}" +echo "" \ No newline at end of file diff --git a/recipes-sota/provision-device/provision-device_1.0.bb b/recipes-sota/provision-device/provision-device_1.0.bb new file mode 100644 index 00000000..b18f1af5 --- /dev/null +++ b/recipes-sota/provision-device/provision-device_1.0.bb @@ -0,0 +1,20 @@ +SUMMARY = "Provision-device is a service to manually provision \ +the device to the Platform Services" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = " \ + file://provision-device \ +" + +S = "${WORKDIR}" + +RDEPENDS:${PN} = "bash jq curl unzip" + +inherit allarch + +do_install() { + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/provision-device ${D}${sbindir} +} diff --git a/recipes-sota/rac/rac_git.bb b/recipes-sota/rac/rac_git.bb index f8ebc4ce..c5ec29f3 100644 --- a/recipes-sota/rac/rac_git.bb +++ b/recipes-sota/rac/rac_git.bb @@ -12,7 +12,9 @@ SRC_URI = " \ " SRCREV = "dd2c885984f9ab19b522cb4cff22e46ae4095e3d" -SRCREV:use-head-next = "${AUTOREV}" +# FIXME: this sounds wrong, should not be the next +# FIXME: BUT WE ARE FOLLOWING WHAT UPSTREAM IS DOING +#SRCREV:use-head-next = "${AUTOREV}" S = "${WORKDIR}/git" diff --git a/recipes-support/docker-binfmt/docker-binfmt/docker-binfmt b/recipes-support/docker-binfmt/docker-binfmt/docker-binfmt new file mode 100644 index 00000000..a8ce1447 --- /dev/null +++ b/recipes-support/docker-binfmt/docker-binfmt/docker-binfmt @@ -0,0 +1,7 @@ +#!/usr/bin/bash +# +# Copyright (c) MicroHobby 2023 +# All rights reserved. +# + +docker run --rm --privileged torizon/binfmt diff --git a/recipes-support/docker-binfmt/docker-binfmt/docker-binfmt.service b/recipes-support/docker-binfmt/docker-binfmt/docker-binfmt.service new file mode 100644 index 00000000..394aa92d --- /dev/null +++ b/recipes-support/docker-binfmt/docker-binfmt/docker-binfmt.service @@ -0,0 +1,12 @@ +[Unit] +Description=Start binfmt-support from Docker torizon/binfmt +Requires=docker.service +After=docker.service +Wants=docker.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/docker-binfmt + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/docker-binfmt/docker-binfmt_0.1.bb b/recipes-support/docker-binfmt/docker-binfmt_0.1.bb new file mode 100644 index 00000000..e110cb4d --- /dev/null +++ b/recipes-support/docker-binfmt/docker-binfmt_0.1.bb @@ -0,0 +1,28 @@ +SUMMARY = "Start binfmt-support from Docker torizon/binfmt" +DESCRIPTION = "Start binfmt-support from Docker torizon/binfmt" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit allarch systemd + +RDEPENDS:${PN} += " bash docker" + +SRC_URI = " \ + file://docker-binfmt \ + file://docker-binfmt.service \ +" + +S = "${WORKDIR}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_install () { + install -d ${D}${sbindir} + install -m 0755 ${S}/docker-binfmt ${D}${sbindir} + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/docker-binfmt.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_SERVICE:${PN} = "docker-binfmt.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" diff --git a/recipes-support/resize-helper/resize-helper/resize-helper b/recipes-support/resize-helper/resize-helper/resize-helper new file mode 100644 index 00000000..4616b5a9 --- /dev/null +++ b/recipes-support/resize-helper/resize-helper/resize-helper @@ -0,0 +1,81 @@ +#!/bin/sh +# Copyright (c) Fathi Boudra +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# must exit on error +set -e +set -o pipefail + +# we must be root +[ $(whoami) = "root" ] || { echo "E: You must be root" && exit 1; } + +# we must have few tools +SGDISK=$(which sgdisk) || { echo "E: You must have sgdisk" && exit 1; } +FDISK=$(which fdisk) || { echo "E: You must have fdisk" && exit 1; } +PARTX=$(which partx) || { echo "E: You must have partx" && exit 1; } +RESIZE2FS=$(which resize2fs) || { echo "E: You must have resize2fs" && exit 1; } + +# find root device +ROOT_DEVICE=$(findmnt --noheadings --output=SOURCE / | cut -d'[' -f1) +# prune root device (for example UUID) +ROOT_DEVICE=$(realpath ${ROOT_DEVICE}) +# get the partition number and type +INFO=$(udevadm info --query=property --name=${ROOT_DEVICE}) +PART_ENTRY_NUMBER=$(echo "${INFO}" | grep '^ID_PART_ENTRY_NUMBER=' | cut -d'=' -f2) +PART_ENTRY_NAME=$(echo "${INFO}" | grep '^ID_PART_ENTRY_NAME=' || true | cut -d'=' -f2) + +# in case the root device is not on a partitioned media +if [ "x$PART_ENTRY_NUMBER" = "x" ]; then + ${RESIZE2FS} "${ROOT_DEVICE}" + exit 0 +fi + +PART_TABLE_TYPE=$(echo "${INFO}" | grep '^ID_PART_TABLE_TYPE=' | cut -d'=' -f2) +# find the block device +DEVICE=$(udevadm info --query=path --name=${ROOT_DEVICE} | awk -F'/' '{print $(NF-1)}') +DEVICE="/dev/${DEVICE}" + +SIZE=$(blockdev --getsz ${DEVICE}) +TYPE="p\n" +if [ "$PART_TABLE_TYPE" = "gpt" ]; then + ${SGDISK} -e ${DEVICE} + SIZE=$(($SIZE - 33)) # the GPT end of disk is 34 sectors + TYPE="" +fi + +# Use fdisk to repartition +# fdisk uses a ram image of the parition table until a write is performed +# so the sequence is to delete the partition and recreate it at the same +# starting point but making it the size of the available disk. +# +END=$((${SIZE} - 1)) +PARTOF=$(echo "${INFO}" | grep '^ID_PART_ENTRY_OFFSET=' | cut -d'=' -f2) +echo -e "d\n${PART_ENTRY_NUMBER}\nn\n${TYPE}${PART_ENTRY_NUMBER}\n${PARTOF}\n${END}\nw\n" | ${FDISK} ${DEVICE} + +if [ -n "${PART_ENTRY_NAME}" ]; then + ${SGDISK} --change-name=${PART_ENTRY_NUMBER}:"${PART_ENTRY_NAME}" ${DEVICE} +fi + +${PARTX} -u ${DEVICE} +${RESIZE2FS} "${ROOT_DEVICE}" diff --git a/recipes-support/resize-helper/resize-helper/resize-helper.service b/recipes-support/resize-helper/resize-helper/resize-helper.service new file mode 100644 index 00000000..e2262bea --- /dev/null +++ b/recipes-support/resize-helper/resize-helper/resize-helper.service @@ -0,0 +1,13 @@ +[Unit] +Description=Resize root filesystem to fit available disk space +Wants=systemd-udevd.service systemd-udev-trigger.service +After=systemd-remount-fs.service systemd-udevd.service + +[Service] +Type=oneshot +ExecStartPre=-/bin/udevadm settle +ExecStart=/usr/sbin/resize-helper +ExecStartPost=/bin/systemctl disable resize-helper.service + +[Install] +WantedBy=basic.target diff --git a/recipes-support/resize-helper/resize-helper_0.1.bb b/recipes-support/resize-helper/resize-helper_0.1.bb new file mode 100644 index 00000000..34feb23c --- /dev/null +++ b/recipes-support/resize-helper/resize-helper_0.1.bb @@ -0,0 +1,27 @@ +SUMMARY = "Rootfs disk resize-helper" +SECTION = "devel" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f" + +inherit allarch systemd + +RDEPENDS:${PN} += "e2fsprogs-resize2fs gptfdisk util-linux-fdisk util-linux-blockdev util-linux-partx util-linux-findmnt" + +SRC_URI = "file://resize-helper \ + file://resize-helper.service \ +" + +S = "${WORKDIR}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_install () { + install -d ${D}${sbindir} + install -m 0755 ${S}/resize-helper ${D}${sbindir} + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/resize-helper.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_SERVICE:${PN} = "resize-helper.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" diff --git a/recipes-support/tdx-info/tdx-info_%.bbappend b/recipes-support/tdx-info/tdx-info_%.bbappend new file mode 100644 index 00000000..a4b86206 --- /dev/null +++ b/recipes-support/tdx-info/tdx-info_%.bbappend @@ -0,0 +1,3 @@ + +SRC_URI = "git://github.com/commontorizon/tdx-info;protocol=https;branch=kirkstone" +SRCREV = "ca1ac11abc90cf0aa934d5f39c90839298a9faab" diff --git a/recipes-support/telemetry/telemetry/telemetry b/recipes-support/telemetry/telemetry/telemetry new file mode 100644 index 00000000..e6f3bd39 --- /dev/null +++ b/recipes-support/telemetry/telemetry/telemetry @@ -0,0 +1,81 @@ +#!/usr/bin/bash +# +# Copyright (c) MicroHobby 2023 +# All rights reserved. +# + +# check if we have an internet connection +# retry 3x +for i in {1..3} +do + if ping -c 1 google.com + then + break + # else we are in the last iteration exit + elif [ $i -eq 3 ] + then + echo "E: No internet connection" + # exit with success to avoid taint the systemd status + exit 0 + fi + + sleep 60 +done + +export JSON_OUTPUT=1 + +# create the info in json format +tdx-info > /tmp/tdx-info.json + +# get the data +BOARDMODEL=$(cat /tmp/tdx-info.json | jq '."hardware-info"."hw-model"') +BOARDARCH=$(cat /tmp/tdx-info.json | jq '."hardware-info"."processor-arch"') +OSRELEASE=$(cat /tmp/tdx-info.json | jq '."software-summary"."distro-version"') + +# get emerg, alert, crit, err, warning dmesg levels +DMESG=$(dmesg -r --level=emerg,alert,crit,err,warn) + +# query the region +# if the region is null try 3x +for i in {1..3} +do + REGION=$(curl -s https://ipapi.co/city) + # try to set the date and time + dateFromServer=$(curl -v --silent https://google.com/ 2>&1 \ + | grep Date | sed -e 's/< Date: //'); date +"%d%m%Y%H%M%S" -d "$dateFromServer" + + if [ ! -z "$REGION" ] + then + break + # else we are in the last iteration exit + elif [ $i -eq 3 ] + then + echo "E: Region was undefined" + REGION="Undefined" + fi + + sleep 60 +done + +# we should have a date now +DATETIME=$(date +%Y-%m-%d) + +# debug +echo "REGION: $REGION" +echo "BOARDMODEL: $BOARDMODEL" +echo "BOARDARCH: $BOARDARCH" +echo "OSRELEASE: $OSRELEASE" +echo "DATETIME: $DATETIME" +echo "DMESG: $DMESG" + +# do it +curl --request POST \ + --url http://castello.dev.br/api/telemetry/add \ + --data-urlencode "region=$REGION" \ + --data-urlencode "dateTime=$DATETIME" \ + --data-urlencode "boardarch=$BOARDARCH" \ + --data-urlencode "boardmodel=$BOARDMODEL" \ + --data-urlencode "osrelease=$OSRELEASE" \ + --data-urlencode "dmesg=\"$DMESG\"" + +exit 0 diff --git a/recipes-support/telemetry/telemetry/telemetry.service b/recipes-support/telemetry/telemetry/telemetry.service new file mode 100644 index 00000000..ba6294f2 --- /dev/null +++ b/recipes-support/telemetry/telemetry/telemetry.service @@ -0,0 +1,11 @@ +[Unit] +Description=Send Telemetry about the Common TorizonCore usage +Requires=set-hostname.service network-online.target +After=set-hostname.service network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/sbin/telemetry + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/telemetry/telemetry_0.1.bb b/recipes-support/telemetry/telemetry_0.1.bb new file mode 100644 index 00000000..a3ef5001 --- /dev/null +++ b/recipes-support/telemetry/telemetry_0.1.bb @@ -0,0 +1,28 @@ +SUMMARY = "Common Torizon anonymous Telemetry" +DESCRIPTION = "Script to ping the Common Torizon server and collect information about the hardware that is booting Common Torizon" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit allarch systemd + +RDEPENDS:${PN} += "curl bash tdx-info" + +SRC_URI = " \ + file://telemetry \ + file://telemetry.service \ +" + +S = "${WORKDIR}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_install () { + install -d ${D}${sbindir} + install -m 0755 ${S}/telemetry ${D}${sbindir} + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/telemetry.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_SERVICE:${PN} = "telemetry.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" diff --git a/scripts/lib/wic/canned-wks/efiimage-sota.wks b/scripts/lib/wic/canned-wks/efiimage-sota.wks new file mode 100644 index 00000000..21b2f84d --- /dev/null +++ b/scripts/lib/wic/canned-wks/efiimage-sota.wks @@ -0,0 +1,8 @@ +# short-description: Create an OTA-enabled EFI disk image +# long-description: Creates an OTA-enabled EFI disk image that the user +# can directly dd to boot media. + +part /boot --source bootimg-efi-tmp --sourceparams="loader=grub-efi" --ondisk hda --label efi --active --align 1024 +part / --source otaimage --ondisk hda --fstype=ext4 --align 1024 --use-uuid + +bootloader --ptable gpt --timeout=0 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0" --configfile="grub-ota.cfg" diff --git a/scripts/lib/wic/canned-wks/nezha-sota.wks b/scripts/lib/wic/canned-wks/nezha-sota.wks new file mode 100644 index 00000000..7aa39479 --- /dev/null +++ b/scripts/lib/wic/canned-wks/nezha-sota.wks @@ -0,0 +1,9 @@ +# short-description: Create SD card image for Nezha Allwinner D1 development board + +part boot0 --source rawcopy --sourceparams="file=boot0_sdcard_sun20iw1p1.bin" --offset 16s --ondisk mmcblk0 --no-table + +part u-boot --source rawcopy --sourceparams="file=u-boot.toc1" --offset 32800s --ondisk mmcblk0 --no-table + +part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --align 4096 --fixed-size 64 --active + +part / --source otaimage --ondisk mmcblk0 --fstype=ext4 --align 4096 diff --git a/scripts/lib/wic/plugins/source/bootimg-efi-tmp.py b/scripts/lib/wic/plugins/source/bootimg-efi-tmp.py new file mode 100644 index 00000000..dd5217ba --- /dev/null +++ b/scripts/lib/wic/plugins/source/bootimg-efi-tmp.py @@ -0,0 +1,415 @@ +# +# Copyright (c) 2014, Intel Corporation. +# +# SPDX-License-Identifier: GPL-2.0-only +# +# DESCRIPTION +# This implements the 'bootimg-efi' source plugin class for 'wic' +# +# AUTHORS +# Tom Zanussi +# + +import logging +import os +import tempfile +import shutil +import re + +from glob import glob + +from wic import WicError +from wic.engine import get_custom_config +from wic.pluginbase import SourcePlugin +from wic.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, BOOTDD_EXTRA_SPACE) + +logger = logging.getLogger('wic') + +class BootimgEFIPlugin(SourcePlugin): + """ + Create EFI boot partition. + This plugin supports GRUB 2 and systemd-boot bootloaders. + """ + + name = 'bootimg-efi-tmp' + + @classmethod + def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): + """ + Create loader-specific (grub-efi) config + """ + configfile = creator.ks.bootloader.configfile + custom_cfg = None + if configfile: + custom_cfg = get_custom_config(configfile) + if custom_cfg: + # Use a custom configuration for grub + grubefi_conf = custom_cfg + logger.debug("Using custom configuration file " + "%s for grub.cfg", configfile) + else: + raise WicError("configfile is specified but failed to " + "get it from %s." % configfile) + + initrd = source_params.get('initrd') + + if initrd: + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + initrds = initrd.split(';') + for rd in initrds: + cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) + exec_cmd(cp_cmd, True) + else: + logger.debug("Ignoring missing initrd") + + if not custom_cfg: + # Create grub configuration using parameters from wks file + bootloader = creator.ks.bootloader + title = source_params.get('title') + + grubefi_conf = "" + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" + grubefi_conf += "default=boot\n" + grubefi_conf += "timeout=%s\n" % bootloader.timeout + grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot") + + kernel = get_bitbake_var("KERNEL_IMAGETYPE") + if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1": + if get_bitbake_var("INITRAMFS_IMAGE"): + kernel = "%s-%s.bin" % \ + (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME")) + + label = source_params.get('label') + label_conf = "root=%s" % creator.rootdev + if label: + label_conf = "LABEL=%s" % label + + grubefi_conf += "linux /%s %s rootwait %s\n" \ + % (kernel, label_conf, bootloader.append) + + if initrd: + initrds = initrd.split(';') + grubefi_conf += "initrd" + for rd in initrds: + grubefi_conf += " /%s" % rd + grubefi_conf += "\n" + + grubefi_conf += "}\n" + + logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg", + cr_workdir) + cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") + cfg.write(grubefi_conf) + cfg.close() + + @classmethod + def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params): + """ + Create loader-specific systemd-boot/gummiboot config + """ + install_cmd = "install -d %s/loader" % hdddir + exec_cmd(install_cmd) + + install_cmd = "install -d %s/loader/entries" % hdddir + exec_cmd(install_cmd) + + bootloader = creator.ks.bootloader + + loader_conf = "" + if source_params.get('create-unified-kernel-image') != "true": + loader_conf += "default boot\n" + loader_conf += "timeout %d\n" % bootloader.timeout + + initrd = source_params.get('initrd') + + if initrd and source_params.get('create-unified-kernel-image') != "true": + # obviously we need to have a common common deploy var + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + initrds = initrd.split(';') + for rd in initrds: + cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) + exec_cmd(cp_cmd, True) + else: + logger.debug("Ignoring missing initrd") + + logger.debug("Writing systemd-boot config " + "%s/hdd/boot/loader/loader.conf", cr_workdir) + cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") + cfg.write(loader_conf) + cfg.close() + + configfile = creator.ks.bootloader.configfile + custom_cfg = None + if configfile: + custom_cfg = get_custom_config(configfile) + if custom_cfg: + # Use a custom configuration for systemd-boot + boot_conf = custom_cfg + logger.debug("Using custom configuration file " + "%s for systemd-boots's boot.conf", configfile) + else: + raise WicError("configfile is specified but failed to " + "get it from %s.", configfile) + + if not custom_cfg: + # Create systemd-boot configuration using parameters from wks file + kernel = get_bitbake_var("KERNEL_IMAGETYPE") + if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1": + if get_bitbake_var("INITRAMFS_IMAGE"): + kernel = "%s-%s.bin" % \ + (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME")) + + title = source_params.get('title') + + boot_conf = "" + boot_conf += "title %s\n" % (title if title else "boot") + boot_conf += "linux /%s\n" % kernel + + label = source_params.get('label') + label_conf = "LABEL=Boot root=%s" % creator.rootdev + if label: + label_conf = "LABEL=%s" % label + + boot_conf += "options %s %s\n" % \ + (label_conf, bootloader.append) + + if initrd: + initrds = initrd.split(';') + for rd in initrds: + boot_conf += "initrd /%s\n" % rd + + if source_params.get('create-unified-kernel-image') != "true": + logger.debug("Writing systemd-boot config " + "%s/hdd/boot/loader/entries/boot.conf", cr_workdir) + cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") + cfg.write(boot_conf) + cfg.close() + + + @classmethod + def do_configure_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(), creates loader-specific config + """ + hdddir = "%s/hdd/boot" % cr_workdir + + install_cmd = "install -d %s/EFI/BOOT" % hdddir + exec_cmd(install_cmd) + + try: + if source_params['loader'] == 'grub-efi': + cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) + elif source_params['loader'] == 'systemd-boot': + cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) + else: + raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) + except KeyError: + raise WicError("bootimg-efi requires a loader, none specified") + + if get_bitbake_var("IMAGE_EFI_BOOT_FILES") is None: + logger.debug('No boot files defined in IMAGE_EFI_BOOT_FILES') + else: + boot_files = None + for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): + if fmt: + var = fmt % id + else: + var = "" + + boot_files = get_bitbake_var("IMAGE_EFI_BOOT_FILES" + var) + if boot_files: + break + + logger.debug('Boot files: %s', boot_files) + + # list of tuples (src_name, dst_name) + deploy_files = [] + for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files): + if ';' in src_entry: + dst_entry = tuple(src_entry.split(';')) + if not dst_entry[0] or not dst_entry[1]: + raise WicError('Malformed boot file entry: %s' % src_entry) + else: + dst_entry = (src_entry, src_entry) + + logger.debug('Destination entry: %r', dst_entry) + deploy_files.append(dst_entry) + + cls.install_task = []; + for deploy_entry in deploy_files: + src, dst = deploy_entry + if '*' in src: + # by default install files under their basename + entry_name_fn = os.path.basename + if dst != src: + # unless a target name was given, then treat name + # as a directory and append a basename + entry_name_fn = lambda name: \ + os.path.join(dst, + os.path.basename(name)) + + srcs = glob(os.path.join(kernel_dir, src)) + + logger.debug('Globbed sources: %s', ', '.join(srcs)) + for entry in srcs: + src = os.path.relpath(entry, kernel_dir) + entry_dst_name = entry_name_fn(entry) + cls.install_task.append((src, entry_dst_name)) + else: + cls.install_task.append((src, dst)) + + @classmethod + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, prepare content for an EFI (grub) boot partition. + """ + if not kernel_dir: + kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not kernel_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + staging_kernel_dir = kernel_dir + + hdddir = "%s/hdd/boot" % cr_workdir + + kernel = get_bitbake_var("KERNEL_IMAGETYPE") + if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1": + if get_bitbake_var("INITRAMFS_IMAGE"): + kernel = "%s-%s.bin" % \ + (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME")) + + if source_params.get('create-unified-kernel-image') == "true": + initrd = source_params.get('initrd') + if not initrd: + raise WicError("initrd= must be specified when create-unified-kernel-image=true, exiting") + + deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + efi_stub = glob("%s/%s" % (deploy_dir, "linux*.efi.stub")) + if len(efi_stub) == 0: + raise WicError("Unified Kernel Image EFI stub not found, exiting") + efi_stub = efi_stub[0] + + with tempfile.TemporaryDirectory() as tmp_dir: + label = source_params.get('label') + label_conf = "root=%s" % creator.rootdev + if label: + label_conf = "LABEL=%s" % label + + bootloader = creator.ks.bootloader + cmdline = open("%s/cmdline" % tmp_dir, "w") + cmdline.write("%s %s" % (label_conf, bootloader.append)) + cmdline.close() + + initrds = initrd.split(';') + initrd = open("%s/initrd" % tmp_dir, "wb") + for f in initrds: + with open("%s/%s" % (deploy_dir, f), 'rb') as in_file: + shutil.copyfileobj(in_file, initrd) + initrd.close() + + # Searched by systemd-boot: + # https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images + install_cmd = "install -d %s/EFI/Linux" % hdddir + exec_cmd(install_cmd) + + staging_dir_host = get_bitbake_var("STAGING_DIR_HOST") + + # https://www.freedesktop.org/software/systemd/man/systemd-stub.html + objcopy_cmd = "objcopy \ + --add-section .osrel=%s --change-section-vma .osrel=0x20000 \ + --add-section .cmdline=%s --change-section-vma .cmdline=0x30000 \ + --add-section .linux=%s --change-section-vma .linux=0x2000000 \ + --add-section .initrd=%s --change-section-vma .initrd=0x3000000 \ + %s %s" % \ + ("%s/usr/lib/os-release" % staging_dir_host, + cmdline.name, + "%s/%s" % (staging_kernel_dir, kernel), + initrd.name, + efi_stub, + "%s/EFI/Linux/linux.efi" % hdddir) + exec_cmd(objcopy_cmd) + else: + install_cmd = "install -m 0644 %s/%s %s/%s" % \ + (staging_kernel_dir, kernel, hdddir, kernel) + exec_cmd(install_cmd) + + if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): + for src_path, dst_path in cls.install_task: + install_cmd = "install -m 0644 -D %s %s" \ + % (os.path.join(kernel_dir, src_path), + os.path.join(hdddir, dst_path)) + exec_cmd(install_cmd) + + try: + if source_params['loader'] == 'grub-efi': + shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, + "%s/grub.cfg" % cr_workdir) + for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: + cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) + exec_cmd(cp_cmd, True) + shutil.move("%s/grub.cfg" % cr_workdir, + "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) + elif source_params['loader'] == 'systemd-boot': + for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: + cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) + exec_cmd(cp_cmd, True) + else: + raise WicError("unrecognized bootimg-efi loader: %s" % + source_params['loader']) + except KeyError: + raise WicError("bootimg-efi requires a loader, none specified") + + startup = os.path.join(kernel_dir, "startup.nsh") + if os.path.exists(startup): + cp_cmd = "cp %s %s/" % (startup, hdddir) + exec_cmd(cp_cmd, True) + + du_cmd = "du -bks %s" % hdddir + out = exec_cmd(du_cmd) + blocks = int(out.split()[0]) + + extra_blocks = part.get_extra_block_count(blocks) + + if extra_blocks < BOOTDD_EXTRA_SPACE: + extra_blocks = BOOTDD_EXTRA_SPACE + + blocks += extra_blocks + + logger.debug("Added %d extra blocks to %s to get to %d total blocks", + extra_blocks, part.mountpoint, blocks) + + # dosfs image, created by mkdosfs + bootimg = "%s/boot.img" % cr_workdir + + label = part.label if part.label else "ESP" + + dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d" % \ + (label, part.fsuuid, bootimg, blocks) + exec_native_cmd(dosfs_cmd, native_sysroot) + + # TODO: upstream it - maintain properties and dates + mcopy_cmd = "mcopy -i %s -s %s/* ::/ -p -m" % (bootimg, hdddir) + exec_native_cmd(mcopy_cmd, native_sysroot) + + chmod_cmd = "chmod 644 %s" % bootimg + exec_cmd(chmod_cmd) + + du_cmd = "du -Lbks %s" % bootimg + out = exec_cmd(du_cmd) + bootimg_size = out.split()[0] + + part.size = int(bootimg_size) + part.source_file = bootimg diff --git a/scripts/setup-environment b/scripts/setup-environment index eac85b79..ec31a234 100755 --- a/scripts/setup-environment +++ b/scripts/setup-environment @@ -18,4 +18,4 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -. layers/meta-toradex-torizon/scripts/setup-environment-internal $@ +. layers/meta-common-torizon/scripts/setup-environment-internal $@ diff --git a/scripts/setup-environment-internal b/scripts/setup-environment-internal index 36d47567..efe4d623 100755 --- a/scripts/setup-environment-internal +++ b/scripts/setup-environment-internal @@ -112,7 +112,7 @@ fi # Create a common list of "()", sorted by # Blacklist unsupported machines of TorizonCore MACHLAYERS=$(find layers/ -print | grep "conf/machine/.*\.conf" | - grep -E '(apalis.*\.conf|colibri.*\.conf|verdin.*\.conf|qemuarm64\.conf|genericx86-64\.conf)' | + grep -E '(apalis.*\.conf|colibri.*\.conf|verdin.*\.conf|qemuarm64\.conf|genericx86-64\.conf|raspberrypi4-64\.conf|raspberrypi3-64\.conf|raspberrypi0-2w-64\.conf|raspberrypi0-wifi\.conf|intel-corei7-64\.conf|nezha-allwinner-d1\.conf|beaglebone-yocto\.conf|beagleplay\.conf|qemux86-64\.conf)' | grep -E -v '(imx7-nand|colibri-vf|tk1|colibri-imx7|colibri-imx6ull|verdin-am62-k3r5)\.conf' | sed -e 's/\.conf//g' -e 's/layers\///' | awk -F'/conf/machine/' '{print $NF "(" $1 ")"}' | LC_ALL=C sort) @@ -129,7 +129,7 @@ DISTRO_DEFAULT="torizon-upstream" && echo "$MACHINE" | grep -E -q '(imx8|am62|qe DISTRO=${DISTRO:-$DISTRO_DEFAULT} # Create a common list of "()" supported by TorizonCore, sorted by -DISTLAYERS=$(find layers/meta-toradex-torizon -print | grep "conf/distro/.*\.conf" | +DISTLAYERS=$(find layers/meta-common-torizon -print | grep "conf/distro/.*\.conf" | sed -e 's/\.conf//g' -e 's/layers\///' | awk -F'/conf/distro/' '{print $NF "(" $1 ")"}' | LC_ALL=C sort) @@ -144,7 +144,7 @@ if [ -z "${SDKMACHINE}" ]; then fi MANIFESTS="${OEROOT}"/.repo/manifests -SCRIPTS="${OEROOT}"/layers/meta-toradex-torizon/scripts +SCRIPTS="${OEROOT}"/layers/meta-common-torizon/scripts # We can be called with only 1 parameter max (build folder) BUILDDIR=${1:-build-$DISTRO} @@ -356,52 +356,3 @@ EOF done fi fi - -cat <' - -Some of common targets are: - - torizon-core-docker - torizon-minimal - torizon-core-podman - -EOF - -if [ "${MACHINE}" = "qemuarm64" ]; then - cat < System -> Extended Features -> Enable EFI - Start the machine - -EOF -fi