Skip to content

Commit 68ca7e4

Browse files
committed
cdba: Default to fastboot continue if image is omitted
Add the ability to omit the image from the cdba call. In this case default to "fastboot continue" on the cdba-server side. Regular booting continues to work like this: cdba -b db410c -h benchtop-cdba ./qlt-kernel/build/square_5.x-tracking/boot_t2a.img New option to boot the default image a proxy for "fastboot continue" cdba -b db410c -h benchtop-cdba Signed-off-by: Bryan O'Donoghue <[email protected]>
1 parent 30e6838 commit 68ca7e4

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

cdba.c

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
static bool quit;
5252
static bool fastboot_repeat;
5353
static bool fastboot_done;
54+
static bool fastboot_continue;
5455

5556
static int status_fd = -1;
5657

@@ -340,6 +341,22 @@ static void request_power_off(void)
340341
list_add(&work_items, &work.node);
341342
}
342343

344+
static void request_fastboot_continue_fn(struct work *work, int ssh_stdin)
345+
{
346+
int ret;
347+
348+
ret = cdba_send(ssh_stdin, MSG_FASTBOOT_CONTINUE);
349+
if (ret < 0)
350+
err(1, "failed to send fastboot continue request");
351+
}
352+
353+
static void request_fastboot_continue(void)
354+
{
355+
static struct work work = { request_fastboot_continue_fn };
356+
357+
list_add(&work_items, &work.node);
358+
}
359+
343360
struct fastboot_download_work {
344361
struct work work;
345362

@@ -532,10 +549,14 @@ static int handle_message(struct circ_buf *buf)
532549
case MSG_FASTBOOT_PRESENT:
533550
if (*(uint8_t*)msg->data) {
534551
// printf("======================================== MSG_FASTBOOT_PRESENT(on)\n");
535-
if (!fastboot_done || fastboot_repeat)
552+
if (fastboot_continue) {
553+
request_fastboot_continue();
554+
fastboot_continue = false;
555+
} else if (!fastboot_done || fastboot_repeat) {
536556
request_fastboot_files();
537-
else
557+
} else {
538558
quit = true;
559+
}
539560
} else {
540561
fastboot_done = true;
541562
// printf("======================================== MSG_FASTBOOT_PRESENT(off)\n");
@@ -557,6 +578,9 @@ static int handle_message(struct circ_buf *buf)
557578
handle_board_info(msg->data, msg->len);
558579
return -1;
559580
break;
581+
case MSG_FASTBOOT_CONTINUE:
582+
// printf("======================================== MSG_FASTBOOT_CONTINUE\n");
583+
break;
560584
default:
561585
fprintf(stderr, "unk %d len %d\n", msg->type, msg->len);
562586
return -1;
@@ -585,7 +609,7 @@ static void usage(void)
585609
extern const char *__progname;
586610

587611
fprintf(stderr, "usage: %s -b <board> -h <host> [-t <timeout>] "
588-
"[-T <inactivity-timeout>] boot.img\n",
612+
"[-T <inactivity-timeout>] <boot.img>\n",
589613
__progname);
590614
fprintf(stderr, "usage: %s -i -b <board> -h <host>\n",
591615
__progname);
@@ -673,13 +697,15 @@ int main(int argc, char **argv)
673697

674698
switch (verb) {
675699
case CDBA_BOOT:
676-
if (optind >= argc || !board)
700+
if (optind > argc || !board)
677701
usage();
678702

679703
fastboot_file = argv[optind];
680-
if (lstat(fastboot_file, &sb))
704+
if (!fastboot_file)
705+
fastboot_continue = true;
706+
else if (lstat(fastboot_file, &sb))
681707
err(1, "unable to read \"%s\"", fastboot_file);
682-
if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
708+
else if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
683709
errx(1, "\"%s\" is not a regular file", fastboot_file);
684710

685711
request_select_board(board);

0 commit comments

Comments
 (0)