Specify dependencies specifically for building coreboot toolchains in the file, so they are not conflated with the dependencies required for building firmware-open. Remove building the toolchain when building firmware, so that the new script is the single source for building coreboot toolchains. Signed-off-by: Tim Crawford <tcrawford@system76.com>
42 lines
823 B
Bash
Executable File
42 lines
823 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
if [ -z "$1" -o ! -e "$1" -o -z "$2" ]
|
|
then
|
|
echo "$0 [coreboot.config] [coreboot.rom]" >&2
|
|
exit 1
|
|
fi
|
|
CONFIG="$(realpath "$1")"
|
|
COREBOOT="$(realpath "$2")"
|
|
|
|
function check_configs() {
|
|
local defconfig="$1"
|
|
|
|
while read -r line; do
|
|
if [[ "${line}" =~ ^# ]] || [[ -z "${line}" ]]; then
|
|
continue
|
|
fi
|
|
|
|
if [[ "${line}" =~ "=n" ]]; then
|
|
local config="${line//=n/} is not set"
|
|
else
|
|
local config="${line}"
|
|
fi
|
|
|
|
if ! grep -q "${config}" ".config"; then
|
|
echo "expected config not found: '${config}'" >&2
|
|
exit 1
|
|
fi
|
|
done < "${defconfig}"
|
|
}
|
|
|
|
pushd coreboot >/dev/null
|
|
make distclean
|
|
make defconfig KBUILD_DEFCONFIG="${CONFIG}"
|
|
check_configs "${CONFIG}"
|
|
|
|
make --jobs="$(nproc)"
|
|
cp -v "build/coreboot.rom" "${COREBOOT}"
|
|
popd >/dev/null
|