blob: ad771c03b18c839f22f4fb2ea145ca5a116032fe (
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
|
#!/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() {
[ -d "config/coreboot/${1}" ] || \
err "build_for_mainboard ${1}: board dir does not exist"
[ -f "config/coreboot/${1}/target.cfg" ] || \
err "build_for_mainboard ${1}: target.cfg does not exist"
tree="undefined"
. "config/coreboot/${1}/target.cfg" # source
[ "${tree}" = "undefined" ] && \
err "build_for_mainboard ${1}: improper tree definition"
buildutils "${tree}"
}
buildutils() {
[ -d "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="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 $@
|