Initial population

Content imported from the old test distro, with the
following modifications:

* Removed most custom configuration files
* All open-source layers fully included under layers/
* Secureboot support removed
* Layout reworked to eliminate extra subdirectory for
  core layer
* Added meta-tegra-support layer for holding common
  metadata for use by all distro layers
* Reworked setup-env script to be usable for multiple
  distros sharing the repository
* Added demo image recipes and packagegroups

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2020-09-06 07:01:57 -07:00
parent 2bea7f3596
commit b27bbfb61a
66 changed files with 1660 additions and 1 deletions

24
.gitmodules vendored Normal file
View File

@@ -0,0 +1,24 @@
[submodule "poky"]
path = repos/poky
url = git://git.yoctoproject.org/poky
branch = master
[submodule "repos/meta-openembedded"]
path = repos/meta-openembedded
url = git://git.openembedded.org/meta-openembedded
branch = master
[submodule "repos/meta-virtualization"]
path = repos/meta-virtualization
url = git://git.yoctoproject.org/meta-virtualization
branch = master
[submodule "repos/meta-mender"]
path = repos/meta-mender
url = https://github.com/mendersoftware/meta-mender.git
branch = dunfell
[submodule "repos/meta-mender-community"]
path = repos/meta-mender-community
url = https://github.com/mendersoftware/meta-mender-community.git
branch = dunfell
[submodule "repos/meta-tegra"]
path = repos/meta-tegra
url = https://github.com/OE4T/meta-tegra.git
branch = master

View File

@@ -1,5 +1,59 @@
# tegra-demo-distro
Reference/demo distribution for NVIDIA Jetson platforms
using Yocto Project tools and the meta-tegra BSP layer.
## Prerequisites
See the [Yocto Project Quick Build](https://www.yoctoproject.org/docs/3.1.2/brief-yoctoprojectqs/brief-yoctoprojectqs.html)
documentation for information on setting up your build host.
In addition to the packages mentioned in that documentation, you
will need gcc and g++ 8 (on Ubuntu, packages `gcc-8` and `g++-8`).
For burning SDcards (for the Jetson Nano or Jetson Xavier NX developer
kits), the `bmap-tools` package is recommended.
For building CUDA applications, you must download the CUDA host-side
tools using the NVIDIA SDK Manager (NVIDIA Developer Network login
required). You should set the environment variable NVIDIA_DEVNET_MIRROR
to the path of the directory where the `.deb` file for the tools
package is located.
## Setting up
1. Clone this repository:
$ git clone https://github.com/OE4T/tegra-demo-distro.git
2. Initialize the git submodules:
$ cd tegra-demo-distro
$ git submodule update --init
3. Source the `setup-env` script to create a build directory,
specifying the MACHINE you want to configure as the default
for your builds. For example, to set up a build directory
called `build` that is set up for the Jetson Xavier NX
developer kit and the default `tegrademo` distro:
$ . ./setup-env --machine jetson-xavier-nx-devkit
You can get a complete list of available options, MACHINE
names, and DISTRO names with
$ . ./setup-env --help
## Images
The `tegrademo` distro includes the following image recipes, which
are dervied from the `core-image-XXX` recipes in OE-Core but configured
for Jetson platforms. They include some additional test tools and
demo applications.
| Recipe name | Description |
| ----------------- | ------------------------------------------------------------- |
| demo-image-base | Basic image with no graphics |
| demo-image-egl | Base with DRM/EGL graphics, no window manager |
| demo-image-sato | X11 image with Sato UI |
| demo-image-weston | Wayland with Weston compositor |
| demo-image-full | Sato image plus nvidia-docker, openCV, multimedia API samples |

2
layers/.templateconf Normal file
View File

@@ -0,0 +1,2 @@
# This file is required by oe-setup-buildenv script
# but not used in this repository - see ../setup-env

1
layers/bitbake Symbolic link
View File

@@ -0,0 +1 @@
../repos/poky/bitbake

1
layers/meta Symbolic link
View File

@@ -0,0 +1 @@
../repos/poky/meta

1
layers/meta-filesystems Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-openembedded/meta-filesystems

1
layers/meta-mender-core Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-mender/meta-mender-core

1
layers/meta-mender-tegra Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-mender-community/meta-mender-tegra

1
layers/meta-networking Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-openembedded/meta-networking

1
layers/meta-oe Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-openembedded/meta-oe

1
layers/meta-python Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-openembedded/meta-python

1
layers/meta-tegra Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-tegra

View File

@@ -0,0 +1,34 @@
TD_BBLAYERS_CONF_VERSION ??= "unset-0"
python tegra_distro_update_bblayersconf() {
current_version = d.getVar('TD_BBLAYERS_CONF_VERSION').split('-')
required_version = (d.getVar('REQUIRED_TD_BBLAYERS_CONF_VERSION') or 'UNKNOWN-0').split('-')
if required_version[0] == "UNKNOWN":
# malformed configuration
raise NotImplementedError("You need to update bblayers.conf manually for this version transition")
if current_version[0] == required_version[0] and int(current_version[1]) == int(required_version[1]):
return
distro_layerdir = d.getVar('TD_DISTRO_LAYERDIR')
if not distro_layerdir:
raise NotImplementedError("TD_DISTRO_LAYERDIR must be set to locate the bblayers template config")
root = d.getVar("COREBASE")
# On any mismatch, just use the template
newconf = sanity_conf_read(os.path.join(distro_layerdir, 'conf',
'template-{}'.format(d.getVar('DISTRO')),
'bblayers.conf.sample'))
with open(bblayers_conf_file(d), "w") as f:
f.write(''.join([line.replace('##OEROOT##', root).replace('##COREBASE##', root) for line in newconf]))
bb.note("Your conf/bblayers.conf has been automatically updated.")
return
}
BBLAYERS_CONF_UPDATE_FUNCS += " \
conf/bblayers.conf:TD_BBLAYERS_CONF_VERSION:REQUIRED_TD_BBLAYERS_CONF_VERSION:tegra_distro_update_bblayersconf \
"

View File

@@ -0,0 +1,9 @@
BBPATH =. "${LAYERDIR}:"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "tegrasupport"
BBFILE_PATTERN_tegrasupport = "^${LAYERDIR}/"
BBFILE_PRIORITY_tegrasupport = "40"
LAYERVERSION_tegrasupport = "4"
LAYERSERIES_COMPAT_tegrasupport = "gatesgarth"

View File

@@ -0,0 +1,2 @@
RRECOMMENDS_${PN}-sshd_remove_tegra = "rng-tools"
RRECOMMENDS_${PN}-sshd_append_tegra = " haveged"

View File

@@ -0,0 +1 @@
PTEST_ENABLED = "0"

View File

@@ -0,0 +1,127 @@
Index: jetson_multimedia_api/samples/Rules.mk
===================================================================
--- jetson_multimedia_api.orig/samples/Rules.mk
+++ jetson_multimedia_api/samples/Rules.mk
@@ -28,10 +28,6 @@
#
###############################################################################
-# Clear the flags from env
-CPPFLAGS :=
-LDFLAGS :=
-
# Verbose flag
ifeq ($(VERBOSE), 1)
AT =
@@ -39,11 +35,6 @@ else
AT = @
endif
-# ARM ABI of the target platform
-ifeq ($(TEGRA_ARMABI),)
-TEGRA_ARMABI ?= aarch64-linux-gnu
-endif
-
# Location of the target rootfs
ifeq ($(shell uname -m), aarch64)
TARGET_ROOTFS :=
@@ -62,49 +53,16 @@ CLASS_DIR := $(TOP_DIR)/samples/common/
ALGO_CUDA_DIR := $(TOP_DIR)/samples/common/algorithm/cuda
ALGO_TRT_DIR := $(TOP_DIR)/samples/common/algorithm/trt
-ifeq ($(shell uname -m), aarch64)
-CROSS_COMPILE :=
-else
-CROSS_COMPILE ?= aarch64-unknown-linux-gnu-
-endif
-AS = $(AT) $(CROSS_COMPILE)as
-LD = $(AT) $(CROSS_COMPILE)ld
-CC = $(AT) $(CROSS_COMPILE)gcc
-CPP = $(AT) $(CROSS_COMPILE)g++
-AR = $(AT) $(CROSS_COMPILE)ar
-NM = $(AT) $(CROSS_COMPILE)nm
-STRIP = $(AT) $(CROSS_COMPILE)strip
-OBJCOPY = $(AT) $(CROSS_COMPILE)objcopy
-OBJDUMP = $(AT) $(CROSS_COMPILE)objdump
-NVCC = $(AT) $(CUDA_PATH)/bin/nvcc -ccbin $(filter-out $(AT), $(CPP))
-
-# Specify the logical root directory for headers and libraries.
-ifneq ($(TARGET_ROOTFS),)
-CPPFLAGS += --sysroot=$(TARGET_ROOTFS)
-LDFLAGS += \
- -Wl,-rpath-link=$(TARGET_ROOTFS)/lib/$(TEGRA_ARMABI) \
- -Wl,-rpath-link=$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI) \
- -Wl,-rpath-link=$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)/tegra \
- -Wl,-rpath-link=$(TARGET_ROOTFS)/$(CUDA_PATH)/lib64
-endif
-
# All common header files
CPPFLAGS += -std=c++11 \
-I"$(TOP_DIR)/include" \
-I"$(TOP_DIR)/include/libjpeg-8b" \
-I"$(ALGO_CUDA_DIR)" \
- -I"$(ALGO_TRT_DIR)" \
- -I"$(TARGET_ROOTFS)/$(CUDA_PATH)/include" \
- -I"$(TARGET_ROOTFS)/usr/include/$(TEGRA_ARMABI)" \
- -I"$(TARGET_ROOTFS)/usr/include/libdrm" \
- -I"$(TARGET_ROOTFS)/usr/include/opencv4"
+ -I"$(ALGO_TRT_DIR)"
# All common dependent libraries
LDFLAGS += \
-lpthread -lv4l2 -lEGL -lGLESv2 -lX11 \
-lnvbuf_utils -lnvjpeg -lnvosd -ldrm \
-lcuda -lcudart \
- -lnvinfer -lnvparsers \
- -L"$(TARGET_ROOTFS)/$(CUDA_PATH)/lib64" \
- -L"$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)" \
- -L"$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)/tegra"
+ -lnvinfer -lnvparsers
Index: jetson_multimedia_api/samples/v4l2cuda/Makefile
===================================================================
--- jetson_multimedia_api.orig/samples/v4l2cuda/Makefile
+++ jetson_multimedia_api/samples/v4l2cuda/Makefile
@@ -26,14 +26,8 @@ SRCS := \
capture.cpp \
yuv2rgb.cu
-ALL_CPPFLAGS := $(addprefix -Xcompiler ,$(filter-out -std=c++11, $(CPPFLAGS)))
-
-# CUDA code generation flags
-GENCODE_SM53 := -gencode arch=compute_53,code=sm_53
-GENCODE_SM62 := -gencode arch=compute_62,code=sm_62
-GENCODE_SM72 := -gencode arch=compute_72,code=sm_72
-GENCODE_SM_PTX := -gencode arch=compute_72,code=compute_72
-GENCODE_FLAGS := $(GENCODE_SM53) $(GENCODE_SM62) $(GENCODE_SM72) $(GENCODE_SM_PTX)
+ALL_CPPFLAGS := $(NVCCFLAGS)
+ALL_CPPFLAGS += $(addprefix -Xcompiler ,$(filter-out -std=c++11, $(CPPFLAGS)))
all: $(APP)
@@ -47,7 +41,7 @@ yuv2rgb.o: yuv2rgb.cu
$(APP): capture.o yuv2rgb.o
@echo "Linking: $@"
- $(CPP) -o $@ $^ $(CPPFLAGS) $(LDFLAGS)
+ $(CPP) -o $@ $^ $(CPPFLAGS) $(LDFLAGS) $(NVLDFLAGS)
clean:
$(AT) rm -f *.o $(APP)
Index: jetson_multimedia_api/samples/common/algorithm/cuda/Makefile
===================================================================
--- jetson_multimedia_api.orig/samples/common/algorithm/cuda/Makefile
+++ jetson_multimedia_api/samples/common/algorithm/cuda/Makefile
@@ -43,13 +43,6 @@ endif
ALL_CPPFLAGS := $(NVCCFLAGS)
ALL_CPPFLAGS += $(addprefix -Xcompiler ,$(filter-out -std=c++11, $(CPPFLAGS)))
-# CUDA code generation flags
-GENCODE_SM53 := -gencode arch=compute_53,code=sm_53
-GENCODE_SM62 := -gencode arch=compute_62,code=sm_62
-GENCODE_SM72 := -gencode arch=compute_72,code=sm_72
-GENCODE_SM_PTX := -gencode arch=compute_72,code=compute_72
-GENCODE_FLAGS := $(GENCODE_SM53) $(GENCODE_SM62) $(GENCODE_SM72) $(GENCODE_SM_PTX)
-
# Target rules
all: NvAnalysis.o NvCudaProc.o

