Skip to content

Commit f31942f

Browse files
authored
Merge pull request #92 from Dasharo/mock-seabios-payload-presence
scripts: dasharo-deploy.sh: mock SeaBIOS payload presence
2 parents d2c81d3 + 7eb3e0c commit f31942f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

include/hal/common-mock-func.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ cbmem_check_if_me_disabled_mock() {
322322
TEST_VBOOT_ENABLED="${TEST_VBOOT_ENABLED:-}"
323323
TEST_ROMHOLE_MIGRATION="${TEST_ROMHOLE_MIGRATION:-}"
324324
TEST_DIFFERENT_FMAP="${TEST_DIFFERENT_FMAP:-}"
325+
TEST_IS_SEABIOS="${TEST_IS_SEABIOS:-}"
325326

326327
cbfstool_layout_mock() {
327328
# Emulating some fields in Coreboot Files System layout table:
@@ -354,10 +355,18 @@ cbfstool_read_bios_conffile_mock() {
354355
local _file_to_write_into
355356
_file_to_write_into=$(parse_for_arg_return_next "-f" "$@")
356357

358+
cat /dev/null >"$_file_to_write_into"
359+
357360
if [ "$TEST_VBOOT_ENABLED" = "true" ]; then
358361
# Emulating VBOOT presence, check firmware_pre_installation_routine and
359362
# firmware_pre_updating_routine funcs for more inf.:
360-
echo "CONFIG_VBOOT=y" >"$_file_to_write_into"
363+
echo "CONFIG_VBOOT=y" >>"$_file_to_write_into"
364+
fi
365+
366+
if [ "$TEST_IS_SEABIOS" = "true" ]; then
367+
# Emulating SeaBIOS payload presence, check function choose_version for more
368+
# inf..
369+
echo "CONFIG_PAYLOAD_SEABIOS=y" >>"$_file_to_write_into"
361370
fi
362371

363372
echo "" >>"$_file_to_write_into"

scripts/dasharo-deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ choose_version() {
249249
tmp_rom=$(mktemp --dry-run)
250250
config=/tmp/config
251251
# get current firmware
252-
$FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r "$tmp_rom" >>"$FLASH_INFO_FILE" 2>>"$ERR_LOG_FILE"
252+
$FLASHROM flashrom_read_firm_mock -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r "$tmp_rom" >>"$FLASH_INFO_FILE" 2>>"$ERR_LOG_FILE"
253253
if [ -f "$tmp_rom" ]; then
254254
# extract config
255-
$CBFSTOOL "$tmp_rom" extract -n config -f "$config" 2>>"$ERR_LOG_FILE"
255+
$CBFSTOOL read_bios_conffile_mock "$tmp_rom" extract -n config -f "$config" 2>>"$ERR_LOG_FILE"
256256
# check if current firmware is seabios, if yes then we can offer update
257257
if grep -q "CONFIG_PAYLOAD_SEABIOS=y" "$config"; then
258258
if check_for_firmware_access seabios; then

0 commit comments

Comments
 (0)