Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
From 82becbadd5918ed7ad3c2b651ce479084b5feb2a Mon Sep 17 00:00:00 2001
From: Etienne Carriere <etienne.carriere@linaro.org>
Date: Mon, 10 May 2021 15:58:41 +0200
Subject: core: zlib: fix build warning when _LFS64_LARGEFILE is not defined
In zlib, _LFS64_LARGEFILE is expected to be a boolean directive, either
1 (true) or 0 (false). Depending on toolchain version and directives
build may produces warnings (as shown below with gcc 9.3) when the macro
is not defined hence this change to default it to value 0 (false).
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
In file included from core/lib/zlib/adler32.c:9:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
CC out/core/lib/zlib/zutil.o
In file included from core/lib/zlib/inftrees.c:7:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
In file included from core/lib/zlib/inflate.c:84:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
In file included from core/lib/zlib/zutil.c:9:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
core/lib/zlib/zconf.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/core/lib/zlib/zconf.h b/core/lib/zlib/zconf.h
index 0bca18be..a7d13741 100644
--- a/core/lib/zlib/zconf.h
+++ b/core/lib/zlib/zconf.h
@@ -487,6 +487,11 @@ typedef uLong FAR uLongf;
# endif
#endif
+/* Other places expect _LFS64_LARGEFILE to be defined with a valid value */
+#ifndef _LFS64_LARGEFILE
+#define _LFS64_LARGEFILE 0
+#endif
+
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
--
2.17.1

183
boot/optee-os/Config.in Normal file
View File

@@ -0,0 +1,183 @@
menuconfig BR2_TARGET_OPTEE_OS
bool "optee_os"
depends on BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A || BR2_RISCV_64
help
OP-TEE OS provides the secure world boot image and the trust
application development kit of the OP-TEE project. OP-TEE OS
also provides generic trusted application one can embedded
into its system.
http://github.com/OP-TEE/optee_os
if BR2_TARGET_OPTEE_OS
choice
prompt "OP-TEE OS version"
default BR2_TARGET_OPTEE_OS_LATEST if BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
help
Select the version of OP-TEE OS you want to use
config BR2_TARGET_OPTEE_OS_LATEST
bool "4.9.0"
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
select BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
help
Use the latest release tag from the OP-TEE OS official Git
repository.
config BR2_TARGET_OPTEE_OS_CUSTOM_VERSION
bool "Custom version"
help
This option allows to use a specific official version
config BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
bool "Custom tarball"
help
This option allows to specify a URL pointing to an OP-TEE OS
source tarball. This URL can use any protocol recognized by
Buildroot, like http://, ftp://, file:// or scp://.
When pointing to a local tarball using file://, you may want
to use a make variable like $(TOPDIR) to reference the root of
the Buildroot tree.
config BR2_TARGET_OPTEE_OS_CUSTOM_GIT
bool "Custom Git repository"
help
Use a custom version fetched from a Git repository.
endchoice
config BR2_TARGET_OPTEE_OS_CUSTOM_VERSION_VALUE
string "OP-TEE version"
depends on BR2_TARGET_OPTEE_OS_CUSTOM_VERSION
if BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
config BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION
string "URL of custom OP-TEE OS tarball"
endif
if BR2_TARGET_OPTEE_OS_CUSTOM_GIT
config BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL
string "URL of custom repository"
depends on BR2_TARGET_OPTEE_OS_CUSTOM_GIT
help
Specific location of the reference source tree Git
repository.
config BR2_TARGET_OPTEE_OS_CUSTOM_REPO_VERSION
string "Custom repository version"
depends on BR2_TARGET_OPTEE_OS_CUSTOM_GIT
help
Revision to use in the typical format used by Git, i.e a
SHA1 or a tag.
endif
config BR2_TARGET_OPTEE_OS_VERSION
string
default "4.9.0" if BR2_TARGET_OPTEE_OS_LATEST
default BR2_TARGET_OPTEE_OS_CUSTOM_VERSION_VALUE \
if BR2_TARGET_OPTEE_OS_CUSTOM_VERSION
default "custom" if BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
default BR2_TARGET_OPTEE_OS_CUSTOM_REPO_VERSION \
if BR2_TARGET_OPTEE_OS_CUSTOM_GIT
config BR2_TARGET_OPTEE_OS_LICENSE_FILES
string "OP-TEE OS license files" if BR2_TARGET_OPTEE_OS_CUSTOM_GIT || \
BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
default "LICENSE"
help
A space-separated list of license files related to the
OPTEE-OS package.
config BR2_TARGET_OPTEE_OS_NEEDS_DTC
bool "OP-TEE OS needs dtc"
select BR2_PACKAGE_HOST_DTC
help
Select this option if your OP-TEE OS platform configuration
requires the Device Tree compiler to be available.
config BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
bool "OP-TEE OS needs host-python-cryptography"
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
help
OP-TEE OS version below 3.16 used python-pycryptodomex
package in python scripts. Newer version uses
python-cryptography. Select this option if optee-os needs
python-cryptography to be built.
config BR2_TARGET_OPTEE_OS_NEEDS_CMAKE
bool "OP-TEE OS needs cmake"
help
Select this option if your OP-TEE OS platform configuration
requires the cmake build system to be available.
config BR2_TARGET_OPTEE_OS_CORE
bool "Build core"
default y
help
This option will build and install the OP-TEE core
boot images.
config BR2_TARGET_OPTEE_OS_SDK
bool "Build TA devkit"
default y
help
This option will build and install the OP-TEE development
kit for building OP-TEE trusted application images. It is
installed in the staging directory /lib/optee.
config BR2_TARGET_OPTEE_OS_SERVICES
bool "Build service TAs and libs"
default y
select BR2_TARGET_OPTEE_OS_CORE
help
This option installs the service trusted applications and
trusted shared libraries built from OP-TEE OS source tree.
These are installed in target /lib/optee_armtz directory
as other trusted applications. At runtime OP-TEE OS can
load these from this non-secure filesystem/directory into
the secure world for execution.
config BR2_TARGET_OPTEE_OS_PLATFORM
string "Target platform (mandatory)"
help
Value for the mandated PLATFORM build directive provided to
OP-TEE OS.
config BR2_TARGET_OPTEE_OS_PLATFORM_FLAVOR
string "Target platform flavor (optional)"
help
Value for the optional PLATFORM_FLAVOR build directive
provided to OP-TEE OS.
config BR2_TARGET_OPTEE_OS_CUSTOM_DTS_PATH
string "Device Tree Source file paths"
help
Space-separated list of paths to device tree source files
that will be copied to core/arch/arm/dts/ before starting
the build.
To use this device tree source file, the OP-TEE OS
configuration must refer to it with the
CFG_EMBED_DTB_SOURCE_FILE option and no platform flavor
needs to be specified.
config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES
string "Additional build variables"
help
Additional parameters for the OP-TEE OS build
E.g. 'CFG_TEE_CORE_LOG_LEVEL=3 CFG_UNWIND=y'
config BR2_TARGET_OPTEE_OS_CORE_IMAGES
string "Binary boot images"
default "tee.bin tee-raw.bin tee-*_v2.bin"
help
Names of generated image files that are installed in the
output images/ directory.
endif # BR2_TARGET_OPTEE_OS