View File

@@ -0,0 +1,31 @@
Index: tegra_multimedia_api/tools/ConvertCaffeToTrtModel/Makefile
===================================================================
--- tegra_multimedia_api.orig/tools/ConvertCaffeToTrtModel/Makefile
+++ tegra_multimedia_api/tools/ConvertCaffeToTrtModel/Makefile
@@ -28,16 +28,8 @@
#
###############################################################################
-CC = aarch64-linux-gnu-g++
-
-INCPATHS = -I/usr/include/aarch64-linux-gnu/
-CFLAGS = -Wall -std=c++11 $(INCPATHS)
-
-CFLAGS += -D ENABLE_TRT
-
-LIBPATHS = -L/usr/lib/aarch64-linux-gnu/
+CXXFLAGS += -Wall -std=c++11 -DENABLE_TRT
LIBS = -lnvinfer -lnvcaffe_parser
-LFLAGS = $(LIBPATHS) -Wl,--start-group $(LIBS) -Wl,--end-group
SRCFILES = ConvertCaffeToTrtModel_main.cpp
OUTNAME = ConvertCaffeToTrtModel
@@ -45,7 +37,7 @@ OUTNAME = ConvertCaffeToTrtModel
all: $(OUTNAME)
$(OUTNAME) : $(SRCFILES)
- $(CC) -o $@ $^ $(CFLAGS) $(LFLAGS)
+ $(CXX) -o $@ $^ $(CXXFLAGS) -Wl,--start-group $(LIBS) -Wl,--end-group $(LDFLAGS)
clean:
rm -rf $(OUTNAME)

View File

@@ -0,0 +1,26 @@
Index: tegra_multimedia_api/include/NvJpegDecoder.h
===================================================================
--- tegra_multimedia_api.orig/include/NvJpegDecoder.h
+++ tegra_multimedia_api/include/NvJpegDecoder.h
@@ -56,7 +56,7 @@
#endif
#include <stdio.h>
-#include "jpeglib.h"
+#include "libjpeg-8b/jpeglib.h"
#include "NvElement.h"
#include "NvBuffer.h"
Index: tegra_multimedia_api/include/NvJpegEncoder.h
===================================================================
--- tegra_multimedia_api.orig/include/NvJpegEncoder.h
+++ tegra_multimedia_api/include/NvJpegEncoder.h
@@ -57,7 +57,7 @@
#endif
#include <stdio.h>
-#include "jpeglib.h"
+#include "libjpeg-8b/jpeglib.h"
#include "NvElement.h"
#include "NvBuffer.h"

View File

