diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..86cb821 --- /dev/null +++ b/.gitmodules @@ -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 diff --git a/README.md b/README.md index 7258929..d6a4c38 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/layers/.templateconf b/layers/.templateconf new file mode 100644 index 0000000..5eb5b84 --- /dev/null +++ b/layers/.templateconf @@ -0,0 +1,2 @@ +# This file is required by oe-setup-buildenv script +# but not used in this repository - see ../setup-env diff --git a/layers/bitbake b/layers/bitbake new file mode 120000 index 0000000..57f9d73 --- /dev/null +++ b/layers/bitbake @@ -0,0 +1 @@ +../repos/poky/bitbake \ No newline at end of file diff --git a/layers/meta b/layers/meta new file mode 120000 index 0000000..edc8e6c --- /dev/null +++ b/layers/meta @@ -0,0 +1 @@ +../repos/poky/meta \ No newline at end of file diff --git a/layers/meta-filesystems b/layers/meta-filesystems new file mode 120000 index 0000000..31b79db --- /dev/null +++ b/layers/meta-filesystems @@ -0,0 +1 @@ +../repos/meta-openembedded/meta-filesystems \ No newline at end of file diff --git a/layers/meta-mender-core b/layers/meta-mender-core new file mode 120000 index 0000000..758ea80 --- /dev/null +++ b/layers/meta-mender-core @@ -0,0 +1 @@ +../repos/meta-mender/meta-mender-core \ No newline at end of file diff --git a/layers/meta-mender-tegra b/layers/meta-mender-tegra new file mode 120000 index 0000000..0f3f32c --- /dev/null +++ b/layers/meta-mender-tegra @@ -0,0 +1 @@ +../repos/meta-mender-community/meta-mender-tegra \ No newline at end of file diff --git a/layers/meta-networking b/layers/meta-networking new file mode 120000 index 0000000..9c86a7d --- /dev/null +++ b/layers/meta-networking @@ -0,0 +1 @@ +../repos/meta-openembedded/meta-networking \ No newline at end of file diff --git a/layers/meta-oe b/layers/meta-oe new file mode 120000 index 0000000..8cccc3e --- /dev/null +++ b/layers/meta-oe @@ -0,0 +1 @@ +../repos/meta-openembedded/meta-oe \ No newline at end of file diff --git a/layers/meta-python b/layers/meta-python new file mode 120000 index 0000000..56a1dac --- /dev/null +++ b/layers/meta-python @@ -0,0 +1 @@ +../repos/meta-openembedded/meta-python \ No newline at end of file diff --git a/layers/meta-tegra b/layers/meta-tegra new file mode 120000 index 0000000..54226d3 --- /dev/null +++ b/layers/meta-tegra @@ -0,0 +1 @@ +../repos/meta-tegra \ No newline at end of file diff --git a/layers/meta-tegra-support/classes/tegrademo-sanity.bbclass b/layers/meta-tegra-support/classes/tegrademo-sanity.bbclass new file mode 100644 index 0000000..269ff22 --- /dev/null +++ b/layers/meta-tegra-support/classes/tegrademo-sanity.bbclass @@ -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 \ +" diff --git a/layers/meta-tegra-support/conf/layer.conf b/layers/meta-tegra-support/conf/layer.conf new file mode 100644 index 0000000..cb45eb6 --- /dev/null +++ b/layers/meta-tegra-support/conf/layer.conf @@ -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" diff --git a/layers/meta-tegra-support/recipes-connectivity/openssh/openssh_%.bbappend b/layers/meta-tegra-support/recipes-connectivity/openssh/openssh_%.bbappend new file mode 100644 index 0000000..7cfe239 --- /dev/null +++ b/layers/meta-tegra-support/recipes-connectivity/openssh/openssh_%.bbappend @@ -0,0 +1,2 @@ +RRECOMMENDS_${PN}-sshd_remove_tegra = "rng-tools" +RRECOMMENDS_${PN}-sshd_append_tegra = " haveged" diff --git a/layers/meta-tegra-support/recipes-filesystems/sshfs-fuse/sshfs-fuse_%.bbappend b/layers/meta-tegra-support/recipes-filesystems/sshfs-fuse/sshfs-fuse_%.bbappend new file mode 100644 index 0000000..d15986c --- /dev/null +++ b/layers/meta-tegra-support/recipes-filesystems/sshfs-fuse/sshfs-fuse_%.bbappend @@ -0,0 +1 @@ +PTEST_ENABLED = "0" diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/cross-build-fixups.patch b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/cross-build-fixups.patch new file mode 100644 index 0000000..d6be31f --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/cross-build-fixups.patch @@ -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 + diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/fix-tools-makefile.patch b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/fix-tools-makefile.patch new file mode 100644 index 0000000..45c5761 --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/fix-tools-makefile.patch @@ -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) diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/jpeg-fixups.patch b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/jpeg-fixups.patch new file mode 100644 index 0000000..a71cdc3 --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/jpeg-fixups.patch @@ -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 +-#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 +-#include "jpeglib.h" ++#include "libjpeg-8b/jpeglib.h" + #include "NvElement.h" + #include "NvBuffer.h" + diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/make-x11-conditional.patch b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/make-x11-conditional.patch new file mode 100644 index 0000000..dc636c7 --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/make-x11-conditional.patch @@ -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 diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/remove-xxd-reference.patch b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/remove-xxd-reference.patch new file mode 100644 index 0000000..02e2a56 --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/remove-xxd-reference.patch @@ -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 diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/vector-fixup.patch b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/vector-fixup.patch new file mode 100644 index 0000000..2ac3c40 --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples-32.4.3/vector-fixup.patch @@ -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 + #include + #include ++#include + #include + #include + #include diff --git a/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples_32.4.3.bb b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples_32.4.3.bb new file mode 100644 index 0000000..f203b7c --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/argus/tegra-mmapi-samples_32.4.3.bb @@ -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" + diff --git a/layers/meta-tegra-support/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/layers/meta-tegra-support/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend new file mode 100644 index 0000000..1c5cc7c --- /dev/null +++ b/layers/meta-tegra-support/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend @@ -0,0 +1 @@ +PACKAGECONFIG_append = " faad" diff --git a/layers/meta-tegra-support/recipes-support/fuse/fuse3_%.bbappend b/layers/meta-tegra-support/recipes-support/fuse/fuse3_%.bbappend new file mode 100644 index 0000000..f2f5d06 --- /dev/null +++ b/layers/meta-tegra-support/recipes-support/fuse/fuse3_%.bbappend @@ -0,0 +1,5 @@ +PTEST_ENABLED = "0" + +do_install_append() { + sed -i -e's,^#user_allow_other,user_allow_other,' ${D}${sysconfdir}/fuse.conf +} diff --git a/layers/meta-tegra-support/recipes-test/eglstreams/eglstreams-kms-example/cross-build.patch b/layers/meta-tegra-support/recipes-test/eglstreams/eglstreams-kms-example/cross-build.patch new file mode 100644 index 0000000..94dc6ad --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/eglstreams/eglstreams-kms-example/cross-build.patch @@ -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) *~ diff --git a/layers/meta-tegra-support/recipes-test/eglstreams/eglstreams-kms-example_git.bb b/layers/meta-tegra-support/recipes-test/eglstreams/eglstreams-kms-example_git.bb new file mode 100644 index 0000000..3bb1ca8 --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/eglstreams/eglstreams-kms-example_git.bb @@ -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}" +} diff --git a/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/capturetest.sh.in b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/capturetest.sh.in new file mode 100644 index 0000000..36b5afa --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/capturetest.sh.in @@ -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 diff --git a/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/confvars.in b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/confvars.in new file mode 100644 index 0000000..5038900 --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/confvars.in @@ -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" diff --git a/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/nvjpegtest.sh.in b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/nvjpegtest.sh.in new file mode 100644 index 0000000..59d298f --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/nvjpegtest.sh.in @@ -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 diff --git a/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/sinteltest.sh.in b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/sinteltest.sh.in new file mode 100644 index 0000000..2a84379 --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests/sinteltest.sh.in @@ -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 diff --git a/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests_1.0.bb b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests_1.0.bb new file mode 100644 index 0000000..3590599 --- /dev/null +++ b/layers/meta-tegra-support/recipes-test/tegra-tests/gstreamer-tests_1.0.bb @@ -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" diff --git a/layers/meta-tegrademo/.templateconf b/layers/meta-tegrademo/.templateconf new file mode 100644 index 0000000..5bec33f --- /dev/null +++ b/layers/meta-tegrademo/.templateconf @@ -0,0 +1 @@ +TEMPLATECONF=${TEMPLATECONF:-meta-tegrademo/conf/template-$DISTRO} diff --git a/layers/meta-tegrademo/conf/distro/tegrademo.conf b/layers/meta-tegrademo/conf/distro/tegrademo.conf new file mode 100644 index 0000000..f1b5a38 --- /dev/null +++ b/layers/meta-tegrademo/conf/distro/tegrademo.conf @@ -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 " + +TARGET_VENDOR = "-oe4t" + +# New ${DISTRO}- 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" diff --git a/layers/meta-tegrademo/conf/layer.conf b/layers/meta-tegrademo/conf/layer.conf new file mode 100644 index 0000000..2913577 --- /dev/null +++ b/layers/meta-tegrademo/conf/layer.conf @@ -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}" diff --git a/layers/meta-tegrademo/conf/template-tegrademo/bblayers.conf.sample b/layers/meta-tegrademo/conf/template-tegrademo/bblayers.conf.sample new file mode 100644 index 0000000..590ef51 --- /dev/null +++ b/layers/meta-tegrademo/conf/template-tegrademo/bblayers.conf.sample @@ -0,0 +1,20 @@ +# Version of layers configuration, specific to +# each defined distro in the repository. +# Format: ${DISTRO}- +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 \ + " diff --git a/layers/meta-tegrademo/conf/template-tegrademo/conf-notes.txt b/layers/meta-tegrademo/conf/template-tegrademo/conf-notes.txt new file mode 100644 index 0000000..65b2348 --- /dev/null +++ b/layers/meta-tegrademo/conf/template-tegrademo/conf-notes.txt @@ -0,0 +1,10 @@ +### Shell environment set up for builds. ### + +You can now run 'bitbake ' +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 diff --git a/layers/meta-tegrademo/conf/template-tegrademo/local.conf.sample b/layers/meta-tegrademo/conf/template-tegrademo/local.conf.sample new file mode 100644 index 0000000..42497b0 --- /dev/null +++ b/layers/meta-tegrademo/conf/template-tegrademo/local.conf.sample @@ -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 ":" 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" diff --git a/layers/meta-tegrademo/recipes-demo/images/demo-image-base.bb b/layers/meta-tegrademo/recipes-demo/images/demo-image-base.bb new file mode 100644 index 0000000..9da5fc4 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/images/demo-image-base.bb @@ -0,0 +1,3 @@ +DESCRIPTION = "Tegra demo base image" + +require demo-image-common.inc diff --git a/layers/meta-tegrademo/recipes-demo/images/demo-image-common.inc b/layers/meta-tegrademo/recipes-demo/images/demo-image-common.inc new file mode 100644 index 0000000..f5acaf0 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/images/demo-image-common.inc @@ -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 diff --git a/layers/meta-tegrademo/recipes-demo/images/demo-image-egl.bb b/layers/meta-tegrademo/recipes-demo/images/demo-image-egl.bb new file mode 100644 index 0000000..f8435da --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/images/demo-image-egl.bb @@ -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" diff --git a/layers/meta-tegrademo/recipes-demo/images/demo-image-full.bb b/layers/meta-tegrademo/recipes-demo/images/demo-image-full.bb new file mode 100644 index 0000000..f3ae421 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/images/demo-image-full.bb @@ -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" diff --git a/layers/meta-tegrademo/recipes-demo/images/demo-image-sato.bb b/layers/meta-tegrademo/recipes-demo/images/demo-image-sato.bb new file mode 100644 index 0000000..657d170 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/images/demo-image-sato.bb @@ -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)}" diff --git a/layers/meta-tegrademo/recipes-demo/images/demo-image-weston.bb b/layers/meta-tegrademo/recipes-demo/images/demo-image-weston.bb new file mode 100644 index 0000000..73585ff --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/images/demo-image-weston.bb @@ -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)}" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-base.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-base.bb new file mode 100644 index 0000000..2f56784 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-base.bb @@ -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 \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-basetests.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-basetests.bb new file mode 100644 index 0000000..7d95c94 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-basetests.bb @@ -0,0 +1,10 @@ +DESCRIPTION = "Packagegroup for common Tegra demo test applications" + +LICENSE = "MIT" + +inherit packagegroup + +RDEPENDS_${PN} = " \ + cuda-samples \ + gpu-burn \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-egltests.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-egltests.bb new file mode 100644 index 0000000..0904a91 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-egltests.bb @@ -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 \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-systemd.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-systemd.bb new file mode 100644 index 0000000..28bd7df --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-systemd.bb @@ -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 \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-vulkantests.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-vulkantests.bb new file mode 100644 index 0000000..a1f2896 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-vulkantests.bb @@ -0,0 +1,10 @@ +DESCRIPTION = "Packagegroup for common Tegra demo Vulkan test apps" + +LICENSE = "MIT" + +inherit packagegroup + +RDEPENDS_${PN} = " \ + vulkan-demos \ + vulkan-tools \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-weston.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-weston.bb new file mode 100644 index 0000000..676c2b3 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-weston.bb @@ -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)} \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-westontests.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-westontests.bb new file mode 100644 index 0000000..bc09926 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-westontests.bb @@ -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 \ +" diff --git a/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-x11tests.bb b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-x11tests.bb new file mode 100644 index 0000000..95a6456 --- /dev/null +++ b/layers/meta-tegrademo/recipes-demo/packagegroups/packagegroup-demo-x11tests.bb @@ -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 \ +" diff --git a/layers/meta-tegrademo/scripts/buildenv-host-gcc-check b/layers/meta-tegrademo/scripts/buildenv-host-gcc-check new file mode 100755 index 0000000..1b0aab6 --- /dev/null +++ b/layers/meta-tegrademo/scripts/buildenv-host-gcc-check @@ -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 diff --git a/layers/meta-tegrademo/scripts/layer-setup-env b/layers/meta-tegrademo/scripts/layer-setup-env new file mode 100644 index 0000000..bc23a3a --- /dev/null +++ b/layers/meta-tegrademo/scripts/layer-setup-env @@ -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 diff --git a/layers/meta-virtualization b/layers/meta-virtualization new file mode 120000 index 0000000..aa3e657 --- /dev/null +++ b/layers/meta-virtualization @@ -0,0 +1 @@ +../repos/meta-virtualization \ No newline at end of file diff --git a/layers/scripts b/layers/scripts new file mode 120000 index 0000000..73ac353 --- /dev/null +++ b/layers/scripts @@ -0,0 +1 @@ +../repos/poky/scripts \ No newline at end of file diff --git a/repos/meta-mender b/repos/meta-mender new file mode 160000 index 0000000..fbcae51 --- /dev/null +++ b/repos/meta-mender @@ -0,0 +1 @@ +Subproject commit fbcae512847bf03f3dc0e6eb5fe6503b52c35b03 diff --git a/repos/meta-mender-community b/repos/meta-mender-community new file mode 160000 index 0000000..8f8f67f --- /dev/null +++ b/repos/meta-mender-community @@ -0,0 +1 @@ +Subproject commit 8f8f67f77354b7d69b5cfcf4fa2865faf0675a46 diff --git a/repos/meta-openembedded b/repos/meta-openembedded new file mode 160000 index 0000000..eb69aad --- /dev/null +++ b/repos/meta-openembedded @@ -0,0 +1 @@ +Subproject commit eb69aad33fc06f06544589ec483f9b76464f6c5f diff --git a/repos/meta-tegra b/repos/meta-tegra new file mode 160000 index 0000000..2251b80 --- /dev/null +++ b/repos/meta-tegra @@ -0,0 +1 @@ +Subproject commit 2251b80e32d93906151c71e0d118505532fdb657 diff --git a/repos/meta-virtualization b/repos/meta-virtualization new file mode 160000 index 0000000..2711b81 --- /dev/null +++ b/repos/meta-virtualization @@ -0,0 +1 @@ +Subproject commit 2711b81afd489d5b458617dfdfda520d8fe61f65 diff --git a/repos/poky b/repos/poky new file mode 160000 index 0000000..c4daf38 --- /dev/null +++ b/repos/poky @@ -0,0 +1 @@ +Subproject commit c4daf38f476c62948aa7c58e83e3281e398cc323 diff --git a/scripts-setup/diff-bblayers-conf b/scripts-setup/diff-bblayers-conf new file mode 100755 index 0000000..f38fe72 --- /dev/null +++ b/scripts-setup/diff-bblayers-conf @@ -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 diff --git a/scripts-setup/setup-env-internal b/scripts-setup/setup-env-internal new file mode 100755 index 0000000..da8d99d --- /dev/null +++ b/scripts-setup/setup-env-internal @@ -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 < [] [] +Usage: . $PROGNAME [] + +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 , configures it for the +specified and , 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 . 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 < /dev/null 2>&1 +git submodule status | grep '^-' | awk '{print $2}' | xargs git submodule update --init -- +exit 0 + + diff --git a/setup-env b/setup-env new file mode 100644 index 0000000..7471ae7 --- /dev/null +++ b/setup-env @@ -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 <