Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

khadas-edge2: add vendor uboot to images #6754

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions config/boards/khadas-edge2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff. I suppose we can remove the SRC_EXTLINUX here and use boot.cmd/scr like other boards? kedge2 was different in this aspect; using boot.scr enables armbianEnv.txt, overlay selection, etc.

}
4 changes: 4 additions & 0 deletions config/sources/families/include/rockchip64_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ prepare_boot_configuration() {
;;
esac

if [[ ! -z $BL32_BLOB ]]; then
UBOOT_TARGET_MAP="BL32=$RKBIN_DIR/$BL32_BLOB ${UBOOT_TARGET_MAP}"
fi

if [[ $BOOT_SUPPORT_SPI == yes ]]; then

if [[ "${BOOT_SPI_RKSPI_LOADER:-"no"}" != "yes" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/artifacts/artifact-uboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function artifact_uboot_prepare_version() {
"${BOOTCONFIG:-"no_bootconfig"}"
"${BOOTDELAY}" "${UBOOT_DEBUGGING}" "${UBOOT_TARGET_MAP}" # general for all families
"${BOOT_SCENARIO}" "${BOOT_SUPPORT_SPI}" "${BOOT_SOC}" # rockchip stuff, sorry.
"${DDR_BLOB}" "${BL31_BLOB}" "${MINILOADER_BLOB}" # More rockchip stuff, even more sorry.
"${DDR_BLOB}" "${BL31_BLOB}" "${BL32_BLOB}" "${MINILOADER_BLOB}" # More rockchip stuff, even more sorry.
"${ATF_COMPILE}" "${ATFBRANCH}" "${ATFPATCHDIR}" # arm-trusted-firmware stuff
"${CRUSTCONFIG}" "${CRUSTBRANCH}" "${CRUSTPATCHDIR}" # crust stuff
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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