mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-22 22:32:23 +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>
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
function usage() {
|
|
echo -n \
|
|
"Usage: $(basename "$0") path_to_original_rom path_to_output_directory
|
|
Extract Intel firmware from the original ROM.
|
|
"
|
|
}
|
|
|
|
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
|
|
|
|
original_rom="$(realpath "$1")"
|
|
output_dir="$(realpath "${2:-./}")"
|
|
|
|
# Neutralize Intel ME and resize the Intel Flash Descriptor (IFD)
|
|
# layout.
|
|
# https://github.com/corna/me_cleaner/wiki/External-flashing#neutralize-and-shrink-intel-me-useful-only-for-coreboot
|
|
pushd "${COREBOOT_DIR}/util/me_cleaner"
|
|
|
|
python me_cleaner.py -S -r -t -d -O out.bin -D ifd_shrinked.bin -M me_shrinked.bin "${original_rom}"
|
|
|
|
mv ifd_shrinked.bin "${output_dir}/ifd.bin"
|
|
mv me_shrinked.bin "${output_dir}/me.bin"
|
|
rm ./*.bin
|
|
|
|
popd
|
|
|
|
# Extract the Intel Gigabit Ethernet (GbE) firmware.
|
|
pushd "${COREBOOT_DIR}/util/ifdtool"
|
|
|
|
make
|
|
./ifdtool -x "${original_rom}"
|
|
|
|
mv flashregion_3_gbe.bin "${output_dir}/gbe.bin"
|
|
rm ./*.bin
|
|
|
|
popd
|
|
fi
|
|
fi
|