mirror of
https://github.com/linuxboot/heads.git
synced 2025-05-28 13:24:14 +00:00
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
function usage() {
|
|
echo -n \
|
|
"Usage: $(basename "$0") path_to_output_directory
|
|
Obtain mrc.bin from a Broadwell Chromebook firmware image.
|
|
"
|
|
}
|
|
|
|
MRC_BIN_HASH="dd05ab481e1fe0ce20ade164cf3dbef3c479592801470e6e79faa17624751343"
|
|
|
|
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
|
if [[ "${1:-}" == "--help" ]]; then
|
|
usage
|
|
else
|
|
if [[ -z "${COREBOOT_DIR}" ]]; then
|
|
echo "ERROR: No COREBOOT_DIR variable defined."
|
|
exit 1
|
|
fi
|
|
|
|
output_dir="$(realpath "${1:-./}")"
|
|
|
|
# Obtain broadwell mrc blob
|
|
if [[ ! -f "${output_dir}/mrc.bin" ]]; then
|
|
pushd "${COREBOOT_DIR}"
|
|
|
|
make -C util/cbfstool
|
|
cd util/chromeos
|
|
./crosfirmware.sh samus
|
|
../cbfstool/cbfstool coreboot-*.bin extract -f mrc.bin -n mrc.bin -r RO_SECTION
|
|
|
|
mv mrc.bin "${output_dir}/mrc.bin"
|
|
|
|
popd
|
|
fi
|
|
|
|
if ! echo "${MRC_BIN_HASH} ${output_dir}/mrc.bin" | sha256sum --check; then
|
|
echo "ERROR: SHA256 checksum for mrc.bin doesn't match."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|