[Mod] First commit

This commit is contained in:
2022-10-31 22:18:58 +08:00
commit 1c8a3d9709
13090 changed files with 526733 additions and 0 deletions

View File

@ -0,0 +1,229 @@
config BR2_TARGET_ARM_TRUSTED_FIRMWARE
bool "ARM Trusted Firmware (ATF)"
depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A)
help
Enable this option if you want to build the ATF for your ARM
based embedded device.
https://github.com/ARM-software/arm-trusted-firmware
if BR2_TARGET_ARM_TRUSTED_FIRMWARE
choice
prompt "ATF Version"
help
Select the specific ATF version you want to use
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION
bool "v2.7"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION
bool "Custom version"
help
This option allows to use a specific official versions
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL
bool "Custom tarball"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
bool "Custom Git repository"
endchoice
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION
string "URL of custom ATF tarball"
endif
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE
string "ATF version"
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION
string
default "v2.7" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION
default "custom" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION \
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE \
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL
string "URL of custom repository"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION
string "Custom repository version"
help
Revision to use in the typical format used by Git
E.G. a sha id, a tag, ..
endif
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM
string "ATF platform"
help
Target plaform to build for.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_TARGET_BOARD
string "ATF target board"
help
Target board to build for. In many cases, this can be left
empty.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_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 fdts/ before starting the build.
To use this device tree source file, the ATF configuration
file must refer to it.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP
bool "Build FIP image"
help
This option enables building the FIP image (Firmware Image
Package). This is typically the image format used by
platforms were ATF encapsulates the second stage bootloader
(such as U-Boot).
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
bool "Build BL31 image"
help
This option enables building the BL31 image. This is
typically used on platforms where another bootloader (e.g
U-Boot) encapsulates ATF BL31.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT
bool "Build BL31 U-Boot image"
select BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
help
Generates a U-Boot image named atf-uboot.ub containing
bl31.bin. This is used for example by the Xilinx version of
U-Boot SPL to load ATF on the ZynqMP SoC.
choice
prompt "BL32"
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_DEFAULT
help
Select BL32 stage for the trusted firmware
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_DEFAULT
bool "Default"
help
With this option selected, ATF will not use any BL32 stage,
unless if one is explicitly chosen using the SPD (for
AArch64) or AARCH32_SP (for AArch32) variables, which can be
passed through
BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
bool "OP-TEE OS"
depends on BR2_TARGET_OPTEE_OS
help
This option allows to embed OP-TEE OS as the BL32 part of
the ARM Trusted Firmware boot sequence.
endchoice
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
bool "Use U-Boot as BL33"
depends on BR2_TARGET_UBOOT
help
This option allows to embed u-boot.bin as the BL33 part of
the ARM Trusted Firmware. It ensures that the u-boot package
gets built before ATF, and that the appropriate BL33
variable pointing to u-boot.bin is passed when building ATF.
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE
string "U-Boot BL33 image name"
default "u-boot.bin"
help
Name of the U-Boot BL33 image to include in ATF, it must
have been installed to BINARIES_DIR by the U-Boot package.
endif
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
bool "Use EDK2 as BL33"
depends on BR2_TARGET_EDK2
help
This option allows to embed EDK2 as the BL33 part of
the ARM Trusted Firmware. It ensures that the EDK2 package
gets built before ATF, and that the appropriate BL33
variable pointing to the EDK2 is passed when building ATF.
Do not choose this option if you intend to build ATF and EDK2
for the 'qemu_sbsa' platform. In this case, due to the EDK2
build system, the dependency between ATF and EDK is reversed.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS
string "Additional ATF make targets"
help
Additional targets for the ATF build
E.G. When using the QorIQ custom ATF repository from NXP,
the target 'pbl' can be used to build the pbl binary.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES
string "Additional ATF build variables"
help
Additional parameters for the ATF build
E.G. 'DEBUG=1 LOG_LEVEL=20'
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
bool "Build in debug mode"
help
Enable this option to build ATF with DEBUG=1.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
string "Binary boot images"
default "*.bin"
help
Names of generated image files that are installed in the
output images/ directory.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC
bool "Needs dtc"
select BR2_PACKAGE_HOST_DTC
help
Select this option if your ATF board configuration
requires the Device Tree compiler to be available.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN
bool "Needs arm-none-eabi toolchain"
depends on BR2_aarch64
depends on BR2_HOSTARCH = "x86_64"
help
Select this option if your ATF board configuration requires
an ARM32 bare metal toolchain to be available.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP
bool "Build with SSP"
default y
depends on BR2_TOOLCHAIN_HAS_SSP
depends on !BR2_SSP_NONE
help
Say 'y' here if you want to build ATF with SSP.
Your board must have SSP support in ATF: it must have an
implementation for plat_get_stack_protector_canary().
If you say 'y', the SSP level will be the level selected
by the global SSP setting.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL
string
# While newer versions of TF-A support "none" as
# ENABLE_STACK_PROTECTOR value, older versions (e.g 2.0) only
# supported "0" to disable SSP.
default "0" if !BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP
default "default" if BR2_SSP_REGULAR
default "strong" if BR2_SSP_STRONG
default "all" if BR2_SSP_ALL
endif

View File

@ -0,0 +1,3 @@
# Locally calculated
sha256 327c65b1bc231608a7a808b068b00c1a22310e9fc86158813cd10a9711d5725e arm-trusted-firmware-v2.7.tar.gz
sha256 130d0c6e5159fa454b1e969fd281fa1d388819aefb203f65dd282544b5ab7ba9 docs/license.rst

View File

