Skip to content

Commit

Permalink
Fix handling of updater dry runs on Nano-eMMC platforms
Browse files Browse the repository at this point in the history
We need to open the GPT device for Nano eMMC platforms
to perform the VER checks, so rework the logic to open
the GPT device read-only for dry runs.

Signed-off-by: Matt Madison <[email protected]>
  • Loading branch information
madisongh committed Dec 30, 2020
1 parent 779dbaa commit 6af0102
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tegra-bootloader-update.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ int
main (int argc, char * const argv[])
{
int c, which, fd = -1, gptfd, err;
int reset_bootdev = 0, reset_gptdev;
int reset_bootdev = 0, reset_gptdev = 0;
gpt_context_t *gptctx;
bup_context_t *bupctx;
smd_context_t *smdctx = NULL;
Expand Down Expand Up @@ -1186,12 +1186,15 @@ main (int argc, char * const argv[])
return 1;
}

if (spiboot_platform || dryrun) {
reset_gptdev = 0;
if (spiboot_platform)
gptfd = -1;
} else {
reset_gptdev = set_bootdev_writeable_status(bup_gpt_device(bupctx), 1);
gptfd = open(bup_gpt_device(bupctx), O_RDWR);
else {
if (dryrun)
gptfd = open(bup_gpt_device(bupctx), O_RDONLY);
else {
reset_gptdev = set_bootdev_writeable_status(bup_gpt_device(bupctx), 1);
gptfd = open(bup_gpt_device(bupctx), O_RDWR);
}
if (gptfd < 0) {
perror(bup_gpt_device(bupctx));
goto reset_and_depart;
Expand Down

0 comments on commit 6af0102

Please sign in to comment.