-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #398 from zach-welch-aquabyte/scarthgap-tegra-jetp…
…ack5-v3 [scarthgap] add Jetson Tegra w/ Jetpack 5.x support
- Loading branch information
Showing
38 changed files
with
919 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
header: | ||
version: 11 | ||
|
||
repos: | ||
meta-tegra: | ||
url: https://github.com/OE4T/meta-tegra.git | ||
meta-tegra-community: | ||
url: https://github.com/OE4T/meta-tegra-community.git | ||
meta-tegrademo: | ||
url: https://github.com/OE4T/tegra-demo-distro.git | ||
layers: | ||
layers/meta-tegra-support: | ||
layers/meta-demo-ci: | ||
layers/meta-tegrademo: | ||
|
||
meta-openembedded: | ||
layers: | ||
meta-filesystems: | ||
meta-networking: | ||
meta-python: | ||
|
||
meta-virtualization: | ||
url: https://git.yoctoproject.org/meta-virtualization.git | ||
commit: 6a80f140e387621f62964209a2e07d3bcfb125ce | ||
|
||
distro: tegrademo | ||
|
||
local_conf_header: | ||
tegra: | | ||
# these two classes only work as intended when being inherited in the | ||
# OE4t setup-env.sh style environment, as they modify bblayers.conf | ||
# and expect additional information on the host. | ||
INHERIT:remove = "tegra-support-sanity distro_layer_buildinfo" | ||
INHERIT += "tegra-mender-setup" | ||
MENDER_FEATURES_ENABLE:append = " mender-growfs-data" | ||
MENDER_FEATURES_DISABLE:append = " mender-uboot" | ||
IMAGE_FSTYPES:tegra = "tegraflash mender dataimg" | ||
IMAGE_FSTYPES:pn-tegra-minimal-initramfs:tegra = "${INITRAMFS_FSTYPES}" | ||
IMAGE_FSTYPES:pn-tegra-initrd-flash-initramfs:tegra = "${TEGRA_INITRD_FLASH_INITRAMFS_FSTYPES}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
header: | ||
version: 14 | ||
includes: | ||
- kas/include/tegra-base.yml | ||
|
||
repos: | ||
meta-tegra: | ||
# refers to the scarthgap-l4t-r35.x branch | ||
commit: 972488415a80afebbd652a983a46c2641eed99ad | ||
meta-tegra-community: | ||
# refers to the scarthgap-l4t-r35.x branch | ||
commit: 865561b6d3ba6607a814354c122c91422df720d5 | ||
meta-tegrademo: | ||
# refers to the scarthgap-l4t-r35.x branch | ||
commit: 2d9319ba0c24fb46937a742d78fc046983edb325 | ||
|
||
meta-mender-community: | ||
layers: | ||
meta-mender-tegra: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
header: | ||
version: 14 | ||
includes: | ||
- kas/include/tegra-base.yml | ||
|
||
repos: | ||
meta-tegra: | ||
# refers to the scarthgap branch | ||
commit: b20cff753ff0ffc24121cb35d2e2d218c2d26cf3 | ||
meta-tegra-community: | ||
# refers to the scarthgap branch | ||
commit: 68f0520b73312ecc6767252de569679c374afc73 | ||
meta-tegrademo: | ||
# refers to the scarthgap branch | ||
commit: 7d54c8f932b9527255e9b871b662beaafca7fa7b | ||
|
||
meta-mender-community: | ||
layers: | ||
meta-mender-tegra: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
header: | ||
version: 14 | ||
includes: | ||
- kas/include/mender-full.yml | ||
- kas/include/tegra-jetpack6.yml | ||
|
||
machine: jetson-agx-orin-devkit | ||
|
||
local_conf_header: | ||
AB-upgrades: | | ||
USE_REDUNDANT_FLASH_LAYOUT_DEFAULT = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
header: | ||
version: 14 | ||
includes: | ||
- kas/include/mender-full.yml | ||
- kas/include/tegra-jetpack5.yml | ||
|
||
machine: jetson-agx-xavier-devkit | ||
|
||
local_conf_header: | ||
AB-upgrades: | | ||
USE_REDUNDANT_FLASH_LAYOUT_DEFAULT = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
header: | ||
version: 14 | ||
includes: | ||
- kas/include/mender-full.yml | ||
- kas/include/tegra-jetpack6.yml | ||
|
||
machine: jetson-orin-nano-devkit | ||
|
||
local_conf_header: | ||
AB-upgrades: | | ||
UBOOT_EXTLINUX = "1" | ||
USE_REDUNDANT_FLASH_LAYOUT_DEFAULT = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# meta-mender-tegra | ||
|
||
Mender integration layer for NVIDIA Tegra hardware. | ||
|
||
The supported and tested boards are: | ||
|
||
- AGX Orin | ||
- AGX Xavier | ||
- Orin Nano | ||
|
||
|
||
## Dependencies | ||
|
||
This layer depends on: | ||
|
||
``` | ||
URI: https://github.com/OE4T/meta-tegra.git | ||
layers: meta-tegra | ||
branch: scarthgap-l4t-r35.x (JP5) or scarthgap (JP6) | ||
revision: HEAD | ||
``` | ||
|
||
``` | ||
URI: https://github.com/mendersoftware/meta-mender.git | ||
layers: meta-mender-core | ||
branch: scarthgap | ||
revision: HEAD | ||
``` | ||
|
||
## Quick start | ||
|
||
See the mender hub pages and the documentation for the `tegrademo-mender` | ||
distro on the [tegra-demo-distro](https://github.com/OE4T/tegra-demo-distro) repository | ||
for the most up to date instructions on starting out with mender and tegra. | ||
|
||
## [`kas`](https://github.com/siemens/kas) configurations | ||
|
||
The following configuration files for building using the `kas` tool are provided: | ||
|
||
- [jetson-agx-orin-devkit.yml](../kas/jetson-agx-orin-devkit.yml) | ||
- [jetson-agx-xavier-devkit.yml](../kas/jetson-agx-xavier-devkit.yml) | ||
- [jetson-orin-nano-devkit.yml](../kas/jetson-orin-nano-devkit.yml) | ||
|
||
## Acknowlegements | ||
|
||
Special thanks to [Matt Madison](https://github.com/madisongh) for his contributions to | ||
support zeus and later branches and his work on meta-tegra which makes this mender | ||
integration possible. | ||
|
||
Thanks also to [Kurt Keifer](https://github.com/kekiefer/) for his contributions and | ||
cleanup to support additional platforms and the tegra-demo-distro on the dunfell release. |
162 changes: 162 additions & 0 deletions
162
meta-mender-tegra/classes-global/tegra-mender-setup.bbclass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
inherit l4t_version | ||
|
||
python () { | ||
# insert l4t-mender-<version> as a machine-specific override for tegra platforms | ||
machine_overrides = d.getVar('MACHINEOVERRIDES', False).split(':') | ||
try: | ||
i = machine_overrides.index('tegra') | ||
l4t_ver = 'l4t-mender-%s' % d.getVar('L4T_VERSION').replace('.','-') | ||
d.setVar('MACHINEOVERRIDES', ':'.join(machine_overrides[:i] + [l4t_ver] + machine_overrides[i:])) | ||
except ValueError: | ||
pass | ||
} | ||
|
||
def tegra_mender_set_rootfs_partsize(calc_rootfs_size_kb): | ||
return calc_rootfs_size_kb * 1024 | ||
|
||
def tegra_mender_image_rootfs_size(d): | ||
rootfspart_size = d.getVar('ROOTFSPART_SIZE') | ||
if rootfspart_size: | ||
calc_rootfs_size = int(rootfspart_size) // 1024 | ||
else: | ||
calc_rootfs_size = int(d.getVar('MENDER_CALC_ROOTFS_SIZE')) | ||
calc_rootfs_size = (calc_rootfs_size * 95) // 100 | ||
return calc_rootfs_size - eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE')) | ||
|
||
# meta-tegra and tegraflash requirements | ||
IMAGE_CLASSES += "image_types_mender_tegra" | ||
IMAGE_FSTYPES += "tegraflash" | ||
|
||
ARTIFACTIMG_FSTYPE = "ext4" | ||
# Generate dataimg for use with tegraflash | ||
IMAGE_TYPEDEP:tegraflash += " dataimg" | ||
IMAGE_FSTYPES += "dataimg" | ||
PREFERRED_PROVIDER_u-boot-fw-utils = "u-boot-fw-utils-tegra" | ||
PREFERRED_PROVIDER_libubootenv:tegra = "${@'libubootenv-fake' if d.getVar('PREFERRED_PROVIDER_virtual/bootloader').startswith('cboot') else 'libubootenv'}" | ||
PREFERRED_RPROVIDER_u-boot-fw-utils = "u-boot-fw-utils-tegra" | ||
PREFERRED_RPROVIDER_libubootenv-bin:tegra = "${@'libubootenv-fake' if d.getVar('PREFERRED_PROVIDER_virtual/bootloader').startswith('cboot') else 'libubootenv-bin'}" | ||
PREFERRED_PROVIDER_virtual/bootloader:tegra194 = "edk2-firmware-tegra" | ||
PREFERRED_PROVIDER_libubootenv:tegra234 = "libubootenv-fake" | ||
PREFERRED_PROVIDER_libubootenv:tegra194 = "libubootenv-fake" | ||
MENDER_FEATURES_DISABLE:append:tegra194 = " mender-uboot" | ||
|
||
# Note: this isn't really a boot file, just put it here to keep the mender build from | ||
# complaining about empty IMAGE_BOOT_FILES. We won't use the full image anyway, just the mender file | ||
IMAGE_BOOT_FILES = "u-boot-dtb.bin" | ||
# Mender customizations to support jetson platforms. This needs to | ||
# match up with your defined flash or sdcard layout. | ||
# You will need to update these partition values when you update the flash layout. One way to find the correct number is to | ||
# boot into an emergency shell and examine the /dev/mmcblk* devices, | ||
# or use the uboot console to look at mtdparts | ||
MENDER_DATA_PART_NUMBER_DEFAULT:tegra186 = "34" | ||
MENDER_DATA_PART_NUMBER_DEFAULT:tegra194 = "42" | ||
MENDER_DATA_PART_NUMBER_DEFAULT:xavier-nx = "23" | ||
MENDER_DATA_PART_NUMBER_DEFAULT:tegra210 = "${@'16' if (d.getVar('TEGRA_SPIFLASH_BOOT') or '') == '1' else '23'}" | ||
MENDER_DATA_PART_NUMBER_DEFAULT:jetson-nano-emmc = "19" | ||
MENDER_DATA_PART_NUMBER_DEFAULT:tegra234 = "15" | ||
MENDER_ROOTFS_PART_A_NUMBER_DEFAULT = "1" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:tegra186 = "33" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:tegra194 = "2" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:tegra210 = "${@'15' if (d.getVar('TEGRA_SPIFLASH_BOOT') or '') == '1' else '22'}" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:jetson-nano-emmc = "18" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:tegra234 = "2" | ||
MENDER_STORAGE_DEVICE_DEFAULT:jetson-orin-nano-devkit = "/dev/mmcblk1" | ||
|
||
# Machine name and flash layout changed for SDcard Nanos in L4T R32.5.x | ||
MENDER_DATA_PART_NUMBER_DEFAULT:jetson-nano-devkit = "3" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:jetson-nano-devkit = "2" | ||
# Machine name changed for Nano-eMMC in L4T R32.5.x | ||
MENDER_DATA_PART_NUMBER_DEFAULT:jetson-nano-devkit-emmc = "19" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:jetson-nano-devkit-emmc = "18" | ||
# Added in L4T R32.5.x | ||
MENDER_DATA_PART_NUMBER_DEFAULT:jetson-nano-2gb-devkit = "4" | ||
MENDER_ROOTFS_PART_B_NUMBER_DEFAULT:jetson-nano-2gb-devkit = "2" | ||
|
||
# Use a 4096 byte alignment for support of tegraflash scheme and default partition locations | ||
MENDER_PARTITION_ALIGNMENT = "4096" | ||
|
||
MENDER_RESERVED_SPACE_BOOTLOADER_DATA = "0" | ||
|
||
# See note in https://docs.mender.io/1.7/troubleshooting/running-yocto-project-image#i-moved-from-an-older-meta-mender-branch-to-the-thud-branch-and | ||
# Prevents build failure during mkfs.ext4 step on warrior | ||
MENDER_PARTITIONING_OVERHEAD_KB = "0" | ||
# We don't use a boot partition in the mender image, we use tegraflash to setup our boot partition | ||
MENDER_BOOT_PART = "" | ||
MENDER_BOOT_PART_SIZE_MB = "0" | ||
|
||
# Calculate the ROOTFSPART_SIZE value based on the *calculated* | ||
# IMAGE_ROOTFS_SIZE set by mender. Do *not* use ${IMAGE_ROOTFS_SIZE} | ||
# here; when we're called on in the context of an initramfs image | ||
# build (for BUP payload generation), its size is set smaller than | ||
# the actual rootfs image, so the resulting flash layout XML files | ||
# will be different between the two contexts, leading to boot | ||
# failures after bootloader updates. | ||
ROOTFSPART_SIZE = "${@tegra_mender_set_rootfs_partsize(${MENDER_CALC_ROOTFS_SIZE})}" | ||
|
||
# See https://hub.mender.io/t/yocto-thud-release-and-mender/144 | ||
# Default for thud and later is grub integration but we need to use u-boot integration already included. | ||
# Leave out sdimg since we don't use this with tegra (instead use | ||
# tegraflash) | ||
MENDER_FEATURES_ENABLE:append:tegra = "${@tegra_mender_uboot_feature(d)}" | ||
MENDER_FEATURES_DISABLE:append:tegra = " mender-grub mender-image-uefi" | ||
|
||
# Use these variables to adjust your total rootfs size across both | ||
# images. Rootfs size will be approximately 1/2 of | ||
# MENDER_STORAGE_TOTAL_SIZE_MB (ignoring alignment). | ||
# Calculate the total size based on the eMMC or SDcard size configured | ||
# for the machine, subtracting off space for the boot-related files | ||
# and other NVIDIA-specific partitions (by default, 1GiB). | ||
def tegra_mender_calc_total_size(d): | ||
# For pre-production Nanos, use SDCard size, which in the machine | ||
# config ends with a size factor (K, M, or G). Note that the | ||
# factors are kilo/mega/giga, rather than kibi/mibi/gibi. | ||
if (d.getVar('TEGRA_SPIFLASH_BOOT') or '') == '1': | ||
sdcard_size = d.getVar('TEGRAFLASH_SDCARD_SIZE') | ||
fchar = sdcard_size[-1:].upper() | ||
sdcard_size = int(sdcard_size[:-1]) | ||
if fchar == 'G': | ||
total_size_bytes = sdcard_size * 1000 * 1000 * 1000 | ||
elif fchar == 'K': | ||
total_size_bytes = sdcard_size * 1000 | ||
elif fchar == 'M': | ||
total_size_bytes = sdcard_size * 1000 * 1000 | ||
else: | ||
bb.error('TEGRAFLASH_SDCARD_SIZE does not end with G, K, or M') | ||
else: | ||
total_size_bytes = int(d.getVar('EMMC_SIZE')) | ||
# Mender uses mibibytes, not megabytes | ||
return total_size_bytes // (1024*1024) - int(d.getVar('TEGRA_MENDER_RESERVED_SPACE_MB')) | ||
|
||
MENDER_IMAGE_ROOTFS_SIZE_DEFAULT = "${@tegra_mender_image_rootfs_size(d)}" | ||
TEGRA_MENDER_RESERVED_SPACE_MB_DEFAULT = "1024" | ||
TEGRA_MENDER_RESERVED_SPACE_MB_DEFAULT:jetson-nano-2gb-devkit = "5120" | ||
TEGRA_MENDER_RESERVED_SPACE_MB ?= "${TEGRA_MENDER_RESERVED_SPACE_MB_DEFAULT}" | ||
MENDER_STORAGE_TOTAL_SIZE_MB_DEFAULT:tegra = "${@tegra_mender_calc_total_size(d)}" | ||
|
||
def tegra_mender_uboot_feature(d): | ||
if (d.getVar('PREFERRED_PROVIDER_virtual/bootloader') or '').startswith('cboot'): | ||
return " mender-persist-systemd-machine-id" | ||
return " mender-uboot mender-persist-systemd-machine-id" | ||
|
||
_MENDER_IMAGE_DEPS_EXTRA = "" | ||
_MENDER_IMAGE_DEPS_EXTRA:tegra = "tegra-state-scripts:do_deploy" | ||
do_image_mender[depends] += "${_MENDER_IMAGE_DEPS_EXTRA}" | ||
|
||
# mender-setup-image adds kernel-image and kernel-devicetree | ||
# to MACHINE_ESSENTIAL_EXTRA_RDEPENDS, but they should *not* | ||
# be included by default on cboot platforms. | ||
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove:tegra194 = "kernel-image kernel-devicetree" | ||
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove:tegra186 = "${@'kernel-image kernel-devicetree' if (d.getVar('PREFERRED_PROVIDER_virtual/bootloader') or '').startswith('cboot') else ''}" | ||
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove:tegra234 = "kernel-image kernel-devicetree" | ||
|
||
# Compatibility settings for handling the machine name changes | ||
# made in L4T R32.5.x, to allow for upgrades. This does not | ||
# include jetson-nano-qspi-sd (now jetson-nano-devkit) due to | ||
# major changes in the flash layout. | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-tx1-devkit = " jetson-tx1" | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-tx2-devkit = " jetson-tx2" | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-tx2-devkit-tx2i = " jetson-tx2i" | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-tx2-devkit-4gb = " jetson-tx2-4gb" | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-agx-xavier-devkit = " jetson-xavier" | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-agx-xavier-devkit-8gb = " jetson-xavier-8gb" | ||
MENDER_DEVICE_TYPES_COMPATIBLE:append:jetson-nano-devkit-emmc = " jetson-nano-emmc" |
4 changes: 4 additions & 0 deletions
4
meta-mender-tegra/classes-recipe/image_types_mender_tegra.bbclass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
inherit image_types_tegra | ||
|
||
DATAFILE ?= "${IMAGE_BASENAME}-${MACHINE}.dataimg" | ||
IMAGE_TEGRAFLASH_DATA ?= "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.dataimg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# We have a conf and classes directory, add to BBPATH | ||
BBPATH .= ":${LAYERDIR}" | ||
# We have recipes-* directories, add to BBFILES | ||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
${LAYERDIR}/recipes-*/*/*.bbappend" | ||
|
||
BBFILE_COLLECTIONS += "meta-mender-tegra" | ||
BBFILE_PATTERN_meta-mender-tegra = "^${LAYERDIR}/" | ||
BBFILE_PRIORITY_meta-mender-tegra = "10" | ||
LAYERVERSION_meta-mender-tegra = "1" | ||
LAYERSERIES_COMPAT_meta-mender-tegra = "scarthgap" | ||
LAYERDEPENDS_meta-mender-tegra = "tegra" |
Oops, something went wrong.