Skip to content

Creating your Distro Layer

Yuma Ochi edited this page Apr 2, 2023 · 7 revisions

Creating your own layer for this distro can be done by using create-distro-layer script.

First Steps

To create a custom distro layer named meta-my-layer with distro name as my-layer, run (from the root of tegra-demo-distro)

./scripts-setup/create-distro-layer -d my-layer

This script will setup the initial metadata for your layer to integrate with meta-tegra and meta-tegra-support. Note that this script takes layers/meta-tegrademo as a template.

This will create a layers/meta-my-layer directory as follows

$ tree meta-my-layer
meta-my-layer
├── classes
│   ├── mender-workarounds.bbclass
│   └── rootfs-postcommands-overrides.bbclass
├── conf
│   ├── distro
│   │   └── my-layer.conf
│   ├── layer.conf
│   └── template-my-layer
│       ├── bblayers.conf.sample
│       ├── conf-notes.txt
│       └── local.conf.sample
└── scripts
    ├── buildenv-host-gcc-check
    └── layer-setup-env

Editing configurations

conf/distro/my-layer.conf will contain distro specific settings for your layer. It is recommended that you should change the following attributes with your custom values:

DISTRO = "my-layer"
DISTRO_NAME = "My-Layer Test Script Distribution"
DISTRO_VERSION_BASE = "X.X"
DISTRO_VERSION = "${DISTRO_VERSION_BASE}+snapshot-${DATE}"
DISTRO_CODENAME = "master"
SDK_VENDOR = "-tdsdk"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"

MAINTAINER = "Test User <test@oe4t>"

TARGET_VENDOR = "-oe4t"

conf/template-my-layer/local.conf.sample - This file will be used to create a conf/local.conf for your build directory. Hence, make sure you tweak the settings in this file. Review local.conf.sample for creating your own template.

Ex. You might want to disable debug-tweaks for production setup. You will need to change EXTRA_IMAGE_FEATURES ?= "debug-tweaks" to EXTRA_IMAGE_FEATURES ?= "" in your local.conf.sample file.

Mender OTA

tegra-demo-distro also includes Mender OTA support. To leverage this support while making your distribution, Use:

./scripts-setup/create-distro-layer -d my-mender -m

This will add mender related settings in your conf/distro/my-mender.conf. Additionally, it will include mender layers into your conf/template-my-mender/bblayers.conf.sample to include these layers while you are building your distribution.

NOTE - Executing ./scripts-setup/create-distro-layer --help will print a help message for more information

Rebasing Your Repo on tegra-demo-distro branches

If you choose, you can keep all of your customizations in separate layer(s), then easily rebase your work and customizations on top of changes in tegra-demo-distro to pull in the latest software used here. Here's one way you can accomplish this:

  1. Get the latest upstream branches by running git remote add oe4t https://github.com/OE4T/tegra-demo-distro.git and git pull oe4t
  2. git rebase oe4t/targetbranch where targetbranch is the branch you want to rebase your work on top of, for instance dunfell-l4t-r32.4.3
  3. Squash every commit since the latest commit since the the commit at the HEAD of oe4t/targetbranch with git rebase -i oe4t/targetbranch. Vim %s:/pick/squash/g is useful for this.
  4. Rename your old main branch on your origin repo, something like git branch -m mymainbranch mymainbranch-release-XXX-and-earlier followed by git push origin :mymainbranch mymainbranch-release-XXX-and-earlier. This keeps the commit history for your customizations of the shared tegra-demo-distro project in your private repository tracking tegra-demo-distro upstream in a new branch called mymainbranch-release-XXX-and-earlier. You might need to configure permissions on your git repository to allow renaming main branches.
  5. Rename your current working branch as the main branch, using something like git branch -m mymainbranch from within your new working branch and push that back to your local private repository tracking tegra-demo-distro.
  6. Inform your team members of the need to git reset --hard origin/mymainbranch to synchronize their tegra-demo-distro clone, since you've rewritten branch history (the old history is still there but moved to mymainbranch-release-XXX-and-earlier