@@ -0,0 +1,142 @@
Index: tegra_multimedia_api/argus/samples/utils/CMakeLists.txt
===================================================================
--- tegra_multimedia_api.orig/argus/samples/utils/CMakeLists.txt
+++ tegra_multimedia_api/argus/samples/utils/CMakeLists.txt
@@ -33,11 +33,15 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DI
find_package(Argus REQUIRED)
find_package(OpenGLES REQUIRED)
find_package(EGL REQUIRED)
-find_package(X11 REQUIRED)
+if(WITH_X11)
+ find_package(X11 REQUIRED)
+endif(WITH_X11)
find_package(CUDA)
find_package(PkgConfig REQUIRED)
-pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+if(WITH_X11)
+ pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+endif(WITH_X11)
set(SOURCES
EGLGlobal.cpp
@@ -47,10 +51,19 @@ set(SOURCES
PreviewConsumer.cpp
Thread.cpp
WindowBase.cpp
- gtk/GuiElement.cpp
- gtk/Window.cpp
)
+if(WITH_X11)
+ set(SOURCES
+ ${SOURCES}
+ gtk/GuiElement.cpp
+ gtk/Window.cpp
+ )
+else(WITH_X11)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOWINDOWS")
+ set(SOURCES ${SOURCES} WindowNoGui.cpp)
+endif(WITH_X11)
+
if(CUDA_FOUND)
set(SOURCES
${SOURCES}
Index: tegra_multimedia_api/argus/samples/utils/EGLGlobal.cpp
===================================================================
--- tegra_multimedia_api.orig/argus/samples/utils/EGLGlobal.cpp
+++ tegra_multimedia_api/argus/samples/utils/EGLGlobal.cpp
@@ -136,6 +136,7 @@ bool EGLDisplayHolder::initialize(EGLNat
bool EGLDisplayHolder::cleanup()
{
+#ifndef NOWINDOWS
if (m_display != EGL_NO_DISPLAY)
{
// inform the window that the display is gone
@@ -146,7 +147,7 @@ bool EGLDisplayHolder::cleanup()
REPORT_ERROR("eglTerminate failed (error 0x%04x)", eglGetError());
m_display = EGL_NO_DISPLAY;
}
-
+#endif
return true;
}
Index: tegra_multimedia_api/argus/samples/utils/Window.h
===================================================================
--- tegra_multimedia_api.orig/argus/samples/utils/Window.h
+++ tegra_multimedia_api/argus/samples/utils/Window.h
@@ -30,6 +30,35 @@
#include "android/Window.h"
#elif defined(SAMPLE_USE_GLX)
#include "glx/Window.h"
+#elif defined(NOWINDOWS)
+#include "WindowBase.h"
+#ifndef WINDOW_H_NOWINDOWS__
+#define WINDOW_H_NOWINDOWS__
+#define WINDOW_GUI_SUPPORT WINDOW_GUI_NONE
+namespace ArgusSamples
+{
+ class Window : public WindowBase
+ {
+ public:
+ static Window &getInstance();
+ virtual bool shutdown() { return true; }
+ virtual bool pollEvents() {return true; }
+ virtual bool eventLoop() {return true; }
+ virtual bool requestExit() {return true; }
+ virtual EGLNativeDisplayType getEGLNativeDisplay() const {return NULL;}
+ virtual EGLNativeWindowType getEGLNativeWindow() const {return 0;}
+ virtual uint32_t getWidth() const {return 0;}
+ virtual uint32_t getHeight() const {return 0;}
+ virtual bool setWindowRect(uint32_t x, uint32_t y, uint32_t w, uint32_t h) {return true;}
+ virtual bool setWindowGui(IGuiContainer *iGuiContainer = NULL,
+ IGuiElement *iGuiElementWindow = NULL, IGuiElement *iGuiElementView = NULL) {return true;}
+ private:
+ Window() {}
+ virtual ~Window() {}
+ virtual bool initialize() {return true;}
+ };
+};
+#endif /* WINDOW_H_NOWINDOWS__ */
#else
#include "gtk/Window.h"
#endif
Index: tegra_multimedia_api/argus/CMakeLists.txt
===================================================================
--- tegra_multimedia_api.orig/argus/CMakeLists.txt
+++ tegra_multimedia_api/argus/CMakeLists.txt
@@ -26,7 +26,9 @@
cmake_minimum_required (VERSION 2.6)
-add_subdirectory(apps/camera)
+if(WITH_X11)
+ add_subdirectory(apps/camera)
+endif(WITH_X11)
add_subdirectory(samples/bayerAverageMap)
add_subdirectory(samples/cudaHistogram)
add_subdirectory(samples/denoise)
Index: tegra_multimedia_api/argus/samples/utils/WindowNoGui.cpp
===================================================================
--- /dev/null
+++ tegra_multimedia_api/argus/samples/utils/WindowNoGui.cpp
@@ -0,0 +1,17 @@
+#include "Window.h"
+
+namespace ArgusSamples
+{
+
+/*static*/ Window &Window::getInstance()
+{
+ static Window instance;
+ return instance;
+}
+
+bool Window::IGuiElement::createLabel(const char *labelText, IGuiElement **element)
+{
+ return true;
+}
+
+}; // namespace ArgusSamples

View File

@@ -0,0 +1,24 @@
Index: tegra_multimedia_api/argus/apps/camera/ui/camera/CMakeLists.txt
===================================================================
--- tegra_multimedia_api.orig/argus/apps/camera/ui/camera/CMakeLists.txt
+++ tegra_multimedia_api/argus/apps/camera/ui/camera/CMakeLists.txt
@@ -32,8 +32,9 @@ set(GEN_OUTPUT ${CMAKE_CURRENT_BINARY_DI
add_custom_command(
OUTPUT ${GEN_OUTPUT}
- COMMAND xxd -i < ${GEN_INPUT} > ${GEN_OUTPUT}
+ COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/xxd.sh ${GEN_INPUT} ${GEN_OUTPUT}
DEPENDS ${GEN_INPUT}
+ VERBATIM
)
#end generate source
Index: tegra_multimedia_api/argus/apps/camera/ui/camera/xxd.sh
===================================================================
--- /dev/null
+++ tegra_multimedia_api/argus/apps/camera/ui/camera/xxd.sh
@@ -0,0 +1,4 @@
+set -x
+od -tx1 -v "$1" | sed -r -e's,^[0-9a-f]+, ,' -e's! ([0-9a-f][0-9a-f])! 0x\1,!g' > "$2"
+truncate --size="-4" "$2"
+set +x

View File

@@ -0,0 +1,12 @@
Index: tegra_multimedia_api/tools/ConvertCaffeToTrtModel/ConvertCaffeToTrtModel_main.cpp
===================================================================
--- tegra_multimedia_api.orig/tools/ConvertCaffeToTrtModel/ConvertCaffeToTrtModel_main.cpp
+++ tegra_multimedia_api/tools/ConvertCaffeToTrtModel/ConvertCaffeToTrtModel_main.cpp
@@ -31,6 +31,7 @@
#include <iostream>
#include <cmath>
#include <algorithm>
+#include <vector>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>

View File

@@ -0,0 +1,78 @@
DESCRIPTION = "NVIDIA Tegra Multimedia API headers and examples"
HOMEPAGE = "http://developer.nvidia.com"
LICENSE = "Proprietary & BSD"
require recipes-multimedia/argus/tegra-mmapi-${PV}.inc
SRC_URI += " \
file://remove-xxd-reference.patch \
file://jpeg-fixups.patch \
file://cross-build-fixups.patch \
file://vector-fixup.patch \
"
DEPENDS = "libdrm tegra-mmapi virtual/egl virtual/libgles1 virtual/libgles2 jpeg expat gstreamer1.0 glib-2.0 v4l-utils tensorrt cudnn opencv coreutils-native"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2cc00be68c1227a7c42ff3620ef75d05 \
file://argus/LICENSE.TXT;md5=271791ce6ff6f928d44a848145021687"
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
PACKAGECONFIG[x11] = "-DWITH_X11=ON,,virtual/libx11 gtk+3"
inherit cmake pkgconfig cuda
B = "${S}"
OECMAKE_SOURCEPATH = "${S}/argus"
EXTRA_OECMAKE = "-DMULTIPROCESS=ON \
-DCMAKE_INCLUDE_PATH=${S}/include/libjpeg-8b-tegra \
-DJPEG_NAMES=libnvjpeg.so"
do_configure() {
rm -f ${S}/include/nvbuf_utils.h
#sed -i -e's,\(samples/11\),#\1,' ${S}/Makefile
find samples -name 'Makefile' -exec sed -i -e's,^LDFLAGS,NVLDFLAGS,' -e's,\$(LDFLAGS),$(LDFLAGS) $(NVLDFLAGS),' {} \;
cd ${OECMAKE_SOURCEPATH}
cmake_do_configure
}
do_compile() {
VERBOSE=1 cmake --build '${B}/argus' -- ${EXTRA_OECMAKE_BUILD}
export CPP=`echo ${CXX} | sed -e's, .*,,'`
CXX_EXTRA=`echo ${CXX} | sed -e's,^[^ ]*,,'`
export CUDA_PATH=${STAGING_DIR_NATIVE}/usr/local/cuda-${CUDA_VERSION}
PATH=$CUDA_PATH/bin:$PATH
export CPPFLAGS="${CXX_EXTRA} ${CXXFLAGS} -I${STAGING_DIR_TARGET}/usr/local/cuda-${CUDA_VERSION}/include"
CPPFLAGS="$CPPFLAGS `pkg-config --cflags libdrm`"
CPPFLAGS="$CPPFLAGS `pkg-config --cflags opencv4`"
export LDFLAGS="-L${STAGING_DIR_TARGET}/usr/local/cuda-${CUDA_VERSION}/lib ${LDFLAGS}"
CCBIN=`which $CPP`
oe_runmake -j1 all TEGRA_ARMABI=${TARGET_ARCH} TARGET_ROOTFS=${STAGING_DIR_TARGET} NVCC=nvcc NVCCFLAGS="--shared -ccbin=${CCBIN}" GENCODE_FLAGS="${CUDA_NVCC_ARCH_FLAGS}"
}
do_install() {
DESTDIR="${D}" cmake --build '${B}/argus' --target ${OECMAKE_TARGET_INSTALL}
install -d ${D}/opt/tegra-mmapi
cp -R --preserve=mode,timestamps ${S}/data ${D}/opt/tegra-mmapi/
install -d ${D}/opt/tegra-mmapi/bin
install -m 0755 ${S}/samples/00_video_decode/video_decode ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/01_video_encode/video_encode ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/02_video_dec_cuda/video_dec_cuda ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/03_video_cuda_enc/video_cuda_enc ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/04_video_dec_trt/video_dec_trt ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/05_jpeg_encode/jpeg_encode ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/06_jpeg_decode/jpeg_decode ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/07_video_convert/video_convert ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/08_video_dec_drm/video_dec_drm ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/09_camera_jpeg_capture/camera_jpeg_capture ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/10_camera_recording/camera_recording ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/12_camera_v4l2_cuda/camera_v4l2_cuda ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/13_multi_camera/multi_camera ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/backend/backend ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/frontend/frontend ${D}/opt/tegra-mmapi/bin/
install -m 0755 ${S}/samples/v4l2cuda/capture-cuda ${D}/opt/tegra-mmapi/bin/
}
FILES_${PN} += "/opt/tegra-mmapi"
RDEPENDS_${PN} += "tegra-libraries-libv4l-plugins"

View File

@@ -0,0 +1 @@
PACKAGECONFIG_append = " faad"

View File

@@ -0,0 +1,5 @@
PTEST_ENABLED = "0"
do_install_append() {
sed -i -e's,^#user_allow_other,user_allow_other,' ${D}${sysconfdir}/fuse.conf
}

View File

@@ -0,0 +1,38 @@
Index: git/Makefile
===================================================================
--- git.orig/Makefile
+++ git/Makefile
@@ -33,17 +33,27 @@ OBJECTS = $(SOURCES:.c=.o)
EGLSTREAMS_KMS_EXAMPLE = eglstreams-kms-example
-CFLAGS += -Wall -Wextra -g
-CFLAGS += -I /usr/include/libdrm
+CFLAGS += -Wall -Wextra
+CFLAGS += $(shell pkg-config --cflags egl)
+CFLAGS += $(shell pkg-config --cflags gl)
+CFLAGS += $(shell pkg-config --cflags libdrm)
+
+LDFLAGS += $(shell pkg-config --libs egl)
+LDFLAGS += $(shell pkg-config --libs gl)
+LDFLAGS += $(shell pkg-config --libs libdrm)
-# Use a current snapshot of EGL header files from Khronos
-CFLAGS += -I khronos
+.PHONY: install clean all
+all: $(EGLSTREAMS_KMS_EXAMPLE)
%.o: %.c $(HEADERS)
- gcc -c $< -o $@ $(CFLAGS)
+ $(CC) -c $< -o $@ $(CFLAGS)
$(EGLSTREAMS_KMS_EXAMPLE): $(OBJECTS)
- gcc -o $@ $(OBJECTS) -lEGL -lOpenGL -ldrm -lm
+ $(CCLD) -o $@ $(OBJECTS) $(LDFLAGS) -lm
+
+install:
+ install -d $(DESTDIR)$(bindir)
+ install -m 0755 $(EGLSTREAMS_KSM_EXAMPLE) $(DESTDIR)$(bindir)/
clean:
rm -f *.o $(EGLSTREAMS_KMS_EXAMPLE) *~

View File

@@ -0,0 +1,23 @@
DESCRIPTION = "Simple example program demonstrating the use of EGLStreams with DRM KMS."
HOMEPAGE = "https://github.com/aritger"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=2c4ffb74754562207b887a66a37aad6c"
DEPENDS = "libdrm virtual/egl"
SRC_REPO ?= "github.com/madisongh/eglstreams-kms-example"
SRCBRANCH ?= "master"
SRC_URI = "git://${SRC_REPO};branch=${SRCBRANCH}"
SRCREV = "${AUTOREV}"
PV = "1.0+git${SRCPV}"
COMPATIBLE_MACHINE = "(tegra)"
PACKAGE_ARCH_tegra = "${TEGRA_PKGARCH}"
S = "${WORKDIR}/git"
inherit pkgconfig
do_install() {
oe_runmake install DESTDIR="${D}"
}

View File

@@ -0,0 +1,16 @@
#!/bin/sh
. @DATADIR@/gstreamer-tests/confvars
if [ ! -e /dev/video0 ]; then
echo "ERR: no camera found" >&2
exit 1
fi
if readlink -f /sys/class/video4linux/video0 2>/dev/null | grep -q usb; then
gst-launch-1.0 v4l2src num-buffers=300 ! 'video/x-raw,format=(string)YUY2,width=640,height=480,framerate=(fraction)30/1' ! \
nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)NV12' $TRANSFORM ! queue ! $VIDEOSINK
else
gst-launch-1.0 nvarguscamerasrc timeout=10 ! 'video/x-raw(memory:NVMM),width=640,height=480,format=(string)NV12,framerate=(fraction)30/1' ! \
nvvidconv ! queue ! $VIDEOSINK
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
if [ -n "$WAYLAND_DISPLAY" ]; then
unset DISPLAY
VIDEOSINK="nveglglessink winsys=wayland"
IMAGESINK="waylandsink"
TRANSFORM="! nvegltransform"
else
VIDEOSINK="nv3dsink"
IMAGESINK="xvimagesink"
TRANSFORM=""
fi
AUDIOSINK="autoaudiosink"

View File

@@ -0,0 +1,10 @@
#!/bin/sh
. @DATADIR@/gstreamer-tests/confvars
if gst-launch-1.0 videotestsrc num-buffers=1 ! 'video/x-raw,format=(string)I420,width=640,height=480,framerate=(fraction)30/1' ! \
nvjpegenc ! nvjpegdec ! imagefreeze ! $IMAGESINK & then
pid=$!
sleep 5
kill $pid
fi

View File

@@ -0,0 +1,5 @@
#!/bin/sh
. @DATADIR@/gstreamer-tests/confvars
gst-play-1.0 --audiosink="$AUDIOSINK" --videosink="$VIDEOSINK" @DATADIR@/gstreamer-tests/sintel_trailer-1080p.mp4

View File

@@ -0,0 +1,40 @@
DESCRIPTION = "Scripts for testing gstreamer playback and capture"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "\
https://peach.themazzone.com/durian/trailer/sintel_trailer-1080p.mp4 \
file://sinteltest.sh.in \
file://capturetest.sh.in \
file://nvjpegtest.sh.in \
file://confvars.in \
"
# The above mirror is more reachable than download.blender.org
SRC_URI[md5sum] = "bfd19c4e7ad04c72bfb327cf7e6b9576"
SRC_URI[sha256sum] = "34bbd52a4b89fdf63c8ace50b268da26653a59508288100cd3c23de276db7931"
S = "${WORKDIR}"
B = "${WORKDIR}/build"
do_compile() {
for f in sinteltest.sh capturetest.sh nvjpegtest.sh confvars; do
sed -e's,@DATADIR@,${datadir},g' \
${S}/${f}.in > ${B}/${f}
done
}
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/sinteltest.sh ${D}${bindir}/sinteltest
install -m 0755 ${B}/capturetest.sh ${D}${bindir}/capturetest
install -m 0755 ${B}/nvjpegtest.sh ${D}${bindir}/nvjpegtest
install -d ${D}${datadir}/gstreamer-tests
install -m 0644 ${B}/confvars ${D}${datadir}/gstreamer-tests/confvars
install -m 0644 ${S}/sintel_trailer-1080p.mp4 ${D}${datadir}/gstreamer-tests
}
PACKAGE_ARCH = "${MACHINE_ARCH}"
RDEPENDS_${PN} = "gst-player gstreamer1.0 gstreamer1.0-plugins-nveglgles gstreamer1.0-plugins-base-videotestsrc \
gstreamer1.0-plugins-nvvideo4linux2 gstreamer1.0-plugins-nvvideosinks gstreamer1.0-plugins-nvjpeg \
gstreamer1.0-plugins-tegra gstreamer1.0-plugins-good-imagefreeze gstreamer1.0-plugins-bad-waylandsink \
gstreamer1.0-plugins-good-video4linux2"

View File

@@ -0,0 +1 @@
TEMPLATECONF=${TEMPLATECONF:-meta-tegrademo/conf/template-$DISTRO}

View File

@@ -0,0 +1,83 @@
DISTRO = "tegrademo"
DISTRO_NAME = "OE4Tegra Demonstration Distro"
DISTRO_VERSION = "3.1+snapshot-${DATE}"
DISTRO_CODENAME = "master"
SDK_VENDOR = "-tdsdk"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"
MAINTAINER = "OE4Tegra team <oe4tegra@madison.systems>"
TARGET_VENDOR = "-oe4t"
# New ${DISTRO}-<version> setting for sanity checks.
# Increment version number (and the corresponding
# setting int the template bblayers.conf.sample file)
# each time the layer settings are changed.
REQUIRED_TD_BBLAYERS_CONF_VERSION = "${DISTRO}-2"
LOCALCONF_VERSION = "1"
DISTRO_VERSION[vardepsexclude] = "DATE"
SDK_VERSION[vardepsexclude] = "DATE"
TD_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland vulkan systemd pam virtualization"
DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${TD_DEFAULT_DISTRO_FEATURES}"
# Jetson platforms do not use linux-yocto, but for QEMU testing
# align with the poky distro.
PREFERRED_VERSION_linux-yocto ?= "5.8%"
PREFERRED_VERSION_linux-yocto-rt ?= "5.4%"
# Gstreamer libraries are passed through to containers when using
# nvidia-docker, so our version of Gstreamer must match the one in
# the stock L4T/JetPack release.
require conf/include/gstreamer-1.14.conf
SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
SDKPATH = "/opt/${DISTRO}/${SDK_VERSION}"
TCLIBCAPPEND = ""
PREMIRRORS ??= "\
bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
cvs://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
gitsm://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
hg://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
osc://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
p4://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
svn://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n"
SANITY_TESTED_DISTROS ?= " \
ubuntu-18.04 \n \
ubuntu-20.04 \n \
"
# CUDA 10.2 requires gcc 7 or 8
GCCVERSION_aarch64 = "8.%"
SDKGCCVERSION = "10.%"
# Most NVIDIA-supplied services expect systemd
INIT_MANAGER = "systemd"
INHERIT += "tegrademo-sanity"
#
# OELAYOUT_ABI allows us to notify users when the format of TMPDIR changes in
# an incompatible way. Such changes should usually be detailed in the commit
# that breaks the format and have been previously discussed on the mailing list
# with general agreement from the core team.
#
OELAYOUT_ABI = "12"
require conf/distro/include/no-static-libs.inc
require conf/distro/include/yocto-uninative.inc
require conf/distro/include/security_flags.inc
INHERIT += "uninative"
INHERIT += "reproducible_build"
BB_SIGNATURE_HANDLER ?= "OEEquivHash"
BB_HASHSERVE ??= "auto"
LICENSE_FLAGS_WHITELIST += "commercial_faad2"

View File

@@ -0,0 +1,14 @@
BBPATH =. "${LAYERDIR}:"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "tegrademo"
BBFILE_PATTERN_tegrademo = "^${LAYERDIR}/"
BBFILE_PRIORITY_tegrademo = "50"
LAYERVERSION_tegrademo = "4"
LAYERSERIES_COMPAT_tegrademo = "gatesgarth"
# This is used by the tegra-distro-sanity bbclass
# to identify the distro layer directory during
# bblayers checks.
TD_DISTRO_LAYERDIR = "${LAYERDIR}"

View File

@@ -0,0 +1,20 @@
# Version of layers configuration, specific to
# each defined distro in the repository.
# Format: ${DISTRO}-<version>
TD_BBLAYERS_CONF_VERSION = "tegrademo-2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
##OEROOT##/meta \
##OEROOT##/meta-tegra \
##OEROOT##/meta-tegra/contrib \
##OEROOT##/meta-oe \
##OEROOT##/meta-python \
##OEROOT##/meta-networking \
##OEROOT##/meta-filesystems \
##OEROOT##/meta-virtualization \
##OEROOT##/meta-tegra-support \
##OEROOT##/meta-tegrademo \
"

View File

@@ -0,0 +1,10 @@
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Targets for building Tegra demo images with test applications:
core-image-minimal - minimally bootable image (no demo apps, no graphics)
demo-image-base - basic image with no graphics
demo-image-egl - basic image with DRM/EGL, no window manager
demo-image-sato - X11 image with 'sato' UI
demo-image-weston - Wayland with Weston compositor
demo-image-full - X11/sato UI plus docker, openCV, multimedia API samples

View File

@@ -0,0 +1,270 @@
## This file is your local configuration file and is where all local user settings
# are placed. The comments in this file give some guide to the options a new user
# to the system might want to change but pretty much any configuration option can
# be set in this file.
#
# Machine Selection
#
# You need to select a specific machine to target the build with.
# The following machines are avilable in the meta-tegra layer:
#
#MACHINE ?= "jetson-nano-emmc"
#MACHINE ?= "jetson-nano-qspi-sd"
#MACHINE ?= "jetson-tx1"
#MACHINE ?= "jetson-tx2-4gb"
#MACHINE ?= "jetson-tx2"
#MACHINE ?= "jetson-tx2i"
#MACHINE ?= "jetson-xavier-8gb"
#MACHINE ?= "jetson-xavier"
#MACHINE ?= "jetson-xavier-nx-devkit"
#MACHINE ?= "jetson-xavier-nx-devkit-emmc"
#@TD_SETUP_MACHINE@ - placeholder for automatic insertion by setup-env
#
# This sets the default machine to be qemux86-64 if no other machine is selected:
MACHINE ??= "qemux86-64"
# Where to find NVIDIA binary packages
#
# The CUDA host-side tools are only available through a URL that requires
# authentication with an NVIDIA Developer Network login, and so cannot be
# fetched directly by Bitbake. The NVIDIA_DEVNET MIRROR variable should
# be set to an accessible URL where you have downloaded the tools using
# the NVIDIA SDK Manager.
#@TD_SETUP_DEVNET_MIRROR@ - placeholder for automatic insertion by setup-env
#NVIDIA_DEVNET_MIRROR ?= "${HOME}/Downloads/nvidia/sdkm_downloads"
#
# Where to place downloads
#
# During a first build the system will download many different source code tarballs
# from various upstream projects. This can take a while, particularly if your network
# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you
# can preserve this directory to speed up this part of subsequent builds. This directory
# is safe to share between multiple builds on the same machine too.
#
# The default is a downloads directory under TOPDIR which is the build directory.
#
#DL_DIR ?= "${TOPDIR}/downloads"
#
# Where to place shared-state files
#
# BitBake has the capability to accelerate builds based on previously built output.
# This is done using "shared state" files which can be thought of as cache objects
# and this option determines where those files are placed.
#
# You can wipe out TMPDIR leaving this directory intact and the build would regenerate
# from these files if no changes were made to the configuration. If changes were made
# to the configuration, only shared state files where the state was still valid would
# be used (done using checksums).
#
# The default is a sstate-cache directory under TOPDIR.
#
#SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
#
# Where to place the build output
#
# This option specifies where the bulk of the building work should be done and
# where BitBake should place its temporary files and output. Keep in mind that
# this includes the extraction and compilation of many applications and the toolchain
# which can use Gigabytes of hard disk space.
#
# The default is a tmp directory under TOPDIR.
#
#TMPDIR = "${TOPDIR}/tmp"
#
# Default policy (distro) config
#
#@TD_SETUP_DISTRO@ - placeholder for automatic insertion by setup-env
# Base distro for meta-tegra
#DISTRO ?= "tegrademo"
# Base distro with Mender OTA update support:
#DISTRO ?= "tegrademo-mender"
#
# Package Management configuration
#
# This variable lists which packaging formats to enable. Multiple package backends
# can be enabled at once and the first item listed in the variable will be used
# to generate the root filesystems.
# Options are:
# - 'package_deb' for debian style deb files
# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager)
# - 'package_rpm' for rpm style packages
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
# We default to rpm:
PACKAGE_CLASSES ?= "package_rpm"
#
# SDK target architecture
#
# This variable specifies the architecture to build SDK items for and means
# you can build the SDK packages for architectures other than the machine you are
# running the build on (i.e. building i686 packages on an x86_64 host).
# Only x86_64 is supported for the meta-tegra BSP, since some of the NVIDIA-provided
# host tools are 64-bit only.
SDKMACHINE ?= "x86_64"
#
# Extra image configuration defaults
#
# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated
# images. Some of these options are added to certain image types automatically. The
# variable can contain the following options:
# "dbg-pkgs" - add -dbg packages for all installed packages
# (adds symbol information for debugging/profiling)
# "src-pkgs" - add -src packages for all installed packages
# (adds source code for debugging)
# "dev-pkgs" - add -dev packages for all installed packages
# (useful if you want to develop against libs in the image)
# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages
# (useful if you want to run the package test suites)
# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.)
# "tools-debug" - add debugging tools (gdb, strace)
# "eclipse-debug" - add Eclipse remote debugging support
# "tools-profile" - add profiling tools (oprofile, lttng, valgrind)
# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.)
# "debug-tweaks" - make an image suitable for development
# e.g. ssh root access has a blank password
# There are other application targets that can be used here too, see
# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details.
# We default to enabling the debugging tweaks.
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
#
# Additional image features
#
# The following is a list of additional classes to use when building images which
# enable extra features. Some available options which can be included in this variable
# are:
# - 'buildstats' collect build statistics
# - 'image-mklibs' to reduce shared library files size for an image
# - 'image-prelink' in order to prelink the filesystem image
# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink
# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
#
# Runtime testing of images
#
# The build system can test booting virtual machine images under qemu (an emulator)
# after any root filesystems are created and run tests against those images. It can also
# run tests against any SDK that are built. To enable this uncomment these lines.
# See classes/test{image,sdk}.bbclass for further details.
#IMAGE_CLASSES += "testimage testsdk"
#TESTIMAGE_AUTO_qemuall = "1"
#
# Interactive shell configuration
#
# Under certain circumstances the system may need input from you and to do this it
# can launch an interactive shell. It needs to do this since the build is
# multithreaded and needs to be able to handle the case where more than one parallel
# process may require the user's attention. The default is iterate over the available
# terminal types to find one that works.
#
# Examples of the occasions this may happen are when resolving patches which cannot
# be applied, to use the devshell or the kernel menuconfig
#
# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none
# Note: currently, Konsole support only works for KDE 3.x due to the way
# newer Konsole versions behave
#OE_TERMINAL = "auto"
# By default disable interactive patch resolution (tasks will just fail instead):
PATCHRESOLVE = "noop"
#
# Disk Space Monitoring during the build
#
# Monitor the disk space during the build. If there is less that 1GB of space or less
# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully
# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort
# of the build. The reason for this is that running completely out of space can corrupt
# files and damages the build in ways which may not be easily recoverable.
# It's necesary to monitor /tmp, if there is no space left the build will fail
# with very exotic errors.
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
#
# Shared-state files from other locations
#
# As mentioned above, shared state files are prebuilt cache data objects which can
# used to accelerate build time. This variable can be used to configure the system
# to search other mirror locations for these objects before it builds the data itself.
#
# This can be a filesystem directory, or a remote url such as http or ftp. These
# would contain the sstate-cache results from previous builds (possibly from other
# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the
# cache locations to check for the shared objects.
# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH
# at the end as shown in the examples below. This will be substituted with the
# correct path within the directory structure.
#SSTATE_MIRRORS ?= "\
#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
#file://.* file:///some/local/dir/sstate/PATH"
#
# Yocto Project SState Mirror
#
# The Yocto Project has prebuilt artefacts available for its releases, you can enable
# use of these by uncommenting the following line. This will mean the build uses
# the network to check for artefacts at the start of builds, which does slow it down
# equally, it will also speed up the builds by not having to build things if they are
# present in the cache. It assumes you can download something faster than you can build it
# which will depend on your network.
#
#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH"
#
# Qemu configuration
#
# By default native qemu will build with a builtin VNC server where graphical output can be
# seen. The line below enables the SDL UI frontend too.
PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
# By default libsdl2-native will be built, if you want to use your host's libSDL instead of
# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below.
#ASSUME_PROVIDED += "libsdl2-native"
# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds
# a handy set of menus for controlling the emulator.
#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+"
#
# Hash Equivalence
#
# Enable support for automatically running a local hash equivalence server and
# instruct bitbake to use a hash equivalence aware signature generator. Hash
# equivalence improves reuse of sstate by detecting when a given sstate
# artifact can be reused as equivalent, even if the current task hash doesn't
# match the one that generated the artifact.
#
# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format
#
#BB_HASHSERVE = "auto"
#BB_SIGNATURE_HANDLER = "OEEquivHash"
#
# Memory Resident Bitbake
#
# Bitbake's server component can stay in memory after the UI for the current command
# has completed. This means subsequent commands can run faster since there is no need
# for bitbake to reload cache files and so on. Number is in seconds, after which the
# server will shut down.
#
#BB_SERVER_TIMEOUT = "60"
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
# track the version of this file when it was generated. This can safely be ignored if
# this doesn't mean anything to you.
CONF_VERSION = "1"

View File

@@ -0,0 +1,3 @@
DESCRIPTION = "Tegra demo base image"
require demo-image-common.inc

View File

@@ -0,0 +1,10 @@
IMAGE_FEATURES += "ssh-server-openssh"
LICENSE = "MIT"
inherit core-image
CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-base packagegroup-demo-basetests"
CORE_IMAGE_BASE_INSTALL += "${@'packagegroup-demo-systemd' if d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd' else ''}"
inherit nopackages

View File

@@ -0,0 +1,11 @@
DESCRIPTION = "Tegra demo image with no display/window manager."
require demo-image-common.inc
IMAGE_FEATURES += "hwcodecs"
inherit features_check
REQUIRED_DISTRO_FEATURES = "opengl"
CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-egltests"

View File

@@ -0,0 +1,14 @@
DESCRIPTION = "Full Tegra demo image with X11/Sato, nvidia-docker, OpenCV, \
and Tegra multimedia API sample apps."
require demo-image-common.inc
IMAGE_FEATURES += "splash x11-base x11-sato hwcodecs"
inherit features_check
REQUIRED_DISTRO_FEATURES = "x11 opengl virtualization"
CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-x11tests"
CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'packagegroup-demo-vulkantests', '', d)}"
CORE_IMAGE_BASE_INSTALL += "libvisionworks nvidia-docker tegra-mmapi-samples"

View File

@@ -0,0 +1,10 @@
DESCRIPTION = "Tegra demo image with Sato, a mobile environment and visual style for \
mobile devices. The image supports X11 with a Sato theme, Pimlico \
applications, and contains terminal, editor, and file manager."
require demo-image-common.inc
IMAGE_FEATURES += "splash x11-base x11-sato hwcodecs"
CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-x11tests"
CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'packagegroup-demo-vulkantests', '', d)}"

