mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-24 15:16:42 +00:00
d396236a83
Remove hard coded paths from shebangs and other references because they do not play well in nix-land. Either use /usr/bin/env to do runtime PATH based lookup or avoid absolute paths so PATH look up happens instead. Signed-off-by: Thierry Laurion <insurgo@riseup.net> Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev> Signed-off-by: Thierry Laurion <insurgo@riseup.net>
46 lines
1.2 KiB
Bash
Executable File
46 lines
1.2 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 Haswell Chromebook firmware image.
|
|
"
|
|
}
|
|
|
|
MRC_BIN_HASH="d368ba45096a3b5490ed27014e1f9004bc363434ffdce0c368c08a89c4746722"
|
|
|
|
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 mrc.bin from a Haswell Chromebook firmware image.
|
|
# https://doc.coreboot.org/northbridge/intel/haswell/mrc.bin.html#obtaining-mrc-bin
|
|
if [[ ! -f "${output_dir}/mrc.bin" ]]; then
|
|
pushd "${COREBOOT_DIR}"
|
|
|
|
make -C util/cbfstool
|
|
cd util/chromeos
|
|
./crosfirmware.sh peppy
|
|
../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
|