From 009bf3b67f71f86ad5331afe0cd68efc578dfb90 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 14 May 2023 09:50:48 +0100 Subject: [PATCH] blobutil/extract: split up extract_blobs() --- resources/scripts/blobs/extract | 43 +++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/resources/scripts/blobs/extract b/resources/scripts/blobs/extract index d648d090..ad15d44f 100755 --- a/resources/scripts/blobs/extract +++ b/resources/scripts/blobs/extract @@ -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