View File

@@ -0,0 +1,13 @@
SUMMARY = "Tegra demo image with Weston compositor"
require demo-image-common.inc
IMAGE_FEATURES += "hwcodecs"
inherit features_check
REQUIRED_DISTRO_FEATURES = "wayland opengl"
CORE_IMAGE_BASE_INSTALL += "packagegroup-demo-weston packagegroup-demo-westontests"
CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'packagegroup-demo-x11tests', '', d)}"
CORE_IMAGE_BASE_INSTALL += "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'packagegroup-demo-vulkantests', '', d)}"

View File

@@ -0,0 +1,13 @@
DESCRIPTION = "Packagegroup for inclusion in all Tegra demo images"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
haveged \
procps \
sshfs-fuse \
strace \
tegra-tools-tegrastats \
"

View File

@@ -0,0 +1,10 @@
DESCRIPTION = "Packagegroup for common Tegra demo test applications"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
cuda-samples \
gpu-burn \
"

View File

@@ -0,0 +1,11 @@
DESCRIPTION = "Packagegroup for Tegra demo apps with no window manager"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
eglstreams-kms-example \
l4t-graphics-demos-egldevice \
tegra-udrm-probeconf \
"

View File

@@ -0,0 +1,12 @@
DESCRIPTION = "Packagegroup for demo images using systemd. These pacakges \
are not strictly required for systemd support, but provide tools that make \
using systemd easier."
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
less \
systemd-analyze \
"

