From a747ba2c37fd25e04fc807a705320616e2309a2d Mon Sep 17 00:00:00 2001 From: Gunjan Gupta Date: Wed, 21 Jun 2023 15:15:41 +0530 Subject: [PATCH] Only install gcc-or1k-bin package when building images with crust-firmware support --- .../families/include/crust_firmware.inc | 32 +++++++++++++++++++ .../families/include/sunxi64_common.inc | 10 +----- .../sources/families/include/sunxi_common.inc | 10 +----- extensions/sunxi-tools.sh | 6 ++-- 4 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 config/sources/families/include/crust_firmware.inc diff --git a/config/sources/families/include/crust_firmware.inc b/config/sources/families/include/crust_firmware.inc new file mode 100644 index 0000000000..fe21b5dd79 --- /dev/null +++ b/config/sources/families/include/crust_firmware.inc @@ -0,0 +1,32 @@ +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ +# +declare -g CRUST_TARGET_MAP="scp;;build/scp/scp.bin" + +[[ -n "${CRUSTCONFIG}" && -z $CRUSTSOURCE ]] && CRUSTSOURCE='https://github.com/crust-firmware/crust' +[[ -n "${CRUSTCONFIG}" && -z $CRUSTDIR ]] && CRUSTDIR='crust-sunxi-mainline' +[[ -n "${CRUSTCONFIG}" && -z $CRUSTBRANCH ]] && CRUSTBRANCH='commit:c308a504853e7fdb47169796c9a832796410ece8' +[[ -n "${CRUSTCONFIG}" && -z $CRUST_USE_GCC ]] && CRUST_USE_GCC='> 9.1.0' +[[ -n "${CRUSTCONFIG}" && -z $CRUST_COMPILER ]] && CRUST_COMPILER='or1k-elf-' + +# Apply crust patches if crust is enabled +[[ -n "${CRUSTCONFIG}" ]] && BOOTPATCHDIR="${BOOTPATCHDIR} u-boot-sunxi-crust" + +# complain about system not being supported for building crust image +function add_host_dependencies__dont_try_to_build_crust_on_unsupported_systems() { + if [[ -n "${CRUSTCONFIG}" ]] ; then + if [[ -z $HOSTRELEASE || "bookworm sid jammy kinetic lunar vanessa vera" != *"$HOSTRELEASE"* ]] ; then + if [[ $NO_HOST_RELEASE_CHECK == yes ]]; then + display_alert "You are running on an unsupported system" "${HOSTRELEASE:-(unknown)}" "wrn" + display_alert "Do not report any errors, warnings or other issues encountered beyond this point" "" "wrn" + else + exit_with_error "Unsupported build system for images with crust-firmware: '${HOSTRELEASE:-(unknown)}'" + fi + fi + fi +} diff --git a/config/sources/families/include/sunxi64_common.inc b/config/sources/families/include/sunxi64_common.inc index 74e924871a..4bd4b5c2c0 100644 --- a/config/sources/families/include/sunxi64_common.inc +++ b/config/sources/families/include/sunxi64_common.inc @@ -17,16 +17,8 @@ declare -g BOOTENV_FILE='sunxi.txt' UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP:-BINMAN_ALLOW_MISSING=1;;u-boot-sunxi-with-spl.bin}" declare -g BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd' declare -g LINUXFAMILY=sunxi64 -declare -g CRUST_TARGET_MAP="scp;;build/scp/scp.bin" -[[ -n "${CRUSTCONFIG}" && -z $CRUSTSOURCE ]] && CRUSTSOURCE='https://github.com/crust-firmware/crust' -[[ -n "${CRUSTCONFIG}" && -z $CRUSTDIR ]] && CRUSTDIR='crust-sunxi-mainline' -[[ -n "${CRUSTCONFIG}" && -z $CRUSTBRANCH ]] && CRUSTBRANCH='commit:c308a504853e7fdb47169796c9a832796410ece8' -[[ -n "${CRUSTCONFIG}" && -z $CRUST_USE_GCC ]] && CRUST_USE_GCC='> 9.1.0' -[[ -n "${CRUSTCONFIG}" && -z $CRUST_COMPILER ]] && CRUST_COMPILER='or1k-elf-' - -# Apply crust patches if crust is enabled -[[ -n "${CRUSTCONFIG}" ]] && BOOTPATCHDIR="${BOOTPATCHDIR} u-boot-sunxi-crust" +source "${BASH_SOURCE%/*}/crust_firmware.inc" case $BRANCH in diff --git a/config/sources/families/include/sunxi_common.inc b/config/sources/families/include/sunxi_common.inc index 17abd3fc9e..58bbcde949 100644 --- a/config/sources/families/include/sunxi_common.inc +++ b/config/sources/families/include/sunxi_common.inc @@ -18,16 +18,8 @@ declare -g LINUXFAMILY=sunxi declare -g UBOOT_FW_ENV='0x88000,0x20000' # /etc/fw_env.config offset and env size declare -g ASOUND_STATE='asound.state.sunxi-next' declare -g GOVERNOR=ondemand -declare -g CRUST_TARGET_MAP="scp;;build/scp/scp.bin" -[[ -n "${CRUSTCONFIG}" && -z $CRUSTSOURCE ]] && CRUSTSOURCE='https://github.com/crust-firmware/crust' -[[ -n "${CRUSTCONFIG}" && -z $CRUSTDIR ]] && CRUSTDIR='crust-sunxi-mainline' -[[ -n "${CRUSTCONFIG}" && -z $CRUSTBRANCH ]] && CRUSTBRANCH='commit:c308a504853e7fdb47169796c9a832796410ece8' -[[ -n "${CRUSTCONFIG}" && -z $CRUST_USE_GCC ]] && CRUST_USE_GCC='> 9.1.0' -[[ -n "${CRUSTCONFIG}" && -z $CRUST_COMPILER ]] && CRUST_COMPILER='or1k-elf-' - -# Apply crust patches if crust is enabled -[[ -n "${CRUSTCONFIG}" ]] && BOOTPATCHDIR="${BOOTPATCHDIR} u-boot-sunxi-crust" +source "${BASH_SOURCE%/*}/crust_firmware.inc" case $BRANCH in diff --git a/extensions/sunxi-tools.sh b/extensions/sunxi-tools.sh index 2d8d65cea7..c500320842 100644 --- a/extensions/sunxi-tools.sh +++ b/extensions/sunxi-tools.sh @@ -9,8 +9,10 @@ function add_host_dependencies__sunxi_add_32_bit_c_compiler() { # Install gcc-or1k-elf for crust compilation function add_host_dependencies__sunxi_add_or1k_c_compiler() { - display_alert "Adding or1k C compiler to host dependencies" "for sunxi bootloader compile" "debug" - declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} gcc-or1k-elf" + if [[ -n "$HOSTRELEASE" && "bookworm sid jammy kinetic lunar vanessa vera" == *"$HOSTRELEASE"* ]] ; then + display_alert "Adding or1k C compiler to host dependencies" "for sunxi bootloader compile" "debug" + declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} gcc-or1k-elf" + fi } function fetch_sources_tools__sunxi_tools() {