summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rwxr-xr-xresources/scripts/build/module/cbutils66
1 files changed, 30 insertions, 36 deletions
diff --git a/resources/scripts/build/module/cbutils b/resources/scripts/build/module/cbutils
index a24cac02..487e4fd9 100755
--- a/resources/scripts/build/module/cbutils
+++ b/resources/scripts/build/module/cbutils
@@ -18,40 +18,31 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# This script assumes that the current working directory is the root
-
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
printf "Building coreboot utils\n"
-buildutils() {
- cbtree="${1}"
- if [ ! -d "coreboot/${cbtree}/" ]; then
- ./download coreboot $cbtree || return 1
- fi
- if [ ! -d "coreboot/${cbtree}/" ]; then
- printf "build/cbutils: coreboot/%s not found. Exiting\n" \
- "${cbtree}"
- return 1
+main()
+{
+ if [ $# -gt 0 ]; then
+ for board in "${@}"; do
+ buildfromboardconfig ${board} || exit 1
+ done
+ else
+ for boarddir in resources/coreboot/*; do
+ [ ! -d "${boarddir}" ] && continue
+ buildfromboardconfig ${boarddir##*/} || exit 1
+ done
fi
- for util in cbfstool ifdtool; do
- (
- cd "coreboot/${cbtree}/util/${util}/"
- make -j$(nproc) || return 1
- )
- done
- return 0
}
buildfromboardconfig() {
board="${1}"
- if [ ! -d "resources/coreboot/${board}" ]; then
+ [ ! -d "resources/coreboot/${board}" ] && \
continue
- fi
- if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
+ [ ! -f "resources/coreboot/${board}/board.cfg" ] && \
continue
- fi
cbtree="undefined"
. "resources/coreboot/${board}/board.cfg" # source
if [ "${cbtree}" = "undefined" ]; then
@@ -60,21 +51,24 @@ buildfromboardconfig() {
return 1
fi
buildutils "${cbtree}" || return 1
- return 0
}
-if [ $# -gt 0 ]; then
- for board in "${@}"; do
- buildfromboardconfig ${board} || exit 1
- done
-else
- for boarddir in resources/coreboot/*; do
- if [ ! -d "${boarddir}" ]; then
- continue
- fi
- buildfromboardconfig ${boarddir##*/} || exit 1
+buildutils() {
+ cbtree="${1}"
+ if [ ! -d "coreboot/${cbtree}/" ]; then
+ ./download coreboot $cbtree || return 1
+ fi
+ if [ ! -d "coreboot/${cbtree}/" ]; then
+ printf "build/cbutils: coreboot/%s not found. Exiting\n" \
+ "${cbtree}"
+ return 1
+ fi
+ for util in cbfstool ifdtool; do
+ (
+ cd "coreboot/${cbtree}/util/${util}/"
+ make -j$(nproc) || return 1
+ )
done
-fi
+}
-printf "\n\n"
-exit 0
+main $@