├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── layers ├── .templateconf ├── LICENSE ├── bitbake ├── meta ├── meta-demo-ci │ ├── classes │ │ └── mirror_updates.bbclass │ ├── conf │ │ └── layer.conf │ └── lib │ │ └── oeaws │ │ ├── aws_env.py │ │ ├── botos3fetcher.py │ │ └── s3session.py ├── meta-filesystems ├── meta-networking ├── meta-oe ├── meta-python ├── meta-skeleton ├── meta-tegra ├── meta-tegra-community ├── meta-tegra-support │ ├── classes │ │ ├── distro_layer_buildinfo.bbclass │ │ └── tegra-support-sanity.bbclass │ ├── conf │ │ └── layer.conf │ ├── recipes-core │ │ ├── images │ │ │ └── tegra-minimal-initramfs.bbappend │ │ └── psplash │ │ │ ├── files │ │ │ └── psplash-OE4T-img.h │ │ │ └── psplash_git.bbappend │ ├── recipes-filesystems │ │ └── sshfs-fuse │ │ │ └── sshfs-fuse_%.bbappend │ ├── recipes-multimedia │ │ └── gstreamer │ │ │ └── gstreamer1.0-plugins-bad_%.bbappend │ └── recipes-support │ │ └── fuse │ │ └── fuse3_%.bbappend ├── meta-tegrademo │ ├── .templateconf │ ├── conf │ │ ├── distro │ │ │ ├── include │ │ │ │ └── tegrademo.inc │ │ │ └── tegrademo.conf │ │ ├── kas │ │ │ ├── include │ │ │ │ └── tegra-demo-distro-branch.yml │ │ │ └── tegra-demo-distro.yml │ │ ├── layer.conf │ │ └── templates │ │ │ └── tegrademo │ │ │ ├── bblayers.conf.sample │ │ │ ├── conf-notes.txt │ │ │ └── local.conf.sample │ ├── dynamic-layers │ │ └── meta-swupdate │ │ │ ├── README.md │ │ │ ├── classes-recipe │ │ │ └── tegra_swupdate.bbclass │ │ │ ├── conf │ │ │ └── kas │ │ │ │ ├── include │ │ │ │ ├── swupdate-base.yml │ │ │ │ └── tegra-demo-distro-swupdate-lasttested.yml │ │ │ │ ├── swupdate-oe4t-lasttested.yml │ │ │ │ └── swupdate-oe4t.yml │ │ │ ├── recipes-demo │ │ │ └── images │ │ │ │ ├── swupdate-image-tegra.bb │ │ │ │ └── swupdate-image-tegra │ │ │ │ └── sw-description │ │ │ ├── recipes-support │ │ │ └── swupdate │ │ │ │ ├── swupdate-machine-config │ │ │ │ ├── swupdate-genconfig.sh.in │ │ │ │ ├── swupdate-mods.conf │ │ │ │ └── swupdate.cfg.in │ │ │ │ ├── swupdate-machine-config_1.0.bb │ │ │ │ ├── swupdate │ │ │ │ ├── archive.cfg │ │ │ │ ├── disable-uboot.cfg │ │ │ │ ├── hash.cfg │ │ │ │ ├── part-format.cfg │ │ │ │ └── systemd.cfg │ │ │ │ ├── swupdate_%.bbappend │ │ │ │ ├── tegra-swupdate-script │ │ │ │ └── tegra-swupdate-script.lua.in │ │ │ │ └── tegra-swupdate-script_1.0.bb │ │ │ └── scripts │ │ │ ├── build-jetson-orin-nano-devkit-nvme.sh │ │ │ └── kasbuildbase.sh │ ├── recipes-bsp │ │ ├── tegra-fitimage │ │ │ └── tegra-fitimage_1.0.bb │ │ └── tegrademo-devicetree │ │ │ ├── tegrademo-devicetree │ │ │ ├── tegra194-p2888-0001-p2822-0000-oe4t.dts │ │ │ └── tegra194-p3668-all-p3509-0000-oe4t.dts │ │ │ └── tegrademo-devicetree_1.0.bb │ ├── recipes-containers │ │ └── docker │ │ │ ├── docker-conf │ │ │ ├── docker-overlay.fstab │ │ │ └── docker-storage-redirect.conf │ │ │ ├── docker-conf_1.0.bb │ │ │ └── docker-moby_%.bbappend │ ├── recipes-demo │ │ ├── data-overlay-setup │ │ │ ├── data-overlay-setup │ │ │ │ ├── data-overlay-setup.service.in │ │ │ │ └── data-overlay-setup.sh.in │ │ │ └── data-overlay-setup_1.0.bb │ │ ├── images │ │ │ ├── demo-image-base.bb │ │ │ ├── demo-image-common.inc │ │ │ ├── demo-image-egl.bb │ │ │ ├── demo-image-full.bb │ │ │ ├── demo-image-sato.bb │ │ │ └── demo-image-weston.bb │ │ └── packagegroups │ │ │ ├── packagegroup-demo-base.bb │ │ │ ├── packagegroup-demo-basetests.bb │ │ │ ├── packagegroup-demo-egltests.bb │ │ │ ├── packagegroup-demo-systemd.bb │ │ │ ├── packagegroup-demo-vulkantests.bb │ │ │ ├── packagegroup-demo-westontests.bb │ │ │ └── packagegroup-demo-x11tests.bb │ └── scripts │ │ ├── layer-setup-env │ │ ├── oe4t-tegraflash-deploy │ │ └── setup-udev-rules ├── meta-virtualization ├── oe-init-build-env └── scripts ├── scripts-setup ├── create-distro-layer ├── diff-bblayers-conf ├── git-scripts │ └── prepare-commit-msg ├── setup-env-internal ├── setup-git-hooks └── update-git-submodules └── setup-env /.gitignore: -------------------------------------------------------------------------------- 1 | build*/ 2 | *~ 3 | *.pyc 4 | *.pyo 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "poky"] 2 | path = repos/poky 3 | url = git://git.yoctoproject.org/poky 4 | branch = master 5 | [submodule "repos/meta-openembedded"] 6 | path = repos/meta-openembedded 7 | url = git://git.openembedded.org/meta-openembedded 8 | branch = master 9 | [submodule "repos/meta-virtualization"] 10 | path = repos/meta-virtualization 11 | url = git://git.yoctoproject.org/meta-virtualization 12 | branch = master 13 | [submodule "repos/meta-tegra"] 14 | path = repos/meta-tegra 15 | url = https://github.com/OE4T/meta-tegra.git 16 | branch = master 17 | [submodule "repos/meta-tegra-community"] 18 | path = repos/meta-tegra-community 19 | url = https://github.com/OE4T/meta-tegra-community 20 | branch = master 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020, Matthew Madison and the OE4T contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tegra-demo-distro 2 | 3 | Reference/demo distribution for NVIDIA Jetson platforms 4 | using Yocto Project tools and the [meta-tegra](https://github.com/OE4T/meta-tegra) BSP layer. 5 | 6 | ![Build status](https://builder.madison.systems/badges/tegrademo-master.svg) 7 | 8 | Metadata layers are brought in as git submodules: 9 | 10 | | Layer Repo | Branch | Description | 11 | | --------------------- | ---------------|---------------------------------------------------- | 12 | | poky | master | OE-Core from poky repo at yoctoproject.org | 13 | | meta-tegra | master | L4T BSP layer - L4T R36.4.3/JetPack 6.2 | 14 | | meta-tegra-community | master | OE4T layer with additions from the community | 15 | | meta-openembedded | master | OpenEmbedded layers | 16 | | meta-virtualization | master | Virtualization layer for docker support | 17 | 18 | ## Prerequisites 19 | 20 | See the [Yocto Project Quick Build](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html) 21 | documentation for information on setting up your build host. 22 | 23 | For burning SDcards (for Jetson Xavier NX developer kits), the `bmap-tools` 24 | package is recommended. 25 | 26 | ## Setting up 27 | 28 | 1. Clone this repository: 29 | 30 | $ git clone https://github.com/OE4T/tegra-demo-distro.git 31 | 32 | 2. Switch to the appropriate branch, using the 33 | [wiki page](https://github.com/OE4T/tegra-demo-distro/wiki/Which-branch-should-I-use%3F) 34 | for guidance. 35 | 36 | 3. Initialize the git submodules: 37 | 38 | $ cd tegra-demo-distro 39 | $ git submodule update --init 40 | 41 | 4. Source the `setup-env` script to create a build directory, 42 | specifying the MACHINE you want to configure as the default 43 | for your builds. For example, to set up a build directory 44 | called `build` that is set up for the Jetson Xavier NX 45 | developer kit and the default `tegrademo` distro: 46 | 47 | $ . ./setup-env --machine jetson-xavier-nx-devkit 48 | 49 | You can get a complete list of available options, MACHINE 50 | names, and DISTRO names with 51 | 52 | $ . ./setup-env --help 53 | 54 | 5. Optional: Install pre-commit hook for commit autosigning using 55 | $ ./scripts-setup/setup-git-hooks 56 | 57 | ## Distributions 58 | 59 | Use the `--distro` option with `setup-env` to specify a distribution for your build, 60 | or customize the DISTRO setting in your `$BUILDDIR/conf/local.conf` to reference one 61 | of the supported distributions. 62 | 63 | Currently supported distributions are listed below: 64 | 65 | 66 | | Distribution name | Description | 67 | | ----------------- | ------------------------------------------------------------- | 68 | | tegrademo | Default distro used to demonstrate/test meta-tegra features | 69 | 70 | ## Images 71 | 72 | The `tegrademo` distro includes the following image recipes, which 73 | are dervied from the `core-image-XXX` recipes in OE-Core but configured 74 | for Jetson platforms. They include some additional test tools and 75 | demo applications. 76 | 77 | | Recipe name | Description | 78 | | ----------------- | ------------------------------------------------------------- | 79 | | demo-image-base | Basic image with no graphics | 80 | | demo-image-egl | Base with DRM/EGL graphics, no window manager | 81 | | demo-image-sato | X11 image with Sato UI | 82 | | demo-image-weston | Wayland with Weston compositor | 83 | | demo-image-full | Sato image plus nvidia-docker, openCV, multimedia API samples | 84 | 85 | ### Update image demo 86 | 87 | A [swupdate](https://sbabic.github.io/swupdate/) demo image is also available which supports 88 | A/B rootfs updates to any of the supported images. For details refer to 89 | [layers/meta-tegrademo/dynamic-layers/meta-swupdate/README.md](layers/meta-tegrademo/dynamic-layers/meta-swupdate/README.md). 90 | 91 | # Contributing 92 | 93 | Please see the contributor wiki page at [this link](https://github.com/OE4T/meta-tegra/wiki/OE4T-Contributor-Guide). 94 | Contributions are welcome! 95 | -------------------------------------------------------------------------------- /layers/.templateconf: -------------------------------------------------------------------------------- 1 | # This file is required by oe-setup-buildenv script 2 | # but not used in this repository - see ../setup-env 3 | -------------------------------------------------------------------------------- /layers/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /layers/bitbake: -------------------------------------------------------------------------------- 1 | ../repos/poky/bitbake -------------------------------------------------------------------------------- /layers/meta: -------------------------------------------------------------------------------- 1 | ../repos/poky/meta -------------------------------------------------------------------------------- /layers/meta-demo-ci/classes/mirror_updates.bbclass: -------------------------------------------------------------------------------- 1 | # Class for automatically populating downloads and/or sstate mirrors 2 | # during builds, when the mirrors are separate from the normal, local 3 | # DL_DIR and SSTATE_DIR used to perform the build. 4 | # 5 | # Supports file:// and s3:// URLs. 6 | # S3 support also requires the lib/oeaws/s3session.py module. 7 | 8 | # For updating the downloads mirror: 9 | # - set UPDATE_DOWNLOADS_MIRROR to "1" and 10 | # - set DOWNLOADS_MIRROR_URL to the URL for the mirror 11 | # You should also set BB_GENERATE_MIRROR_TARBALLS to "1" so 12 | # that tarballs of any SCM repositories get uploaded to the 13 | # mirror. 14 | UPDATE_DOWNLOADS_MIRROR ?= "0" 15 | DOWNLOADS_MIRROR_URL ??= "" 16 | 17 | # For updating the shared state mirror: 18 | # - set UPDATE_SSTATE_MIROR to "1" and 19 | # - set SSTATE_MIRROR_URL to the URL for the mirror 20 | UPDATE_SSTATE_MIRROR ?= "0" 21 | SSTATE_MIRROR_URL ??= "" 22 | 23 | python downloads_mirror_update() { 24 | import os, shutil, urllib.parse 25 | try: 26 | from oeaws import aws_env 27 | aws_env.fix_env(d) 28 | except ImportError: 29 | pass 30 | 31 | src_uri = (d.getVar("SRC_URI") or "").split() 32 | if len(src_uri) == 0: 33 | return 34 | 35 | mirror = urllib.parse.urlparse(d.getVar("DOWNLOADS_MIRROR_URL")) 36 | 37 | s3 = None 38 | if mirror.scheme == 's3': 39 | from oeaws import s3session 40 | s3 = s3session.S3Session() 41 | elif mirror.scheme != 'file': 42 | bb.warn("unsupported DOWNLOADS_MIRROR_URL type: %s" % mirror.scheme) 43 | return 44 | fetcher = bb.fetch2.Fetch(src_uri, d) 45 | dl_dir = d.getVar("DL_DIR") 46 | for url in src_uri: 47 | # We don't mirror when the SRC_URI is a file://, since those 48 | # aren't actually downloaded 49 | if urllib.parse.urlparse(url).scheme == 'file': 50 | continue 51 | if hasattr(fetcher.ud[url], 'fullmirror'): 52 | localfile = fetcher.ud[url].fullmirror 53 | else: 54 | localfile = fetcher.localpath(url) 55 | # Only files get mirrored, not directories 56 | if not os.path.exists(localfile) or os.path.isdir(localfile): 57 | continue 58 | remotefile = localfile[len(dl_dir)+1:] 59 | if not s3: 60 | # When mirroring to the local filesystem, don't mirror symlinks 61 | if os.path.islink(localfile): 62 | continue 63 | mirrorfile = os.path.join(mirror.path, remotefile) 64 | bb.utils.mkdirhier(os.path.dirname(mirrorfile)) 65 | lf = bb.utils.lockfile("%s.lock" % mirrorfile) 66 | try: 67 | bb.debug(1, "copying: %s -> %s" % (localfile, mirrorfile)) 68 | shutil.copyfile(localfile, mirrorfile) 69 | except IOError: 70 | bb.warn("error copying %s to %s" % (localfile, mirrorfile)) 71 | bb.utils.unlockfile(lf) 72 | else: 73 | mirrorpath = mirror.path.split('/') 74 | mirrorpath.append(remotefile) 75 | destobj = '/'.join(mirrorpath[1:]) 76 | info = s3.get_object_info(mirror.netloc, destobj) 77 | if info and 'LastModified' in info: 78 | mtime = int(time.mktime(info['LastModified'].timetuple())) 79 | st = os.stat(localfile) 80 | if info['ContentLength'] == st.st_size and int(st.st_mtime) == mtime: 81 | continue 82 | s3.upload(localfile, mirror.netloc, destobj) 83 | } 84 | 85 | python sstate_mirror_update() { 86 | import os, shutil, urllib.parse 87 | try: 88 | from oeaws import aws_env 89 | aws_env.fix_env(d) 90 | except ImportError: 91 | pass 92 | 93 | if d.getVar('SSTATE_SKIP_CREATION') == '1': 94 | return 95 | 96 | mirror = urllib.parse.urlparse(d.getVar("SSTATE_MIRROR_URL")) 97 | if mirror.scheme == 'file': 98 | sstatepkg = d.getVar("SSTATE_PKG") 99 | mirrorpkg = os.path.join(mirror.path, d.getVar("SSTATE_PKGNAME")) 100 | bb.utils.mkdirhier(os.path.dirname(mirrorpkg)) 101 | lf = bb.utils.lockfile("%s.lock" % mirrorpkg) 102 | try: 103 | bb.debug(1, "copying: %s -> %s" % (sstatepkg, mirrorpkg)) 104 | shutil.copyfile(sstatepkg, mirrorpkg) 105 | shutil.copyfile(sstatepkg + ".siginfo", mirrorpkg + ".siginfo") 106 | except IOError: 107 | bb.warn("error copying %s to %s" % (sstatepkg, mirrorpkg)) 108 | bb.utils.unlockfile(lf) 109 | elif mirror.scheme == 's3': 110 | from oeaws import s3session 111 | 112 | mirrorpath = mirror.path.split('/') 113 | mirrorpath.append(d.getVar("SSTATE_PKGNAME")) 114 | sstatepkg = d.getVar("SSTATE_PKG") 115 | destobj = '/'.join(mirrorpath[1:]) 116 | s3 = s3session.S3Session() 117 | s3.upload(sstatepkg, mirror.netloc, destobj) 118 | s3.upload(sstatepkg + ".siginfo", mirror.netloc, destobj + ".siginfo") 119 | else: 120 | bb.warn("unsupported SSTATE_MIRROR_URL type: %s" % mirror.scheme) 121 | } 122 | 123 | 124 | python () { 125 | import os, urllib.parse 126 | 127 | try: 128 | from oeaws import s3session 129 | except ImportError: 130 | pass 131 | 132 | if bb.utils.to_boolean(d.getVar("UPDATE_DOWNLOADS_MIRROR")): 133 | mirror = urllib.parse.urlparse(d.getVar("DOWNLOADS_MIRROR_URL")) 134 | enable = False 135 | if mirror.scheme == 'file': 136 | if os.access(mirror.path, os.W_OK): 137 | enable = True 138 | else: 139 | bb.warn("DOWNLOADS_MIRROR_URL (%s) not writable" % mirror.path) 140 | elif mirror.scheme == 's3': 141 | if s3session: 142 | enable = True 143 | else: 144 | bb.warn("UPDATE_DOWNLOADS_MIRROR enabled but s3session module cannot be loaded") 145 | else: 146 | bb.warn("UPDATE_DOWNLOADS_MIRROR enabled, but DOWNLOADS_MIRROR_URL not file:// or s3:// URL") 147 | 148 | if enable: 149 | postfuncs = (d.getVarFlag("do_fetch", "postfuncs") or "").split() 150 | if "downloads_mirror_update" not in postfuncs: 151 | d.appendVarFlag("do_fetch", "postfuncs", " downloads_mirror_update") 152 | d.appendVarFlag("do_fetch", "vardepsexclude", " downloads_mirror_update") 153 | 154 | if bb.utils.to_boolean(d.getVar("UPDATE_SSTATE_MIRROR")): 155 | enable = False 156 | mirror = urllib.parse.urlparse(d.getVar("SSTATE_MIRROR_URL")) 157 | if mirror.scheme == 'file': 158 | if os.access(mirror.path, os.W_OK): 159 | enable = True 160 | else: 161 | bb.warn("SSTATE_MIRROR_URL (%s) not writable, skipping updates" % mirror.path) 162 | elif mirror.scheme == 's3': 163 | if s3session: 164 | enable = True 165 | else: 166 | bb.warn("UPDATE_SSTATE_MIRROR enabled but s3session module cannot be loaded") 167 | else: 168 | bb.warn("UPDATE_SSTATE_MIRROR enabled, but SSTATE_MIRROR_URL not file:// or s3:// URL") 169 | 170 | if enable: 171 | for task in (d.getVar("SSTATETASKS") or "").split(): 172 | postfuncs = (d.getVarFlag(task, "postfuncs") or "").split() 173 | if "sstate_task_postfunc" in postfuncs and "sstate_mirror_update" not in postfuncs: 174 | d.appendVarFlag(task, "postfuncs", " sstate_mirror_update") 175 | d.appendVarFlag(task, "vardepsexclude", " sstate_mirror_update") 176 | 177 | } 178 | -------------------------------------------------------------------------------- /layers/meta-demo-ci/conf/layer.conf: -------------------------------------------------------------------------------- 1 | BBPATH =. "${LAYERDIR}:" 2 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" 3 | 4 | BBFILE_COLLECTIONS += "tegrademo-ci" 5 | BBFILE_PATTERN_tegrademo-ci = "^${LAYERDIR}/" 6 | BBFILE_PATTERN_IGNORE_EMPTY_tegrademo-ci = "1" 7 | BBFILE_PRIORITY_tegrademo-ci = "40" 8 | 9 | LAYERVERSION_tegrademo-ci = "1" 10 | LAYERDEPENDS_tegrademo-ci = "core" 11 | LAYERSERIES_COMPAT_tegrademo-ci = "walnascar" 12 | 13 | addpylib ${LAYERDIR}/lib oeaws.botos3fetcher 14 | -------------------------------------------------------------------------------- /layers/meta-demo-ci/lib/oeaws/aws_env.py: -------------------------------------------------------------------------------- 1 | # ex:ts=4:sw=4:sts=4:et 2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- 3 | """ 4 | Fix AWS env for S3 fetcher 5 | Extracted from botos3fetcher in order to be used in bbclass too 6 | 7 | Copyright (c) 2019-2020, Matthew Madison 8 | """ 9 | import os 10 | 11 | import bb 12 | 13 | awsvars = [ 'AWS_CONFIG_FILE', 14 | 'AWS_PROFILE', 15 | 'AWS_ACCESS_KEY_ID', 16 | 'AWS_SECRET_ACCESS_KEY', 17 | 'AWS_SHARED_CREDENTIALS_FILE', 18 | 'AWS_SESSION_TOKEN', 19 | 'AWS_DEFAULT_REGION', 20 | 'AWS_METADATA_SERVICE_NUM_ATTEMPTS', 21 | 'AWS_METADATA_SERVICE_TIMEOUT'] 22 | 23 | def fix_env(d): 24 | origenv = d.getVar('BB_ORIGENV', False) 25 | for v in awsvars: 26 | val = os.getenv(v) 27 | if val: 28 | bb.debug(2, "Have %s=%s in env" % (v, val)) 29 | continue 30 | val = origenv and origenv.getVar(v) 31 | if val: 32 | os.environ[v] = val 33 | bb.debug(2, 'Set %s=%s in env' % (v, val)) 34 | bb.debug(2, 'No setting for %s' % v) 35 | -------------------------------------------------------------------------------- /layers/meta-demo-ci/lib/oeaws/botos3fetcher.py: -------------------------------------------------------------------------------- 1 | # ex:ts=4:sw=4:sts=4:et 2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- 3 | """ 4 | BitBake fetcher for AWS S3 using boto3 5 | 6 | Makes direct boto3 API calls for S3 fetches for improved 7 | performance over the built-in awscli-based fetcher. 8 | 9 | You must have the boto3 and botocore packages, and their 10 | dependencies, installed prior to use. 11 | 12 | 13 | Copyright (c) 2019-2020, Matthew Madison 14 | """ 15 | 16 | from oeaws import aws_env 17 | import bb 18 | 19 | 20 | class S3(bb.fetch2.s3.S3): 21 | 22 | def __init__(self, urls=None): 23 | super().__init__(urls) 24 | self.session = oeaws.s3session.S3Session() 25 | 26 | def checkstatus(self, fetch, ud, d): 27 | aws_env.fix_env(d) 28 | return self.session.get_object_info(ud.host, ud.path[1:]) is not None 29 | 30 | def download(self, ud, d): 31 | aws_env.fix_env(d) 32 | if not self.session.download(ud.host, ud.path[1:], ud.localpath): 33 | raise bb.fetch2.FetchError("could not download s3://%s%s" % (ud.host, ud.path)) 34 | return True 35 | 36 | try: 37 | import oeaws.s3session 38 | bb.fetch2.methods = [m for m in bb.fetch2.methods if not isinstance(m, bb.fetch2.s3.S3)] + [S3()] 39 | bb.debug(1, "botos3fetcher: installed") 40 | except: 41 | bb.debug(1, "botos3fetcher: s3session import failed") 42 | pass 43 | -------------------------------------------------------------------------------- /layers/meta-demo-ci/lib/oeaws/s3session.py: -------------------------------------------------------------------------------- 1 | # ex:ts=4:sw=4:sts=4:et 2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- 3 | """ 4 | AWS S3 session management using boto3/botocore. 5 | 6 | Speeds up S3 fetcher operations by directly calling boto3 7 | APIs. Can also be used for S3 uploads. 8 | 9 | Remember to whitelist any AWS_* environment variables you 10 | may need to use for S3 access during builds. 11 | 12 | Copyright (c) 2019-2020, Matthew Madison 13 | """ 14 | 15 | import os 16 | import time 17 | import random 18 | import bb 19 | import boto3 20 | import botocore 21 | 22 | def s3retry_wait(trynumber): 23 | time.sleep(random.SystemRandom().random() * (trynumber * 5.0) + 5.0) 24 | 25 | class S3Session(object): 26 | def __init__(self, maxtries=10): 27 | self.s3client = None 28 | default_maxtries = os.getenv('AWS_METADATA_SERVICE_NUM_ATTEMPTS') 29 | if default_maxtries is not None and int(default_maxtries) > maxtries: 30 | self.maxtries = int(default_maxtries) 31 | else: 32 | self.maxtries = maxtries 33 | default_timeout = os.getenv('AWS_METADATA_SERVICE_TIMEOUT') 34 | if default_timeout is not None and int(default_timeout) > 1: 35 | self.metadata_timeout = int(default_timeout) 36 | else: 37 | self.metadata_timeout = 10 38 | 39 | def makeclient(self): 40 | os.environ['AWS_METADATA_SERVICE_NUM_ATTEMPTS'] = '{}'.format(self.maxtries) 41 | os.environ['AWS_METADATA_SERVICE_TIMEOUT'] = '{}'.format(self.metadata_timeout) 42 | session = botocore.session.get_session() 43 | self.s3client = boto3.Session(botocore_session=session).client('s3') 44 | provider = session.get_component('credential_provider').get_provider('assume-role') 45 | provider.cache = botocore.credentials.JSONFileCache() 46 | bb.debug(1, "Using AWS profile: %s" % provider._profile_name) 47 | 48 | def upload(self, Filename, Bucket, Key): 49 | if self.s3client is None: 50 | self.makeclient() 51 | for attempt in range(self.maxtries): 52 | try: 53 | self.s3client.upload_file(Bucket=Bucket, Key=Key, Filename=Filename) 54 | except (botocore.exceptions.NoCredentialsError, botocore.exceptions.EndpointConnectionError): 55 | s3retry_wait(attempt) 56 | continue 57 | except botocore.exceptions.ClientError as e: 58 | err = e.repsonse['Error'] 59 | bb.warn("{}/{}: {} {}".format(Bucket, Key, err['Code'], err['Message'])) 60 | return False 61 | return True 62 | bb.warn("{}/{}: credentials error on upload for 10 attempts".format(Bucket, Key)) 63 | return False 64 | 65 | def download(self, Bucket, Key, Filename, quiet=True): 66 | if self.s3client is None: 67 | self.makeclient() 68 | for attempt in range(10): 69 | try: 70 | bb.debug(2, "%s/%s: attempt %d" % (Bucket, Key, attempt)) 71 | info = self.s3client.head_object(Bucket=Bucket, Key=Key) 72 | self.s3client.download_file(Bucket=Bucket, Key=Key, Filename=Filename) 73 | if 'LastModified' in info: 74 | mtime = int(time.mktime(info['LastModified'].timetuple())) 75 | os.utime(Filename, (mtime, mtime)) 76 | except (botocore.exceptions.NoCredentialsError, botocore.exceptions.EndpointConnectionError): 77 | s3retry_wait(attempt) 78 | continue 79 | except botocore.exceptions.ClientError as e: 80 | err = e.response['Error'] 81 | if quiet and err['Code'] == "404": 82 | bb.debug(2, "not found: {}/{}".format(Bucket, Key)) 83 | else: 84 | bb.warn("{}/{}: {} {}".format(Bucket, Key, err['Code'], err['Message'])) 85 | return False 86 | except OSError as e: 87 | if quiet: 88 | pass 89 | bb.warn("os.utime({}): {} (errno {})".format(Filename, e.strerror, e.errno)) 90 | return False 91 | bb.debug(1, "{}/{}: success".format(Bucket, Key)) 92 | return True 93 | bb.warn("{}/{}: credentials error on download for 10 attempts".format(Bucket, Key)) 94 | return False 95 | 96 | def get_object_info(self, Bucket, Key, quiet=True): 97 | if self.s3client is None: 98 | self.makeclient() 99 | for attempt in range(10): 100 | try: 101 | info = self.s3client.head_object(Bucket=Bucket, Key=Key) 102 | except botocore.exceptions.NoCredentialsError: 103 | s3retry_wait(attempt) 104 | continue 105 | except botocore.exceptions.ClientError as e: 106 | err = e.response['Error'] 107 | if quiet and err['Code'] == "404": 108 | bb.debug(2, "not found: {}/{}".format(Bucket, Key)) 109 | else: 110 | bb.warn("{}/{}: {} {}".format(Bucket, Key, err['Code'], err['Message'])) 111 | return None 112 | return info 113 | bb.warn("{}/{}: credentials error on get_object_info for 10 attempts".format(Bucket, Key)) 114 | return None 115 | -------------------------------------------------------------------------------- /layers/meta-filesystems: -------------------------------------------------------------------------------- 1 | ../repos/meta-openembedded/meta-filesystems -------------------------------------------------------------------------------- /layers/meta-networking: -------------------------------------------------------------------------------- 1 | ../repos/meta-openembedded/meta-networking -------------------------------------------------------------------------------- /layers/meta-oe: -------------------------------------------------------------------------------- 1 | ../repos/meta-openembedded/meta-oe -------------------------------------------------------------------------------- /layers/meta-python: -------------------------------------------------------------------------------- 1 | ../repos/meta-openembedded/meta-python -------------------------------------------------------------------------------- /layers/meta-skeleton: -------------------------------------------------------------------------------- 1 | ../repos/poky/meta-skeleton -------------------------------------------------------------------------------- /layers/meta-tegra: -------------------------------------------------------------------------------- 1 | ../repos/meta-tegra -------------------------------------------------------------------------------- /layers/meta-tegra-community: -------------------------------------------------------------------------------- 1 | ../repos/meta-tegra-community -------------------------------------------------------------------------------- /layers/meta-tegra-support/classes/distro_layer_buildinfo.bbclass: -------------------------------------------------------------------------------- 1 | def dlb_git_describe(path): 2 | if path is not None: 3 | with os.popen("cd %s; git describe --dirty --always 2>/dev/null" % path) as f: 4 | gitinfo = f.read().strip() 5 | return gitinfo 6 | return "" 7 | 8 | def dlb_git_branch(path): 9 | branchname = "" 10 | if path is not None: 11 | with os.popen("cd %s; git branch 2>/dev/null" % path) as f: 12 | for line in f: 13 | if line.startswith("* "): 14 | branchname = line[2:].strip() 15 | break 16 | return branchname 17 | 18 | def distro_layername(d): 19 | return d.getVar("DISTRO_LAYER", True) 20 | 21 | def distro_layerpath(lname, d): 22 | layers = {os.path.basename(l): l for l in (d.getVar("BBLAYERS", True) or "").split()} 23 | try: 24 | return layers[lname] 25 | except KeyError: 26 | return None 27 | 28 | def distro_layer_buildtag(d): 29 | tag = dlb_git_describe(distro_layerpath(distro_layername(d), d)) 30 | if os.getenv("USER") in ['jenkins', 'builder'] or bb.utils.to_boolean(d.getVar("PRODUCTION_BUILD")): 31 | return '-' + tag 32 | return '-' + tag + '-' + os.getenv("USER") 33 | 34 | def distro_layer_branch(d): 35 | return dlb_git_branch(distro_layerpath(distro_layername(d), d)) 36 | 37 | DISTRO_LAYER ??= "meta-${DISTRO}" 38 | DISTRO_LAYER_BUILDTAG := "${@distro_layer_buildtag(d)}" 39 | DISTRO_LAYER_BUILDTAG[vardepvalue] = "${DISTRO_LAYER_BUILDTAG}" 40 | DISTRO_LAYER_BRANCH := "${@distro_layer_branch(d)}" 41 | DISTRO_LAYER_BRANCH[vardepvalue] = "${DISTRO_LAYER_BRANCH}" 42 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/classes/tegra-support-sanity.bbclass: -------------------------------------------------------------------------------- 1 | TD_BBLAYERS_CONF_VERSION ??= "unset-0" 2 | 3 | 4 | python tegra_distro_update_bblayersconf() { 5 | current_version = d.getVar('TD_BBLAYERS_CONF_VERSION').split('-') 6 | required_version = (d.getVar('REQUIRED_TD_BBLAYERS_CONF_VERSION') or 'UNKNOWN-0').split('-') 7 | if required_version[0] == "UNKNOWN": 8 | # malformed configuration 9 | raise NotImplementedError("You need to update bblayers.conf manually for this version transition") 10 | 11 | if '-'.join(current_version[0:-1]) == '-'.join(required_version[0:-1]) and int(current_version[-1]) == int(required_version[-1]): 12 | return 13 | 14 | distro_layerdir = d.getVar('TD_DISTRO_LAYERDIR') 15 | if not distro_layerdir: 16 | raise NotImplementedError("TD_DISTRO_LAYERDIR must be set to locate the bblayers template config") 17 | 18 | root = d.getVar("COREBASE") 19 | 20 | # On any mismatch, just use the template 21 | newconf = sanity_conf_read(os.path.join(distro_layerdir, 'conf', 22 | 'templates/{}'.format(d.getVar('DISTRO')), 23 | 'bblayers.conf.sample')) 24 | with open(bblayers_conf_file(d), "w") as f: 25 | f.write(''.join([line.replace('##OEROOT##', root).replace('##COREBASE##', root) for line in newconf])) 26 | bb.note("Your conf/bblayers.conf has been automatically updated.") 27 | return 28 | 29 | } 30 | 31 | BBLAYERS_CONF_UPDATE_FUNCS += " \ 32 | conf/bblayers.conf:TD_BBLAYERS_CONF_VERSION:REQUIRED_TD_BBLAYERS_CONF_VERSION:tegra_distro_update_bblayersconf \ 33 | " 34 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/conf/layer.conf: -------------------------------------------------------------------------------- 1 | BBPATH =. "${LAYERDIR}:" 2 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" 3 | 4 | BBFILE_COLLECTIONS += "tegrasupport" 5 | BBFILE_PATTERN_tegrasupport = "^${LAYERDIR}/" 6 | BBFILE_PRIORITY_tegrasupport = "40" 7 | 8 | LAYERVERSION_tegrasupport = "4" 9 | LAYERDEPENDS_tegrasupport = "core tegra" 10 | LAYERSERIES_COMPAT_tegrasupport = "walnascar" 11 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/recipes-core/images/tegra-minimal-initramfs.bbappend: -------------------------------------------------------------------------------- 1 | ROOTFS_POSTPROCESS_COMMAND:remove = "rootfs_version_info;" 2 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/recipes-core/psplash/psplash_git.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend:tegrademo := "${THISDIR}/files:" 2 | SPLASH_IMAGES:tegrademo = "file://psplash-OE4T-img.h;outsuffix=default" 3 | 4 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/recipes-filesystems/sshfs-fuse/sshfs-fuse_%.bbappend: -------------------------------------------------------------------------------- 1 | PTEST_ENABLED = "0" 2 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend: -------------------------------------------------------------------------------- 1 | PACKAGECONFIG:append = " faad" 2 | -------------------------------------------------------------------------------- /layers/meta-tegra-support/recipes-support/fuse/fuse3_%.bbappend: -------------------------------------------------------------------------------- 1 | PTEST_ENABLED = "0" 2 | 3 | do_install:append() { 4 | sed -i -e's,^#user_allow_other,user_allow_other,' ${D}${sysconfdir}/fuse.conf 5 | } 6 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/.templateconf: -------------------------------------------------------------------------------- 1 | TEMPLATECONF=${TEMPLATECONF:-meta-tegrademo/conf/templates/$DISTRO} 2 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/distro/include/tegrademo.inc: -------------------------------------------------------------------------------- 1 | DISTRO = "tegrademo" 2 | DISTRO_NAME = "OE4Tegra Demonstration Distro" 3 | DISTRO_VERSION_BASE = "5.2" 4 | DISTRO_VERSION = "${DISTRO_VERSION_BASE}+snapshot-${METADATA_REVISION}" 5 | DISTRO_CODENAME = "master" 6 | SDK_VENDOR = "-tdsdk" 7 | SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${METADATA_REVISION}','snapshot')}" 8 | SDK_VERSION[vardepvalue] = "${SDK_VERSION}" 9 | 10 | MAINTAINER = "OE4Tegra team " 11 | 12 | TARGET_VENDOR = "-oe4t" 13 | 14 | # New ${DISTRO}- setting for sanity checks. 15 | # Increment version number (and the corresponding 16 | # setting int the template bblayers.conf.sample file) 17 | # each time the layer settings are changed. 18 | REQUIRED_TD_BBLAYERS_CONF_VERSION = "${DISTRO}-5" 19 | 20 | LOCALCONF_VERSION = "2" 21 | 22 | TD_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland vulkan systemd pam virtualization usrmerge" 23 | 24 | DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${TD_DEFAULT_DISTRO_FEATURES}" 25 | 26 | # As of L4T R36, Jetson platforms can use linux-yocto 27 | # instead of linux-jammy-nvidia-tegra 28 | TEGRA_DEFAULT_KERNEL ?= "linux-yocto" 29 | PREFERRED_PROVIDER_virtual/kernel:tegra = "${TEGRA_DEFAULT_KERNEL}" 30 | PREFERRED_VERSION_linux-yocto ?= "6.12%" 31 | PREFERRED_VERSION_linux-yocto-rt ?= "6.12%" 32 | 33 | SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}" 34 | SDKPATHINSTALL = "/opt/${DISTRO}/${SDK_VERSION}" 35 | 36 | PACKAGE_CLASSES ?= "package_rpm" 37 | 38 | SANITY_TESTED_DISTROS ?= " \ 39 | ubuntu-20.04 \n \ 40 | ubuntu-22.04 \n \ 41 | ubuntu-24.04 \n \ 42 | " 43 | 44 | # Most NVIDIA-supplied services expect systemd 45 | INIT_MANAGER = "systemd" 46 | 47 | require conf/distro/include/no-static-libs.inc 48 | require conf/distro/include/yocto-uninative.inc 49 | require conf/distro/include/security_flags.inc 50 | require conf/distro/include/yocto-space-optimize.inc 51 | INHERIT += "uninative" 52 | 53 | LICENSE_FLAGS_ACCEPTED += "commercial_faad2 commercial_x264" 54 | 55 | USE_REDUNDANT_FLASH_LAYOUT_DEFAULT ?= "1" 56 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/distro/tegrademo.conf: -------------------------------------------------------------------------------- 1 | require conf/distro/include/tegrademo.inc 2 | 3 | INHERIT += "tegra-support-sanity" 4 | ESDK_CLASS_INHERIT_DISABLE:append = " tegra-support-sanity" 5 | 6 | BB_SIGNATURE_HANDLER ?= "OEEquivHash" 7 | BB_HASHSERVE ??= "auto" -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/kas/include/tegra-demo-distro-branch.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 14 3 | 4 | defaults: 5 | repos: 6 | branch: master 7 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/kas/tegra-demo-distro.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 14 3 | includes: 4 | - layers/meta-tegrademo/conf/kas/include/tegra-demo-distro-branch.yml 5 | 6 | distro: tegrademo 7 | 8 | target: 9 | - demo-image-base 10 | 11 | machine: jetson-orin-nano-devkit 12 | 13 | repos: 14 | tegra-demo-distro: 15 | layers: 16 | layers/meta-tegra-support: 17 | layers/meta-tegrademo: 18 | layers/meta-demo-ci: 19 | 20 | meta-tegra: 21 | path: repos/meta-tegra 22 | url: https://github.com/OE4T/meta-tegra.git 23 | 24 | meta-openembedded: 25 | path: repos/meta-openembedded 26 | url: https://git.openembedded.org/meta-openembedded 27 | layers: 28 | meta-filesystems: 29 | meta-networking: 30 | meta-python: 31 | meta-oe: 32 | 33 | 34 | meta-tegra-community: 35 | path: repos/meta-tegra-community 36 | url: https://github.com/OE4T/meta-tegra-community 37 | 38 | meta-virtualization: 39 | path: repos/meta-virtualization 40 | url: https://git.yoctoproject.org/meta-virtualization 41 | 42 | poky: 43 | path: repos/poky 44 | url: https://git.yoctoproject.org/poky 45 | layers: 46 | meta: 47 | 48 | local_conf_header: 49 | tegra: | 50 | # these two classes only work as intended when being inherited in the 51 | # OE4t setup-env.sh style environment, as they modify bblayers.conf 52 | # and expect additional information on the host. 53 | INHERIT:remove = "tegra-support-sanity distro_layer_buildinfo" 54 | EXTRA_IMAGE_FEATURES ?= "allow-empty-password empty-root-password allow-root-login" 55 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/layer.conf: -------------------------------------------------------------------------------- 1 | BBPATH =. "${LAYERDIR}:${LAYERDIR}/dynamic-layers/meta-swupdate:" 2 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" 3 | BBFILES_DYNAMIC += "swupdate:${LAYERDIR}/dynamic-layers/meta-swupdate/recipes-*/*/*.bb \ 4 | swupdate:${LAYERDIR}/dynamic-layers/meta-swupdate/recipes-*/*/*.bbappend" 5 | 6 | BBFILE_COLLECTIONS += "tegrademo" 7 | BBFILE_PATTERN_tegrademo = "^${LAYERDIR}/" 8 | BBFILE_PRIORITY_tegrademo = "50" 9 | 10 | LAYERVERSION_tegrademo = "4" 11 | LAYERSERIES_COMPAT_tegrademo = "walnascar" 12 | 13 | # This is used by the tegra-distro-sanity bbclass 14 | # to identify the distro layer directory during 15 | # bblayers checks. 16 | TD_DISTRO_LAYERDIR = "${LAYERDIR}" 17 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/templates/tegrademo/bblayers.conf.sample: -------------------------------------------------------------------------------- 1 | # Version of layers configuration, specific to 2 | # each defined distro in the repository. 3 | # Format: ${DISTRO}- 4 | TD_BBLAYERS_CONF_VERSION = "tegrademo-5" 5 | 6 | BBPATH = "${TOPDIR}" 7 | BBFILES ?= "" 8 | 9 | BBLAYERS ?= " \ 10 | ##OEROOT##/meta \ 11 | ##OEROOT##/meta-tegra \ 12 | ##OEROOT##/meta-oe \ 13 | ##OEROOT##/meta-python \ 14 | ##OEROOT##/meta-networking \ 15 | ##OEROOT##/meta-filesystems \ 16 | ##OEROOT##/meta-virtualization \ 17 | ##OEROOT##/meta-tegra-community \ 18 | ##OEROOT##/meta-tegra-support \ 19 | ##OEROOT##/meta-demo-ci \ 20 | ##OEROOT##/meta-tegrademo \ 21 | " 22 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/templates/tegrademo/conf-notes.txt: -------------------------------------------------------------------------------- 1 | ### Shell environment set up for builds. ### 2 | 3 | You can now run 'bitbake ' 4 | Targets for building Tegra demo images with test applications: 5 | core-image-minimal - minimally bootable image (no demo apps, no graphics) 6 | demo-image-base - basic image with no graphics 7 | demo-image-egl - basic image with DRM/EGL, no window manager 8 | demo-image-sato - X11 image with 'sato' UI 9 | demo-image-weston - Wayland with Weston compositor 10 | demo-image-full - X11/sato UI plus docker, openCV, VPI, TensorRT and multimedia API samples 11 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/conf/templates/tegrademo/local.conf.sample: -------------------------------------------------------------------------------- 1 | # This file is your local configuration file and is where all local user settings 2 | # are placed. The comments in this file give some guide to the options a new user 3 | # to the system might want to change but pretty much any configuration option can 4 | # be set in this file. 5 | 6 | # 7 | # Machine Selection 8 | # 9 | # You need to select a specific machine to target the build with. 10 | # The following machines are avilable in the meta-tegra layer: 11 | # 12 | #MACHINE ?= "jetson-agx-orin-devkit" 13 | #MACHINE ?= "jetson-orin-nano-devkit" 14 | #@TD_SETUP_MACHINE@ - placeholder for automatic insertion by setup-env 15 | # 16 | # This sets the default machine to be qemux86-64 if no other machine is selected: 17 | MACHINE ??= "qemux86-64" 18 | 19 | # 20 | # Where to place downloads 21 | # 22 | # During a first build the system will download many different source code tarballs 23 | # from various upstream projects. This can take a while, particularly if your network 24 | # connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you 25 | # can preserve this directory to speed up this part of subsequent builds. This directory 26 | # is safe to share between multiple builds on the same machine too. 27 | # 28 | # The default is a downloads directory under TOPDIR which is the build directory. 29 | # 30 | #DL_DIR ?= "${TOPDIR}/downloads" 31 | 32 | # 33 | # Where to place shared-state files 34 | # 35 | # BitBake has the capability to accelerate builds based on previously built output. 36 | # This is done using "shared state" files which can be thought of as cache objects 37 | # and this option determines where those files are placed. 38 | # 39 | # You can wipe out TMPDIR leaving this directory intact and the build would regenerate 40 | # from these files if no changes were made to the configuration. If changes were made 41 | # to the configuration, only shared state files where the state was still valid would 42 | # be used (done using checksums). 43 | # 44 | # The default is a sstate-cache directory under TOPDIR. 45 | # 46 | #SSTATE_DIR ?= "${TOPDIR}/sstate-cache" 47 | 48 | # 49 | # Where to place the build output 50 | # 51 | # This option specifies where the bulk of the building work should be done and 52 | # where BitBake should place its temporary files and output. Keep in mind that 53 | # this includes the extraction and compilation of many applications and the toolchain 54 | # which can use Gigabytes of hard disk space. 55 | # 56 | # The default is a tmp directory under TOPDIR. 57 | # 58 | #TMPDIR = "${TOPDIR}/tmp" 59 | 60 | # 61 | # Default policy (distro) config 62 | # 63 | #@TD_SETUP_DISTRO@ - placeholder for automatic insertion by setup-env 64 | # Base distro for meta-tegra 65 | #DISTRO ?= "tegrademo" 66 | 67 | # 68 | # Package Management configuration 69 | # 70 | # This variable lists which packaging formats to enable. Multiple package backends 71 | # can be enabled at once and the first item listed in the variable will be used 72 | # to generate the root filesystems. 73 | # Options are: 74 | # - 'package_deb' for debian style deb files 75 | # - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) 76 | # - 'package_rpm' for rpm style packages 77 | # E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" 78 | # The tegrademo distro defaults to rpm: 79 | #PACKAGE_CLASSES ?= "package_rpm" 80 | 81 | # 82 | # SDK target architecture 83 | # 84 | # This variable specifies the architecture to build SDK items for and means 85 | # you can build the SDK packages for architectures other than the machine you are 86 | # running the build on (i.e. building i686 packages on an x86_64 host). 87 | # Only x86_64 is supported for the meta-tegra BSP, since some of the NVIDIA-provided 88 | # host tools are 64-bit only. 89 | SDKMACHINE ?= "x86_64" 90 | 91 | # 92 | # Extra image configuration defaults 93 | # 94 | # The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated 95 | # images. Some of these options are added to certain image types automatically. Some 96 | # of the features available are: 97 | # "dbg-pkgs" - add -dbg packages for all installed packages 98 | # (adds symbol information for debugging/profiling) 99 | # "src-pkgs" - add -src packages for all installed packages 100 | # (adds source code for debugging) 101 | # "dev-pkgs" - add -dev packages for all installed packages 102 | # (useful if you want to develop against libs in the image) 103 | # "ptest-pkgs" - add -ptest packages for all ptest-enabled packages 104 | # (useful if you want to run the package test suites) 105 | # "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) 106 | # "tools-debug" - add debugging tools (gdb, strace) 107 | # "eclipse-debug" - add Eclipse remote debugging support 108 | # "tools-profile" - add profiling tools (oprofile, lttng, valgrind) 109 | # "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) 110 | # "allow-empty-password" - allow users to have an empty password 111 | # "empty-root-password" - the root user has no password set 112 | # "allow-root-login - the root user can login 113 | # There are other features that can be used here too, see 114 | # meta/classes-recipe/image.bbclass and 115 | # meta/classes-recipe/core-image.bbclass for more details. 116 | # We default to allowing root login without a password for convenience. 117 | EXTRA_IMAGE_FEATURES ?= "allow-empty-password empty-root-password allow-root-login" 118 | 119 | # 120 | # Additional image features 121 | # 122 | # The following is a list of additional classes to use when building images which 123 | # enable extra features. Some available options which can be included in this variable 124 | # are: 125 | # - 'buildstats' collect build statistics 126 | USER_CLASSES ?= "buildstats" 127 | 128 | # 129 | # Runtime testing of images 130 | # 131 | # The build system can test booting virtual machine images under qemu (an emulator) 132 | # after any root filesystems are created and run tests against those images. It can also 133 | # run tests against any SDK that are built. To enable this uncomment these lines. 134 | # See classes/test{image,sdk}.bbclass for further details. 135 | #IMAGE_CLASSES += "testimage testsdk" 136 | #TESTIMAGE_AUTO:qemuall = "1" 137 | 138 | # 139 | # Interactive shell configuration 140 | # 141 | # Under certain circumstances the system may need input from you and to do this it 142 | # can launch an interactive shell. It needs to do this since the build is 143 | # multithreaded and needs to be able to handle the case where more than one parallel 144 | # process may require the user's attention. The default is iterate over the available 145 | # terminal types to find one that works. 146 | # 147 | # Examples of the occasions this may happen are when resolving patches which cannot 148 | # be applied, to use the devshell or the kernel menuconfig 149 | # 150 | # Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none 151 | # Note: currently, Konsole support only works for KDE 3.x due to the way 152 | # newer Konsole versions behave 153 | #OE_TERMINAL = "auto" 154 | # By default disable interactive patch resolution (tasks will just fail instead): 155 | PATCHRESOLVE = "noop" 156 | 157 | # 158 | # Disk Space Monitoring during the build 159 | # 160 | # Monitor the disk space during the build. If there is less than 1GB of space or less 161 | # than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully 162 | # shutdown the build. If there is less than 100MB or 1K inodes, perform a hard halt 163 | # of the build. The reason for this is that running completely out of space can corrupt 164 | # files and damages the build in ways which may not be easily recoverable. 165 | # It's necessary to monitor /tmp, if there is no space left the build will fail 166 | # with very exotic errors. 167 | BB_DISKMON_DIRS ??= "\ 168 | STOPTASKS,${TMPDIR},1G,100K \ 169 | STOPTASKS,${DL_DIR},1G,100K \ 170 | STOPTASKS,${SSTATE_DIR},1G,100K \ 171 | STOPTASKS,/tmp,100M,100K \ 172 | HALT,${TMPDIR},100M,1K \ 173 | HALT,${DL_DIR},100M,1K \ 174 | HALT,${SSTATE_DIR},100M,1K \ 175 | HALT,/tmp,10M,1K" 176 | 177 | # 178 | # Shared-state files from other locations 179 | # 180 | # As mentioned above, shared state files are prebuilt cache data objects which can be 181 | # used to accelerate build time. This variable can be used to configure the system 182 | # to search other mirror locations for these objects before it builds the data itself. 183 | # 184 | # This can be a filesystem directory, or a remote url such as https or ftp. These 185 | # would contain the sstate-cache results from previous builds (possibly from other 186 | # machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the 187 | # cache locations to check for the shared objects. 188 | # NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH 189 | # at the end as shown in the examples below. This will be substituted with the 190 | # correct path within the directory structure. 191 | #SSTATE_MIRRORS ?= "\ 192 | #file://.* https://someserver.tld/share/sstate/PATH;downloadfilename=PATH \ 193 | #file://.* file:///some/local/dir/sstate/PATH" 194 | 195 | # 196 | # Yocto Project SState Mirror 197 | # 198 | # The Yocto Project has prebuilt artefacts available for its releases, you can enable 199 | # use of these by uncommenting the following lines. This will mean the build uses 200 | # the network to check for artefacts at the start of builds, which does slow it down 201 | # equally, it will also speed up the builds by not having to build things if they are 202 | # present in the cache. It assumes you can download something faster than you can build it 203 | # which will depend on your network. 204 | # Note: For this to work you also need hash-equivalence passthrough to the matching server 205 | # Also note that for the tegrademo distro, sstate maintained by the Yocto Project sstate 206 | # is probably not very helpful. 207 | # 208 | #BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' 209 | #SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" 210 | 211 | # 212 | # Qemu configuration 213 | # 214 | # By default native qemu will build with a builtin VNC server where graphical output can be 215 | # seen. The line below enables the SDL UI frontend too. 216 | PACKAGECONFIG:append:pn-qemu-system-native = " sdl" 217 | # By default libsdl2-native will be built, if you want to use your host's libSDL instead of 218 | # the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. 219 | #ASSUME_PROVIDED += "libsdl2-native" 220 | 221 | # You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds 222 | # a handy set of menus for controlling the emulator. 223 | #PACKAGECONFIG:append:pn-qemu-system-native = " gtk+" 224 | 225 | # 226 | # Hash Equivalence 227 | # 228 | # Enable support for automatically running a local hash equivalence server and 229 | # instruct bitbake to use a hash equivalence aware signature generator. Hash 230 | # equivalence improves reuse of sstate by detecting when a given sstate 231 | # artifact can be reused as equivalent, even if the current task hash doesn't 232 | # match the one that generated the artifact. 233 | # 234 | # A shared hash equivalent server can be set with ":" format 235 | # 236 | #BB_HASHSERVE = "auto" 237 | #BB_SIGNATURE_HANDLER = "OEEquivHash" 238 | 239 | # 240 | # Memory Resident Bitbake 241 | # 242 | # Bitbake's server component can stay in memory after the UI for the current command 243 | # has completed. This means subsequent commands can run faster since there is no need 244 | # for bitbake to reload cache files and so on. Number is in seconds, after which the 245 | # server will shut down. 246 | # 247 | #BB_SERVER_TIMEOUT = "60" 248 | 249 | # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to 250 | # track the version of this file when it was generated. This can safely be ignored if 251 | # this doesn't mean anything to you. 252 | CONF_VERSION = "2" 253 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/README.md: -------------------------------------------------------------------------------- 1 | # Swupdate for NVIDIA Tegra (Jetson) platforms 2 | 3 | This dynamic layer provides an example implementation for 4 | Nvidia Jetson and [swupdate](https://sbabic.github.io/swupdate). 5 | 6 | The simplest way to use on tegra is to add to a forked copy of 7 | [tegra-demo-distro](https://github.com/OE4T/tegra-demo-distro) which 8 | also contains relevant images and submodules used to build tegra images. 9 | However, this is not strictly required. The only dependency required 10 | is the [meta-tegra](https://github.com/OE4T/meta-tegra) layer. 11 | 12 | ## Build with KAS 13 | 14 | The files under [conf/kas](conf/kas) support building with 15 | the [kas](https://kas.readthedocs.io/). 16 | 17 | The setups here represent the last configuration tested. 18 | 19 | ### Install kas 20 | ``` 21 | pip3 install kas 22 | ``` 23 | 24 | ### Build with kas 25 | 26 | Start by cloning this repo with 27 | 28 | ``` 29 | git clone --shallow-submodules 30 | ``` 31 | 32 | Then use the scripts at [scripts](scripts) to kick of the build for instance 33 | 34 | ``` 35 | ./scripts/build-jetson-orin-nano-devkit-nvme.sh 36 | ``` 37 | to build for the jetson-orin-nano-devkit-nvme `MACHINE` on the 38 | default branch configuration. 39 | 40 | The default build will build for whatever branch of this 41 | repository you've cloned and latest branch of corresponding 42 | repositories. 43 | 44 | To build the latest tested configuration instead, use kas 45 | build to specify the swupdate-oe4t-lasttested.yml file from 46 | the base directory, for instance: 47 | 48 | ``` 49 | kas build layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/swupdate-oe4t-lasttested.yml 50 | ``` 51 | You may need to modify the machine setting or set KAS_MACHINE appropriately. 52 | 53 | 54 | ## Build with tegra-demo-distro 55 | 56 | Use these instructions to add to tegra-demo-distro on whatever 57 | branch you'd like to target (kirkstone and later are supported). 58 | 59 | ``` 60 | cd repos 61 | git submodule add https://github.com/sbabic/meta-swupdate 62 | cd ../layers 63 | ln -s ../repos/meta-swupdate 64 | ``` 65 | 66 | Then use the `setup-env` script to start a bitbake shell, and add 67 | this layer to your build 68 | ``` 69 | bitbake-layers add-layer ../layers/meta-swupdate 70 | ``` 71 | 72 | In your local.conf (or distro/machine configuration) add 73 | these lines: 74 | ``` 75 | IMAGE_INSTALL:append = " swupdate" 76 | USE_REDUNDANT_FLASH_LAYOUT = "1" 77 | IMAGE_FSTYPES:append = " tar.gz" 78 | ``` 79 | If you desire an image other than demo-image-base as your base image, 80 | you may add a definition for `SWUPDATE_CORE_IMAGE_NAME` with the 81 | desired base image. 82 | 83 | Finally, build the update image using: 84 | ``` 85 | bitbake swupdate-image-tegra 86 | ``` 87 | 88 | ## Deploy and Test 89 | * Tegraflash the inital image (demo-image-base or, whatever 90 | image you've set as `SWUPDATE_CORE_IMAGE_NAME` 91 | * Deploy the .swu file built with swupdate-image-tegra 92 | to the target 93 | * Run the update with: 94 | ``` 95 | swupdate -i 96 | ``` 97 | * Reboot to apply the update. 98 | * The root partition should change 99 | * The `nvbootctrl dump-slots-info` output should show boot 100 | from the alternate boot slot with `Capsule update status:1`. 101 | 102 | # Build Options 103 | 104 | The tegra_swupdate.bbclass contains global configuration options 105 | for the swupdate demo. 106 | 107 | ## TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT 108 | 109 | Set 110 | ``` 111 | TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT = "true" 112 | ``` 113 | in your local.conf or layer to only run the capsule update when 114 | a different bootloader version is detected in the alternate slot, 115 | where bootloader version is set based on ${L4T_VERSION} but can 116 | be modified by overriding variable `TEGRA_SWUPDATE_BOOTLOADER_VERSION` 117 | 118 | When this variable is set, the capsule payload will not be installed 119 | as a part of the update when the alternate partition is found to contain 120 | the same bootloader release version (rootfs was built with the same 121 | value of `TEGRA_SWUPDATE_BOOTLOADER_VERSION`. Instead, the rootfs 122 | will be switched to the alternate rootfs. 123 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/classes-recipe/tegra_swupdate.bbclass: -------------------------------------------------------------------------------- 1 | inherit l4t_version 2 | 3 | # Set to "true" to use logic which only installs the bootloader 4 | # when a change in L4T_VERSION is found between current and target rootfs 5 | TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT ?= "false" 6 | 7 | 8 | # The version written into the sw-versions file for the 9 | # bootloader update capsule, used to control bootloader 10 | # updates when TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT is "true" 11 | # Can be set to anything, but ideally would match the value 12 | # used for get_hex_bsp_version in tegra-uefi-capsule-signing.bbclass 13 | # to support comparisons with runtime checks of version in 14 | # /sys/firmware/efi/esrt/entries/entry0/fw_version 15 | TEGRA_SWUPDATE_BOOTLOADER_VERSION ?= "${L4T_VERSION}" 16 | 17 | 18 | TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH ?= "/boot/efi/EFI/UpdateCapsule/TEGRA_BL.Cap" 19 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/include/swupdate-base.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 14 3 | 4 | machine: jetson-orin-nano-devkit-nvme 5 | 6 | target: 7 | - swupdate-image-tegra 8 | 9 | 10 | repos: 11 | meta-swupdate: 12 | url: https://github.com/sbabic/meta-swupdate 13 | path: layers/meta-swupdate 14 | 15 | local_conf_header: 16 | swupdate-tegra: | 17 | IMAGE_INSTALL:append = " swupdate" 18 | USE_REDUNDANT_FLASH_LAYOUT = "1" 19 | IMAGE_FSTYPES:append = " tar.gz" 20 | SWUPDATE_CORE_IMAGE_NAME ?= "demo-image-base" 21 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/include/tegra-demo-distro-swupdate-lasttested.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 14 3 | 4 | repos: 5 | meta-swupdate: 6 | branch: master 7 | commit: e7fdc1e09e816d0118a145068b7fff338d8bb3db 8 | 9 | meta-tegra: 10 | branch: master 11 | commit: acb5907d2c6cf79b666fd7de631ef9518a2025fe 12 | 13 | meta-openembedded: 14 | branch: master 15 | commit: c225779474d7f39db13ad5bba6850de7e8c41b8e 16 | 17 | meta-tegra-community: 18 | branch: master 19 | commit: d95b55630470cd3c4c362e92fc42a97850dccce2 20 | 21 | meta-virtualization: 22 | branch: master 23 | commit: 1640a4dc81f5d06a1e43c9870fefb2a0d016ef81 24 | 25 | poky: 26 | branch: master 27 | commit: 7434b5428971576c6c1422d0a385084936ee9768 28 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/swupdate-oe4t-lasttested.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 14 3 | includes: 4 | - layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/swupdate-oe4t.yml 5 | - layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/include/tegra-demo-distro-swupdate-lasttested.yml 6 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/swupdate-oe4t.yml: -------------------------------------------------------------------------------- 1 | header: 2 | version: 14 3 | includes: 4 | - layers/meta-tegrademo/conf/kas/tegra-demo-distro.yml 5 | - layers/meta-tegrademo/dynamic-layers/meta-swupdate/conf/kas/include/swupdate-base.yml 6 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-demo/images/swupdate-image-tegra.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Tegra swupdate update image" 2 | DESCRIPTION = "A swupdate image for demonstrating tegra updates" 3 | 4 | LICENSE = "MIT" 5 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 6 | 7 | SRC_URI = "\ 8 | file://sw-description \ 9 | " 10 | 11 | inherit swupdate image_types_tegra tegra_swupdate 12 | 13 | DEPLOY_KERNEL_IMAGE ?= "${@os.path.basename(tegra_kernel_image(d))}" 14 | 15 | ROOTFS_DEVICE_PATH ?= "/dev/disk/by-partlabel" 16 | 17 | # By default, use demo-image-base as the base image. 18 | # Redefine in local.conf if you'd like to use a different base image. 19 | SWUPDATE_CORE_IMAGE_NAME ?= "demo-image-base" 20 | 21 | ROOTFS_FILENAME ?= "${SWUPDATE_CORE_IMAGE_NAME}-${MACHINE}.rootfs.tar.gz" 22 | 23 | KERNEL_A_PARTNAME = "A_kernel" 24 | KERNEL_A_DTB_PARTNAME = "A_kernel-dtb" 25 | KERNEL_B_PARTNAME = "B_kernel" 26 | KERNEL_B_DTB_PARTNAME = "B_kernel-dtb" 27 | 28 | # images to build before building swupdate image 29 | IMAGE_DEPENDS = "${SWUPDATE_CORE_IMAGE_NAME} tegra-uefi-capsules tegra-swupdate-script tegra-espimage" 30 | 31 | ESP_ARCHIVE ?= "${TEGRA_ESP_IMAGE}-${MACHINE}.tar.gz" 32 | 33 | # images and files that will be included in the .swu image 34 | DTBFILE_PATH = "${@'${EXTERNAL_KERNEL_DEVICETREE}/${DTBFILE}' if len(d.getVar('EXTERNAL_KERNEL_DEVICETREE')) else '${DTBFILE}'}" 35 | SWUPDATE_IMAGES = "${ROOTFS_FILENAME} tegra-bl.cap ${DEPLOY_KERNEL_IMAGE} ${DTBFILE_PATH} tegra-swupdate-script.lua ${ESP_ARCHIVE}" 36 | 37 | do_swuimage[depends] += "${DTB_EXTRA_DEPS}" 38 | 39 | # Add a link using the core image name.swu to the resulting swu image 40 | do_swuimage:append() { 41 | os.symlink(d.getVar("IMAGE_NAME") + ".swu", d.getVar("SWUPDATE_CORE_IMAGE_NAME") + "-" + d.getVar("MACHINE") + ".swu") 42 | } 43 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-demo/images/swupdate-image-tegra/sw-description: -------------------------------------------------------------------------------- 1 | software = 2 | { 3 | version = "@@DISTRO_VERSION@@"; 4 | 5 | @@MACHINE@@ = { 6 | hardware-compatibility: [ "1.0" ] 7 | system = { 8 | slot_a : { 9 | partitions: ( 10 | { 11 | type = "diskformat"; 12 | device = "@@ROOTFS_DEVICE_PATH@@/APP_b"; 13 | properties: { 14 | fstype = "ext4"; 15 | force = "true"; 16 | } 17 | } 18 | ); 19 | images: ( 20 | { 21 | filename = "@@ROOTFS_FILENAME@@"; 22 | type = "archive"; 23 | device = "@@ROOTFS_DEVICE_PATH@@/APP_b"; 24 | filesystem = "ext4"; 25 | path = "/"; 26 | installed-directly = true; 27 | preserve-attributes = true; 28 | sha256 = "$swupdate_get_sha256(@@ROOTFS_FILENAME@@)"; 29 | }, 30 | { 31 | filename = "@@DEPLOY_KERNEL_IMAGE@@"; 32 | device = "@@ROOTFS_DEVICE_PATH@@/@@KERNEL_B_PARTNAME@@"; 33 | }, 34 | { 35 | filename = "@@DTBFILE@@"; 36 | device = "@@ROOTFS_DEVICE_PATH@@/@@KERNEL_B_DTB_PARTNAME@@"; 37 | } 38 | 39 | ); 40 | files: ( 41 | { 42 | filename = "tegra-bl.cap"; 43 | path = "@@TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH@@"; 44 | properties = {create-destination = "true";} 45 | name = "tegra-bootloader-capsule" 46 | version = "@@TEGRA_SWUPDATE_BOOTLOADER_VERSION@@" 47 | install-if-different = @@TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT@@ 48 | }, 49 | { 50 | filename = "@@ESP_ARCHIVE@@" 51 | type = "archive" 52 | installed-directly = "true" 53 | path = "/boot/efi" 54 | name = "tegra-bootloader-capsule" 55 | version = "@@TEGRA_SWUPDATE_BOOTLOADER_VERSION@@" 56 | install-if-different = @@TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT@@ 57 | } 58 | ); 59 | scripts: ( 60 | { 61 | filename = "tegra-swupdate-script.lua"; 62 | type = "lua" 63 | sha256 = "$swupdate_get_sha256(tegra-swupdate-script.lua)"; 64 | } 65 | ); 66 | 67 | }; 68 | slot_b : { 69 | partitions: ( 70 | { 71 | type = "diskformat"; 72 | device = "@@ROOTFS_DEVICE_PATH@@/APP"; 73 | properties: { 74 | fstype = "ext4"; 75 | force = "true"; 76 | } 77 | } 78 | ); 79 | images: ( 80 | { 81 | filename = "@@ROOTFS_FILENAME@@"; 82 | type = "archive"; 83 | device = "@@ROOTFS_DEVICE_PATH@@/APP"; 84 | filesystem = "ext4"; 85 | path = "/"; 86 | installed-directly = true; 87 | preserve-attributes = true; 88 | sha256 = "$swupdate_get_sha256(@@ROOTFS_FILENAME@@)"; 89 | }, 90 | { 91 | filename = "@@DEPLOY_KERNEL_IMAGE@@"; 92 | device = "@@ROOTFS_DEVICE_PATH@@/@@KERNEL_A_PARTNAME@@"; 93 | }, 94 | { 95 | filename = "@@DTBFILE@@"; 96 | device = "@@ROOTFS_DEVICE_PATH@@/@@KERNEL_A_DTB_PARTNAME@@"; 97 | } 98 | ); 99 | files: ( 100 | { 101 | filename = "tegra-bl.cap"; 102 | path = "@@TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH@@"; 103 | properties = {create-destination = "true";} 104 | name = "tegra-bootloader-capsule" 105 | version = "@@TEGRA_SWUPDATE_BOOTLOADER_VERSION@@" 106 | install-if-different = @@TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT@@ 107 | }, 108 | { 109 | filename = "@@ESP_ARCHIVE@@" 110 | type = "archive" 111 | installed-directly = "true" 112 | path = "/boot/efi" 113 | name = "tegra-bootloader-capsule" 114 | version = "@@TEGRA_SWUPDATE_BOOTLOADER_VERSION@@" 115 | install-if-different = @@TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT@@ 116 | } 117 | ); 118 | scripts: ( 119 | { 120 | filename = "tegra-swupdate-script.lua"; 121 | type = "lua" 122 | sha256 = "$swupdate_get_sha256(tegra-swupdate-script.lua)"; 123 | } 124 | ); 125 | }; 126 | }; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate-machine-config/swupdate-genconfig.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | datadir=@DATADIR@ 3 | get_current_slot() { 4 | curslot=$(nvbootctrl get-current-slot) 5 | if [ $curslot -eq 1 ]; then 6 | echo "b" 7 | else 8 | echo "a" 9 | fi 10 | } 11 | 12 | . /etc/os-release 13 | 14 | if [ -e /run/mfgdata/serial-number ]; then 15 | SERIALNUMBER=$(cat /run/mfgdata/serial-number) 16 | elif [ -e /sys/module/fuse_burn/parameters/tegra_chip_uid ]; then 17 | SERIALNUMBER=$(cat /sys/module/fuse_burn/parameters/tegra_chip_uid) 18 | else 19 | SERIALNUMBER="unknown" 20 | fi 21 | 22 | BOOTSLOT=$(get_current_slot) 23 | ALTROOTSLOT="APP" 24 | if [ "$BOOTSLOT" = "a" ]; then 25 | ALTROOTSLOT="${ALTROOTSLOT}_b" 26 | fi 27 | 28 | 29 | rm -f /run/swupdate/swupdate.cfg 30 | 31 | extrased= 32 | if [ ! -e /usr/share/swupdate/swupdate.pem ]; then 33 | extrased="-e /public-key-file/d" 34 | fi 35 | sed -e"s,@SWVERSION@,$VERSION_ID," \ 36 | -e"s,@SERIALNUMBER@,$SERIALNUMBER," \ 37 | -e"s,@BOOTSLOT@,$BOOTSLOT," \ 38 | $extrased \ 39 | /${datadir}/swupdate/swupdate.cfg.in > /run/swupdate/swupdate.cfg 40 | 41 | rm -f /run/swupdate/sw-versions 42 | alt_rootfs_dev="/dev/disk/by-partlabel/$ALTROOTSLOT" 43 | tmp_mount=`mktemp -d` 44 | mount -o ro $alt_rootfs_dev $tmp_mount 45 | if [ -e $tmp_mount/usr/share/swupdate/sw-versions-thisslot ]; then 46 | echo "Setup sw-versions based on $ALTROOTSLOT" 47 | cp $tmp_mount/${datadir}/swupdate/sw-versions-thisslot /run/swupdate/sw-versions 48 | else 49 | echo "Alternate slot $ALTROOTSLOT does not contain sw-versions, using empty file" 50 | touch /run/swupdate/sw-versions 51 | fi 52 | umount $tmp_mount 53 | rm -rf $tmp_mount 54 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate-machine-config/swupdate-mods.conf: -------------------------------------------------------------------------------- 1 | [Service] 2 | ExecStartPre=/usr/libexec/swupdate/swupdate-genconfig 3 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate-machine-config/swupdate.cfg.in: -------------------------------------------------------------------------------- 1 | globals: 2 | { 3 | verbose = false; 4 | loglevel = 3; 5 | select = "system,slot_@BOOTSLOT@"; 6 | }; 7 | 8 | identify : ( 9 | { name = "swversion"; value = "@SWVERSION@" }, 10 | { name = "serialnumber"; value = "@SERIALNUMBER@" }, 11 | { name = "model"; value = "@MODEL@" } 12 | ); 13 | 14 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate-machine-config_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Machine-specific configuration for swupdate" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 4 | 5 | inherit tegra_swupdate 6 | 7 | SRC_URI = "\ 8 | file://swupdate.cfg.in \ 9 | file://swupdate-genconfig.sh.in \ 10 | file://swupdate-mods.conf \ 11 | " 12 | 13 | SRC_URI:append:secureboot = " \ 14 | file://swupdate.pem \ 15 | " 16 | 17 | SWUPDATE_BOARDNAME ??= "${MACHINE}" 18 | SWUPDATE_HWREVISION ??= "1.0" 19 | 20 | S = "${WORKDIR}/sources" 21 | UNPACKDIR = "${S}" 22 | B = "${WORKDIR}/build" 23 | 24 | do_compile() { 25 | rm -f ${B}/hwrevision 26 | echo "${SWUPDATE_BOARDNAME} ${SWUPDATE_HWREVISION}" > ${B}/hwrevision 27 | sed -e's,@MODEL@,${SWUPDATE_BOARDNAME},g' \ 28 | ${S}/swupdate.cfg.in > ${B}/swupdate.cfg.in 29 | sed -e's,@DATADIR@,${datadir},g' \ 30 | ${S}/swupdate-genconfig.sh.in > ${B}/swupdate-genconfig.sh 31 | echo "tegra-bootloader-capsule ${TEGRA_SWUPDATE_BOOTLOADER_VERSION}" > ${B}/sw-versions-thisslot 32 | } 33 | 34 | do_install() { 35 | install -d ${D}${sysconfdir} 36 | install -m 0644 ${B}/hwrevision ${D}${sysconfdir}/ 37 | ln -s /run/swupdate/swupdate.cfg ${D}${sysconfdir}/swupdate.cfg 38 | install -d ${D}${datadir}/swupdate 39 | install -m 0644 ${B}/swupdate.cfg.in ${D}${datadir}/swupdate/ 40 | install -d ${D}${libexecdir}/swupdate 41 | install -m 0755 ${B}/swupdate-genconfig.sh ${D}${libexecdir}/swupdate/swupdate-genconfig 42 | install -d ${D}${sysconfdir}/systemd/system/swupdate.service.d 43 | install -m 0644 ${S}/swupdate-mods.conf ${D}${sysconfdir}/systemd/system/swupdate.service.d/ 44 | install -m 0644 ${B}/sw-versions-thisslot ${D}${datadir}/swupdate/ 45 | ln -s /run/swupdate/sw-versions ${D}${sysconfdir}/sw-versions 46 | } 47 | 48 | do_install:append:secureboot() { 49 | install -m 0644 ${S}/swupdate.pem ${D}${datadir}/swupdate/ 50 | } 51 | 52 | FILES:${PN} += "${datadir}/swupdate" 53 | FILES:${PN} += "${sysconfdir}/sw-versions" 54 | PACKAGE_ARCH = "${MACHINE_ARCH}" 55 | EXTRADEPS = "tegra-redundant-boot" 56 | RDEPENDS:${PN} += "${EXTRADEPS}" 57 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate/archive.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_ARCHIVE=y 2 | CONFIG_LOCALE=y 3 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate/disable-uboot.cfg: -------------------------------------------------------------------------------- 1 | # CONFIG_UBOOT is not set 2 | # CONFIG_UBOOT_FWENV is not set 3 | # CONFIG_UBOOT_DEFAULTENV is not set 4 | CONFIG_BOOTLOADER_NONE=y 5 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate/hash.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_HASH_VERIFY=y 2 | CONFIG_DISABLE_CPIO_CRC=y 3 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate/part-format.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_DISKPART_HANDLER=y 2 | CONFIG_DISKFORMAT_HANDLER=y 3 | # CONFIG_FAT_FILESYSTEM is not set 4 | CONFIG_EXT_FILESYSTEM=y 5 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate/systemd.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_SYSTEMD=y 2 | CONFIG_SOCKET_CTRL_PATH="/run/swupdate/control.sock" 3 | CONFIG_SOCKET_PROGRESS_PATH="/run/swupdate/progress.sock" 4 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/swupdate_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" 2 | 3 | SRC_URI += "\ 4 | file://systemd.cfg \ 5 | file://hash.cfg \ 6 | file://part-format.cfg \ 7 | file://archive.cfg \ 8 | file://disable-uboot.cfg \ 9 | " 10 | 11 | DEPENDS += "e2fsprogs" 12 | 13 | do_install:append() { 14 | rm -rf ${D}${sysconfdir}/swupdate.cfg 15 | } 16 | 17 | RDEPENDS:${PN} += "swupdate-machine-config" 18 | FILES_${PN}:remove = "${sysconfdir}/swupdate.cfg" 19 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/tegra-swupdate-script/tegra-swupdate-script.lua.in: -------------------------------------------------------------------------------- 1 | local function get_current_slot() 2 | local handle = io.popen("nvbootctrl get-current-slot") 3 | if not handle then 4 | print("Failed to get-current-slot") 5 | return nil 6 | end 7 | local result = handle:read("*a") 8 | handle:close() 9 | return result:match("%d") -- Extracts the first digit found 10 | end 11 | 12 | local function set_active_slot(slot) 13 | local command = "nvbootctrl set-active-boot-slot " .. slot 14 | return os.execute(command) 15 | end 16 | 17 | local function switch_slots() 18 | local current_slot = get_current_slot() 19 | local success = -1 20 | if current_slot then 21 | local new_slot = current_slot == "1" and "0" or "1" 22 | print("Switching active slot to: " .. new_slot) 23 | success = set_active_slot(new_slot) 24 | else 25 | print("Failed to determine the current slot.") 26 | end 27 | return success 28 | end 29 | 30 | local function file_exists(path) 31 | local file = io.open(path, "r") 32 | if file then 33 | file:close() 34 | return true 35 | else 36 | return false 37 | end 38 | end 39 | 40 | function postinst() 41 | local success = -1 42 | local result = "" 43 | if file_exists("@TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH@") then 44 | print("Running bootloader update script") 45 | success = os.execute("/usr/bin/oe4t-set-uefi-OSIndications") 46 | result = "oe4t-set-uefi-OSIndications completed with status: " .. tostring(success) 47 | else 48 | if @TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT@ then 49 | print("Running os switch instead of bootloader update since @TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH@ is missing") 50 | success = switch_slots() 51 | result = "switch_slots completed with status: " .. tostring(success) 52 | else 53 | result = "Missing @TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH@, cannot complete update" 54 | end 55 | end 56 | return success, result 57 | end 58 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/recipes-support/swupdate/tegra-swupdate-script_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Script run as a part of swupdate install for tegra" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 4 | 5 | SRC_URI = "\ 6 | file://tegra-swupdate-script.lua.in \ 7 | " 8 | 9 | S = "${WORKDIR}/sources" 10 | UNPACKDIR = "${S}" 11 | B = "${WORKDIR}/build" 12 | 13 | inherit tegra_swupdate deploy 14 | 15 | do_compile() { 16 | sed -e's,@TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT@,${TEGRA_SWUPDATE_BOOTLOADER_INSTALL_ONLY_IF_DIFFERENT},g' \ 17 | -e's,@TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH@,${TEGRA_SWUPDATE_CAPSULE_INSTALL_PATH},g'\ 18 | ${S}/tegra-swupdate-script.lua.in > ${B}/tegra-swupdate-script.lua 19 | } 20 | 21 | do_deploy() { 22 | cp ${B}/tegra-swupdate-script.lua ${DEPLOYDIR}/ 23 | } 24 | 25 | addtask deploy after do_install 26 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/scripts/build-jetson-orin-nano-devkit-nvme.sh: -------------------------------------------------------------------------------- 1 | kasbuildbase.sh -------------------------------------------------------------------------------- /layers/meta-tegrademo/dynamic-layers/meta-swupdate/scripts/kasbuildbase.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | base=$(basename $0 .sh) 3 | machine=$(echo $base | cut -s -d '-' -f 2-) 4 | if [ ! -z "${machine}" ]; then 5 | echo "building for machine ${machine}" 6 | export KAS_MACHINE=${machine} 7 | fi 8 | base_layer_path=$(realpath $(dirname $0))/../ 9 | echo "move to the base repo directory" 10 | pushd $(dirname $0)/../../../../../ 11 | echo "Ensure we've initialized submodules before running kas on cloned repo with submodules" 12 | git submodule update --init --no-fetch --recommend-shallow 13 | kas build --update ${base_layer_path}/conf/kas/swupdate-oe4t.yml 14 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-bsp/tegra-fitimage/tegra-fitimage_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Install tegra fitImage in the location expected by u-boot" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 4 | 5 | COMPATIBLE_MACHINE = "(cot)" 6 | 7 | do_install() { 8 | fitImgPath=$(readlink -f ${DEPLOY_DIR_IMAGE}/fitImage) 9 | fitImgName=$(basename "$fitImgPath") 10 | install -d ${D}/boot 11 | install -m 0644 $fitImgPath ${D}/boot/ 12 | ln -sf $fitImgName ${D}/boot/fitImage 13 | } 14 | 15 | do_install[depends] += "linux-tegra:do_deploy" 16 | FILES:${PN} = "/boot/fitImage*" 17 | PACKAGE_ARCH = "${MACHINE_ARCH}" 18 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-bsp/tegrademo-devicetree/tegrademo-devicetree/tegra194-p2888-0001-p2822-0000-oe4t.dts: -------------------------------------------------------------------------------- 1 | #include "tegra194-p2888-0001-p2822-0000.dts" 2 | 3 | /* adds compatible string for oe4t, for demonstration purposes */ 4 | / { 5 | nvidia,dtsfilename = __FILE__; 6 | nvidia,dtbbuildtime = __DATE__, __TIME__; 7 | 8 | compatible = "oe4t,p2822-0000+p2888-0001+tegrademo", "nvidia,galen", "nvidia,jetson-xavier", "nvidia,p2822-0000+p2888-0001", "nvidia,tegra194"; 9 | }; 10 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-bsp/tegrademo-devicetree/tegrademo-devicetree/tegra194-p3668-all-p3509-0000-oe4t.dts: -------------------------------------------------------------------------------- 1 | #include "tegra194-p3668-all-p3509-0000.dts" 2 | 3 | /* adds compatible string for oe4t, for demonstration purposes */ 4 | / { 5 | nvidia,dtsfilename = __FILE__; 6 | nvidia,dtbbuildtime = __DATE__, __TIME__; 7 | 8 | compatible = "oe4t,p3449-0000+p3668-0000+tegrademo", "nvidia,p3449-0000+p3668-0000", "nvidia,p3449-0000+p3668-0001", "nvidia,p3509-0000+p3668-0000", "nvidia,p3509-0000+p3668-0001", "nvidia,tegra194"; 9 | }; 10 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-bsp/tegrademo-devicetree/tegrademo-devicetree_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Meta-tegrademo example device trees for out-of-tree builds." 2 | HOMEPAGE = "https://github.com/OE4T" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | inherit devicetree 7 | 8 | COMPATIBLE_MACHINE = "(tegra)" 9 | 10 | S = "${WORKDIR}/sources" 11 | UNPACKDIR = "${S}" 12 | 13 | SRC_URI = "\ 14 | file://tegra194-p2888-0001-p2822-0000-oe4t.dts \ 15 | file://tegra194-p3668-all-p3509-0000-oe4t.dts \ 16 | " 17 | 18 | KERNEL_INCLUDE = " \ 19 | ${STAGING_KERNEL_DIR}/nvidia/soc/tegra/kernel-include \ 20 | ${STAGING_KERNEL_DIR}/nvidia/platform/tegra/common/kernel-dts \ 21 | ${STAGING_KERNEL_DIR}/nvidia/soc/t19x/kernel-include \ 22 | ${STAGING_KERNEL_DIR}/nvidia/soc/t19x/kernel-dts \ 23 | ${STAGING_KERNEL_DIR}/nvidia/platform/t19x/common/kernel-dts \ 24 | ${STAGING_KERNEL_DIR}/nvidia/soc/t23x/kernel-include \ 25 | ${STAGING_KERNEL_DIR}/nvidia/soc/t23x/kernel-dts \ 26 | ${STAGING_KERNEL_DIR}/nvidia/platform/t23x/common/kernel-dts \ 27 | ${STAGING_KERNEL_DIR}/nvidia/platform/t19x/galen/kernel-dts \ 28 | ${STAGING_KERNEL_DIR}/nvidia/platform/t19x/jakku/kernel-dts \ 29 | ${STAGING_KERNEL_DIR}/nvidia/platform/t19x/mccoy/kernel-dts \ 30 | ${STAGING_KERNEL_DIR}/nvidia/platform/t23x/concord/kernel-dts \ 31 | ${STAGING_KERNEL_DIR}/scripts/dtc/include-prefixes \ 32 | " 33 | 34 | # Straight from arch/arm64/boot/dts in kernel source tree 35 | DTC_PPFLAGS:append = " -DLINUX_VERSION=504 -DTEGRA_HOST1X_DT_VERSION=1" 36 | 37 | # re-implement function from devicetree.bbclass to preserve order of KERNEL_INCLUDE 38 | def expand_includes(varname, d): 39 | import glob 40 | includes = list() 41 | # expand all includes with glob 42 | for i in (d.getVar(varname) or "").split(): 43 | for g in glob.glob(i): 44 | if os.path.isdir(g): # only add directories to include path 45 | includes.append(g) 46 | return includes 47 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-containers/docker/docker-conf/docker-overlay.fstab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OE4T/tegra-demo-distro/cd9d84609a367a6fc3539f18c2470194fbc57e83/layers/meta-tegrademo/recipes-containers/docker/docker-conf/docker-overlay.fstab -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-containers/docker/docker-conf/docker-storage-redirect.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OE4T/tegra-demo-distro/cd9d84609a367a6fc3539f18c2470194fbc57e83/layers/meta-tegrademo/recipes-containers/docker/docker-conf/docker-storage-redirect.conf -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-containers/docker/docker-conf_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Service configuration drop-in for docker" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 4 | 5 | SRC_URI = "\ 6 | file://docker-storage-redirect.conf \ 7 | file://docker-overlay.fstab \ 8 | " 9 | 10 | S = "${WORKDIR}/sources" 11 | UNPACKDIR = "${S}" 12 | 13 | do_install() { 14 | if [ -s ${S}/docker-storage-redirect.conf ]; then 15 | install -d ${D}${systemd_system_unitdir}/docker.service.d 16 | install -m 0644 ${S}/docker-storage-redirect.conf ${D}${systemd_system_unitdir}/docker.service.d/ 17 | fi 18 | if [ -s ${S}/docker-overlay.fstab ]; then 19 | install -d ${D}${sysconfdir} 20 | install -m 0644 ${S}/docker-overlay.fstab ${D}${sysconfdir}/ 21 | fi 22 | } 23 | 24 | pkg_postinst:${PN}() { 25 | if [ -e $D${sysconfdir}/docker-overlay.fstab ]; then 26 | cat $D${sysconfdir}/docker-overlay.fstab >> $D${sysconfdir}/fstab 27 | rm -f $D${sysconfdir}/docker-overlay.fstab 28 | fi 29 | } 30 | ALLOW_EMPTY:${PN} = "1" 31 | FILES:${PN} = "${systemd_system_unitdir} ${sysconfdir}" 32 | RDEPENDS:${PN} = "base-files" 33 | PACKAGE_ARCH = "${MACHINE_ARCH}" 34 | 35 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-containers/docker/docker-moby_%.bbappend: -------------------------------------------------------------------------------- 1 | RDEPENDS:${PN} += "docker-conf" 2 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/data-overlay-setup/data-overlay-setup/data-overlay-setup.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Create directories for overlay mounts 3 | DefaultDependencies=no 4 | RequiresMountsFor=/data 5 | 6 | [Service] 7 | Type=oneshot 8 | RemainAfterExit=yes 9 | ExecStart=@SBINDIR@/data-overlay-setup 10 | 11 | [Install] 12 | WantedBy=local-fs.target 13 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/data-overlay-setup/data-overlay-setup/data-overlay-setup.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Script to verify that the upperdir and workdir 4 | # directories for overlayfs mounts exist. 5 | # 6 | 7 | # This function is fed mount options from the fstab, 8 | # looks for the upperdir= and workdir= options, and 9 | # creates those directories if they aren't already present. 10 | process_mntopts() { 11 | read opt1 opt2 opt3 opt4 opt5 opt6 opt7 opt8 12 | for opt in $opt1 $opt2 $opt3 $opt4 $opt5 $opt6 $opt7 $opt8; do 13 | for tag in upperdir workdir; do 14 | val="${opt##$tag=}" 15 | if [ "$opt" != "$val" -a ! -d "$val" ]; then 16 | mkdir -p "$val" 17 | fi 18 | done 19 | done 20 | } 21 | 22 | # Read the fstab looking for overlay mounts. 23 | while read fs_spec fs_file fs_vfstype fs_mntopts fs_freq fs_passno; do 24 | [ "$fs_spec" = "overlay" -a "$fs_vfstype" = "overlay" ] || continue 25 | echo "$fs_mntopts" | (IFS=, process_mntopts) 26 | done < @SYSCONFDIR@/fstab 27 | 28 | exit 0 29 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/data-overlay-setup/data-overlay-setup_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Script to set up directories for overlayfs mounts on /data" 2 | HOMEPAGE = "https://github.com/OE4T" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 5 | DEPENDS = "" 6 | 7 | SRC_URI = "\ 8 | file://data-overlay-setup.sh.in \ 9 | file://data-overlay-setup.service.in \ 10 | " 11 | 12 | S = "${WORKDIR}/sources" 13 | UNPACKDIR = "${S}" 14 | B = "${WORKDIR}/build" 15 | 16 | inherit systemd 17 | 18 | do_compile() { 19 | for inf in ${S}/*.in; do 20 | [ -e $inf ] || continue 21 | outf=$(basename $inf .in) 22 | sed -e 's,@BINDIR@,${bindir},g' \ 23 | -e 's,@SBINDIR@,${sbindir},g' \ 24 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ 25 | -e 's,@BASE_BINDIR@,${base_bindir},g' \ 26 | -e 's,@BASE_SBINDIR@,${base_sbindir},g' \ 27 | -e 's,@NONARCH_BASE_LIBDIR@,${nonarch_base_libdir},g' \ 28 | $inf > ${B}/$outf 29 | done 30 | } 31 | 32 | do_install() { 33 | install -d ${D}${sbindir} ${D}${systemd_system_unitdir} 34 | install -m 0755 ${B}/data-overlay-setup.sh ${D}${sbindir}/data-overlay-setup 35 | install -m 0644 ${B}/data-overlay-setup.service ${D}${systemd_system_unitdir}/ 36 | } 37 | 38 | SYSTEMD_SERVICE:${PN} = "data-overlay-setup.service" 39 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/images/demo-image-base.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Tegra demo base image" 2 | 3 | require demo-image-common.inc 4 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/images/demo-image-common.inc: -------------------------------------------------------------------------------- 1 | IMAGE_FEATURES += "ssh-server-openssh" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit core-image 6 | 7 | CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-base packagegroup-demo-basetests" 8 | CORE_IMAGE_BASE_INSTALL += "${@'packagegroup-demo-systemd' if d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd' else ''}" 9 | TOOLCHAIN_HOST_TASK += "nativesdk-packagegroup-cuda-sdk-host" 10 | 11 | inherit nopackages 12 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/images/demo-image-egl.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Tegra demo image with no display/window manager." 2 | 3 | require demo-image-common.inc 4 | 5 | IMAGE_FEATURES += "hwcodecs" 6 | 7 | inherit features_check 8 | 9 | REQUIRED_DISTRO_FEATURES = "opengl" 10 | 11 | CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-egltests" 12 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/images/demo-image-full.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Full Tegra demo image with X11/Sato, nvidia-docker, OpenCV, \ 2 | VPI samples, TensorRT samples, and Tegra multimedia API sample apps." 3 | 4 | require demo-image-common.inc 5 | 6 | IMAGE_FEATURES += "splash x11-base x11-sato hwcodecs" 7 | 8 | inherit features_check 9 | 10 | REQUIRED_DISTRO_FEATURES = "x11 opengl virtualization" 11 | 12 | CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-x11tests" 13 | CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'packagegroup-demo-vulkantests', '', d)}" 14 | CORE_IMAGE_BASE_INSTALL += "nvidia-docker cuda-libraries tegra-mmapi-tests vpi3-tests tensorrt-tests" 15 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/images/demo-image-sato.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Tegra demo image with Sato, a mobile environment and visual style for \ 2 | mobile devices. The image supports X11 with a Sato theme, Pimlico \ 3 | applications, and contains terminal, editor, and file manager." 4 | 5 | require demo-image-common.inc 6 | 7 | IMAGE_FEATURES += "splash x11-base x11-sato hwcodecs" 8 | 9 | CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-x11tests" 10 | CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'packagegroup-demo-vulkantests', '', d)}" 11 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/images/demo-image-weston.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Tegra demo image with Weston compositor" 2 | 3 | require demo-image-common.inc 4 | 5 | IMAGE_FEATURES += "hwcodecs weston" 6 | 7 | inherit features_check 8 | 9 | REQUIRED_DISTRO_FEATURES = "wayland opengl" 10 | 11 | CORE_IMAGE_BASE_INSTALL += "gtk+3-demo packagegroup-demo-westontests" 12 | CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'weston-xwayland matchbox-terminal packagegroup-demo-x11tests', '', d)}" 13 | CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'packagegroup-demo-vulkantests', '', d)}" 14 | SYSTEMD_DEFAULT_TARGET = "graphical.target" 15 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-base.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Packagegroup for inclusion in all Tegra demo images" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit packagegroup 6 | 7 | RDEPENDS:${PN} = " \ 8 | procps \ 9 | sshfs-fuse \ 10 | strace \ 11 | tegra-tools-tegrastats \ 12 | " 13 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-basetests.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Packagegroup for common Tegra demo test applications" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit packagegroup 6 | 7 | RDEPENDS:${PN} = " \ 8 | cuda-samples \ 9 | optee-nvsamples \ 10 | optee-test \ 11 | " 12 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-egltests.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Packagegroup for Tegra demo apps with no window manager" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit packagegroup 6 | 7 | RDEPENDS:${PN} = " \ 8 | eglstreams-kms-example \ 9 | gstreamer-tests \ 10 | l4t-graphics-demos-egldevice \ 11 | " 12 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-systemd.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Packagegroup for demo images using systemd. These pacakges \ 2 | are not strictly required for systemd support, but provide tools that make \ 3 | using systemd easier." 4 | 5 | LICENSE = "MIT" 6 | 7 | inherit packagegroup 8 | 9 | RDEPENDS:${PN} = " \ 10 | less \ 11 | systemd-analyze \ 12 | " 13 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-vulkantests.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Packagegroup for common Tegra demo Vulkan test apps" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit packagegroup 6 | 7 | RDEPENDS:${PN} = " \ 8 | vulkan-tools \ 9 | tegra-libraries-vulkan \ 10 | " 11 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-westontests.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Packagegroup for Tegra demo weston test applications" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit packagegroup 6 | 7 | RDEPENDS:${PN} = " \ 8 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'gstreamer-tests', '', d)} \ 9 | l4t-graphics-demos-wayland \ 10 | weston-examples \ 11 | " 12 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-x11tests.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Tegra demo apps and tests for X11" 2 | 3 | LICENSE = "MIT" 4 | 5 | inherit packagegroup 6 | 7 | RDEPENDS:${PN} = " \ 8 | argus-samples \ 9 | cuda-samples \ 10 | gstreamer-tests \ 11 | l4t-graphics-demos-x11 \ 12 | mesa-demos \ 13 | nvgstapps \ 14 | " 15 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/scripts/layer-setup-env: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if ! $(return >/dev/null 2>&1); then 3 | echo "This script must be sourced" >&2 4 | exit 1 5 | fi 6 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/scripts/oe4t-tegraflash-deploy: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | set -e 3 | 4 | PROGNAME=$(basename $0) 5 | 6 | usage() 7 | { 8 | cat >&2 < --image 12 | Options: 13 | -h, --h Print this usage message 14 | -m, --machine Set the MACHINE used for this script 15 | -i, --image Set the IMAGE used for this script 16 | Examples: 17 | - To deploy a demo-image-base image for jetson-xavier-nx-devkit machine: 18 | $ $0 --machine jetson-xavier-nx-devkit --image demo-image-base 19 | EOF 20 | } 21 | 22 | # get command line options 23 | SHORTOPTS="hm:i:" 24 | LONGOPTS="help,machine:,image:" 25 | 26 | ARGS=$(getopt --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@" ) 27 | if [ $? != 0 ]; then 28 | usage 29 | exit 1 30 | fi 31 | 32 | eval set -- "$ARGS" 33 | while true; 34 | do 35 | case $1 in 36 | -h | --help) usage; exit 0 ;; 37 | -m | --machine) MACHINE="$2"; shift 2;; 38 | -i | --image) IMAGE="$2"; shift 2;; 39 | -- ) shift; break ;; 40 | * ) break ;; 41 | esac 42 | done 43 | 44 | if [ -z "$MACHINE" ]; then 45 | echo "You must specify a machine" 46 | usage 47 | exit 1 48 | fi 49 | 50 | if [ -z "$IMAGE" ]; then 51 | echo "You must specify an image" 52 | usage 53 | exit 1 54 | fi 55 | 56 | echo "Using machine ${MACHINE} image ${IMAGE}" 57 | deployfile=${IMAGE}-${MACHINE}.tegraflash.tar.gz 58 | scriptdir=$(realpath $(dirname $0)) 59 | tmpdir=`mktemp` 60 | rm -rf $tmpdir 61 | mkdir -p $tmpdir 62 | echo "Using temp directory $tmpdir" 63 | currentdir=$(realpath .) 64 | cd $tmpdir 65 | cp $scriptdir/../../../build/tmp/deploy/images/${MACHINE}/$deployfile . 66 | tar -xvf $deployfile 67 | set +e 68 | ./doflash.sh 69 | rc=$? 70 | if [ $rc -ne 0 ]; then 71 | if [ ! -e /etc/udev/rules.d/??-oe4t.rules ]; then 72 | echo "No rules file exists and flash failed." 73 | echo "You may need to run setup-udev-rules" 74 | echo "Or run this script as root" 75 | fi 76 | fi 77 | cd $currentdir 78 | echo "Removing temp directory $tmpdir" 79 | rm -rf $tmpdir 80 | exit $rc 81 | -------------------------------------------------------------------------------- /layers/meta-tegrademo/scripts/setup-udev-rules: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ "$(id -u)" -ne 0 ]; then 3 | echo "You may need to run this script as sudo if you see permission errors" 4 | fi 5 | if [ ! -z "${SUDO_USER}" ]; then 6 | user=${SUDO_USER} 7 | else 8 | user=`whoami` 9 | fi 10 | set -e 11 | cat << EOF > /etc/udev/rules.d/99-oe4t.rules 12 | # Jetson TK1 13 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7140", GROUP="plugdev" 14 | # Jetson TX1 15 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7721", GROUP="plugdev" 16 | # Jetson TX2 17 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7c18", GROUP="plugdev" 18 | # Jetson TX2i 19 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7018", GROUP="plugdev" 20 | # Jetson TX2-4GB 21 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7418", GROUP="plugdev" 22 | # Jetson AGX Xavier 23 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7019", GROUP="plugdev" 24 | # Jetson Xavier NX 25 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7e19", GROUP="plugdev" 26 | # Jetson Nano 27 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7f21", GROUP="plugdev" 28 | # Jetson Orin AGX (P3701-0000 Developer Kit module), (P3701-0005 with 64GB), (P3701-0008 with 64GB) 29 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7023", GROUP="plugdev" 30 | # Jetson Orin AGX (P3701-0004 with 32GB) 31 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7223", GROUP="plugdev" 32 | # Jetson Orin NX (P3767-0000 with 16GB) 33 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7323", GROUP="plugdev" 34 | # Jetson Orin NX (P3767-0001 with 8GB) 35 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7423", GROUP="plugdev" 36 | # Jetson Orin Nano (P3767-0003 and P3767-0005 with 8GB) 37 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7523", GROUP="plugdev" 38 | # Jetson Orin Nano (P3767-0004 with 4GB) 39 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7623", GROUP="plugdev" 40 | EOF 41 | udevadm control --reload 42 | echo "udev settings applied, please disconnect/reconnect your device" 43 | set +e 44 | groups ${user} | grep "plugdev" > /dev/null 2>&1 45 | rc=$? 46 | if [ $rc -ne 0 ]; then 47 | echo "Please add ${user} to plugdev using:" 48 | echo "sudo usermod -a -G plugdev ${user}" 49 | echo "Then apply to your user by logging back into the session or running" 50 | echo "newgrp plugdev" 51 | fi 52 | -------------------------------------------------------------------------------- /layers/meta-virtualization: -------------------------------------------------------------------------------- 1 | ../repos/meta-virtualization -------------------------------------------------------------------------------- /layers/oe-init-build-env: -------------------------------------------------------------------------------- 1 | ../repos/poky/oe-init-build-env -------------------------------------------------------------------------------- /layers/scripts: -------------------------------------------------------------------------------- 1 | ../repos/poky/scripts -------------------------------------------------------------------------------- /scripts-setup/create-distro-layer: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | set -e 4 | 5 | PROGNAME=$(basename $0) 6 | 7 | usage() 8 | { 9 | cat >&2 < [] 11 | Options: 12 | -h, --help Print this usage message 13 | -d, --distro Set the DISTRO name for newly created distro layer 14 | 15 | Arguments: 16 | Examples: 17 | - To create a new distro layer: 18 | $ $PROGNAME --distro testdistro 19 | EOF 20 | } 21 | 22 | DISTRO_NAME="" 23 | 24 | # get command line options 25 | SHORTOPTS="hd:" 26 | LONGOPTS="help,distro:" 27 | 28 | ARGS=$(getopt --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@" ) 29 | if [ $? != 0 ]; then 30 | usage 31 | exit 1 32 | fi 33 | 34 | eval set -- "$ARGS" 35 | while true; 36 | do 37 | case $1 in 38 | -h | --help) usage; exit 0 ;; 39 | -d | --distro) DISTRO_NAME="$2"; shift 2;; 40 | -- ) shift; break ;; 41 | * ) break ;; 42 | esac 43 | done 44 | 45 | if [ -z "$DISTRO_NAME" ]; then 46 | usage 47 | echo "ERROR: You must specify DISTRO." >&2 48 | exit 1 49 | fi 50 | 51 | TOP_DIR=$(dirname $(dirname $0)) 52 | TOP_DIR=$(readlink -f "$TOP_DIR") 53 | LAYER_DIR="${TOP_DIR}/layers/meta-${DISTRO_NAME}" 54 | 55 | if [ -d layers/meta-tegrademo ]; then 56 | 57 | echo -n "Creating a distro layer based on meta-tegrademo..." 58 | 59 | cp -a layers/meta-tegrademo ${LAYER_DIR} 60 | 61 | # Delete tegrademo recipes 62 | rm -rf ${LAYER_DIR}/recipes-* 63 | 64 | # Adjust the data in templates 65 | mv ${LAYER_DIR}/conf/templates/tegrademo ${LAYER_DIR}/conf/templates/${DISTRO_NAME} 66 | rm -rf ${LAYER_DIR}/conf/templates/tegrademo 67 | 68 | # Adjust the data in conf/distro 69 | cat ${LAYER_DIR}/conf/distro/tegrademo.conf > ${LAYER_DIR}/conf/distro/${DISTRO_NAME}.conf 70 | rm -rf ${LAYER_DIR}/conf/distro/tegrademo.conf 71 | 72 | # Adjust the data in conf/distro/include 73 | cat ${LAYER_DIR}/conf/distro/include/tegrademo.inc > ${LAYER_DIR}/conf/distro/include/${DISTRO_NAME}.inc 74 | rm -rf ${LAYER_DIR}/conf/distro/include/tegrademo.inc 75 | 76 | # Change Layer attributes from tegrademo 77 | find ${LAYER_DIR} -type f -exec sed -i "s/tegrademo/${DISTRO_NAME}/" {} \; 78 | 79 | echo "Done!" 80 | else 81 | echo "Warning: layers/meta-tegrademo not present" >&2 82 | echo "This script uses meta-tegrademo as template" 83 | exit 1 84 | fi 85 | -------------------------------------------------------------------------------- /scripts-setup/diff-bblayers-conf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | baseconf="$OEROOT/$TEMPLATECONF/bblayers.conf.sample" 3 | [ -e "$baseconf" -a -e "$BUILDDIR/conf/bblayers.conf" ] || exit 0 4 | [ -n "$COLOR" ] || COLOR=never 5 | confsdiff=$(sed -E -e "s!##(OEROOT|COREBASE)##!$OEROOT!g" "$baseconf" | \ 6 | diff -u --color=$COLOR - "$BUILDDIR/conf/bblayers.conf") 7 | if [ $? -ne 0 ]; then 8 | echo 9 | [ "$COLOR" = "always" ] && echo -ne "\033[33;1m" 10 | echo -e "Layers differ from ${baseconf}:" 11 | [ "$COLOR" = "always" ] && echo -ne "\033[0m" 12 | echo -e "$confsdiff" 13 | fi 14 | exit 0 15 | -------------------------------------------------------------------------------- /scripts-setup/git-scripts/prepare-commit-msg: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | NAME=$(git config user.name) 3 | EMAIL=$(git config user.email) 4 | if [ -z "$NAME" ]; then 5 | echo "empty git config user.name" 6 | exit 1 7 | fi 8 | if [ -z "$EMAIL" ]; then 9 | echo "empty git config user.email" 10 | exit 1 11 | fi 12 | git interpret-trailers --if-exists doNothing --trailer \ 13 | "Signed-off-by: $NAME <$EMAIL>" \ 14 | --in-place "$1" 15 | 16 | -------------------------------------------------------------------------------- /scripts-setup/setup-env-internal: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SETUP_SCRIPT="$1" 4 | shift 5 | PROGNAME=$(basename "$SETUP_SCRIPT") 6 | SETUP_SCRIPTDIR=$(dirname "$SETUP_SCRIPT") 7 | TD_TOP="${TD_TOP:-$(readlink -f $SETUP_SCRIPTDIR)}" 8 | 9 | DISTRO_DEFAULT="tegrademo" 10 | BUILDDIR_DEFAULT="build" 11 | 12 | distro_list() { 13 | local paths 14 | paths=$(find -L $TD_TOP/layers/ -path '*meta-*/conf/distro/*' -name '*.conf') 15 | find $paths -maxdepth 1 -name '*.conf' | xargs basename -s .conf | sort -u | awk '{print "\t" $0}' 16 | } 17 | 18 | distro_path() { 19 | local dconf=$(find -L "$TD_TOP"/layers -path "*/conf/distro/*" -name "${1}.conf" | head -n 1) 20 | [ -n "$dconf" ] || exit 1 21 | echo "$dconf" | sed -E -e's,.*/layers/([^/]+)/conf/.*,\1,' 22 | } 23 | 24 | 25 | machine_list() { 26 | find -L "$TD_TOP"/layers/meta*/conf/machine -maxdepth 1 -name '*.conf' | xargs basename -s .conf | sort -u | awk '{print "\t" $0}' 27 | } 28 | 29 | 30 | usage() 31 | { 32 | cat >&2 < [] [] 34 | Usage: . $PROGNAME [] 35 | 36 | Options: 37 | -h, --help Print this usage message 38 | -m, --machine Set the MACHINE name in the build configuratino 39 | -d, --distro Set the DISTRO name in the build configuration (default '${DISTRO_DEFAULT}') 40 | -c, --color Colorize the output; can be 'never', 'always', 41 | or 'auto' (default 'auto') 42 | 43 | Arguments: 44 | BUILDDIR Location of BUILDDIR (default '${BUILDDIR_DEFAULT}') 45 | 46 | The first usage is for creating a new build directory. In this case, the 47 | script creates the build directory , configures it for the 48 | specified and , and prepares the calling shell for 49 | running bitbake on the build directory. 50 | 51 | The second usage is for using an existing build directory. In this case, 52 | the script prepares the calling shell for running bitbake on the build 53 | directory . The build directory configuration is unchanged. 54 | 55 | Available distros: 56 | $(distro_list) 57 | Available machines: 58 | $(machine_list) 59 | 60 | Examples: 61 | - To create a new Yocto build directory: 62 | $ . $PROGNAME --machine jetson-xavier-nx-devkit --distro testdistro build-testdistro 63 | 64 | - To use an existing Yocto build directory: 65 | $ . $PROGNAME build-testdistro 66 | 67 | EOF 68 | } 69 | 70 | COLOR=auto 71 | DISTRO="${DISTRO:-$DISTRO_DEFAULT}" 72 | 73 | # get command line options 74 | SHORTOPTS="hm:d:b:c:" 75 | LONGOPTS="help,machine:,distro:,color:" 76 | 77 | ARGS=$(getopt --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@" ) 78 | # Print the usage menu if invalid options are specified 79 | if [ $? != 0 ]; then 80 | usage 81 | echo "TD_RC=1" 82 | exit 1 83 | fi 84 | 85 | eval set -- "$ARGS" 86 | while true; 87 | do 88 | case $1 in 89 | -h | --help) usage; echo "TD_RC=1"; exit 0 ;; 90 | -m | --machine) MACHINE="$2"; shift 2;; 91 | -d | --distro) DISTRO="$2"; shift 2;; 92 | -c | --color) COLOR="$2"; shift 2;; 93 | -- ) shift; break ;; 94 | * ) break ;; 95 | esac 96 | done 97 | 98 | BUILDDIR="${1:-$BUILDDIR_DEFAULT}" 99 | if [ ! -e $BUILDDIR/conf/local.conf ]; then 100 | if [ -z "$MACHINE" ]; then 101 | usage 102 | echo "ERROR: You must set MACHINE when creating a new build directory." >&2 103 | echo "TD_RC=1" 104 | exit 1 105 | fi 106 | if ! machine_list | grep -qx "[[:space:]]*$MACHINE"; then 107 | echo "ERROR: machine \"$MACHINE\" not found" >&2 108 | echo "Available MACHINEs:" >&2 109 | machine_list >&2 110 | echo "TD_RC=1" 111 | exit 1 112 | fi 113 | if [ -z "$DISTRO" ]; then 114 | DISTRO=$DISTRO_DEFAULT 115 | fi 116 | if ! distro_list | grep -Eqx "[[:space:]]*$DISTRO"; then 117 | echo "ERROR: distro \"$DISTRO\" not found" >&2 118 | echo "Available DISTROs:" >&2 119 | distro_list >&2 120 | echo "TD_RC=1" 121 | exit 1 122 | fi 123 | LAYERPATH=$(distro_path $DISTRO) 124 | NEEDSETUP=yes 125 | fi 126 | 127 | if [ $COLOR = "auto" ]; then 128 | if [ -t 1 ]; then 129 | COLOR=always 130 | else 131 | COLOR=never 132 | fi 133 | else 134 | COLOR=never 135 | fi 136 | 137 | cat < /dev/null 2>&1 5 | git submodule status | grep '^-' | awk '{print $2}' | xargs git submodule update --init -- 6 | exit 0 7 | 8 | 9 | -------------------------------------------------------------------------------- /setup-env: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Tegra demo distro setup script 3 | # 4 | # Copyright (c) 2020, Matthew Madison 5 | # Poritions Copyright (C) 2006-2001 Linux Foundation 6 | # 7 | # SPDX-License-Identifier: GPL-2.0-or-later 8 | 9 | # 10 | # See scripts-setup/setup-env-internal for usage information. 11 | # For shells that do not pass arguments to sourced scripts (e.g., dash), 12 | # you can set MACHINE and DISTRO in your environment to appropriate 13 | # values before sourcing this script. 14 | # 15 | # 16 | # Initial boilerplate from the oe-init-build-env 17 | if [ -n "$BASH_SOURCE" ]; then 18 | THIS_SCRIPT=$BASH_SOURCE 19 | elif [ -n "$ZSH_NAME" ]; then 20 | THIS_SCRIPT=$0 21 | else 22 | THIS_SCRIPT="$(pwd)/setup-env" 23 | if [ ! -e "$THIS_SCRIPT" ]; then 24 | echo "Error: $THIS_SCRIPT doesn't exist!" >&2 25 | echo "Please run this script in setup-env's directory." >&2 26 | return 1 27 | fi 28 | fi 29 | 30 | if [ -n "$BBSERVER" ]; then 31 | unset BBSERVER 32 | fi 33 | 34 | if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then 35 | echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'" >&2 36 | exit 1 37 | fi 38 | 39 | # Running bitbake builds as root can cause issues, so flag this 40 | 41 | if [ $(id -u) -eq 0 ]; then 42 | echo "ERROR: do not use the BSP as root. Exiting..." 43 | unset THIS_SCRIPT 44 | return 1 45 | fi 46 | 47 | TD_TOP=$(dirname "$THIS_SCRIPT") 48 | TD_TOP=$(readlink -f "$TD_TOP") 49 | TD_SCRIPTDIR="$TD_TOP/scripts-setup" 50 | 51 | # Automatically update the git submodules. It's common to forget 52 | # to do this after updating the main repository to latest. 53 | 54 | "$TD_SCRIPTDIR/update-git-submodules" "$TD_TOP" 55 | 56 | # We use TD_VARS to track the variables that need to 57 | # be unset before exiting this script. 58 | TD_RC=0 59 | TD_VARS="TD_RC TD_SCRIPTDIR TD_TOP THIS_SCRIPT TD_VARS" 60 | 61 | # Call on setup-env-internal to parse any arguments. It 62 | # will emit variable assignments on stdout. 63 | eval $(TD_TOP="$TD_TOP" "$TD_SCRIPTDIR/setup-env-internal" "$THIS_SCRIPT" "$@") 64 | if [ $TD_RC -ne 0 ]; then 65 | for var in $(echo $TD_VARS); do unset $var; done; unset var 66 | return 1 67 | fi 68 | 69 | OEROOT=$(readlink -f "$TD_TOP/layers") 70 | export OEROOT 71 | 72 | # There can be multiple distro layers in the repository, which 73 | # may require different setups. The .templateconf file in the 74 | # distro layer can be used to handle where to look for config 75 | # templates. 76 | if [ -n "$TD_NEEDSETUP" ]; then 77 | DISTRO="$TD_DISTRO" 78 | # If the layer directory has a .templateconf file, use that to set TEMPLATECONF 79 | if [ -e "$OEROOT/$TD_LAYERPATH/.templateconf" ]; then 80 | . "$OEROOT/$TD_LAYERPATH/.templateconf" 81 | fi 82 | fi 83 | 84 | # Now things are set up to let the OE setup scripts to their jobs 85 | . $OEROOT/scripts/oe-buildenv-internal && 86 | TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir || { 87 | for var in $(echo $TD_VARS OEROOT DISTRO TEMPLATECONF); do unset $var; done; unset var 88 | return 1 89 | } 90 | 91 | # Make sure to configure in the user's distro and machine settings 92 | # into local.conf if this is the first time setting up. 93 | if [ -n "$TD_NEEDSETUP" ]; then 94 | unset DISTRO TEMPLATECONF 95 | echo "$TD_LAYERPATH" > "$BUILDDIR/conf/distrolayer.cfg" 96 | # Replace placeholder comments with default settings 97 | sed -e"/@TD_SETUP_MACHINE@/c \MACHINE ?= \"$TD_MACHINE\"" \ 98 | -e"/@TD_SETUP_DISTRO@/c \DISTRO ?= \"$TD_DISTRO\"" -i "$BUILDDIR/conf/local.conf" 99 | cat <