forked from linuxboot/heads
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xx30 blobs: copy script from linuxboot#877 to test on x230...
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
function printusage { | ||
echo "Usage: $0 -f <romdump> -m <me_cleaner>(optional) -i <ifdtool>(optional)" | ||
exit 0 | ||
} | ||
|
||
BLOBDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
if [ "$#" -eq 0 ]; then printusage; fi | ||
|
||
while getopts ":f:m:i:" opt; do | ||
case $opt in | ||
f) | ||
FILE="$OPTARG" | ||
;; | ||
m) | ||
if [ -x "$OPTARG" ]; then | ||
MECLEAN="$OPTARG" | ||
fi | ||
;; | ||
i) | ||
if [ -x "$OPTARG" ]; then | ||
IFDTOOL="$OPTARG" | ||
fi | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$MECLEAN" ]; then | ||
MECLEAN=`command -v $BLOBDIR/../../build/coreboot-*/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; | ||
fi | ||
fi | ||
|
||
if [ -z "$IFDTOOL" ]; then | ||
IFDTOOL=`command -v $BLOBDIR/../../build/coreboot-*/util/ifdtool/ifdtool 2>&1|head -n1` | ||
if [ -z "$IFDTOOL" ]; then | ||
echo "ifdtool required but not found or specified with -m. Aborting." | ||
exit 1; | ||
fi | ||
fi | ||
|
||
echo "FILE: $FILE" | ||
echo "ME: $MECLEAN" | ||
echo "IFD: $IFDTOOL" | ||
|
||
bioscopy=$(mktemp) | ||
extractdir=$(mktemp -d) | ||
|
||
cp "$FILE" $bioscopy | ||
|
||
cd "$extractdir" | ||
$IFDTOOL -x $bioscopy | ||
cp "$extractdir/flashregion_3_gbe.bin" "$BLOBDIR/gbe.bin" | ||
$MECLEAN -r -t -d -O /tmp/unneeded.bin -D "$BLOBDIR/ifd.bin" -M "$BLOBDIR/me.bin" "$extractdir/flashregion_2_intel_me.bin" | ||
$IFDTOOL -n "$BLOBDIR/layout.txt" $bioscopy | ||
$IFDTOOL -x $bioscopy.new | ||
|
||
rm "$bioscopy" | ||
rm "$bioscopy.new" | ||
rm -r "$extractdir" |