blob: 9dddc440832ea15aee316619630b88021c17c37c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/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"
main()
{
printf "Building coreboot utils\n"
if [ $# -gt 0 ]; then
for board in "${@}"; do
x_ build_for_mainboard ${board}
done
else
for boarddir in config/coreboot/*; do
[ ! -d "${boarddir}" ] && continue
x_ build_for_mainboard ${boarddir##*/}
done
fi
}
build_for_mainboard() {
board="${1}"
[ -d "config/coreboot/${board}" ] || \
err "build_for_mainboard ${board}: boarddir does not exist"
[ -f "config/coreboot/${board}/target.cfg" ] || \
err "build_for_mainboard ${board}: target.cfg does not exist"
tree="undefined"
. "config/coreboot/${board}/target.cfg" # source
[ "${tree}" = "undefined" ] && \
err "build_for_mainboard ${board}: improper tree definition"
buildutils "${tree}"
}
buildutils() {
tree="${1}"
[ -d "coreboot/${tree}/" ] || \
x_ ./update project trees coreboot ${tree}
for util in cbfstool ifdtool; do
[ -f "cbutils/${tree}/${util}" ] && continue
[ -d "cbutils/${tree}" ] || x_ mkdir -p "cbutils/${tree}"
utildir="coreboot/${tree}/util/${util}"
x_ make distclean -C "${utildir}"
x_ make -j$(nproc) -C "${utildir}"
x_ cp "${utildir}/${util}" "cbutils/${tree}"
x_ make distclean -C "${utildir}"
done
}
main $@
|