Skip to content

Commit

Permalink
dts: dasharo-deploy: improve logging in migration functions
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Żyjewski <[email protected]>
  • Loading branch information
TomaszAIR committed Jan 10, 2024
1 parent f1e7442 commit cc07fb8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -226,24 +226,25 @@ smbios_migration() {
}

smmstore_migration() {
echo -n "Backing up firmware configuration... "
echo "Backing up firmware configuration... "
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r /tmp/dasharo_dump.rom ${FLASHROM_ADD_OPT_READ} --fmap -i FMAP -i SMMSTORE >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
cbfstool /tmp/dasharo_dump.rom read -r SMMSTORE -f /tmp/smmstore.bin >> $ERR_LOG_FILE 2>&1
error_check "Failed! Default settings will be used."
cbfstool "$BIOS_UPDATE_FILE" write -r SMMSTORE -f /tmp/smmstore.bin -u >> $ERR_LOG_FILE 2>&1
error_check "Failed! Default settings will be used."
cbfstool /tmp/dasharo_dump.rom read -r SMMSTORE -f /tmp/smmstore.bin >> $ERR_LOG_FILE 2>&1 || \
print_warning "Failed! Default settings will be used."
cbfstool "$BIOS_UPDATE_FILE" write -r SMMSTORE -f /tmp/smmstore.bin -u >> $ERR_LOG_FILE 2>&1 || \
print_warning "Failed! Default settings will be used."
print_green Done.
}

bootsplash_migration() {
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r /tmp/dasharo_dump.rom ${FLASHROM_ADD_OPT_READ} --fmap -i FMAP -i BOOTSPLASH >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
cbfstool /tmp/dasharo_dump.rom extract -r BOOTSPLASH -n logo.bmp -f /tmp/logo.bmp >> $ERR_LOG_FILE 2>&1
error_check # No custom logo, so exit early and don't show unnecessary messages
echo -n "Backing up custom boot logo... "
cbfstool $BIOS_UPDATE_FILE remove -n logo.bmp -r BOOTSPLASH >> $ERR_LOG_FILE 2>&1
error_check "Failed! Default boot splash will be used."
cbfstool $BIOS_UPDATE_FILE add -f /tmp/logo.bmp -r BOOTSPLASH -n logo.bmp -t raw -c lzma >> $ERR_LOG_FILE 2>&1
error_check "Failed! Default boot splash will be used."
# If no custom logo, return from bootsplash_migration early and don't show
# unnecessary messages
cbfstool /tmp/dasharo_dump.rom extract -r BOOTSPLASH -n logo.bmp -f /tmp/logo.bmp >> $ERR_LOG_FILE 2>&1 || return 1
echo "Backing up custom boot logo... "
cbfstool $BIOS_UPDATE_FILE remove -n logo.bmp -r BOOTSPLASH >> $ERR_LOG_FILE 2>&1 || \
print_warning "Failed! Default boot splash will be used."
cbfstool $BIOS_UPDATE_FILE add -f /tmp/logo.bmp -r BOOTSPLASH -n logo.bmp -t raw -c lzma >> $ERR_LOG_FILE 2>&1 || \
print_warning "Failed! Default boot splash will be used."
print_green Done.
}

Expand Down

0 comments on commit cc07fb8

Please sign in to comment.