View File

@@ -0,0 +1,10 @@
DESCRIPTION = "Packagegroup for common Tegra demo Vulkan test apps"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
vulkan-demos \
vulkan-tools \
"

View File

@@ -0,0 +1,11 @@
DESCRIPTION = "Packagegroup for inclusion in all Tegra demo weston images"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
weston \
weston-init \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'weston-xwayland matchbox-terminal', '', d)} \
"

View File

@@ -0,0 +1,12 @@
DESCRIPTION = "Packagegroup for Tegra demo weston test applications"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
clutter-1.0-examples \
gstreamer-tests \
l4t-graphics-demos-wayland \
weston-examples \
"

View File

@@ -0,0 +1,14 @@
DESCRIPTION = "Tegra demo apps and tests for X11"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = " \
cuda-samples \
gstreamer-tests \
l4t-graphics-demos-x11 \
libgl-mesa \
mesa-demos \
nvgstapps \
"

View File

@@ -0,0 +1,39 @@
#!/bin/sh
# Make sure host toolchain is gcc/g++ 8 or
version_ok() {
local v=$("$1" -v 2>&1 | tail -n 1 | cut -d' ' -f3)
if [ -z "$v" ]; then
echo "Error: cannot validate $1 version" >&2
return 1
fi
case "$v" in
8.*)
return 0
;;
*)
return 1
;;
esac
}
make_local_bin_symlink() {
local cmdpath=$(which "$1" 2>/dev/null)
local target="$2"
if [ -z "$cmdpath" ]; then
echo "Error: $1 not found in PATH" >&2
echo " Please install $1 (with 'sudo apt install $1') and try again." >&2
return 1
fi
mkdir -p "$BUILDDIR/.local/bin"
ln -sf "$cmdpath" "$BUILDDIR/.local/bin/$target"
}
if ! version_ok gcc; then
make_local_bin_symlink gcc-8 gcc || return 1
fi
if ! version_ok g++; then
make_local_bin_symlink g++-8 g++ || return 1
fi

