summaryrefslogtreecommitdiff
path: root/resources/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts')
-rwxr-xr-xresources/scripts/build/boot/roms23
-rwxr-xr-xresources/scripts/build/command/options31
-rwxr-xr-xresources/scripts/handle/make/config10
-rwxr-xr-xresources/scripts/update/blobs/inject13
4 files changed, 43 insertions, 34 deletions
diff --git a/resources/scripts/build/boot/roms b/resources/scripts/build/boot/roms
index 0aedfdb1..a19d9445 100755
--- a/resources/scripts/build/boot/roms
+++ b/resources/scripts/build/boot/roms
@@ -42,7 +42,8 @@ main()
firstoption="${1}"
[ "${firstoption}" = "help" ] && usage && exit 0
- [ "${firstoption}" = "list" ] && listboards && exit 0
+ [ "${firstoption}" = "list" ] && \
+ ./build command options resources/coreboot && exit 0
while [ $# -gt 0 ]; do
case ${1} in
@@ -65,8 +66,8 @@ main()
printf "Building %s ROM images\n" "${projectname}"
if [ "${firstoption}" = "all" ]; then
- for boardname in $(listboards); do
- buildrom "${boardname}" || err "build/roms (1): error"
+ for target in $(./build command options resources/coreboot); do
+ buildrom "${target}" || err "build/roms (1): error"
done
else
for board in ${boards}; do
@@ -80,7 +81,7 @@ main()
usage()
{
cat <<- EOF
- USAGE: ./build boot roms boardname
+ USAGE: ./build boot roms target
To build *all* boards, do this: ./build boot roms all
To list *all* boards, do this: ./build boot roms list
@@ -94,23 +95,13 @@ usage()
./build boot roms x200_8mb x60
./build boot roms x60 -p grub -d corebootfb -k usqwerty
- possible values for 'boardname':
- $(listboards)
+ possible values for 'target':
+ $(./build command options "resources/coreboot")
Refer to the ${projectname} documentation for more information.
EOF
}
-listboards()
-{
- for boarddir in resources/coreboot/*; do
- [ -d "${boarddir}" ] || continue
- board="${boarddir##resources/coreboot/}"
- board="${board%/}"
- printf '%s\n' "${board##*/}"
- done
-}
-
# Build ROM images for supported boards
buildrom() {
[ -d "resources/coreboot/${1}/" ] || \
diff --git a/resources/scripts/build/command/options b/resources/scripts/build/command/options
new file mode 100755
index 00000000..84a9a3fb
--- /dev/null
+++ b/resources/scripts/build/command/options
@@ -0,0 +1,31 @@
+#!/usr/bin/env sh
+
+# Copyright (c) 2023 Leah Rowe <info@minifree.org>
+# SPDX-License-Identifier: MIT
+
+. "include/err.sh"
+
+items=1
+
+main()
+{
+ [ $# -gt 0 ] || \
+ err "No argument given"
+ listitems "${1}" || err "No items present under: ${1}"
+}
+
+listitems()
+{
+ [ -d "${1}" ] || \
+ err "Directory not does exist: ${1}"
+ for x in "${1}/"*; do
+ # -e used because this is for files *or* directories
+ [ -e "${x}" ] || continue
+ [ "${x##*/}" = "build.list" ] && continue
+ printf "%s\n" "${x##*/}"
+ items=0
+ done
+ return ${items}
+}
+
+main $@
diff --git a/resources/scripts/handle/make/config b/resources/scripts/handle/make/config
index 1ab0864b..0c60285f 100755
--- a/resources/scripts/handle/make/config
+++ b/resources/scripts/handle/make/config
@@ -76,17 +76,13 @@ main()
[ -f "${listfile}" ] || fail "list file, ${listfile}, does not exist"
# Build for all targets if no argument is given
- if [ "$#" -eq 0 ]; then
- for target_dir in "${cfgsdir}"/*; do
- [ -d "${target_dir}/config/" ] || continue
- set -- "$@" "${target_dir#${cfgsdir}/}"
- done
- fi
+ targets=$(./build command options "${cfgsdir}")
+ [ $# -gt 0 ] && targets=$@
[ -d "${elfdir}" ] || [ "${mode}" != "all" ] || \
mkdir -p "${elfdir}/" || fail "can't create directory ${elfdir}"
- for x in "$@"; do
+ for x in ${targets}; do
target="${x}"
printf "Running 'make %s' for project '%s, target '%s''\n" \
"${mode}" "${project}" "${target}"
diff --git a/resources/scripts/update/blobs/inject b/resources/scripts/update/blobs/inject
index 3cdf38c6..bc6b55c9 100755
--- a/resources/scripts/update/blobs/inject
+++ b/resources/scripts/update/blobs/inject
@@ -44,7 +44,8 @@ main()
sname="${0}"
[ $# -lt 1 ] && err "No options specified."
- [ "${1}" = "listboards" ] && listboards && exit 0
+ [ "${1}" = "listboards" ] && \
+ ./build command options resources/coreboot && exit 0
archive="${1}"
@@ -345,16 +346,6 @@ modify_gbe()
rm -f "${_gbe_tmp}"
}
-listboards()
-{
- for boarddir in "${cbcfgsdir}"/*; do
- [ -d "${boarddir}" ] || continue
- board="${boarddir##${cbcfgsdir}/}"
- board="${board%/}"
- printf "%s\n" "${board##*/}"
- done
-}
-
usage()
{
cat <<- EOF