From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 10 Feb 2023 20:36:22 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pQZC3-003QLI-Mt for lore@lore.pengutronix.de; Fri, 10 Feb 2023 20:36:22 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pQZC0-00063M-Vz; Fri, 10 Feb 2023 20:36:20 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQZBw-00062I-35 for distrokit@pengutronix.de; Fri, 10 Feb 2023 20:36:16 +0100 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pQZBu-0043ed-3O for distrokit@pengutronix.de; Fri, 10 Feb 2023 20:36:15 +0100 Received: from mfe by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pQZBu-008zkV-Eu for distrokit@pengutronix.de; Fri, 10 Feb 2023 20:36:14 +0100 From: Marco Felsch To: distrokit@pengutronix.de Date: Fri, 10 Feb 2023 20:36:01 +0100 Message-Id: <20230210193612.2143905-4-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230210193612.2143905-1-m.felsch@pengutronix.de> References: <20230210193612.2143905-1-m.felsch@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 03/14] v8a: replace imx-atf with tf-a X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Replace the downstream imx-atf version with the most recent upstream version already used by the v7a platform. Signed-off-by: Marco Felsch --- configs/platform-v8a/platformconfig | 1 - .../platform-v8a/platforms/barebox-imx8m.in | 2 +- configs/platform-v8a/rules/barebox-imx8m.make | 2 +- configs/platform-v8a/rules/imx-atf.in | 7 -- configs/platform-v8a/rules/imx-atf.make | 87 ------------------- ...-add-helper-to-detect-linker-options.patch | 38 -------- ...void-gcc-warning-that-triggers-with-.patch | 48 ---------- ...dd-support-for-new-binutils-versions.patch | 38 -------- ...004-makefile-link-with-z-noexecstack.patch | 38 -------- patches/imx-atf-imx_5.4.24_2.1.0/series | 4 - 10 files changed, 2 insertions(+), 263 deletions(-) delete mode 100644 configs/platform-v8a/rules/imx-atf.in delete mode 100644 configs/platform-v8a/rules/imx-atf.make delete mode 100644 patches/imx-atf-imx_5.4.24_2.1.0/0001-build-makefile-add-helper-to-detect-linker-options.patch delete mode 100644 patches/imx-atf-imx_5.4.24_2.1.0/0002-build-makefile-avoid-gcc-warning-that-triggers-with-.patch delete mode 100644 patches/imx-atf-imx_5.4.24_2.1.0/0003-feat-build-add-support-for-new-binutils-versions.patch delete mode 100644 patches/imx-atf-imx_5.4.24_2.1.0/0004-makefile-link-with-z-noexecstack.patch delete mode 100644 patches/imx-atf-imx_5.4.24_2.1.0/series diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig index c5cd8fb..634698d 100644 --- a/configs/platform-v8a/platformconfig +++ b/configs/platform-v8a/platformconfig @@ -182,7 +182,6 @@ PTXCONF_BAREBOX_ARCH_STRING="arm" PTXCONF_BOOTLOADER=y # PTXCONF_GRUB is not set # PTXCONF_HOST_MXS_UTILS is not set -PTXCONF_IMX_ATF=y PTXCONF_TF_A=y PTXCONF_TF_A_URL="https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot" PTXCONF_TF_A_VERSION="v2.8" diff --git a/configs/platform-v8a/platforms/barebox-imx8m.in b/configs/platform-v8a/platforms/barebox-imx8m.in index ca11fe2..edba6ac 100644 --- a/configs/platform-v8a/platforms/barebox-imx8m.in +++ b/configs/platform-v8a/platforms/barebox-imx8m.in @@ -2,7 +2,7 @@ config BAREBOX_IMX8M select FIRMWARE_IMX - select IMX_ATF + select TF_A tristate prompt "Barebox (imx8m)" help diff --git a/configs/platform-v8a/rules/barebox-imx8m.make b/configs/platform-v8a/rules/barebox-imx8m.make index da1adfa..c96c10d 100644 --- a/configs/platform-v8a/rules/barebox-imx8m.make +++ b/configs/platform-v8a/rules/barebox-imx8m.make @@ -71,7 +71,7 @@ $(STATEDIR)/barebox-imx8m.prepare: $(BAREBOX_IMX8M_CONFIG) done @for i in m p q; do \ - cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/atf/imx8m$$i-bl31.bin \ + cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/imx8m$$i-bl31.bin \ $(BAREBOX_IMX8M_DIR)/firmware/; \ done diff --git a/configs/platform-v8a/rules/imx-atf.in b/configs/platform-v8a/rules/imx-atf.in deleted file mode 100644 index 10c29b2..0000000 --- a/configs/platform-v8a/rules/imx-atf.in +++ /dev/null @@ -1,7 +0,0 @@ -## SECTION=bootloader - -config IMX_ATF - tristate - prompt "imx-atf" - help - ARM trusted firmware for i.MX SoCs. diff --git a/configs/platform-v8a/rules/imx-atf.make b/configs/platform-v8a/rules/imx-atf.make deleted file mode 100644 index 7e0a30f..0000000 --- a/configs/platform-v8a/rules/imx-atf.make +++ /dev/null @@ -1,87 +0,0 @@ -# -*-makefile-*- -# -# Copyright (C) 2019 by Lucas Stach -# -# For further information about the PTXdist project and license conditions -# see the README file. -# - -# -# We provide this package -# -PACKAGES-$(PTXCONF_IMX_ATF) += imx-atf - -# -# Paths and names -# -IMX_ATF_VERSION := imx_5.4.24_2.1.0 -IMX_ATF_MD5 := f60e3f42e90d552227d6fc1278761637 -IMX_ATF := imx-atf-$(IMX_ATF_VERSION) -IMX_ATF_SUFFIX := tar.xz -IMX_ATF_URL := https://source.codeaurora.org/external/imx/imx-atf.git;tag=rel_$(IMX_ATF_VERSION) -IMX_ATF_SOURCE := $(SRCDIR)/$(IMX_ATF).$(IMX_ATF_SUFFIX) -IMX_ATF_DIR := $(BUILDDIR)/$(IMX_ATF) -IMX_ATF_LICENSE := BSD-3-clause - -# ---------------------------------------------------------------------------- -# Prepare -# ---------------------------------------------------------------------------- -IMX_ATF_WRAPPER_BLACKLIST := \ - TARGET_HARDEN_RELRO \ - TARGET_HARDEN_BINDNOW \ - TARGET_HARDEN_PIE \ - TARGET_DEBUG \ - TARGET_BUILD_ID - -IMX_ATF_CONF_TOOL := NO - -IMX_ATF_CONF_OPT := \ - CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) - -IMX_ATF_PLATFORMS := imx8mq imx8mm imx8mp - -# ---------------------------------------------------------------------------- -# Compile -# ---------------------------------------------------------------------------- -IMX_ATF_MAKE_OPT := $(IMX_ATF_CONF_OPT) - -$(STATEDIR)/imx-atf.compile: - @$(call targetinfo) - - @$(foreach plat, $(IMX_ATF_PLATFORMS), \ - $(call compile, IMX_ATF, \ - $(IMX_ATF_MAKE_OPT) PLAT=$(plat) bl31)$(ptx/nl)) - - @$(call touch) - -# ---------------------------------------------------------------------------- -# Install -# ---------------------------------------------------------------------------- - -$(STATEDIR)/imx-atf.install: - @$(call targetinfo) - - @$(foreach plat, $(IMX_ATF_PLATFORMS), \ - install -v -D -m644 $(IMX_ATF_DIR)/build/$(plat)/release/bl31.bin \ - $(PTXCONF_SYSROOT_TARGET)/usr/lib/atf/$(plat)-bl31.bin;) - - @$(call touch) - -# ---------------------------------------------------------------------------- -# Target-Install -# ---------------------------------------------------------------------------- - -$(STATEDIR)/imx-atf.targetinstall: - @$(call targetinfo) - - @$(call install_init, imx-atf) - @$(call install_fixup, imx-atf,PRIORITY,optional) - @$(call install_fixup, imx-atf,SECTION,base) - @$(call install_fixup, imx-atf,AUTHOR,"Lucas Stach ") - @$(call install_fixup, imx-atf,DESCRIPTION,missing) - - @$(call install_finish, imx-atf) - - @$(call touch) - -# vim: syntax=make diff --git a/patches/imx-atf-imx_5.4.24_2.1.0/0001-build-makefile-add-helper-to-detect-linker-options.patch b/patches/imx-atf-imx_5.4.24_2.1.0/0001-build-makefile-add-helper-to-detect-linker-options.patch deleted file mode 100644 index 164f199..0000000 --- a/patches/imx-atf-imx_5.4.24_2.1.0/0001-build-makefile-add-helper-to-detect-linker-options.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 456257d346b295982761d33f4e24e07a9feee74d Mon Sep 17 00:00:00 2001 -From: Marco Felsch -Date: Sat, 26 Nov 2022 08:00:39 +0100 -Subject: [PATCH 1/2] build(makefile): add helper to detect linker options - -This is a small helper to check for possible linker options. If the -linker supports the requested option it is returned and if not nothing -will be returned, e.g.: - - TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) - -can be called unconditional. - -Signed-off-by: Marco Felsch ---- - make_helpers/build_macros.mk | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk -index b89d87ea6087..9f4f70dbe42f 100644 ---- a/make_helpers/build_macros.mk -+++ b/make_helpers/build_macros.mk -@@ -67,6 +67,12 @@ $(foreach d,$(0-9),$(eval __numeric := $(subst $(d),,$(__numeric)))) - $(if $(__numeric),$(error $(1) must be numeric)) - endef - -+# Convenience function to check for a given linker option. An call to -+# $(call ld_option, --no-XYZ) will return --no-XYZ if supported by the linker -+define ld_option -+ $(shell if $(LD) $(1) -v >/dev/null 2>&1; then echo $(1); fi ) -+endef -+ - # IMG_LINKERFILE defines the linker script corresponding to a BL stage - # $(1) = BL stage (2, 30, 31, 32, 33) - define IMG_LINKERFILE --- -2.30.2 - diff --git a/patches/imx-atf-imx_5.4.24_2.1.0/0002-build-makefile-avoid-gcc-warning-that-triggers-with-.patch b/patches/imx-atf-imx_5.4.24_2.1.0/0002-build-makefile-avoid-gcc-warning-that-triggers-with-.patch deleted file mode 100644 index a433800..0000000 --- a/patches/imx-atf-imx_5.4.24_2.1.0/0002-build-makefile-avoid-gcc-warning-that-triggers-with-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 710c027045df0d51e3d83bd26ec954b08108d836 Mon Sep 17 00:00:00 2001 -From: Robert Schwebel -Date: Sat, 26 Nov 2022 08:06:40 +0100 -Subject: [PATCH 2/2] build(makefile): avoid gcc warning that triggers with - -Werror=array-bounds - -With gcc 12, we get these warnings: - -make: Entering directory 'imx-atf-imx_5.4.24_2.1.0' - CC plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c -In file included from plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:20: -In function 'mmio_read_8', - inlined from 'imx8mq_soc_info_init' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:82:16, - inlined from 'bl31_platform_setup' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:224:2: -include/lib/mmio.h:19:16: error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds] - 19 | return *(volatile uint8_t*)addr; - | ^~~~~~~~~~~~~~~~~~~~~~~~ -In function 'mmio_read_8', - inlined from 'imx8mq_soc_info_init' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:86:16, - inlined from 'bl31_platform_setup' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:224:2: -include/lib/mmio.h:19:16: error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds] - 19 | return *(volatile uint8_t*)addr; - | ^~~~~~~~~~~~~~~~~~~~~~~~ -cc1: all warnings being treated as errors - -According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523#c9, this -is the right fix for TF-A, as it is a firmware that has memory at 0. - -Signed-off-by: Robert Schwebel ---- - Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile b/Makefile -index 2ae12fda741a..555b46e7b361 100644 ---- a/Makefile -+++ b/Makefile -@@ -284,6 +284,7 @@ CPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \ - ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ - -ffreestanding -Wa,--fatal-warnings - TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ -+ --param=min-pagesize=0 \ - -ffreestanding -fno-builtin -Wall -std=gnu99 \ - -Os -ffunction-sections -fdata-sections - --- -2.30.2 - diff --git a/patches/imx-atf-imx_5.4.24_2.1.0/0003-feat-build-add-support-for-new-binutils-versions.patch b/patches/imx-atf-imx_5.4.24_2.1.0/0003-feat-build-add-support-for-new-binutils-versions.patch deleted file mode 100644 index 35b2be9..0000000 --- a/patches/imx-atf-imx_5.4.24_2.1.0/0003-feat-build-add-support-for-new-binutils-versions.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b102865225c8db6a4ef60f346aded5959acc4d1c Mon Sep 17 00:00:00 2001 -From: Marco Felsch -Date: Wed, 9 Nov 2022 12:59:09 +0100 -Subject: [PATCH 3/4] feat(build): add support for new binutils versions - -The new ld.bfd linker version has added new warnings which are enabled by -default to secure elf binaries: - - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 - - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774 - -Since the tf-a handles every warning as error we need to tell the linker -to not warn about this. This is required to make the bl31 target -buildable with newer toolchain versions. - -Signed-off-by: Marco Felsch -Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617 ---- - Makefile | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/Makefile b/Makefile -index 3941f869800a..af7fd1535694 100644 ---- a/Makefile -+++ b/Makefile -@@ -444,6 +444,10 @@ TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) - endif - endif - -+# With ld.bfd version 2.29 and newer new warnings are added. Skip those since we -+# are not loaded by a elf loader. -+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) -+ - DTC_FLAGS += -I dts -O dtb - DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ - -x assembler-with-cpp $(DEFINES) --- -2.30.2 - diff --git a/patches/imx-atf-imx_5.4.24_2.1.0/0004-makefile-link-with-z-noexecstack.patch b/patches/imx-atf-imx_5.4.24_2.1.0/0004-makefile-link-with-z-noexecstack.patch deleted file mode 100644 index 727f8af..0000000 --- a/patches/imx-atf-imx_5.4.24_2.1.0/0004-makefile-link-with-z-noexecstack.patch +++ /dev/null @@ -1,38 +0,0 @@ -From f77451f77ff01dda1a5239a65901ed0b666116b3 Mon Sep 17 00:00:00 2001 -From: Robert Schwebel -Date: Sat, 26 Nov 2022 08:24:50 +0100 -Subject: [PATCH 4/4] makefile: link with -z noexecstack - -Starting with binutils 2.39+, there is a new warning: - - ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack - ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker - ld: warning: vmlinux has a LOAD segment with RWX permissions - -Fix it in a similar way to what the Linux kernel does, see: -https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/ - -Following the reasoning there, we set "-z noexecstack" for all linkers -(although LLVM's LLD defaults to it). - -Signed-off-by: Robert Schwebel ---- - Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile b/Makefile -index 54072a4543ce..86be2e68da3e 100644 ---- a/Makefile -+++ b/Makefile -@@ -298,6 +298,8 @@ endif - - GCC_V_OUTPUT := $(shell $(CC) -v 2>&1) - -+TF_LDFLAGS += -z noexecstack -+ - ifneq ($(findstring armlink,$(notdir $(LD))),) - TF_LDFLAGS += --diag_error=warning --lto_level=O1 - TF_LDFLAGS += --remove --info=unused,unusedsymbols --- -2.30.2 - diff --git a/patches/imx-atf-imx_5.4.24_2.1.0/series b/patches/imx-atf-imx_5.4.24_2.1.0/series deleted file mode 100644 index c731f9c..0000000 --- a/patches/imx-atf-imx_5.4.24_2.1.0/series +++ /dev/null @@ -1,4 +0,0 @@ -0001-build-makefile-add-helper-to-detect-linker-options.patch -0002-build-makefile-avoid-gcc-warning-that-triggers-with-.patch -0003-feat-build-add-support-for-new-binutils-versions.patch -0004-makefile-link-with-z-noexecstack.patch -- 2.30.2