Add deguard logic for Dell OptiPlex 3050 Micro

Copy the downloaded deguard source code into appdir,
and patch it to run as part of lbmk, instead of
standalone. The archived one in src/ is not directly
used; instead, the hotpatched version is used.

This is because the standalone version already has
download logic for the .zip file, but we already
cache that file in cache/ and use that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2024-09-24 16:47:21 +01:00
parent 0266a48913
commit e7c0109f5d
3 changed files with 167 additions and 1 deletions
+32 -1
View File
@@ -23,7 +23,7 @@ eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \
E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest tree \
mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \
archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref vrelease \
verify _7ztest $cv`
verify _7ztest ME_bootguard $cv`
vendor_download()
{
@@ -107,6 +107,14 @@ extract_intel_me()
e "$mecleaner" f not && $err "$cbdir: me_cleaner missing"
_me="$PWD/$_dest"; cdir="$PWD/$appdir"
if [ "$ME_bootguard" = "me11disreguard" ]; then
# run mkukri's util to extract me.bin and disable bootguard
# for Dell OptiPlex 3050 Micro, using the deguard util.
extract_deguard_me "$cdir" "$_me"
return 0
fi
# All other ME setups are extracted with brute force and me_cleaner:
[ $# -gt 0 ] && _me="${1}" && cdir="$2"
e "$_me" f && return 0
@@ -141,6 +149,29 @@ extract_intel_me()
rm -Rf "$sdir" || $err "extract_intel_me: !rm -Rf $sdir"
}
extract_deguard_me()
{
x_ ./mk -f deguard
cp -R src/deguard "$1/disreguard" || \
$err "Cannot make temporary deguard clone in $1/disreguard"
if [ ! -e "$1/disreguard/.git" ]; then
git -C "$1/disreguard" init || $err "!init $1/disreguard"
git -C "$1/disreguard" add -A . || $err "!add $1/disreguard"
git -C "$1/disreguard" commit -m "tmp" || \
$err "!commit $1/disreguard"
fi
git -C "$1/disreguard" am config/data/deguard/appdir.patch || \
$err "Cannot temporarily patch deguard clone in $1/disreguard"
(
cd "$1/disreguard" || $err "Cannot cd to '$1/disreguard'"
x_ ./RUNME.sh
)
"$mecleaner" --whitelist MFS --truncate "$1/disreguard/me.bin" || \
$err "extract_intel_me: Can't truncate disreguarded ME"
cp "$cdir/disreguard/me.bin" "$2" || \
$err "extract_intel_me: Can't move disreguarded me.bin"
}
extract_archive()
{
innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \