Skip to content

Commit 59b459e

Browse files
committed
Use '--ifd -i bios' when flashing fulll firmware images if possible
Avoid writing IFD/ME/EC regions Signed-off-by: Matt DeVillier <[email protected]>
1 parent 7c5ddf8 commit 59b459e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

firmware.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ fi
459459

460460
#flash without verify, to avoid IFD mismatch upon verification
461461
echo_yellow "Installing Full ROM firmware (may take up to 90s)"
462-
${flashromcmd} -n -w "${coreboot_file}" -o /tmp/flashrom.log > /dev/null 2>&1
462+
${flashromcmd} ${flashrom_params} -n -w "${coreboot_file}" -o /tmp/flashrom.log > /dev/null 2>&1
463463
if [ $? -ne 0 ]; then
464464
cat /tmp/flashrom.log
465465
exit_red "An error occurred flashing the Full ROM firmware. DO NOT REBOOT!"; return 1
@@ -732,7 +732,7 @@ fi
732732
echo_yellow "Restoring stock firmware"
733733
# we won't verify here, since we need to flash the entire BIOS region
734734
# but don't want to get a mismatch from the IFD or ME
735-
${flashromcmd} -n -w "${firmware_file}" -o /tmp/flashrom.log > /dev/null 2>&1
735+
${flashromcmd} ${flashrom_params} -n -w "${firmware_file}" -o /tmp/flashrom.log > /dev/null 2>&1
736736
if [ $? -ne 0 ]; then
737737
cat /tmp/flashrom.log
738738
exit_red "An error occurred restoring the stock firmware. DO NOT REBOOT!"; return 1

functions.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ fi
427427

428428
#get device firmware info
429429
echo -e "\nGetting device/system info..."
430+
#try reading only flash descriptor
431+
if ${flashromcmd} --ifd -i fd -r /tmp/bios.bin > /dev/null 2>&1; then
432+
#we can flash only BIOS region later
433+
flashrom_params="--ifd -i bios"
434+
fi
430435
#read entire firmware
431436
${flashromcmd} -r /tmp/bios.bin > /dev/null 2>&1
432437
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)