diff --git a/build-pinebookpro.sh b/build-pinebookpro.sh index 7bd4ace7a..d86d161b6 100755 --- a/build-pinebookpro.sh +++ b/build-pinebookpro.sh @@ -20,7 +20,7 @@ kernsha256="f8d2a4fe938ff7faa565765a52e347e518a0712ca6ddd41b198bd9cc1626a724 li free_space="500" rootdir=$(pwd) -basedir=$(pwd)/pinebook-pro +basedir=$(pwd)/artifacts/pinebook-pro rm -rf "${basedir}" mkdir -p "${basedir}" @@ -31,7 +31,9 @@ export DEBIAN_FRONTEND="noninteractive" apt-get update apt-get install -y --no-install-recommends python3 bzip2 wget gcc-arm-none-eabi crossbuild-essential-arm64 make bison flex bc device-tree-compiler ca-certificates sed build-essential debootstrap qemu-user-static qemu-utils qemu-system-arm binfmt-support parted kpartx rsync git libssl-dev xz-utils coreutils util-linux -wget "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot/trusted-firmware-a-$tfaver.tar.gz" +# Tarballs available on official Gitiles repo have different timestamps on every download, so we can't validate them using sha256sum +# Use GitHub mirror instead +wget -O "trusted-firmware-a-${tfaver}.tar.gz" "https://github.com/TrustedFirmware-A/trusted-firmware-a/archive/refs/tags/v${tfaver}.tar.gz" wget "ftp://ftp.denx.de/pub/u-boot/u-boot-${ubootver}.tar.bz2" echo "37f917922bcef181164908c470a2f941006791c0113d738c498d39d95d543b21 trusted-firmware-a-${tfaver}.tar.gz" | sha256sum --check @@ -45,6 +47,8 @@ rm "trusted-firmware-a-${tfaver}.tar.gz" rm "u-boot-${ubootver}.tar.bz2" cd "trusted-firmware-a-${tfaver}" +patch -Np1 -i "${rootdir}/pinebookpro/patches/trusted-firmware-a/0001-fix-rockchip-rk3399-fix-dram-section-placement.patch" +patch -Np1 -i "${rootdir}/pinebookpro/patches/trusted-firmware-a/0002-Add-support-for-new-binutils-versions.patch" unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS CROSS_COMPILE=aarch64-linux-gnu- make PLAT=rk3399 cp build/rk3399/release/bl31/bl31.elf ../u-boot-${ubootver}/ diff --git a/pinebookpro/config/kernel/pinebook-pro-5.8.config b/pinebookpro/config/kernel/pinebook-pro-5.8.config index 0a109f6e0..b15d72d88 100644 --- a/pinebookpro/config/kernel/pinebook-pro-5.8.config +++ b/pinebookpro/config/kernel/pinebook-pro-5.8.config @@ -2,14 +2,15 @@ # Automatically generated file; DO NOT EDIT. # Linux/arm64 5.8.1 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0" +CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0" CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=90300 -CONFIG_LD_VERSION=234000000 +CONFIG_GCC_VERSION=130200 +CONFIG_LD_VERSION=242000000 CONFIG_CLANG_VERSION=0 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO=y +CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_TABLE_SORT=y @@ -383,6 +384,7 @@ CONFIG_SYS_SUPPORTS_HUGETLBFS=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y +CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_SECCOMP=y CONFIG_PARAVIRT=y CONFIG_PARAVIRT_TIME_ACCOUNTING=y @@ -442,6 +444,7 @@ CONFIG_ARM64_AMU_EXTN=y # ARMv8.5 architectural features # CONFIG_ARM64_BTI=y +CONFIG_ARM64_BTI_KERNEL=y CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI=y CONFIG_ARM64_E0PD=y CONFIG_ARCH_RANDOM=y @@ -720,6 +723,7 @@ CONFIG_HAVE_STACKPROTECTOR=y CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y CONFIG_STACKPROTECTOR_STRONG=y +CONFIG_ARCH_SUPPORTS_SHADOW_CALL_STACK=y CONFIG_HAVE_CONTEXT_TRACKING=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y @@ -8363,7 +8367,9 @@ CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor" # # Memory initialization # +CONFIG_CC_HAS_AUTO_VAR_INIT=y CONFIG_INIT_STACK_NONE=y +# CONFIG_INIT_STACK_ALL is not set # CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization @@ -8815,6 +8821,7 @@ CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y CONFIG_HAVE_ARCH_KASAN=y CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y CONFIG_CC_HAS_KASAN_GENERIC=y +CONFIG_CC_HAS_KASAN_SW_TAGS=y CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y # CONFIG_KASAN is not set CONFIG_KASAN_STACK=1 diff --git a/pinebookpro/patches/trusted-firmware-a/0001-fix-rockchip-rk3399-fix-dram-section-placement.patch b/pinebookpro/patches/trusted-firmware-a/0001-fix-rockchip-rk3399-fix-dram-section-placement.patch new file mode 100644 index 000000000..15dc86534 --- /dev/null +++ b/pinebookpro/patches/trusted-firmware-a/0001-fix-rockchip-rk3399-fix-dram-section-placement.patch @@ -0,0 +1,39 @@ +From f943b7c8e292e3aad2fcbdd0a37505f62b3b4c87 Mon Sep 17 00:00:00 2001 +From: Patrick Georgi +Date: Wed, 23 Jun 2021 21:34:38 +0200 +Subject: [PATCH] fix(rockchip/rk3399): fix dram section placement + +To quote jwerner in T925: +"The __sramdata in the declaration is a mistake, the correct target +section for that global needs to be .pmusram.data. This used to be +in .sram.data once upon a time but then the suspend.c stuff got added +and required it to be moved to PMUSRAM. I guess they forgot to update +that part in the declaration and since the old GCC seemed to silently +prefer the attribute in the definition, nobody noticed." + +This fixes building with gcc 11. + +fix #T925 + +Change-Id: I2b91542277c95cf487eaa1344927294d5d1b8f2b +Signed-off-by: Patrick Georgi +--- + plat/rockchip/rk3399/drivers/dram/dram.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plat/rockchip/rk3399/drivers/dram/dram.h b/plat/rockchip/rk3399/drivers/dram/dram.h +index 0eb12cf29..5572b1612 100644 +--- a/plat/rockchip/rk3399/drivers/dram/dram.h ++++ b/plat/rockchip/rk3399/drivers/dram/dram.h +@@ -149,7 +149,7 @@ struct rk3399_sdram_params { + uint32_t rx_cal_dqs[2][4]; + }; + +-extern __sramdata struct rk3399_sdram_params sdram_config; ++extern struct rk3399_sdram_params sdram_config; + + void dram_init(void); + +-- +2.47.0 + diff --git a/pinebookpro/patches/trusted-firmware-a/0002-Add-support-for-new-binutils-versions.patch b/pinebookpro/patches/trusted-firmware-a/0002-Add-support-for-new-binutils-versions.patch new file mode 100644 index 000000000..1a17bf48b --- /dev/null +++ b/pinebookpro/patches/trusted-firmware-a/0002-Add-support-for-new-binutils-versions.patch @@ -0,0 +1,54 @@ +From 701907b4c0e61fe35189ab8a9acf132887651932 Mon Sep 17 00:00:00 2001 +From: Ryo Nakano +Date: Mon, 4 Nov 2024 19:45:08 +0900 +Subject: [PATCH] Add support for new binutils versions + +Backport of the following upstream commits: + +- https://github.com/TrustedFirmware-A/trusted-firmware-a/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c +- https://github.com/TrustedFirmware-A/trusted-firmware-a/commit/86e489c1903c72b76c6ff3b3ff6b75774c132e59 +--- + Makefile | 4 ++++ + make_helpers/build_macros.mk | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/Makefile b/Makefile +index f01a9ae3e..65a30b6f7 100644 +--- a/Makefile ++++ b/Makefile +@@ -375,6 +375,7 @@ TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) + # LD = gcc (used when GCC LTO is enabled) + else ifneq ($(findstring gcc,$(notdir $(LD))),) + # Pass ld options with Wl or Xlinker switches ++TF_LDFLAGS += $(call ld_option,-Xlinker --no-warn-rwx-segments) + TF_LDFLAGS += -Wl,--fatal-warnings -O1 + TF_LDFLAGS += -Wl,--gc-sections + ifeq ($(ENABLE_LTO),1) +@@ -392,6 +393,9 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) + + # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other + else ++# With ld.bfd version 2.39 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) + TF_LDFLAGS += --fatal-warnings -O1 + TF_LDFLAGS += --gc-sections + # ld.lld doesn't recognize the errata flags, +diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk +index 1c3d14d05..cc40a30ac 100644 +--- a/make_helpers/build_macros.mk ++++ b/make_helpers/build_macros.mk +@@ -67,6 +67,10 @@ $(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 ++ld_option = $(shell $(LD) $(1) -Wl,--version >/dev/null 2>&1 || $(LD) $(1) -v >/dev/null 2>&1 && echo $(1)) ++ + # CREATE_SEQ is a recursive function to create sequence of numbers from 1 to + # $(2) and assign the sequence to $(1) + define CREATE_SEQ +-- +2.47.0 +