View File

@@ -0,0 +1,17 @@
#!/bin/sh
if ! $(return >/dev/null 2>&1); then
echo "This script must be sourced" >&2
exit 1
fi
if [ ! -d "$BUILDDIR/.local/bin" ]; then
# No local bin dir, see if we need it
buildenv-host-gcc-check
if [ -d "$BUILDDIR/.local/bin" ]; then
PATH="$BUILDDIR/.local/bin:$PATH"
fi
else
# We have local bin dir, re-check the symlinks there
PATH="$BUILDDIR/.local/bin:$PATH"
buildenv-host-gcc-check
fi

1
layers/meta-virtualization Symbolic link
View File

@@ -0,0 +1 @@
../repos/meta-virtualization

1
layers/scripts Symbolic link
View File

@@ -0,0 +1 @@
../repos/poky/scripts

1
repos/meta-mender Submodule

Submodule repos/meta-mender added at fbcae51284

1
repos/meta-tegra Submodule

Submodule repos/meta-tegra added at 2251b80e32

1
repos/poky Submodule

Submodule repos/poky added at c4daf38f47

View File

@@ -0,0 +1,14 @@
#!/bin/sh
baseconf="$OEROOT/$TEMPLATECONF/bblayers.conf.sample"
[ -e "$baseconf" -a -e "$BUILDDIR/conf/bblayers.conf" ] || exit 0
[ -n "$COLOR" ] || COLOR=never
confsdiff=$(sed -E -e "s!##(OEROOT|COREBASE)##!$OEROOT!g" "$baseconf" | \
diff -u --color=$COLOR - "$BUILDDIR/conf/bblayers.conf")
if [ $? -ne 0 ]; then
echo
[ "$COLOR" = "always" ] && echo -ne "\033[33;1m"
echo -e "Layers differ from ${baseconf}:"
[ "$COLOR" = "always" ] && echo -ne "\033[0m"
echo -e "$confsdiff"
fi
exit 0

