4 PROGNAME
="$(basename "${0}")"
7 ABUILD
="./util/abuild/abuild"
8 OUTPUT
="coreboot-builds"
11 CPUS
=$
(nproc ||
echo "4")
14 # Extra arguments to pass to abuild
17 # Text STYLE variables
25 The ${PROGNAME} script helps select boards to run test builds on. It searches
26 through all of the mainboard Kconfig files for specified identifiers and then
27 runs abuild on the mainboards it finds.
29 Usage: ${PROGNAME} [options]
32 -a | --abuild "<text>" Specify options to pass to abuild
33 -C | --cpus <num> Specify number of CPUs to use (currently ${CPUS})
34 -K | --kconfig <CONFIG> Search for Kconfig option
35 -n | --no_cros Don't run chromeos builds
36 -h | --help Print usage and exit
37 -D | --debug Print debug information. Use -DD to show all commands
38 -V | --version Print the version and exit
39 --nocolor Don't print color codes
46 local newline
="${3:-0}"
47 if [[ ${newline} == "0" ]]; then
48 printf "${color}%s${NO_COLOR}" "${text}"
50 printf "${color}%s${NO_COLOR}\n" "${text}"
55 _echo_color
"${RED}" "$*" 1 >&2
60 _echo_color
"${BOLD}${GREEN}" "${PROGNAME} version ${VERSION}"
65 cd -- "$1" >/dev
/null
2>&1 ||
exit 1
73 if ! args
="$(getopt -l version,help,debug,nocolor,kconfig:,cpus:,no_cros,abuild: -o a:C:K:nDhV -- "$@
")"; then
92 mblist
=$
(grep -r "$1" src
/mainboard |
grep Kconfig |
sed 's|src/mainboard/||;s|/Kconfig.*||')
93 printf "Adding mainboard for %s\n%s\n" "$1" "${mblist}"
95 mapfile
-t mainboards
<<<"$mblist"
96 UNSORTED
+=(${mainboards[@]})
102 if [ -n "${VERBOSE}" ]; then
118 -V |
--version) exit 0 ;;
124 _echo_error
"Unknown argument '$1'"
133 _echo_error
"Unknown command '$1'"
144 if [[ ! -f "MAINTAINERS" ]]; then
146 _echo_error
"Error: This doesn't look like the coreboot directory."
150 # Sort and dedupe list
151 mapfile
-t MAINBOARDS
<<<"$(printf "%s
\n" "${UNSORTED[@]}" | sort -u)"
153 if [[ "${#MAINBOARDS[@]}" != "0" ]]; then
154 echo "Using ${CPUS} CPUs to build ${#MAINBOARDS[@]} boards:"
155 printf "%s\n" "${MAINBOARDS[@]}"
158 _echo_error
"Error: No mainboards found/specified."
162 for board
in ${MAINBOARDS[*]}; do
166 if ! "${ABUILD}" --exitcode --cpus ${CPUS} --target "${board}" ${ABUILD_ARGS}; then
167 _echo_error "Error
: Non-cros build of
${board} failed.
"
172 if [[ ${NO_CROS} -eq 0 ]]; then
174 if ! "${ABUILD}" --exitcode --cpus ${CPUS} --target "${board}" --chromeos ${ABUILD_ARGS}; then
175 _echo_error
"Error: CrOS build of ${board} failed."
183 echo "Successfully built all boards:"
184 printf "%s\n" "${MAINBOARDS[@]}"