armbian_build/patch/u-boot/legacy/u-boot-khadas-edge2-rk3588/0001-fix-tee.bin-not-found-error.patch
2024-06-17 14:11:33 +02:00

105 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Muhammed Efe Cetin <efectn@protonmail.com>
Date: Thu, 13 Jun 2024 16:46:31 +0300
Subject: fix tee.bin not found error
---
arch/arm/mach-rockchip/decode_bl31.py | 14 +++++++--
arch/arm/mach-rockchip/fit_nodes.sh | 10 ++-----
arch/arm/mach-rockchip/make_fit_atf.py | 15 ++++++++--
3 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-rockchip/decode_bl31.py b/arch/arm/mach-rockchip/decode_bl31.py
index 111111111111..222222222222 100755
--- a/arch/arm/mach-rockchip/decode_bl31.py
+++ b/arch/arm/mach-rockchip/decode_bl31.py
@@ -41,8 +41,18 @@ def generate_atf_binary(bl31_file_name):
atf.write(data)
def main():
- bl31_elf="./bl31.elf"
+ if "BL31" in os.environ:
+ bl31_elf=os.getenv("BL31");
+ elif os.path.isfile("./bl31.elf"):
+ bl31_elf = "./bl31.elf"
+ else:
+ os.system("echo 'int main(){}' > bl31.c")
+ os.system("${CROSS_COMPILE}gcc -c bl31.c -o bl31.elf")
+ bl31_elf = "./bl31.elf"
+ logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
+ logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional')
+ logging.warning(' Please read Building section in doc/README.rockchip')
generate_atf_binary(bl31_elf);
if __name__ == "__main__":
- main()
+ main()
\ No newline at end of file
diff --git a/arch/arm/mach-rockchip/fit_nodes.sh b/arch/arm/mach-rockchip/fit_nodes.sh
index 111111111111..222222222222 100755
--- a/arch/arm/mach-rockchip/fit_nodes.sh
+++ b/arch/arm/mach-rockchip/fit_nodes.sh
@@ -171,16 +171,10 @@ function gen_bl32_node()
# If not AArch32 mode
if ! grep -q '^CONFIG_ARM64_BOOT_AARCH32=y' .config ; then
ENTRY="entry = <"${TEE_LOAD_ADDR}">;"
-
- # if disable packing tee.bin
- if ! grep -q '^CONFIG_SPL_OPTEE=y' .config ; then
- return
- fi
-
fi
fi
- TEE="tee.bin"
+ TEE="${BL32:-"tee.bin"}"
echo " optee {
description = \"OP-TEE\";
data = /incbin/(\"${TEE}${SUFFIX}\");
@@ -204,7 +198,7 @@ function gen_bl32_node()
};"
LOADABLE_OPTEE=", \"optee\""
FIRMWARE_OPTEE="firmware = \"optee\";"
- FIRMWARE_SIGN="\"firmware\""
+ FIRMWARE_SIGN=", \"firmware\""
}
function gen_mcu_node()
diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
index 111111111111..222222222222 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -212,9 +212,20 @@ def get_bl31_segments_info(bl31_file_name):
def main():
uboot_elf="./u-boot"
- bl31_elf="./bl31.elf"
FIT_ITS=sys.stdout
+ if "BL31" in os.environ:
+ bl31_elf=os.getenv("BL31");
+ elif os.path.isfile("./bl31.elf"):
+ bl31_elf = "./bl31.elf"
+ else:
+ os.system("echo 'int main(){}' > bl31.c")
+ os.system("${CROSS_COMPILE}gcc -c bl31.c -o bl31.elf")
+ bl31_elf = "./bl31.elf"
+ logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
+ logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional')
+ logging.warning(' Please read Building section in doc/README.rockchip')
+
opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
for opt, val in opts:
if opt == "-o":
@@ -235,4 +246,4 @@ def main():
generate_atf_binary(bl31_elf);
if __name__ == "__main__":
- main()
+ main()
\ No newline at end of file
--
Armbian