Skip to content

Commit b419a50

Browse files
committed
meta-dts-distro/recipes-dts/dts: Add option to override flashrom update parameters
Signed-off-by: Michał Żygowski <[email protected]>
1 parent 5fc65e8 commit b419a50

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,21 @@ update() {
527527

528528
echo "Updating Dasharo firmware..."
529529
print_warning "This may take several minutes. Please be patient and do not reset your computer, or touch the keyboard!"
530-
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_UPDATE} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
531-
error_check "Failed to update Dasharo firmware"
532530

533-
if [ $BINARY_HAS_RW_B -eq 0 ]; then
534-
echo "Updating second firmware partition..."
535-
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} --fmap -N -i RW_SECTION_B -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
536-
error_check "Failed to update second firmware partition"
531+
# FLASHROM_ADD_OPT_UPDATE_OVERRIDE takes priority over auto-detected udpate params.
532+
# It set only by platform-specific and firmware version-specific conditions
533+
if [ -v FLASHROM_ADD_OPT_UPDATE_OVERRIDE ]; then
534+
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_UPDATE_OVERRIDE} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
535+
error_check "Failed to update Dasharo firmware"
536+
else
537+
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_UPDATE} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
538+
error_check "Failed to update Dasharo firmware"
539+
540+
if [ $BINARY_HAS_RW_B -eq 0 ]; then
541+
echo "Updating second firmware partition..."
542+
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} --fmap -N -i RW_SECTION_B -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
543+
error_check "Failed to update second firmware partition"
544+
fi
537545
fi
538546

539547
# We use FLASHROM_ADD_OPT_REGIONS for updating ME and IFD.

meta-dts-distro/recipes-dts/dts/dts/dts-functions.sh

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,7 @@ board_config() {
184184
if [ $? -eq 1 ]; then
185185
# For Dasharo version lesser than 1.5.2
186186
NEED_BOOTSPLASH_MIGRATION="true"
187-
FLASHROM_ADD_OPT_UPDATE="--ifd -i bios"
188-
else
189-
# For Dasharo version greater or equal 1.5.2
190-
FLASHROM_ADD_OPT_UPDATE="--fmap -i RW_SECTION_A"
187+
FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios"
191188
fi
192189
fi
193190
;;
@@ -216,10 +213,7 @@ board_config() {
216213
if [ $? -eq 1 ]; then
217214
# For Dasharo version lesser than 1.5.1
218215
NEED_BOOTSPLASH_MIGRATION="true"
219-
FLASHROM_ADD_OPT_UPDATE="--ifd -i bios"
220-
else
221-
# For Dasharo version greater or equal 1.5.1
222-
FLASHROM_ADD_OPT_UPDATE="--fmap -i RW_SECTION_A"
216+
FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios"
223217
fi
224218
fi
225219
;;
@@ -242,15 +236,12 @@ board_config() {
242236
PROGRAMMER_BIOS="internal"
243237
PROGRAMMER_EC="ite_ec"
244238
if check_if_dasharo; then
245-
# if v1.7.1 or older, flash the whole bios region
239+
# if v1.7.2 or older, flash the whole bios region
246240
compare_versions $DASHARO_VERSION 1.7.2
247241
if [ $? -eq 1 ]; then
248242
# For Dasharo version lesser than 1.7.2
249243
NEED_BOOTSPLASH_MIGRATION="true"
250-
FLASHROM_ADD_OPT_UPDATE="--ifd -i bios"
251-
else
252-
# For Dasharo version greater or equal 1.7.2
253-
FLASHROM_ADD_OPT_UPDATE="--fmap -i RW_SECTION_A"
244+
FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios"
254245
fi
255246
fi
256247
;;
@@ -274,16 +265,12 @@ board_config() {
274265
PROGRAMMER_BIOS="internal"
275266
PROGRAMMER_EC="ite_ec"
276267
if check_if_dasharo; then
277-
# if v1.7.1 or older, flash the whole bios region
268+
# if v1.7.2 or older, flash the whole bios region
278269
compare_versions $DASHARO_VERSION 1.7.2
279270
if [ $? -eq 1 ]; then
280271
# For Dasharo version lesser than 1.7.2
281272
NEED_BOOTSPLASH_MIGRATION="true"
282-
FLASHROM_ADD_OPT_UPDATE="--ifd -i bios"
283-
else
284-
# For Dasharo version greater or equal 1.7.2
285-
FLASHROM_ADD_OPT_UPDATE="--fmap -i RW_SECTION_A"
286-
fi
273+
FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios"
287274
fi
288275
;;
289276
*)

0 commit comments

Comments
 (0)