blobutil/extract: split up extract_blobs()

fsdg20230625
Leah Rowe 2023-05-14 09:50:48 +01:00
parent fd3936cc59
commit 009bf3b67f
1 changed files with 30 additions and 13 deletions

View File

@ -14,6 +14,15 @@ cbcfgsdir="resources/coreboot"
ifdtool="${cbdir}/util/ifdtool/ifdtool"
boarddir=""
CONFIG_HAVE_MRC=""
CONFIG_ME_BIN_PATH=""
CONFIG_GBE_BIN_PATH=""
CONFIG_IFD_BIN_PATH=""
_me_destination=""
_gbe_destination=""
_ifd_destination=""
main()
{
sname=${0}
@ -70,7 +79,6 @@ build_dependencies()
extract_blobs()
{
# TODO: split up this function, it's a mess
printf "extracting blobs for %s from %s\n" ${board} ${vendor_rom}
set -- "${boarddir}/config/"*
@ -86,20 +94,11 @@ extract_blobs()
_gbe_destination=${CONFIG_GBE_BIN_PATH#../../}
_ifd_destination=${CONFIG_IFD_BIN_PATH#../../}
printf "extracting clean ime and modified ifd\n"
./me_cleaner/me_cleaner.py -D ${_ifd_destination} \
-M ${_me_destination} ${vendor_rom} -t -r -S || \
./resources/blobs/me7_update_parser.py
-O ${_me_destination} ${vendor_rom} \
|| fail 'me_cleaner failed to extract blobs from rom'
extract_blob_intel_me
extract_blob_intel_gbe_nvm
printf "extracting gigabit ethernet firmware"
./${ifdtool} -x ${vendor_rom}
mv flashregion*gbe.bin ${_gbe_destination} \
|| fail 'could not extract gbe'
# Cleans up other files extracted with ifdtool
rm flashregion*.bin 2> /dev/null
rm -f flashregion*.bin 2> /dev/null
if [ -f ${_ifd_destination} ]; then
printf "gbe, ifd, and me extracted to ${_me_destination%/*}\n"
@ -109,6 +108,24 @@ extract_blobs()
fi
}
extract_blob_intel_me()
{
printf "extracting clean ime and modified ifd\n"
./me_cleaner/me_cleaner.py -D ${_ifd_destination} \
-M ${_me_destination} ${vendor_rom} -t -r -S || \
./resources/blobs/me7_update_parser.py
-O ${_me_destination} ${vendor_rom} \
|| fail 'me_cleaner failed to extract blobs from rom'
}
extract_blob_intel_gbe_nvm()
{
printf "extracting gigabit ethernet firmware"
./${ifdtool} -x ${vendor_rom}
mv flashregion*gbe.bin ${_gbe_destination} \
|| fail 'could not extract gbe'
}
fail()
{
print_help