Fix broken compilation for boards with multiple targets

This commit is contained in:
Gunjan Gupta 2024-02-04 20:11:36 +05:30 committed by Igor
parent 7217cee9c5
commit 2341940cbe
2 changed files with 36 additions and 26 deletions

View File

@ -97,6 +97,13 @@ function fetch_sources_tools__meson_s4t7_download_uboot_toolchain() {
function build_custom_uboot__meson_s4t7_build_custom_uboot() {
: "${KHADAS_BOARD_ID:?KHADAS_BOARD_ID not set}"
display_alert "$BOARD" "building fip" "info"
patch_uboot_target
if [[ $CREATE_PATCHES == yes ]]; then
return 0
fi
export CROSS_COMPILE="aarch64-elf-"
rm -rf "${PWD}"/fip/_tmp
run_host_command_logged bash fip/mk_script.sh "${KHADAS_BOARD_ID}" "${PWD}"

View File

@ -19,9 +19,38 @@ function maybe_make_clean_uboot() {
fi
}
function patch_uboot_target() {
local uboot_work_dir=""
uboot_work_dir="$(pwd)"
# outer scope variable: uboot_git_revision, validate that it is set
if [[ -z "${uboot_git_revision}" ]]; then
exit_with_error "uboot_git_revision is not set"
fi
display_alert "${uboot_prefix} Checking out to clean sources SHA1 ${uboot_git_revision}" "{$BOOTSOURCEDIR} for ${target_make}"
git checkout -f -q "${uboot_git_revision}"
maybe_make_clean_uboot
# Python patching for u-boot!
do_with_hooks uboot_main_patching_python
# create patch for manual source changes
if [[ $CREATE_PATCHES == yes ]]; then
userpatch_create "u-boot"
fi
}
# this receives version target uboot_name uboottempdir uboot_target_counter toolchain as variables.
# also receives uboot_prefix, target_make, target_patchdir, target_files as input
function compile_uboot_target() {
patch_uboot_target
if [[ $CREATE_PATCHES == yes ]]; then
return 0
fi
# atftempdir comes from atf.sh's compile_atf()
if [[ -n $ATFSOURCE && -d "${atftempdir}" ]]; then
display_alert "Copying over bin/elf's from atftempdir" "${atftempdir}" "debug"
@ -319,32 +348,6 @@ function compile_uboot() {
mkdir -p "$uboottempdir/usr/lib/u-boot" "$uboottempdir/usr/lib/$uboot_name" "$uboottempdir/DEBIAN"
local uboot_work_dir=""
uboot_work_dir="$(pwd)"
# outer scope variable: uboot_git_revision, validate that it is set
if [[ -z "${uboot_git_revision}" ]]; then
exit_with_error "uboot_git_revision is not set"
fi
display_alert "${uboot_prefix} Checking out to clean sources SHA1 ${uboot_git_revision}" "{$BOOTSOURCEDIR} for ${target_make}"
git checkout -f -q "${uboot_git_revision}"
# grab the prepatch version from Makefile
local uboot_prepatch_version=""
uboot_prepatch_version=$(grab_version "${uboot_work_dir}")
maybe_make_clean_uboot
# Python patching for u-boot!
do_with_hooks uboot_main_patching_python
# create patch for manual source changes
if [[ $CREATE_PATCHES == yes ]]; then
userpatch_create "u-boot"
return 0 # exit after this.
fi
# Allow extension-based u-boot bulding. We call the hook, and if EXTENSION_BUILT_UBOOT="yes" afterwards, we skip our own compilation.
# This is to make it easy to build vendor/downstream uboot with their own quirks.