From 941fbcbf1b070c5e82c8590e6a4f1afcc0da78a4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 24 Jun 2023 23:23:16 +0100 Subject: run coreboot utils from own directory this means coreboot can now be distcleaned safely, before and after each build of a rom image Signed-off-by: Leah Rowe --- resources/scripts/build/boot/roms_helper | 7 ++----- resources/scripts/build/clean/cbutils | 8 +++++--- resources/scripts/build/module/cbutils | 15 +++++++++++---- resources/scripts/build/release/roms | 15 ++++++--------- 4 files changed, 24 insertions(+), 21 deletions(-) (limited to 'resources/scripts/build') diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index 8f1be3ef..b6051880 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -121,7 +121,7 @@ load_config() fi romdir="bin/${board}" - cbfstool="${cbdir}/util/cbfstool/cbfstool" + cbfstool="cbutils/${cbtree}/cbfstool" seavgabiosrom="payload/seabios/seavgabios.bin" corebootrom="${cbdir}/build/coreboot.rom" @@ -236,9 +236,7 @@ build_dependencies() if [ ! -d "${cbdir}" ]; then ./download coreboot ${cbtree} fi - if [ ! -f "${cbfstool}" ]; then - ./build module cbutils ${cbtree} || exit 1 - fi + ./build module cbutils ${cbtree} || exit 1 cat version > "${cbdir}/.coreboot-version" build_dependency_crossgcc @@ -499,7 +497,6 @@ mkCoreboot() fi cp "${_cbcfg}" "${cbdir}"/.config - ./build module cbutils ${cbdir#coreboot/} || exit 1 make -j$(nproc) -BC "${cbdir}" } diff --git a/resources/scripts/build/clean/cbutils b/resources/scripts/build/clean/cbutils index d129ff6e..54659564 100755 --- a/resources/scripts/build/clean/cbutils +++ b/resources/scripts/build/clean/cbutils @@ -2,7 +2,7 @@ # helper script: clean the dependencies that were built in coreboot # -# Copyright (C) 2014, 2015, 2016, 2020 Leah Rowe +# Copyright (C) 2014-2016, 2020, 2023 Leah Rowe # Copyright (C) 2015 Klemens Nanni # # This program is free software: you can redistribute it and/or modify @@ -28,6 +28,8 @@ set -u -e printf "Cleaning the previous build of coreboot and its utilities\n" +rm -Rf cbutils + [ ! -d "coreboot/" ] && exit 0 for cbtree in coreboot/*; do @@ -42,9 +44,9 @@ for cbtree in coreboot/*; do # Clean its utilities as well for util in cbfstool ifdtool nvramtool cbmem; do - make -C "${cbtree}/util/${util}/" clean + make distclean -C "${cbtree}/util/${util}/" done - make -C "${cbtree}/payloads/libpayload/" distclean + make distclean -C "${cbtree}/payloads/libpayload/" done printf "\n\n" diff --git a/resources/scripts/build/module/cbutils b/resources/scripts/build/module/cbutils index ee6e8692..8d4e2f2f 100755 --- a/resources/scripts/build/module/cbutils +++ b/resources/scripts/build/module/cbutils @@ -59,10 +59,17 @@ buildutils() { ./download coreboot $cbtree || return 1 fi for util in cbfstool ifdtool; do - utildir="coreboot/${cbtree}/util/${util}/" - make distclean -C "${utildir}" - make -j$(nproc) -C "${utildir}" \ - || return 1 + [ -f "cbutils/${cbtree}/${util}" ] \ + && continue + if [ ! -d "cbutils/${cbtree}" ]; then + mkdir -p "cbutils/${cbtree}" || return 1 + fi + + utildir="coreboot/${cbtree}/util/${util}" + make distclean -C "${utildir}" || return 1 + make -j$(nproc) -C "${utildir}" || return 1 + mv "${utildir}/${util}" "cbutils/${cbtree}" || return 1 + make distclean -C "${utildir}" || return 1 done } diff --git a/resources/scripts/build/release/roms b/resources/scripts/build/release/roms index 33200cc4..d81ec09a 100755 --- a/resources/scripts/build/release/roms +++ b/resources/scripts/build/release/roms @@ -24,14 +24,13 @@ set -u -e projectname="$(cat projectname)" version="version-unknown" versiondate="version-date-unknown" +cbtree="default" target="" CONFIG_HAVE_MRC="" CONFIG_HAVE_ME_BIN="" CONFIG_KBC1126_FIRMWARE="" -ifdtooldir="coreboot/default/util/ifdtool" -ifdtool="${ifdtooldir}/ifdtool" -cbfstooldir="coreboot/default/util/cbfstool" -cbfstool="${cbfstooldir}/cbfstool" +ifdtool="cbutils/${cbtree}/ifdtool" +cbfstool="cbutils/${cbtree}/cbfstool" main() { @@ -114,12 +113,10 @@ strip_archive() { romdir=${1} - if [ ! -d coreboot/default ]; then - ./download coreboot default || exit 1 - fi - if [ ! -f "${ifdtool}" ] || [ ! -f "${cbfstool}" ]; then - ./build module cbutils default || exit 1 + if [ ! -d coreboot/${cbtree} ]; then + ./download coreboot ${cbtree} || exit 1 fi + ./build module cbutils ${cbtree} || exit 1 rm -Rf "${romdir}_tmp" # dirty hack, to reduce disk io later # rather than using /tmp, which might not be tmpfs -- cgit v1.2.1