mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-19 21:17:55 +00:00
Incorporate COREBOOT_DIr mod and VSCC optioanl setting
This commit is contained in:
parent
668d7739ce
commit
b64077fac6
@ -2,26 +2,40 @@
|
||||
# P7 ASUS
|
||||
|
||||
function printusage {
|
||||
echo "Usage: $0 -m <me_cleaner>(optional)"
|
||||
echo "Usage: $0 -m <me_cleaner> -c <COREBOOT_DIR>"
|
||||
}
|
||||
|
||||
BLOBDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
BLOB_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ "$#" -eq 0 ]; then printusage; fi
|
||||
|
||||
while getopts ":m:i:" opt; do
|
||||
while getopts ":m:c:" opt; do
|
||||
case $opt in
|
||||
m)
|
||||
if [ -x "$OPTARG" ]; then
|
||||
MECLEAN="$OPTARG"
|
||||
fi
|
||||
;;
|
||||
c)
|
||||
if [ -x "$OPTARG" ]; then
|
||||
COREBOOT_DIR="$OPTARG"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
|
||||
if [[ -z "${COREBOOT_DIR}" ]]; then
|
||||
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, and no coreboot path found automagically."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$MECLEAN" ]; then
|
||||
MECLEAN=`command -v $BLOBDIR/../../build/x86/coreboot-*/util/me_cleaner/me_cleaner.py 2>&1|head -n1`
|
||||
MECLEAN=`command -v $COREBOOT_DIR/util/me_cleaner/me_cleaner.py 2>&1|head -n1`
|
||||
if [ -z "$MECLEAN" ]; then
|
||||
echo "me_cleaner.py required but not found or specified with -m. Aborting."
|
||||
exit 1;
|
||||
@ -30,8 +44,8 @@ fi
|
||||
|
||||
CAP_ZIP_SHA256SUM="baf7f513227542c507e46735334663f63a0df5be9f6632d7b0f0cca5d3b9f980 P8Z77-M-PRO-ASUS-2203.zip"
|
||||
CAP_FILE_SHA256SUM="d9bf292778655d4e20f5db2154cd6a2229e42b60ce670a68d759f1dac757aaf0 P8Z77-M-PRO-ASUS-2203.CAP"
|
||||
FINAL_IFD_SHA256SUM="092caeee117de27c0eb30587defcb6449a33c7c325b6f3c47b5a7a79670b5c3f $BLOBDIR/ifd.bin"
|
||||
FINAL_ME_SHA256SUM="8dda1e8360fbb2da05bfcd187f6e7b8a272a67d66bc0074bbfd1410eb35e3e17 $BLOBDIR/me.bin"
|
||||
FINAL_IFD_SHA256SUM="702570d59c11b9b70ab9d54b26ff0906a07edf15eebe63f40bcecb04b955969f ifd.bin"
|
||||
FINAL_ME_SHA256SUM="8dda1e8360fbb2da05bfcd187f6e7b8a272a67d66bc0074bbfd1410eb35e3e17 me.bin"
|
||||
ZIPURL="https://dlcdnets.asus.com/pub/ASUS/mb/LGA1155/P8Z77-M_PRO/P8Z77-M-PRO-ASUS-2203.zip"
|
||||
|
||||
ZIPFILENAME=`echo $ZIPURL | sed 's/.*\///'`
|
||||
@ -56,16 +70,21 @@ echo "### extracing BIOS from Capsule"
|
||||
dd bs=1024 skip=2 if=P8Z77-M-PRO-ASUS-2203.CAP of=P8Z77-M-PRO-ASUS-2203.ROM || { echo "Failed to de-cap the ROM..." && exit 1; }
|
||||
|
||||
echo "### Applying me_cleaner to neuter and truncate."
|
||||
$MECLEAN -S -r -t -d -O /tmp/unneeded.bin -D "$BLOBDIR/ifd.bin" -M "$BLOBDIR/me.bin" P8Z77-M-PRO-ASUS-2203.ROM
|
||||
$MECLEAN -S -r -t -d -O /tmp/unneeded.bin -D "ifd.bin" -M "me.bin" P8Z77-M-PRO-ASUS-2203.ROM
|
||||
|
||||
echo "### Modifying VSCC length and identifiers"
|
||||
|
||||
printf '\x00' | dd of="$BLOBDIR/ifd.bin" bs=1 seek=3837 count=1 conv=notrunc
|
||||
printf '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' | dd of="$BLOBDIR/ifd.bin" bs=1 seek=3568 count=32 conv=notrunc
|
||||
|
||||
echo "### Verifying expected hashes"
|
||||
if [[ "${CONFIG_ZERO_IFD_VSCC}" =~ ^(Y|y)$ ]]; then
|
||||
FINAL_IFD_SHA256SUM="092caeee117de27c0eb30587defcb6449a33c7c325b6f3c47b5a7a79670b5c3f ifd.bin"
|
||||
echo "### Modifying VSCC length and identifiers"
|
||||
printf '\x00' | dd of=ifd.bin bs=1 seek=3837 count=1 conv=notrunc
|
||||
printf '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' | dd of=ifd.bin bs=1 seek=3568 count=32 conv=notrunc
|
||||
echo "### Verifying expected hashes"
|
||||
else
|
||||
echo "### Skipping VSCC modification by config"
|
||||
fi
|
||||
echo "$FINAL_IFD_SHA256SUM" | sha256sum --check || { echo "Failed sha256sum verification on generated IFD bin..." && exit 1; }
|
||||
mv ifd.bin $BLOB_DIR/ifd.bin
|
||||
echo "$FINAL_ME_SHA256SUM" | sha256sum --check || { echo "Failed sha256sum verification on generated ME binary..." && exit 1; }
|
||||
mv me.bin $BLOB_DIR/me.bin
|
||||
|
||||
echo "###Cleaning up..."
|
||||
cd -
|
||||
|
@ -71,6 +71,8 @@ export CONFIG_BOOT_KERNEL_REMOVE="quiet"
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_BOARD_NAME="P8Z77-M PRO"
|
||||
export CONFIG_FLASHROM_OPTIONS="-p internal"
|
||||
#Set this option to zero out the VSCC table https://github.com/osresearch/heads/pull/1358#discussion_r1153251399
|
||||
export CONFIG_ZERO_IFD_VSCC=y
|
||||
|
||||
# Make the Coreboot build depend on the following 3rd party blobs:
|
||||
$(build)/coreboot-$(CONFIG_COREBOOT_VERSION)/$(BOARD)/.build: \
|
||||
@ -79,3 +81,7 @@ $(build)/coreboot-$(CONFIG_COREBOOT_VERSION)/$(BOARD)/.build: \
|
||||
$(pwd)/blobs/p8z77-m_pro/me.bin:
|
||||
COREBOOT_DIR="$(build)/$(coreboot_base_dir)" \
|
||||
$(pwd)/blobs/p8z77-m_pro/download_BIOS_clean.sh
|
||||
|
||||
$(pwd)/blobs/p8z77-m_pro/ifd.bin:
|
||||
COREBOOT_DIR="$(build)/$(coreboot_base_dir)" \
|
||||
$(pwd)/blobs/p8z77-m_pro/download_BIOS_clean.sh
|
||||
|
Loading…
Reference in New Issue
Block a user