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" ifdtool="${cbdir}/util/ifdtool/ifdtool"
boarddir="" boarddir=""
CONFIG_HAVE_MRC=""
CONFIG_ME_BIN_PATH=""
CONFIG_GBE_BIN_PATH=""
CONFIG_IFD_BIN_PATH=""
_me_destination=""
_gbe_destination=""
_ifd_destination=""
main() main()
{ {
sname=${0} sname=${0}
@ -70,7 +79,6 @@ build_dependencies()
extract_blobs() extract_blobs()
{ {
# TODO: split up this function, it's a mess
printf "extracting blobs for %s from %s\n" ${board} ${vendor_rom} printf "extracting blobs for %s from %s\n" ${board} ${vendor_rom}
set -- "${boarddir}/config/"* set -- "${boarddir}/config/"*
@ -86,20 +94,11 @@ extract_blobs()
_gbe_destination=${CONFIG_GBE_BIN_PATH#../../} _gbe_destination=${CONFIG_GBE_BIN_PATH#../../}
_ifd_destination=${CONFIG_IFD_BIN_PATH#../../} _ifd_destination=${CONFIG_IFD_BIN_PATH#../../}
printf "extracting clean ime and modified ifd\n" extract_blob_intel_me
./me_cleaner/me_cleaner.py -D ${_ifd_destination} \ extract_blob_intel_gbe_nvm
-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'
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 # 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 if [ -f ${_ifd_destination} ]; then
printf "gbe, ifd, and me extracted to ${_me_destination%/*}\n" printf "gbe, ifd, and me extracted to ${_me_destination%/*}\n"
@ -109,6 +108,24 @@ extract_blobs()
fi 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() fail()
{ {
print_help print_help