mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
Make T440p scripts use Coreboot from environment
Before, the T440p blob scripts would look for Coreboot using the find command. Now, we require the user to specify the path to Coreboot in the COREBOOT_DIR environment variable. Also, add an output directory argument to each script. These changes will make it easier to integrate with the Heads build system and CI.
This commit is contained in:
parent
e6c34bda55
commit
144f9c147e
@ -4,7 +4,7 @@ set -e
|
||||
|
||||
function usage() {
|
||||
echo -n \
|
||||
"Usage: $(basename "$0")
|
||||
"Usage: $(basename "$0") path_to_output_directory
|
||||
Obtain mrc.bin from a Haswell Chromebook firmware image.
|
||||
"
|
||||
}
|
||||
@ -15,24 +15,28 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
if [[ "${1:-}" == "--help" ]]; then
|
||||
usage
|
||||
else
|
||||
BLOB_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
COREBOOT_DIR="$(find "${BLOB_DIR}/../../build/x86/" -maxdepth 1 -type d -name 'coreboot-*')"
|
||||
|
||||
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
|
||||
|
||||
if ! echo "${MRC_BIN_HASH} mrc.bin" | sha256sum --check; then
|
||||
echo "SHA256 checksum for mrc.bin doesn't match."
|
||||
if [[ -z "${COREBOOT_DIR}" ]]; then
|
||||
echo "ERROR: No COREBOOT_DIR variable defined."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
popd
|
||||
if [[ ! -f "$1/mrc.bin" ]]; then
|
||||
pushd "${COREBOOT_DIR}"
|
||||
|
||||
mv "${COREBOOT_DIR}/util/chromeos/mrc.bin" "$(dirname "$0")/mrc.bin"
|
||||
# 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 "${COREBOOT_DIR}/util/chromeos/mrc.bin" "$1/mrc.bin"
|
||||
fi
|
||||
|
||||
if ! echo "${MRC_BIN_HASH} $1/mrc.bin" | sha256sum --check; then
|
||||
echo "ERROR: SHA256 checksum for mrc.bin doesn't match."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -4,7 +4,7 @@ set -e
|
||||
|
||||
function usage() {
|
||||
echo -n \
|
||||
"Usage: $(basename "$0")
|
||||
"Usage: $(basename "$0") path_to_output_directory
|
||||
Download Intel ME firmware from Lenovo, neutralize, and shrink.
|
||||
"
|
||||
}
|
||||
@ -15,34 +15,38 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
if [[ "${1:-}" == "--help" ]]; then
|
||||
usage
|
||||
else
|
||||
BLOB_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
COREBOOT_DIR="$(find "${BLOB_DIR}/../../build/x86/" -maxdepth 1 -type d -name 'coreboot-*')"
|
||||
if [[ -z "${COREBOOT_DIR}" ]]; then
|
||||
echo "ERROR: No COREBOOT_DIR variable defined."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd "$(mktemp -d)"
|
||||
if [[ ! -f "$1/me.bin" ]]; then
|
||||
pushd "$(mktemp -d)"
|
||||
|
||||
curl -O https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe
|
||||
innoextract glrg22ww.exe
|
||||
curl -O https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe
|
||||
innoextract glrg22ww.exe
|
||||
|
||||
mv app/ME9.1_5M_Production.bin "${COREBOOT_DIR}/util/me_cleaner"
|
||||
mv app/ME9.1_5M_Production.bin "${COREBOOT_DIR}/util/me_cleaner"
|
||||
|
||||
popd
|
||||
popd
|
||||
|
||||
pushd "${COREBOOT_DIR}/util/me_cleaner"
|
||||
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
|
||||
# Descriptor.
|
||||
# https://github.com/corna/me_cleaner/wiki/External-flashing#neutralize-and-shrink-intel-me-useful-only-for-coreboot
|
||||
python me_cleaner.py -r -t -O me_shrinked.bin ME9.1_5M_Production.bin
|
||||
# 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
|
||||
# Descriptor.
|
||||
# https://github.com/corna/me_cleaner/wiki/External-flashing#neutralize-and-shrink-intel-me-useful-only-for-coreboot
|
||||
python me_cleaner.py -r -t -O me_shrinked.bin ME9.1_5M_Production.bin
|
||||
|
||||
mv me_shrinked.bin "${BLOB_DIR}/me.bin"
|
||||
rm ./*.bin
|
||||
popd
|
||||
|
||||
popd
|
||||
mv "${COREBOOT_DIR}/util/me_cleaner/me_shrinked.bin" "$1/me.bin"
|
||||
rm "${COREBOOT_DIR}/util/me_cleaner/"*.bin
|
||||
fi
|
||||
|
||||
if ! echo "${ME_BIN_HASH} ${BLOB_DIR}/me.bin" | sha256sum --check; then
|
||||
echo "SHA256 checksum for me.bin doesn't match."
|
||||
if ! echo "${ME_BIN_HASH} $1/me.bin" | sha256sum --check; then
|
||||
echo "ERROR: SHA256 checksum for me.bin doesn't match."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -4,7 +4,7 @@ set -e
|
||||
|
||||
function usage() {
|
||||
echo -n \
|
||||
"Usage: $(basename "$0") path_to_original_rom
|
||||
"Usage: $(basename "$0") path_to_original_rom path_to_output_directory
|
||||
Extract Intel firmware from the original ROM.
|
||||
"
|
||||
}
|
||||
@ -13,19 +13,22 @@ 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-*')"
|
||||
if [[ -z "${COREBOOT_DIR}" ]]; then
|
||||
echo "ERROR: No COREBOOT_DIR variable defined."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
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"
|
||||
mv ifd_shrinked.bin "$2/ifd.bin"
|
||||
mv me_shrinked.bin "$2/me.bin"
|
||||
rm ./*.bin
|
||||
|
||||
cd ../ifdtool
|
||||
@ -35,11 +38,10 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
# original ROM.
|
||||
./ifdtool -x "$1"
|
||||
|
||||
mv flashregion_3_gbe.bin "${BLOB_DIR}/gbe.bin"
|
||||
mv flashregion_3_gbe.bin "$2/gbe.bin"
|
||||
rm ./*.bin
|
||||
|
||||
popd
|
||||
|
||||
else
|
||||
echo "ERROR: You must supply a path to the original ROM."
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user