From d2e40d6b0e8844cbf38422c31a8fa8ed1550d1bd Mon Sep 17 00:00:00 2001 From: Muhammed Efe Cetin Date: Fri, 14 Jun 2024 15:33:07 +0300 Subject: [PATCH] khadas-edge2: add vendor uboot to images --- config/boards/khadas-edge2.conf | 13 ++- .../0001-fix-tee.bin-not-found-error.patch | 104 ++++++++++++++++++ 2 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 patch/u-boot/legacy/u-boot-khadas-edge2-rk3588/0001-fix-tee.bin-not-found-error.patch diff --git a/config/boards/khadas-edge2.conf b/config/boards/khadas-edge2.conf index 75b61c6bf..f10bafa83 100644 --- a/config/boards/khadas-edge2.conf +++ b/config/boards/khadas-edge2.conf @@ -25,10 +25,17 @@ function post_family_tweaks__kedge2_naming_audios() { return 0 } +declare -g DDR_BLOB='rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin' +declare -g BL31_BLOB='rk35/rk3588_bl31_v1.45.elf' +declare -g BL32_BLOB='rk35/rk3588_bl32_v1.15.bin' + # for the kedge2, we're counting on the blobs+u-boot in SPI working, as it comes from factory. It does not support bootscripts. function post_family_config__uboot_kedge2() { - display_alert "$BOARD" "Configuring ($BOARD) non-u-boot" "info" - unset BOOTSOURCE - declare -g BOOTCONFIG='none' + display_alert "$BOARD" "Configuring ($BOARD) u-boot" "info" + + declare -g BOOTSOURCE='https://github.com/khadas/u-boot.git' + declare -g BOOTBRANCH='branch:khadas-edges-v2017.09' + declare -g BOOTPATCHDIR="legacy/u-boot-khadas-edge2-rk3588" + declare -g BOOTCONFIG="khadas-edge2-rk3588s_defconfig" declare -g SRC_EXTLINUX="yes" # For now, use extlinux. Thanks Monka } diff --git a/patch/u-boot/legacy/u-boot-khadas-edge2-rk3588/0001-fix-tee.bin-not-found-error.patch b/patch/u-boot/legacy/u-boot-khadas-edge2-rk3588/0001-fix-tee.bin-not-found-error.patch new file mode 100644 index 000000000..7e66b13a3 --- /dev/null +++ b/patch/u-boot/legacy/u-boot-khadas-edge2-rk3588/0001-fix-tee.bin-not-found-error.patch @@ -0,0 +1,104 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +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 +