View File

@@ -0,0 +1,3 @@
# Locally computed
sha256 9400e16c45bfa45f15585b2c933b86c449e7de05def0ecaaa62a4f38973a3a45 optee-os-4.9.0.tar.gz
sha256 1247ee90858f4037b6cac63cbffddfed435d0d73c631b37d78c1e6e6ab3e5d1a LICENSE

176
boot/optee-os/optee-os.mk Normal file
View File

@@ -0,0 +1,176 @@
################################################################################
#
# optee-os
#
################################################################################
OPTEE_OS_VERSION = $(call qstrip,$(BR2_TARGET_OPTEE_OS_VERSION))
OPTEE_OS_LICENSE = BSD-2-Clause
OPTEE_OS_LICENSE_FILES = $(call qstrip,$(BR2_TARGET_OPTEE_OS_LICENSE_FILES))
OPTEE_OS_CPE_ID_PREFIX = cpe:2.3:o
OPTEE_OS_CPE_ID_VENDOR = trustedfirmware
OPTEE_OS_CPE_ID_PRODUCT = op-tee
OPTEE_OS_INSTALL_STAGING = YES
OPTEE_OS_INSTALL_IMAGES = YES
ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL),y)
OPTEE_OS_TARBALL = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION))
OPTEE_OS_SITE = $(patsubst %/,%,$(dir $(OPTEE_OS_TARBALL)))
OPTEE_OS_SOURCE = $(notdir $(OPTEE_OS_TARBALL))
else ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_GIT),y)
OPTEE_OS_SITE = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL))
OPTEE_OS_SITE_METHOD = git
else
OPTEE_OS_SITE = $(call github,OP-TEE,optee_os,$(OPTEE_OS_VERSION))
endif
ifeq ($(BR2_TARGET_OPTEE_OS):$(BR2_TARGET_OPTEE_OS_LATEST),y:)
BR_NO_CHECK_HASH_FOR += $(OPTEE_OS_SOURCE)
endif
OPTEE_OS_DEPENDENCIES = host-openssl host-python3 host-python-pyelftools
ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_CMAKE),y)
OPTEE_OS_DEPENDENCIES += $(BR2_CMAKE_HOST_DEPENDENCY)
endif
ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY),y)
OPTEE_OS_DEPENDENCIES += host-python-cryptography
else
OPTEE_OS_DEPENDENCIES += host-python-pycryptodomex
endif
ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_DTC),y)
OPTEE_OS_DEPENDENCIES += host-dtc
endif
# On 64bit targets, OP-TEE OS can be built in 32bit mode, or
# can be built in 64bit mode and support 32bit and 64bit
# trusted applications. Since buildroot currently references
# a single cross compiler, build exclusively in 32bit
# or 64bit mode.
OPTEE_OS_MAKE_OPTS = \
CROSS_COMPILE="$(TARGET_CROSS)" \
CROSS_COMPILE_core="$(TARGET_CROSS)" \
CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \
CROSS_COMPILE_ta_arm32="$(TARGET_CROSS)" \
CROSS_COMPILE_ta_rv64="$(TARGET_CROSS)" \
PYTHON3="$(HOST_DIR)/bin/python3"
ifeq ($(BR2_riscv),y)
OPTEE_OS_MAKE_OPTS += \
ARCH=riscv \
CFG_RV64_core=y \
CFG_USER_TA_TARGETS=ta_rv64
else
ifeq ($(BR2_aarch64),y)
OPTEE_OS_MAKE_OPTS += \
ARCH=arm \
CFG_ARM64_core=y \
CFG_USER_TA_TARGETS=ta_arm64
else
OPTEE_OS_MAKE_OPTS += \
ARCH=arm \
CFG_ARM32_core=y
endif
endif
# Get mandatory PLATFORM and optional PLATFORM_FLAVOR and additional
# variables
OPTEE_OS_MAKE_OPTS += PLATFORM=$(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM))
ifneq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM_FLAVOR)),)
OPTEE_OS_MAKE_OPTS += PLATFORM_FLAVOR=$(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM_FLAVOR))
endif
OPTEE_OS_MAKE_OPTS += $(call qstrip,$(BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES))
# Requests OP-TEE OS to build from subdirectory out/ of its sourcetree
# root path otherwise the output directory path depends on the target
# platform name.
OPTEE_OS_BUILDDIR_OUT = out
ifeq ($(BR2_riscv),y)
OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_rv64
OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_rv64
endif
ifeq ($(BR2_aarch64),y)
OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm64
OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
endif
ifeq ($(BR2_arm),y)
OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm32
OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
endif
OPTEE_OS_IMAGE_FILES = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CORE_IMAGES))
OPTEE_OS_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_DTS_PATH))
ifeq ($(BR2_TARGET_OPTEE_OS_CORE),y)
define OPTEE_OS_BUILD_CORE
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \
$(TARGET_CONFIGURE_OPTS) $(OPTEE_OS_MAKE_OPTS) all
endef
define OPTEE_OS_INSTALL_IMAGES_CORE
mkdir -p $(BINARIES_DIR)
$(foreach f,$(OPTEE_OS_IMAGE_FILES), \
cp -dpf $(wildcard $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f)) $(BINARIES_DIR)/
)
endef
endif # BR2_TARGET_OPTEE_OS_CORE
ifeq ($(BR2_TARGET_OPTEE_OS_SERVICES),y)
define OPTEE_OS_INSTALL_TARGET_CMDS
$(if $(wildcard $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/ta/*/*.ta),
$(INSTALL) -D -m 444 -t $(TARGET_DIR)/lib/optee_armtz \
$(@D)/$(OPTEE_OS_BUILDDIR_OUT)/ta/*/*.ta)
$(if $(wildcard $(@D)/$(OPTEE_OS_LOCAL_SDK)/lib/*.ta),
$(INSTALL) -D -m 444 -t $(TARGET_DIR)/lib/optee_armtz \
$(@D)/$(OPTEE_OS_LOCAL_SDK)/lib/*.ta)
endef
endif # BR2_TARGET_OPTEE_OS_SERVICES
ifeq ($(BR2_TARGET_OPTEE_OS_SDK),y)
define OPTEE_OS_BUILD_SDK
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \
$(TARGET_CONFIGURE_OPTS) $(OPTEE_OS_MAKE_OPTS) ta_dev_kit
endef
define OPTEE_OS_INSTALL_STAGING_CMDS
mkdir -p $(OPTEE_OS_SDK)
cp -ardpf $(@D)/$(OPTEE_OS_LOCAL_SDK)/* $(OPTEE_OS_SDK)
endef
endif # BR2_TARGET_OPTEE_OS_SDK
define OPTEE_OS_BUILD_CMDS
$(if $(OPTEE_OS_CUSTOM_DTS_PATH),
cp -f $(OPTEE_OS_CUSTOM_DTS_PATH) $(@D)/core/arch/arm/dts/
)
$(OPTEE_OS_BUILD_CORE)
$(OPTEE_OS_BUILD_SDK)
endef
define OPTEE_OS_INSTALL_IMAGES_CMDS
$(OPTEE_OS_INSTALL_IMAGES_CORE)
$(OPTEE_OS_INSTALL_IMAGES_SERVICES)
endef
ifeq ($(BR2_TARGET_OPTEE_OS)$(BR_BUILDING),yy)
ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM)),)
$(error No OP-TEE OS platform set. Check your BR2_TARGET_OPTEE_OS_PLATFORM setting)
endif
ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL),y)
ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION)),)
$(error No tarball location specified. Please check BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION)
endif
endif
ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_GIT),y)
ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL)),)
$(error No repository specified. Please check BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL)
endif
endif
endif # BR2_TARGET_OPTEE_OS && BR2_BUILDING
$(eval $(generic-package))