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 <leah@libreboot.org>
fsdg20230625
Leah Rowe 2023-06-24 23:23:16 +01:00
parent 4a49ea3599
commit 941fbcbf1b
6 changed files with 29 additions and 38 deletions

View File

@ -121,7 +121,7 @@ load_config()
fi fi
romdir="bin/${board}" romdir="bin/${board}"
cbfstool="${cbdir}/util/cbfstool/cbfstool" cbfstool="cbutils/${cbtree}/cbfstool"
seavgabiosrom="payload/seabios/seavgabios.bin" seavgabiosrom="payload/seabios/seavgabios.bin"
corebootrom="${cbdir}/build/coreboot.rom" corebootrom="${cbdir}/build/coreboot.rom"
@ -236,9 +236,7 @@ build_dependencies()
if [ ! -d "${cbdir}" ]; then if [ ! -d "${cbdir}" ]; then
./download coreboot ${cbtree} ./download coreboot ${cbtree}
fi fi
if [ ! -f "${cbfstool}" ]; then ./build module cbutils ${cbtree} || exit 1
./build module cbutils ${cbtree} || exit 1
fi
cat version > "${cbdir}/.coreboot-version" cat version > "${cbdir}/.coreboot-version"
build_dependency_crossgcc build_dependency_crossgcc
@ -499,7 +497,6 @@ mkCoreboot()
fi fi
cp "${_cbcfg}" "${cbdir}"/.config cp "${_cbcfg}" "${cbdir}"/.config
./build module cbutils ${cbdir#coreboot/} || exit 1
make -j$(nproc) -BC "${cbdir}" make -j$(nproc) -BC "${cbdir}"
} }

View File

@ -2,7 +2,7 @@
# helper script: clean the dependencies that were built in coreboot # helper script: clean the dependencies that were built in coreboot
# #
# Copyright (C) 2014, 2015, 2016, 2020 Leah Rowe <info@minifree.org> # Copyright (C) 2014-2016, 2020, 2023 Leah Rowe <info@minifree.org>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org> # Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
# #
# This program is free software: you can redistribute it and/or modify # 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" printf "Cleaning the previous build of coreboot and its utilities\n"
rm -Rf cbutils
[ ! -d "coreboot/" ] && exit 0 [ ! -d "coreboot/" ] && exit 0
for cbtree in coreboot/*; do for cbtree in coreboot/*; do
@ -42,9 +44,9 @@ for cbtree in coreboot/*; do
# Clean its utilities as well # Clean its utilities as well
for util in cbfstool ifdtool nvramtool cbmem; do for util in cbfstool ifdtool nvramtool cbmem; do
make -C "${cbtree}/util/${util}/" clean make distclean -C "${cbtree}/util/${util}/"
done done
make -C "${cbtree}/payloads/libpayload/" distclean make distclean -C "${cbtree}/payloads/libpayload/"
done done
printf "\n\n" printf "\n\n"

View File

@ -59,10 +59,17 @@ buildutils() {
./download coreboot $cbtree || return 1 ./download coreboot $cbtree || return 1
fi fi
for util in cbfstool ifdtool; do for util in cbfstool ifdtool; do
utildir="coreboot/${cbtree}/util/${util}/" [ -f "cbutils/${cbtree}/${util}" ] \
make distclean -C "${utildir}" && continue
make -j$(nproc) -C "${utildir}" \ if [ ! -d "cbutils/${cbtree}" ]; then
|| return 1 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 done
} }

View File

@ -24,14 +24,13 @@ set -u -e
projectname="$(cat projectname)" projectname="$(cat projectname)"
version="version-unknown" version="version-unknown"
versiondate="version-date-unknown" versiondate="version-date-unknown"
cbtree="default"
target="" target=""
CONFIG_HAVE_MRC="" CONFIG_HAVE_MRC=""
CONFIG_HAVE_ME_BIN="" CONFIG_HAVE_ME_BIN=""
CONFIG_KBC1126_FIRMWARE="" CONFIG_KBC1126_FIRMWARE=""
ifdtooldir="coreboot/default/util/ifdtool" ifdtool="cbutils/${cbtree}/ifdtool"
ifdtool="${ifdtooldir}/ifdtool" cbfstool="cbutils/${cbtree}/cbfstool"
cbfstooldir="coreboot/default/util/cbfstool"
cbfstool="${cbfstooldir}/cbfstool"
main() main()
{ {
@ -114,12 +113,10 @@ strip_archive()
{ {
romdir=${1} romdir=${1}
if [ ! -d coreboot/default ]; then if [ ! -d coreboot/${cbtree} ]; then
./download coreboot default || exit 1 ./download coreboot ${cbtree} || exit 1
fi
if [ ! -f "${ifdtool}" ] || [ ! -f "${cbfstool}" ]; then
./build module cbutils default || exit 1
fi fi
./build module cbutils ${cbtree} || exit 1
rm -Rf "${romdir}_tmp" # dirty hack, to reduce disk io later rm -Rf "${romdir}_tmp" # dirty hack, to reduce disk io later
# rather than using /tmp, which might not be tmpfs # rather than using /tmp, which might not be tmpfs

View File

@ -17,8 +17,8 @@ releasearchive=""
cbdir="coreboot/default" cbdir="coreboot/default"
cbcfgsdir="resources/coreboot" cbcfgsdir="resources/coreboot"
ifdtool="${cbdir}/util/ifdtool/ifdtool" ifdtool="cbutils/default/ifdtool"
cbfstool="${cbdir}/util/cbfstool/cbfstool" cbfstool="cbutils/default/cbfstool"
nvmutil="util/nvmutil/nvm" nvmutil="util/nvmutil/nvm"
boarddir="" boarddir=""
pciromsdir="pciroms" pciromsdir="pciroms"
@ -140,17 +140,7 @@ build_dependencies()
./download coreboot default ./download coreboot default
fi fi
if [ ! -f "${ifdtool}" ]; then ./build module cbutils default || fail "could not build cbutils"
printf "building ifdtool from coreboot\n"
./build module cbutils default \
|| fail 'could not build ifdtool'
fi
if [ ! -f "${cbfstool}" ]; then
printf "building cbfstool from coreboot\n"
./build module cbutils default \
|| fail 'could not build cbfstool'
fi
./blobutil download ${board} || \ ./blobutil download ${board} || \
fail "Could not download blobs for ${board}" fail "Could not download blobs for ${board}"

View File

@ -41,7 +41,7 @@ _mrc_complete_hash="d18de1e3d52c0815b82ea406ca07897c56c65696"
_mrc_complete="mrc/haswell/mrc.bin" _mrc_complete="mrc/haswell/mrc.bin"
cbdir="coreboot/default" cbdir="coreboot/default"
cbfstool="${cbdir}/util/cbfstool/cbfstool" cbfstool="cbutils/default/cbfstool"
sname="" sname=""
@ -76,9 +76,7 @@ build_dependencies()
if [ ! -d "${cbdir}/" ]; then if [ ! -d "${cbdir}/" ]; then
./download coreboot default || return 1 ./download coreboot default || return 1
fi fi
if [ ! -f "${cbfstool}" ]; then ./build module cbutils default || return 1
./build module cbutils default || return 1
fi
return 0 return 0
} }