154
scripts-setup/setup-env-internal Executable file
View File

@@ -0,0 +1,154 @@
#!/bin/bash
SETUP_SCRIPT="$1"
shift
PROGNAME=$(basename "$SETUP_SCRIPT")
SETUP_SCRIPTDIR=$(dirname "$SETUP_SCRIPT")
TD_TOP="${TD_TOP:-$(readlink -f $SETUP_SCRIPTDIR)}"
DISTRO_LAYERS="meta-tegrademo"
DISTRO_DEFAULT="tegrademo"
BUILDDIR_DEFAULT="build"
distro_list() {
local d paths
for d in $DISTRO_LAYERS; do
paths="$paths $TD_TOP/layers/$d/conf/distro"
done
find $paths -maxdepth 1 -name '*.conf' | xargs basename -s .conf | sort -u | awk '{print "\t" $0}'
}
distro_path() {
local dconf=$(find -L "$TD_TOP"/layers -path "*/conf/distro/*" -name "${1}.conf" | head -n 1)
[ -n "$dconf" ] || exit 1
echo "$dconf" | sed -E -e's,.*/layers/([^/]+)/conf/.*,\1,'
}
machine_list() {
find -L "$TD_TOP"/layers/meta*/conf/machine -maxdepth 1 -name '*.conf' | xargs basename -s .conf | sort -u | awk '{print "\t" $0}'
}
usage()
{
cat >&2 <<EOF
Usage: . $PROGNAME --machine <MACHINE> [<options>] [<BUILDDIR>]
Usage: . $PROGNAME [<BUILDDIR>]
Options:
-h, --help Print this usage message
-m, --machine Set the MACHINE name in the build configuratino
-d, --distro Set the DISTRO name in the build configuration (default '${DISTRO_DEFAULT}')
-c, --color Colorize the output; can be 'never', 'always',
or 'auto' (default 'auto')
Arguments:
BUILDDIR Location of BUILDDIR (default '${BUILDDIR_DEFAULT}')
The first usage is for creating a new build directory. In this case, the
script creates the build directory <BUILDDIR>, configures it for the
specified <MACHINE> and <DISTRO>, and prepares the calling shell for
running bitbake on the build directory.
The second usage is for using an existing build directory. In this case,
the script prepares the calling shell for running bitbake on the build
directory <BUILDDIR>. The build directory configuration is unchanged.
Available distros:
$(distro_list)
Available machines:
$(machine_list)
Environment variables:
NVIDIA_DEVNET_MIRROR URL or pathname of NVIDIA SDK Manager downloads.
Default: \$HOME/Downloads/nvidia/sdkm_downloads
Examples:
- To create a new Yocto build directory:
$ . $PROGNAME --machine jetson-tx2 --distro testdistro build-testdistro
- To use an existing Yocto build directory:
$ . $PROGNAME build-testdistro
EOF
}
COLOR=auto
DISTRO="${DISTRO:-$DISTRO_DEFAULT}"
# get command line options
SHORTOPTS="hm:d:b:c:"
LONGOPTS="help,machine:,distro:,color:"
ARGS=$(getopt --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@" )
# Print the usage menu if invalid options are specified
if [ $? != 0 ]; then
usage
echo "TD_RC=1"
exit 1
fi
eval set -- "$ARGS"
while true;
do
case $1 in
-h | --help) usage; echo "TD_RC=1"; exit 0 ;;
-m | --machine) MACHINE="$2"; shift 2;;
-d | --distro) DISTRO="$2"; shift 2;;
-c | --color) COLOR="$2"; shift 2;;
-- ) shift; break ;;
* ) break ;;
esac
done
BUILDDIR="${1:-$BUILDDIR_DEFAULT}"
if [ ! -e $BUILDDIR/conf/local.conf ]; then
if [ -z "$MACHINE" ]; then
usage
echo "ERROR: You must set MACHINE when creating a new build directory." >&2
echo "TD_RC=1"
exit 1
fi
if [ -z "$DISTRO" ]; then
DISTRO=$DISTRO_DEFAULT
fi
LAYERPATH=$(distro_path $DISTRO)
NEEDSETUP=yes
fi
if [ $COLOR = "auto" ]; then
if [ -t 1 ]; then
COLOR=always
else
COLOR=never
fi
else
COLOR=never
fi
[ "$NVIDIA_DEVNET_MIRROR" != "" ] || NVIDIA_DEVNET_MIRROR="$HOME/Downloads/nvidia/sdkm_downloads"
if [ ! -d "$NVIDIA_DEVNET_MIRROR" ]; then
echo "NVIDIA_DEVNET_MIRROR location not found; some recipes may not be available"
TD_DEVNET_MIRROR=
else
if echo "$NVIDIA_DEVNET_MIRROR" | grep -q "^[^:]+://"; then
TD_DEVNET_MIRROR="$NVIDIA_DEVNET_MIRROR"
else
TD_DEVNET_MIRROR="file://$NVIDIA_DEVNET_MIRROR"
fi
fi
cat <<EOF
BDIR="$BUILDDIR"
TD_COLOR="$COLOR"
TD_NEEDSETUP=$NEEDSETUP
TD_DISTRO=$DISTRO
TD_MACHINE=$MACHINE
TD_LAYERPATH=$LAYERPATH
TD_DEVNET_MIRROR="$TD_DEVNET_MIRROR"
TD_RC=0
TD_VARS="\$TD_VARS TD_COLOR TD_NEEDSETUP TD_DISTRO TD_MACHINE TD_LAYERPATH TD_DEVNET_MIRROR"
EOF
exit 0

