mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-30 16:14:01 +00:00
936840415c
More aligned with the naming conventions of xx20 and xx30's extract.sh.
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
function usage() {
|
|
echo -n \
|
|
"Usage: $(basename "$0") path_to_original_rom
|
|
Extract Intel firmware from the original ROM.
|
|
"
|
|
}
|
|
|
|
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
|
if [[ "${1:-}" == "--help" ]]; then
|
|
usage
|
|
else
|
|
if [[ -n "$1" ]]; then
|
|
BLOB_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
COREBOOT_DIR="$(find "${BLOB_DIR}/../../build/x86/" -maxdepth 1 -type d -name 'coreboot-*')"
|
|
|
|
pushd "${COREBOOT_DIR}"
|
|
cd util/me_cleaner
|
|
|
|
# Neutralize and shrink Intel ME.
|
|
# https://github.com/corna/me_cleaner/wiki/External-flashing#neutralize-and-shrink-intel-me-useful-only-for-coreboot
|
|
python me_cleaner.py -S -r -t -d -O out.bin -D ifd_shrinked.bin -M me_shrinked.bin "$1"
|
|
|
|
mv ifd_shrinked.bin "${BLOB_DIR}/ifd.bin"
|
|
mv me_shrinked.bin "${BLOB_DIR}/me.bin"
|
|
rm ./*.bin
|
|
|
|
cd ../ifdtool
|
|
make
|
|
|
|
# Extract the Intel Gigabit Ethernet (GbE) firmware from the
|
|
# original ROM.
|
|
./ifdtool -x "$1"
|
|
|
|
mv flashregion_3_gbe.bin "${BLOB_DIR}/gbe.bin"
|
|
rm ./*.bin
|
|
|
|
popd
|
|
|
|
else
|
|
echo "ERROR: You must supply a path to the original ROM."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|