armbian-next: u-boot: add fasthash to u-boot [deprecated, later removed]

- u-boot: fasthash: add `uboot_target_counter` to id and branch, lest `UBOOT_TARGET_MAP` > 2 fails
This commit is contained in:
Ricardo Pardini 2022-07-06 23:51:43 +02:00
parent f07ec572d8
commit bfa5813c6e
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02

View File

@ -15,12 +15,43 @@ function maybe_make_clean_uboot() {
# 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() {
local uboot_work_dir=""
uboot_work_dir="$(pwd)"
# needed for multiple targets and for calling compile_uboot directly
display_alert "${uboot_prefix} Checking out to clean sources" "{$BOOTSOURCEDIR} for ${target_make}"
git checkout -f -q HEAD # @TODO: this assumes way too much. should call the wrapper again, not directly
# grab the prepatch version from Makefile
local uboot_prepatch_version=""
uboot_prepatch_version=$(grab_version "${uboot_work_dir}")
# grab the mtime of the revision.
declare checked_out_revision_ts="" checked_out_revision_mtime=""
checked_out_revision_ts="$(git log -1 --pretty=%ct "HEAD")" # unix timestamp of the commit date
checked_out_revision_mtime="$(date +%Y%m%d%H%M%S -d "@${checked_out_revision_ts}")" # convert timestamp to local date/time
display_alert "u-boot: checked_out_revision_mtime set!" "${checked_out_revision_mtime} - ${checked_out_revision_ts}" "git"
# mark the minimum mtime for uboot patches
declare -i patch_minimum_target_mtime="${checked_out_revision_mtime}"
declare -i patch_dir_mtime="${patch_minimum_target_mtime}"
local patch_dir="${SRC}/patch/u-boot/${BOOTPATCHDIR}"
if [[ -d "${patch_dir}" ]]; then
patch_dir_mtime=$(get_dir_modification_time "${patch_dir}")
display_alert "uboot: patch_dir mtime:" "${patch_dir_mtime}" "debug"
patch_minimum_target_mtime=$((patch_dir_mtime > patch_minimum_target_mtime ? patch_dir_mtime : patch_minimum_target_mtime))
display_alert "uboot: patch_minimum_target_mtime after patch_dir mtime:" "${patch_minimum_target_mtime}" "debug"
fi
# @TODO: for u-boot, there's also the BOARD patch directory, which should also be taken into account.
initialize_fasthash "u-boot-${uboot_target_counter}" "unknown-uboot-hash" "${uboot_prepatch_version}" "$(pwd)"
fasthash_debug "init"
maybe_make_clean_uboot
fasthash_branch "patches-${uboot_target_counter}-${BOOTPATCHDIR}-$BRANCH"
advanced_patch "u-boot" "$BOOTPATCHDIR" "$BOARD" "$target_patchdir" "$BRANCH" "${LINUXFAMILY}-${BOARD}-${BRANCH}"
# create patch for manual source changes
@ -92,6 +123,9 @@ function compile_uboot_target() {
fi
fasthash_debug "finish"
finish_fasthash "u-boot" # this reports the final hash and creates git branch to build ID. All modifications commited.
# workaround when two compilers are needed
cross_compile="CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\""
[[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe" # empty parameter is not allowed