View File

@@ -0,0 +1,8 @@
#!/bin/sh
[ -n "$1" -a -d "$1" ] || exit
cd "$1"
git submodule sync > /dev/null 2>&1
git submodule status | grep '^-' | awk '{print $2}' | xargs git submodule update --init --
exit 0

142
setup-env Normal file
View File

@@ -0,0 +1,142 @@
#!/bin/sh
# Tegra demo distro setup script
#
# Copyright (c) 2020, Matthew Madison
# Poritions Copyright (C) 2006-2001 Linux Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# See scripts-setup/setup-env-internal for usage information.
# For shells that do not pass arguments to sourced scripts (e.g., dash),
# you can set MACHINE and DISTRO in your environment to appropriate
# values before sourcing this script.
#
#
# Initial boilerplate from the oe-init-build-env
if [ -n "$BASH_SOURCE" ]; then
THIS_SCRIPT=$BASH_SOURCE
elif [ -n "$ZSH_NAME" ]; then
THIS_SCRIPT=$0
else
THIS_SCRIPT="$(pwd)/setup-env"
if [ ! -e "$THIS_SCRIPT" ]; then
echo "Error: $THIS_SCRIPT doesn't exist!" >&2
echo "Please run this script in setup-env's directory." >&2
return 1
fi
fi
if [ -n "$BBSERVER" ]; then
unset BBSERVER
fi
if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'" >&2
exit 1
fi
# Running bitbake builds as root can cause issues, so flag this
if [ $(id -u) -eq 0 ]; then
echo "ERROR: do not use the BSP as root. Exiting..."
unset THIS_SCRIPT
return 1
fi
TD_TOP=$(dirname "$THIS_SCRIPT")
TD_TOP=$(readlink -f "$TD_TOP")
TD_SCRIPTDIR="$TD_TOP/scripts-setup"
# Automatically update the git submodules. It's common to forget
# to do this after updating the main repository to latest.
"$TD_SCRIPTDIR/update-git-submodules" "$TD_TOP"
# We use TD_VARS to track the variables that need to
# be unset before exiting this script.
TD_RC=0
TD_VARS="TD_RC TD_SCRIPTDIR TD_TOP THIS_SCRIPT TD_VARS"
# Call on setup-env-internal to parse any arguments. It
# will emit variable assignments on stdout.
eval $(TD_TOP="$TD_TOP" "$TD_SCRIPTDIR/setup-env-internal" "$THIS_SCRIPT" "$@")
if [ $TD_RC -ne 0 ]; then
unset $TD_VARS
return 1
fi
OEROOT=$(readlink -f "$TD_TOP/layers")
export OEROOT
# There can be multiple distro layers in the repository, which
# may require different setups. The .templateconf file in the
# distro layer can be used to handle where to look for config
# templates.
if [ -n "$TD_NEEDSETUP" ]; then
DISTRO="$TD_DISTRO"
# If the layer directory has a .templateconf file, use that to set TEMPLATECONF
if [ -e "$OEROOT/$TD_LAYERPATH/.templateconf" ]; then
. "$OEROOT/$TD_LAYERPATH/.templateconf"
fi
fi
# Now things are set up to let the OE setup scripts to their jobs
. $OEROOT/scripts/oe-buildenv-internal &&
TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir || {
unset OEROOT DISTRO TEMPLATECONF $TD_VARS
return 1
}
# Make sure to configure in the user's distro and machine settings
# into local.conf if this is the first time setting up.
if [ -n "$TD_NEEDSETUP" ]; then
unset DISTRO TEMPLATECONF
echo "$TD_LAYERPATH" > "$BUILDDIR/conf/distrolayer.cfg"
# Replace placeholder comments with default settings
sed -e"/@TD_SETUP_MACHINE@/c \MACHINE ?= \"$TD_MACHINE\"" \
-e"/@TD_SETUP_DISTRO@/c \DISTRO ?= \"$TD_DISTRO\"" -i "$BUILDDIR/conf/local.conf"
if [ -n "$TD_DEVNET_MIRROR" ]; then
sed -e"/@TD_SETUP_DEVNET_MIRROR@/c \NVIDIA_DEVNET_MIRROR ?= \"$TD_DEVNET_MIRROR\"" \
-i "$BUILDDIR/conf/local.conf"
devnet_info__="NVIDIA_DEVNET_MIRROR=$TD_DEVNET_MIRROR"
else
sed -e"/@TD_SETUP_DEVNET_MIRROR@/d" -i "$BUILDDIR/conf/local.conf"
devnet_info__="(no setting for NVIDIA_DEVNET_MIRROR)"
fi
cat <<EOF
Your build environment has been configured with:
MACHINE=$TD_MACHINE
DISTRO=$TD_DISTRO
$devnet_info__
EOF
for s__ in .oe/$TD_DISTRO .yocto/$TD_DISTRO .oe .yocto ; do
if [ -e "$HOME/$s__/site.conf" ]; then
echo "Linking $s__/site.conf to conf/site.conf"
ln -sf "$HOME/$s__/site.conf" "$BUILDDIR/conf/"
fi
done
unset devnet_info__ s__
else
TD_LAYERPATH=$(cat "$BUILDDIR/conf/distrolayer.cfg")
TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg") COLOR=$TD_COLOR "$TD_TOP/scripts-setup/diff-bblayers-conf"
fi
# Add the distro layer's scripts directory to PATH and
# source its environment setup script, if present
if [ -d "$OEROOT/$TD_LAYERPATH/scripts" ]; then
PATH="$OEROOT/$TD_LAYERPATH/scripts:$PATH"
if [ -e "$OEROOT/$TD_LAYERPATH/scripts/layer-setup-env" ]; then
. "$OEROOT/$TD_LAYERPATH/scripts/layer-setup-env"
fi
fi
# Generally don't want world-writable output by default
# for builds, so fix the umask if it's set that way.
if [ "`umask | tail -c 2`" = "7" ]; then
umask 0022
fi
unset OEROOT $TD_VARS
[ -z "$BUILDDIR" ] || cd "$BUILDDIR"