Skip to content

Commit 49927af

Browse files
committed
source/common.c: PocketBeagle, no slots file, everything built-in
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
1 parent 5f47eb0 commit 49927af

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

source/common.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,28 @@ int uboot_overlay_enabled(void) {
561561
}
562562
}
563563

564+
/*
565+
PocketBeagle has everything built-in to the main dtb
566+
*/
567+
int pocketbeagle(void) {
568+
const char *cmd = "/bin/grep -c 'TI AM335x PocketBeagle' /proc/device-tree/model";
569+
char pocketbeagle;
570+
FILE *file = NULL;
571+
572+
file = popen(cmd, "r");
573+
if (file == NULL) {
574+
fprintf(stderr, "error: pocketbeagle() failed to run cmd=%s\n", cmd);
575+
return -1;
576+
}
577+
pocketbeagle = fgetc(file);
578+
pclose(file);
579+
580+
if(pocketbeagle == '1') {
581+
return 1;
582+
} else {
583+
return 0;
584+
}
585+
}
564586

565587
BBIO_err load_device_tree(const char *name)
566588
{
@@ -583,6 +605,10 @@ BBIO_err load_device_tree(const char *name)
583605
return BBIO_OK;
584606
}
585607

608+
if(pocketbeagle()) {
609+
return BBIO_OK;
610+
}
611+
586612
snprintf(slots, sizeof(slots), "%s/slots", ctrl_dir);
587613

588614
file = fopen(slots, "r+");

0 commit comments

Comments
 (0)