@ -0,0 +1,218 @@
################################################################################
#
# arm-trusted-firmware
#
################################################################################
ARM_TRUSTED_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION))
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL),y)
# Handle custom ATF tarballs as specified by the configuration
ARM_TRUSTED_FIRMWARE_TARBALL = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION))
ARM_TRUSTED_FIRMWARE_SITE = $(patsubst %/,%,$(dir $(ARM_TRUSTED_FIRMWARE_TARBALL)))
ARM_TRUSTED_FIRMWARE_SOURCE = $(notdir $(ARM_TRUSTED_FIRMWARE_TARBALL))
else ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y)
ARM_TRUSTED_FIRMWARE_SITE = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL))
ARM_TRUSTED_FIRMWARE_SITE_METHOD = git
else
# Handle stable official ATF versions
ARM_TRUSTED_FIRMWARE_SITE = $(call github,ARM-software,arm-trusted-firmware,$(ARM_TRUSTED_FIRMWARE_VERSION))
# The licensing of custom or from-git versions is unknown.
# This is valid only for the latest (i.e. known) version.
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION),y)
ARM_TRUSTED_FIRMWARE_LICENSE = BSD-3-Clause
ARM_TRUSTED_FIRMWARE_LICENSE_FILES = docs/license.rst
endif
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE)$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION),y)
BR_NO_CHECK_HASH_FOR += $(ARM_TRUSTED_FIRMWARE_SOURCE)
endif
ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES = YES
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-dtc
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-toolchain
endif
ARM_TRUSTED_FIRMWARE_PLATFORM = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM))
ARM_TRUSTED_FIRMWARE_TARGET_BOARD = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_TARGET_BOARD))
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += DEBUG=1
ifneq ($(ARM_TRUSTED_FIRMWARE_TARGET_BOARD),)
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)/debug
else
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/debug
endif
else
ifneq ($(ARM_TRUSTED_FIRMWARE_TARGET_BOARD),)
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)/release
else
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/release
endif
endif
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
CROSS_COMPILE="$(TARGET_CROSS)" \
$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM) \
TARGET_BOARD=$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)
ARM_TRUSTED_FIRMWARE_MAKE_ENV += \
$(TARGET_MAKE_ENV) \
$(if $(BR2_PIC_PIE),CFLAGS="-fno-PIE") \
ENABLE_STACK_PROTECTOR=$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL))
ifeq ($(BR2_ARM_CPU_ARMV7A),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=7
else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=8
endif
ifeq ($(BR2_arm),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
else ifeq ($(BR2_aarch64),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += optee-os
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
BL32=$(BINARIES_DIR)/tee-header_v2.bin \
BL32_EXTRA1=$(BINARIES_DIR)/tee-pager_v2.bin \
BL32_EXTRA2=$(BINARIES_DIR)/tee-pageable_v2.bin
ifeq ($(BR2_aarch64),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SPD=opteed
endif
ifeq ($(BR2_arm),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee
endif
endif # BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2
# Since the flash device name vary between platforms, we use the variable
# provided by the EDK2 package for this. Using this variable here is OK
# as it will expand after all dependencies are resolved, inside _BUILD_CMDS.
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
BL33=$(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_EDK2_FD_NAME).fd)
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
ARM_TRUSTED_FIRMWARE_UBOOT_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE))
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
endif
ifeq ($(BR2_TARGET_VEXPRESS_FIRMWARE),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SCP_BL2=$(BINARIES_DIR)/scp-fw.bin
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += vexpress-firmware
endif
ifeq ($(BR2_TARGET_BINARIES_MARVELL),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SCP_BL2=$(BINARIES_DIR)/scp-fw.bin
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += binaries-marvell
endif
ifeq ($(BR2_TARGET_MV_DDR_MARVELL),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
endif
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += fip
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-openssl
# fiptool only exists in newer (>= 1.3) versions of ATF, so we build
# it conditionally. We need to explicitly build it as it requires
# OpenSSL, and therefore needs to be passed proper variables to find
# the host OpenSSL.
define ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
if test -d $(@D)/tools/fiptool; then \
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/tools/fiptool \
$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
CPPFLAGS="$(HOST_CPPFLAGS)" \
LDLIBS="$(HOST_LDFLAGS) -lcrypto" ; \
fi
endef
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31),y)
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += bl31
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT),y)
define ARM_TRUSTED_FIRMWARE_BL31_UBOOT_BUILD
# Get the entry point address from the elf.
BASE_ADDR=$$($(TARGET_READELF) -h $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31/bl31.elf | \
sed -r '/^ Entry point address:\s*(.*)/!d; s//\1/') && \
$(MKIMAGE) \
-A $(MKIMAGE_ARCH) -O arm-trusted-firmware -C none \
-a $${BASE_ADDR} -e $${BASE_ADDR} \
-d $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31.bin \
$(ARM_TRUSTED_FIRMWARE_IMG_DIR)/atf-uboot.ub
endef
define ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL
$(INSTALL) -m 0644 $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/atf-uboot.ub \
$(BINARIES_DIR)/atf-uboot.ub
endef
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += RESET_TO_BL31=1
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-uboot-tools
endif
ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
define ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL_ELF
$(INSTALL) -D -m 0644 $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31/bl31.elf \
$(BINARIES_DIR)/bl31.elf
endef
endif
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += \
$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS))
ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH))
define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
$(if $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH),
cp -f $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH) $(@D)/fdts/
)
$(ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL)
$(ARM_TRUSTED_FIRMWARE_MAKE_ENV) $(MAKE) -C $(@D) \
$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
$(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_BUILD)
endef
define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
$(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL_ELF)
endef
# Configuration check
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE)$(BR_BUILDING),yy)
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL),y)
ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION)),)
$(error No tarball location specified. Please check BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION)
endif
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y)
ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL)),)
$(error No repository specified. Please check BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL)
endif
endif
endif
$(eval $(generic-package))