mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-19 21:17:55 +00:00
Make T440p scripts work with relative paths
Because we're using pushd/popd to make the Coreboot util invocation cleaner, we need to use realpath so that the scripts will work with any user input.
This commit is contained in:
parent
3efec15dc7
commit
63eab714e5
@ -20,21 +20,24 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$1/mrc.bin" ]]; then
|
||||
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}"
|
||||
|
||||
# https://doc.coreboot.org/northbridge/intel/haswell/mrc.bin.html#obtaining-mrc-bin
|
||||
make -C util/cbfstool
|
||||
cd util/chromeos
|
||||
./crosfirmware.sh peppy
|
||||
../cbfstool/cbfstool coreboot-*.bin extract -f mrc.bin -n mrc.bin -r RO_SECTION
|
||||
|
||||
popd
|
||||
mv mrc.bin "${output_dir}/mrc.bin"
|
||||
|
||||
mv "${COREBOOT_DIR}/util/chromeos/mrc.bin" "$1/mrc.bin"
|
||||
popd
|
||||
fi
|
||||
|
||||
if ! echo "${MRC_BIN_HASH} $1/mrc.bin" | sha256sum --check; then
|
||||
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
|
||||
|
@ -20,7 +20,11 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$1/me.bin" ]]; then
|
||||
output_dir="$(realpath "${1:-./}")"
|
||||
|
||||
if [[ ! -f "${output_dir}/me.bin" ]]; then
|
||||
# Unpack Lenovo's Windows installer into a temporary directory and
|
||||
# extract the Intel ME blob.
|
||||
pushd "$(mktemp -d)"
|
||||
|
||||
curl -O https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe
|
||||
@ -30,22 +34,22 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
|
||||
popd
|
||||
|
||||
pushd "${COREBOOT_DIR}/util/me_cleaner"
|
||||
|
||||
# Neutralize and shrink Intel ME. Note that this doesn't include
|
||||
# --soft-disable to set the "ME Disable" or "ME Disable B" (e.g., High
|
||||
# Assurance Program) bits, as they are defined within the Flash
|
||||
# --soft-disable to set the "ME Disable" or "ME Disable B" (e.g.,
|
||||
# High Assurance Program) bits, as they are defined within the Flash
|
||||
# Descriptor.
|
||||
# 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 -r -t -O me_shrinked.bin ME9.1_5M_Production.bin
|
||||
|
||||
popd
|
||||
mv me_shrinked.bin "${output_dir}/me.bin"
|
||||
rm ./*.bin
|
||||
|
||||
mv "${COREBOOT_DIR}/util/me_cleaner/me_shrinked.bin" "$1/me.bin"
|
||||
rm "${COREBOOT_DIR}/util/me_cleaner/"*.bin
|
||||
popd
|
||||
fi
|
||||
|
||||
if ! echo "${ME_BIN_HASH} $1/me.bin" | sha256sum --check; then
|
||||
if ! echo "${ME_BIN_HASH} ${output_dir}/me.bin" | sha256sum --check; then
|
||||
echo "ERROR: SHA256 checksum for me.bin doesn't match."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -18,33 +18,31 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
pushd "${COREBOOT_DIR}"
|
||||
original_rom="$(realpath "$1")"
|
||||
output_dir="$(realpath "${2:-./}")"
|
||||
|
||||
cd util/me_cleaner
|
||||
# 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"
|
||||
|
||||
# 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"
|
||||
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 "$2/ifd.bin"
|
||||
mv me_shrinked.bin "$2/me.bin"
|
||||
rm ./*.bin
|
||||
mv ifd_shrinked.bin "${output_dir}/ifd.bin"
|
||||
mv me_shrinked.bin "${output_dir}/me.bin"
|
||||
rm ./*.bin
|
||||
|
||||
cd ../ifdtool
|
||||
make
|
||||
popd
|
||||
|
||||
# Extract the Intel Gigabit Ethernet (GbE) firmware from the
|
||||
# original ROM.
|
||||
./ifdtool -x "$1"
|
||||
# Extract the Intel Gigabit Ethernet (GbE) firmware.
|
||||
pushd "${COREBOOT_DIR}/util/ifdtool"
|
||||
|
||||
mv flashregion_3_gbe.bin "$2/gbe.bin"
|
||||
rm ./*.bin
|
||||
make
|
||||
./ifdtool -x "${original_rom}"
|
||||
|
||||
popd
|
||||
else
|
||||
echo "ERROR: You must supply a path to the original ROM."
|
||||
exit 1
|
||||
fi
|
||||
mv flashregion_3_gbe.bin "${output_dir}/gbe.bin"
|
||||
rm ./*.bin
|
||||
|
||||
popd
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user