2019-05-02 14:42:31 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-10-13 21:53:41 -06:00
|
|
|
if [ -z "$1" ] || [ ! -e "$1" ] || [ -z "$2" ]
|
2019-05-02 14:42:31 -06:00
|
|
|
then
|
|
|
|
echo "$0 [coreboot.config] [coreboot.rom]" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
CONFIG="$(realpath "$1")"
|
|
|
|
COREBOOT="$(realpath "$2")"
|
|
|
|
|
2023-10-13 21:53:41 -06:00
|
|
|
check_configs() {
|
2021-02-26 12:36:53 -07:00
|
|
|
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}"
|
|
|
|
}
|
|
|
|
|
2019-05-02 14:42:31 -06:00
|
|
|
pushd coreboot >/dev/null
|
|
|
|
make distclean
|
2020-12-04 12:33:06 -07:00
|
|
|
make defconfig KBUILD_DEFCONFIG="${CONFIG}"
|
2021-02-26 12:36:53 -07:00
|
|
|
check_configs "${CONFIG}"
|
|
|
|
|
2019-05-02 14:42:31 -06:00
|
|
|
make --jobs="$(nproc)"
|
|
|
|
cp -v "build/coreboot.rom" "${COREBOOT}"
|
|
|
|
popd >/dev/null
|