summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-07 05:03:57 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-07 05:04:55 +0100
commit0ed2ec294bf31d8218e16bcf582031e6b319348f (patch)
treebd2920f1e3cf796176c3e28d00e2e74ab1ae1d27 /script
parentb6d9e6c18ded5659ef5d0ea950133bdb0bb5c772 (diff)
build/coreboot/util: merge to update/project/build
The benefit now is that it can be cleaned. E.g. ./update project build -b coreboot utils ./update project build -b coreboot utils default ./update project build -c coreboot utils ./update project build -c coreboot utils default the update/project/build script checks when arguments are provided after the project name. if the first one is "utils", then it acts in the same way as the old build/coreboot/util script Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script')
-rwxr-xr-xscript/build/coreboot/utils46
-rwxr-xr-xscript/build/fw/coreboot2
-rwxr-xr-xscript/update/project/build30
-rwxr-xr-xscript/update/release/roms2
-rwxr-xr-xscript/update/vendor/download2
-rwxr-xr-xscript/update/vendor/inject2
6 files changed, 32 insertions, 52 deletions
diff --git a/script/build/coreboot/utils b/script/build/coreboot/utils
deleted file mode 100755
index 65c565bb..00000000
--- a/script/build/coreboot/utils
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env sh
-# SPDX-License-Identifier: GPL-3.0-or-later
-# SPDX-FileCopyrightText: 2014-2016,2020,2021,2023 Leah Rowe <leah@libreboot.org>
-
-[ "x${DEBUG+set}" = 'xset' ] && set -v
-set -u -e
-
-. "include/err.sh"
-. "include/option.sh"
-
-main()
-{
- printf "Building coreboot utils\n"
- target="${@}"
- [ $# -gt 0 ] || target=$(listitems config/coreboot) || err "!targets"
- for x in ${target}; do
- x_ build_for_mainboard ${x}
- done
-}
-
-build_for_mainboard() {
- [ -f "config/coreboot/${1}/target.cfg" ] || \
- err "build_for_mainboard ${1}: target.cfg does not exist"
- tree=""
- . "config/coreboot/${1}/target.cfg" # source
- [ -z ${tree} ] && \
- err "build_for_mainboard ${1}: improper tree definition"
- buildutils "${tree}"
-}
-
-buildutils() {
- [ -d "src/coreboot/${1}/" ] || \
- x_ ./update project trees coreboot ${1}
- for util in cbfstool ifdtool; do
- [ -f "cbutils/${1}/${util}" ] && continue
- [ -d "cbutils/${1}" ] || x_ mkdir -p "cbutils/${1}"
-
- utildir="src/coreboot/${1}/util/${util}"
- x_ make distclean -C "${utildir}"
- x_ make -j$(nproc) -C "${utildir}"
- x_ cp "${utildir}/${util}" "cbutils/${1}"
- x_ make distclean -C "${utildir}"
- done
-}
-
-main $@
diff --git a/script/build/fw/coreboot b/script/build/fw/coreboot
index 2f11e725..323fc40d 100755
--- a/script/build/fw/coreboot
+++ b/script/build/fw/coreboot
@@ -125,7 +125,7 @@ prepare_target()
cbfstool="cbutils/${tree}/cbfstool"
cbrom="${cbdir}/build/coreboot.rom"
- x_ ./build coreboot utils ${tree}
+ x_ ./update project build -b coreboot utils ${tree}
build_dependency_seabios
diff --git a/script/update/project/build b/script/update/project/build
index 98d6db9b..43c38141 100755
--- a/script/update/project/build
+++ b/script/update/project/build
@@ -13,7 +13,8 @@ set -u -e
export LOCALVERSION="-${projectname}-${version}"
eval "$(setvars "" arch cfgsdir codedir config config_name crossgcc_ada mode \
- elfdir listfile project romtype target target_dir targets tree cbfstool _f)"
+ elfdir listfile project romtype target target_dir targets tree cbfstool _f \
+ target1)"
tmpclean="$(mktemp -d -t makeclean.XXXXXXXXXX)"
@@ -72,6 +73,9 @@ build_targets()
[ -f "${listfile}" ] || err "list file, ${listfile}, does not exist"
# Build for all targets if no argument is given
+ [ $# -gt 0 ] && target1="${1}"
+ [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && \
+ shift 1
targets=$(listitems "${cfgsdir}") || \
err "Cannot get options for ${cfgsdir}"
[ $# -gt 0 ] && targets=$@
@@ -92,6 +96,7 @@ handle_targets()
x_ handle_defconfig
done
+ [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && return 0
[ -z ${mode} ] || return 0
printf "Done! The files are stored under %s/\n\n" "${elfdir}"
}
@@ -100,6 +105,11 @@ handle_defconfig()
{
handle_src_tree "${target}" || return 0
+ if [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ]; then
+ handle_coreboot_utils "${tree}"
+ return 0
+ fi
+
for y in "${target_dir}/config"/*; do
[ -f "${y}" ] || continue
config="${y}"
@@ -114,6 +124,19 @@ handle_defconfig()
done
}
+handle_coreboot_utils()
+{
+ for util in cbfstool ifdtool; do
+ x_ ./update project build ${_f} "src/coreboot/${1}/util/${util}"
+ [ -z ${mode} ] && [ ! -f "cbutils/${1}/${util}" ] && \
+ x_ mkdir -p "cbutils/${1}" && \
+ x_ cp "src/coreboot/${1}/util/${util}/${util}" \
+ "cbutils/${1}"
+ [ -z ${mode} ] || \
+ x_ rm -Rf "cbutils/${1}"
+ done
+}
+
handle_src_tree()
{
target_dir="${cfgsdir}/${target}"
@@ -148,12 +171,15 @@ handle_src_tree()
touch "${tmpclean}/${tree}"
fi
+ [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && return 0
+
# u-boot and coreboot are both compiled with coreboot's crossgcc
if [ "${project}" = "coreboot" ] || [ "${project}" = "u-boot" ]; then
[ ! -z ${mode} ] || check_cross_compiler || \
err "handle_src_tree ${project}/${target}: crossgcc"
cbfstool="cbutils/${tree}/cbfstool"
- [ -f "${cbfstool}" ] || x_ ./build coreboot utils "${tree}"
+ [ -f "${cbfstool}" ] || \
+ x_ ./update project build -b coreboot utils "${tree}"
fi
}
diff --git a/script/update/release/roms b/script/update/release/roms
index 40697ae3..c34762b0 100755
--- a/script/update/release/roms
+++ b/script/update/release/roms
@@ -102,7 +102,7 @@ strip_archive()
[ -d "src/coreboot/${tree}" ] || \
x_ ./update project trees coreboot ${tree}
- x_ ./build coreboot utils ${tree}
+ x_ ./update project build -b coreboot utils ${tree}
if [ "${microcode_required}" = "n" ]; then
for romfile in "${romdir}"/*.rom; do
diff --git a/script/update/vendor/download b/script/update/vendor/download
index 21b0f7ed..aec59c1f 100755
--- a/script/update/vendor/download
+++ b/script/update/vendor/download
@@ -50,7 +50,7 @@ build_dependencies()
x_ ./update project build -b uefitool
[ -f "${kbc1126_ec_dump}" ] || \
x_ make -C "${cbdir}/util/kbc1126"
- x_ ./build coreboot utils default
+ x_ ./update project build -b coreboot utils default
}
download_vendorfiles()
diff --git a/script/update/vendor/inject b/script/update/vendor/inject
index eac4da37..0b26f81e 100755
--- a/script/update/vendor/inject
+++ b/script/update/vendor/inject
@@ -88,7 +88,7 @@ detect_board()
build_dependencies()
{
[ -d "${cbdir}" ] || x_ ./update project trees coreboot default
- x_ ./build coreboot utils default
+ x_ ./update project build -b coreboot utils default
x_ ./update vendor download ${board}
}