util/chromeos/extract_blobs: try using RW_MAIN_A region first
Since the RW firmware may contain newer/additional blobs than the RO COREBOOT region, try using it first, then fall back to COREBOOT and eventually BOOT_STUB if necessary. TEST=extract blobs from dedede and brya firmware images Change-Id: Ia01b37f8c410685de8a17ea4105ca671931a47c5 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68453 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
This commit is contained in:
parent
86284c231f
commit
0923c62448
|
@ -33,20 +33,24 @@ if [[ "$IFDTOOL" = "" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ensure valid coreboot image / get list of main COREBOOT CBFS contents
|
# ensure valid coreboot image / get list of CBFS contents
|
||||||
REGION=""
|
# try using RW_MAIN_A region first as it may contain newer
|
||||||
if ! $CBFSTOOL $IMAGE print >$DIR/cbfs.txt 2>/dev/null; then
|
# files / files not present in the COREBOOT region
|
||||||
# try using BOOT_STUB region
|
if $CBFSTOOL $IMAGE print -r FW_MAIN_A >$DIR/cbfs.txt 2>/dev/null; then
|
||||||
if ! $CBFSTOOL $IMAGE print -r BOOT_STUB >$DIR/cbfs.txt; then
|
REGION="FW_MAIN_A"
|
||||||
|
elif $CBFSTOOL $IMAGE print -r COREBOOT >$DIR/cbfs.txt; then
|
||||||
|
# use COREBOOT region
|
||||||
|
REGION="COREBOOT"
|
||||||
|
elif $CBFSTOOL $IMAGE print -r BOOT_STUB >$DIR/cbfs.txt; then
|
||||||
|
# use BOOT_STUB region
|
||||||
|
REGION="BOOT_STUB"
|
||||||
|
else
|
||||||
echo "Error reading CBFS: $IMAGE is not a valid coreboot image"
|
echo "Error reading CBFS: $IMAGE is not a valid coreboot image"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
REGION="-r BOOT_STUB"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Extracting blobs..."
|
echo "Extracting blobs from region $REGION..."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# extract flash regions
|
# extract flash regions
|
||||||
|
@ -60,39 +64,39 @@ mv flashregion_0_flashdescriptor.bin $DIR/flashdescriptor.bin
|
||||||
rm flashregion_*.bin
|
rm flashregion_*.bin
|
||||||
|
|
||||||
# extract microcode
|
# extract microcode
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n cpu_microcode_blob.bin -f $DIR/cpu_microcode_blob.bin
|
$CBFSTOOL $IMAGE extract -r $REGION -n cpu_microcode_blob.bin -f $DIR/cpu_microcode_blob.bin
|
||||||
|
|
||||||
# extract VGA BIOS
|
# extract VGA BIOS
|
||||||
VGA=$(grep pci $DIR/cbfs.txt | cut -f1 -d\ )
|
VGA=$(grep pci $DIR/cbfs.txt | cut -f1 -d\ )
|
||||||
if [ "$VGA" != "" ]; then
|
if [ "$VGA" != "" ]; then
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n $VGA -f $DIR/vgabios.bin
|
$CBFSTOOL $IMAGE extract -r $REGION -n $VGA -f $DIR/vgabios.bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# extract MRC.bin
|
# extract MRC.bin
|
||||||
MRC=$(grep mrc.bin $DIR/cbfs.txt | cut -f1 -d\ )
|
MRC=$(grep mrc.bin $DIR/cbfs.txt | cut -f1 -d\ )
|
||||||
if [ "$MRC" != "" ]; then
|
if [ "$MRC" != "" ]; then
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n "$MRC" -f "$DIR/$MRC"
|
$CBFSTOOL $IMAGE extract -r $REGION -n "$MRC" -f "$DIR/$MRC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# extract refcode
|
# extract refcode
|
||||||
REF=$(grep refcode $DIR/cbfs.txt | cut -f1 -d\ )
|
REF=$(grep refcode $DIR/cbfs.txt | cut -f1 -d\ )
|
||||||
if [ "$REF" != "" ]; then
|
if [ "$REF" != "" ]; then
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n fallback/refcode -f "$DIR/refcode.elf" -m x86
|
$CBFSTOOL $IMAGE extract -r $REGION -n fallback/refcode -f "$DIR/refcode.elf" -m x86
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# extract FSP blobs
|
# extract FSP blobs
|
||||||
for FSP in $(grep fsp $DIR/cbfs.txt | cut -f1 -d\ ); do
|
for FSP in $(grep fsp $DIR/cbfs.txt | cut -f1 -d\ ); do
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n $FSP -f $DIR/$FSP
|
$CBFSTOOL $IMAGE extract -r $REGION -n $FSP -f $DIR/$FSP
|
||||||
done
|
done
|
||||||
|
|
||||||
# extract audio blobs
|
# extract audio blobs
|
||||||
for AUD in $(grep -e "-2ch-" -e "-4ch-" $DIR/cbfs.txt | cut -f1 -d\ ); do
|
for AUD in $(grep -e "-2ch-" -e "-4ch-" $DIR/cbfs.txt | cut -f1 -d\ ); do
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n $AUD -f $DIR/$AUD
|
$CBFSTOOL $IMAGE extract -r $REGION -n $AUD -f $DIR/$AUD
|
||||||
done
|
done
|
||||||
|
|
||||||
# extract VBTs
|
# extract VBTs
|
||||||
for VBT in $(grep vbt $DIR/cbfs.txt | cut -f1 -d\ ); do
|
for VBT in $(grep vbt $DIR/cbfs.txt | cut -f1 -d\ ); do
|
||||||
$CBFSTOOL $IMAGE extract $REGION -n $VBT -f $DIR/$VBT
|
$CBFSTOOL $IMAGE extract -r $REGION -n $VBT -f $DIR/$VBT
|
||||||
done
|
done
|
||||||
|
|
||||||
# extract IFWI
|
# extract IFWI
|
||||||
|
|
Loading…
Reference in New Issue