From ProventusNova DeveloperWiki
Line 64: Line 64:
│   └── layer.conf
│   └── layer.conf
└── README.md
└── README.md
</syntaxhighlight>

The same as with the layer.conf, it is easier to start with an existing distro configuration file and modify it in order to fit the project requirements. For example, the following corresponds to a distro configuration file based on the [https://github.com/OE4T/tegra-demo-distro/blob/scarthgap-l4t-r35.x/layers/meta-tegrademo/conf/distro/tegrademo.conf NVIDIA tegra_demo_distro]:

<syntaxhighlight lang="bash">
DISTRO = "proventusnova"
DISTRO_NAME = "ProventusNova Custom Distro"
DISTRO_VERSION_BASE = "1.0"
DISTRO_VERSION = "${DISTRO_VERSION_BASE}+snapshot-${METADATA_REVISION}"
DISTRO_CODENAME = "proventusnova"
SDK_VENDOR = "-proventusnova"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${METADATA_REVISION}','snapshot')}"
SDK_VERSION[vardepvalue] = "${SDK_VERSION}"

MAINTAINER = "ProventusNova team <support@proventusnova.com>"

TARGET_VENDOR = "-proventusnova"

# New ${DISTRO}-<version> setting for sanity checks.
# Increment version number (and the corresponding
# setting int the template bblayers.conf.sample file)
# each time the layer settings are changed.
REQUIRED_PROVENTUSNOVA_BBLAYERS_CONF_VERSION = "${DISTRO}-1"

LOCALCONF_VERSION = "2"

PROVENTUSNOVA_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland vulkan systemd pam virtualization usrmerge"

DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${PROVENTUSNOVA_DEFAULT_DISTRO_FEATURES}"

# Jetson platforms do not use linux-yocto, but for QEMU testing
# align with the poky distro.
PREFERRED_VERSION_linux-yocto ?= "5.19%"
PREFERRED_VERSION_linux-yocto-rt ?= "5.19%"

SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
SDKPATHINSTALL = "/opt/${DISTRO}/${SDK_VERSION}"

TCLIBCAPPEND = ""

PACKAGE_CLASSES ?= "package_rpm"

SANITY_TESTED_DISTROS ?= " \
ubuntu-20.04 \n \
ubuntu-22.04 \n \
ubuntu-24.04 \n \
"

# Most NVIDIA-supplied services expect systemd
INIT_MANAGER = "systemd"

require conf/distro/include/no-static-libs.inc
require conf/distro/include/yocto-uninative.inc
require conf/distro/include/security_flags.inc
INHERIT += "uninative"

LICENSE_FLAGS_ACCEPTED += "commercial_faad2 commercial_x264"

USE_REDUNDANT_FLASH_LAYOUT_DEFAULT ?= "1"

INHERIT += "tegra-support-sanity"
ESDK_CLASS_INHERIT_DISABLE:append = " tegra-support-sanity"

BB_SIGNATURE_HANDLER ?= "OEEquivHash"
BB_HASHSERVE ??= "auto"


</syntaxhighlight>
</syntaxhighlight>

Revision as of 18:04, 11 March 2025

Introduction

This wiki will provide a detailed guide on how to create a custom Yocto meta-layer.

Create Base Meta-Layer

This section contains steps to create the base custom meta-layer. After completion, the custom base meta-layer will contain the following parts:

  • Custom layer configuration
  • Custom distro configuration
  • Custom machine
  • Custom config template files
  • Custom image recipe

Step 1. Add base layer.conf file

The layer configuration file provides Yocto with the configuration for the custom meta-layer. It shall be stored in a directory called conf inside the base meta-layer directory, and it shall be named layer.conf. According to the Yocto documentation it is recommended to start from an existing layer.conf file from a different meta-layer and change it according to the custom requirements.

For instance, here is an example of how the directory structure should look after creating the layer.conf file.

meta-proventusnova/
├── conf
│   └── layer.conf
└── README.md

An example layer.conf file based on NVIDIA OE4T tegra_demo_distro is shown in the following code snipped.

BBPATH =. "${LAYERDIR}:"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILES_DYNAMIC += "swupdate:${LAYERDIR}/dynamic-layers/meta-swupdate/recipes-*/*/*.bb \
                    swupdate:${LAYERDIR}/dynamic-layers/meta-swupdate/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "proventusnova"
BBFILE_PATTERN_proventusnova = "^${LAYERDIR}/"
BBFILE_PRIORITY_proventusnova = "50"

LAYERVERSION_proventusnova = "4"
LAYERSERIES_COMPAT_proventusnova = "scarthgap"

# This is used by the tegra-distro-sanity bbclass
# to identify the distro layer directory during
# bblayers checks.
TD_DISTRO_LAYERDIR = "${LAYERDIR}"

Step 2. Add base distro config

In order to add the initial distro configuration, it is necessary to create distro configuration file inside the meta-layer/conf/distro directory.

Here is an example of how the directory structure should look like:

meta-proventusnova/
├── conf
│   ├── distro
│      └── proventusnova.conf
│   └── layer.conf
└── README.md

The same as with the layer.conf, it is easier to start with an existing distro configuration file and modify it in order to fit the project requirements. For example, the following corresponds to a distro configuration file based on the NVIDIA tegra_demo_distro:

DISTRO = "proventusnova"
DISTRO_NAME = "ProventusNova Custom Distro"
DISTRO_VERSION_BASE = "1.0"
DISTRO_VERSION = "${DISTRO_VERSION_BASE}+snapshot-${METADATA_REVISION}"
DISTRO_CODENAME = "proventusnova"
SDK_VENDOR = "-proventusnova"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${METADATA_REVISION}','snapshot')}"
SDK_VERSION[vardepvalue] = "${SDK_VERSION}"

MAINTAINER = "ProventusNova team <support@proventusnova.com>"

TARGET_VENDOR = "-proventusnova"

# New ${DISTRO}-<version> setting for sanity checks.
# Increment version number (and the corresponding
# setting int the template bblayers.conf.sample file)
# each time the layer settings are changed.
REQUIRED_PROVENTUSNOVA_BBLAYERS_CONF_VERSION = "${DISTRO}-1"

LOCALCONF_VERSION = "2"

PROVENTUSNOVA_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland vulkan systemd pam virtualization usrmerge"

DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${PROVENTUSNOVA_DEFAULT_DISTRO_FEATURES}"

# Jetson platforms do not use linux-yocto, but for QEMU testing
# align with the poky distro.
PREFERRED_VERSION_linux-yocto ?= "5.19%"
PREFERRED_VERSION_linux-yocto-rt ?= "5.19%"

SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
SDKPATHINSTALL = "/opt/${DISTRO}/${SDK_VERSION}"

TCLIBCAPPEND = ""

PACKAGE_CLASSES ?= "package_rpm"

SANITY_TESTED_DISTROS ?= " \
            ubuntu-20.04 \n \
            ubuntu-22.04 \n \
            ubuntu-24.04 \n \
            "

# Most NVIDIA-supplied services expect systemd
INIT_MANAGER = "systemd"

require conf/distro/include/no-static-libs.inc
require conf/distro/include/yocto-uninative.inc
require conf/distro/include/security_flags.inc
INHERIT += "uninative"

LICENSE_FLAGS_ACCEPTED += "commercial_faad2 commercial_x264"

USE_REDUNDANT_FLASH_LAYOUT_DEFAULT ?= "1"

INHERIT += "tegra-support-sanity"
ESDK_CLASS_INHERIT_DISABLE:append = " tegra-support-sanity"

BB_SIGNATURE_HANDLER ?= "OEEquivHash"
BB_HASHSERVE ??= "auto"

Step 3. Add base machine

Step 4. Add initial config template files

Step 5. Add base image recipe