Skip to content

Commit

Permalink
src/update_handler: update boot partition reporting
Browse files Browse the repository at this point in the history
Since r_emmc_read_bootpart() now only returns either a valid boot
partition number or 'no boot enabled', we can simplify the printout.

We allow the 'no boot enabled' configuration here, but emit a warning to
inform the user.

Signed-off-by: Enrico Joerns <[email protected]>
  • Loading branch information
ejoerns committed Jan 15, 2025
1 parent c618a7f commit 7b9e850
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions src/update_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2208,21 +2208,17 @@ static gboolean img_to_boot_emmc_handler(RaucImage *image, RaucSlot *dest_slot,
g_propagate_error(error, ierror);
goto out;
}
switch (part_active) {
case -1:
part_active_str = g_strdup("<none>");
break;
case 6:
part_active_str = g_strdup(realdev);
break;
default:
part_active_str = g_strdup_printf("%sboot%d", realdev, part_active);

if (part_active == -1) {
g_warning("eMMC device was not enabled for booting, yet. Ignoring.");
/* For simplicity: Consider boot0 to be active */
part_active = 0;
} else {
g_message("Found active eMMC boot partition %sboot%d", realdev, part_active);
}
g_message("Found active eMMC boot partition %s", part_active_str);

/* create a temporary RaucSlot with the actual (currently inactive) boot
* partition as device; for simplicity reasons: in case the user partition
* is active use mmcblkXboot1, in case no partition is active use mmcblkXboot0
* partition as device;
*/
part_slot = g_new0(RaucSlot, 1);
part_slot->device = g_strdup_printf(
Expand Down
2 changes: 1 addition & 1 deletion test/test_write_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_write_boot_emmc(system):
out, err, exitcode = run(f"{system.prefix} write-slot bootloader.0 install-content/rootfs.img")
assert exitcode == 0
assert "Slot written successfully" in out
assert "Found active eMMC boot partition <none>" in err
assert "eMMC device was not enabled for booting, yet. Ignoring." in err
assert f"Boot partition {device}boot0 is now active" in err

out, err, exitcode = run(f"{system.prefix} write-slot bootloader.0 install-content/rootfs.img")
Expand Down

0 comments on commit 7b9e850

Please sign in to comment.