2023-06-13 11:09:01 +00:00
|
|
|
#!/usr/bin/env sh
|
2023-09-25 01:19:30 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2023-09-25 01:27:26 +00:00
|
|
|
# SPDX-FileCopyrightText: 2014-2016,2020,2021,2023 Leah Rowe <leah@libreboot.org>
|
2021-05-18 12:56:12 +00:00
|
|
|
|
|
|
|
[ "x${DEBUG+set}" = 'xset' ] && set -v
|
|
|
|
set -u -e
|
|
|
|
|
2023-08-23 23:30:07 +00:00
|
|
|
. "include/err.sh"
|
2023-10-02 03:12:30 +00:00
|
|
|
. "include/option.sh"
|
2021-05-18 12:56:12 +00:00
|
|
|
|
2023-05-20 16:53:03 +00:00
|
|
|
main()
|
|
|
|
{
|
2023-08-23 23:30:07 +00:00
|
|
|
printf "Building coreboot utils\n"
|
2023-10-02 03:12:30 +00:00
|
|
|
target="${@}"
|
|
|
|
[ $# -gt 0 ] || target=$(listitems config/coreboot) || err "!targets"
|
|
|
|
for x in ${target}; do
|
|
|
|
x_ build_for_mainboard ${x}
|
|
|
|
done
|
2021-05-18 12:56:12 +00:00
|
|
|
}
|
|
|
|
|
2023-05-20 17:00:31 +00:00
|
|
|
build_for_mainboard() {
|
2023-10-02 03:12:30 +00:00
|
|
|
[ -f "config/coreboot/${1}/target.cfg" ] || \
|
|
|
|
err "build_for_mainboard ${1}: target.cfg does not exist"
|
2023-10-05 21:16:07 +00:00
|
|
|
tree=""
|
2023-10-02 03:12:30 +00:00
|
|
|
. "config/coreboot/${1}/target.cfg" # source
|
2023-10-05 21:16:07 +00:00
|
|
|
[ -z ${tree} ] && \
|
2023-10-02 03:12:30 +00:00
|
|
|
err "build_for_mainboard ${1}: improper tree definition"
|
2023-08-23 23:30:07 +00:00
|
|
|
buildutils "${tree}"
|
2021-05-18 12:56:12 +00:00
|
|
|
}
|
|
|
|
|
2023-05-20 16:53:03 +00:00
|
|
|
buildutils() {
|
2023-10-06 21:59:36 +00:00
|
|
|
[ -d "src/coreboot/${1}/" ] || \
|
2023-10-02 03:12:30 +00:00
|
|
|
x_ ./update project trees coreboot ${1}
|
2023-06-13 11:09:01 +00:00
|
|
|
for util in cbfstool ifdtool; do
|
2023-10-02 03:12:30 +00:00
|
|
|
[ -f "cbutils/${1}/${util}" ] && continue
|
|
|
|
[ -d "cbutils/${1}" ] || x_ mkdir -p "cbutils/${1}"
|
2023-06-24 22:23:16 +00:00
|
|
|
|
2023-10-06 21:59:36 +00:00
|
|
|
utildir="src/coreboot/${1}/util/${util}"
|
2023-10-01 05:33:43 +00:00
|
|
|
x_ make distclean -C "${utildir}"
|
|
|
|
x_ make -j$(nproc) -C "${utildir}"
|
2023-10-02 03:12:30 +00:00
|
|
|
x_ cp "${utildir}/${util}" "cbutils/${1}"
|
2023-10-01 05:33:43 +00:00
|
|
|
x_ make distclean -C "${utildir}"
|
2023-05-20 15:12:25 +00:00
|
|
|
done
|
2023-05-20 16:53:03 +00:00
|
|
|
}
|
2021-05-18 12:56:12 +00:00
|
|
|
|
2023-05-20 16:53:03 +00:00
|
|
|
main $@
|