Skip to content

Commit f069dd7

Browse files
committed
Return BBIO_OK when u-boot overlays ared enabled
When Linux kernel boots with u-boot overlays enabled, do not load overlays via slots file as the write will hang due to kernel bug in cape manager driver. Skip cape manager and just return BBIO_OK.
1 parent ae47281 commit f069dd7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

source/common.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ BBIO_err load_device_tree(const char *name)
453453
be loaded with the cape manager by writing to the slots file. There
454454
is currently a kernel bug that causes the write to hang.
455455
*/
456-
const char *cmd = "grep -c bone_capemgr.uboot_capemgr_enabled=1 /proc/cmdline";
456+
const char *cmd = "/bin/grep -c bone_capemgr.uboot_capemgr_enabled=1 /proc/cmdline";
457457

458458
#ifdef BBBVERSION41
459459
char slots[41];
@@ -466,20 +466,23 @@ BBIO_err load_device_tree(const char *name)
466466
fprintf(stderr, "load_device_tree: cmd=%s\n", cmd);
467467
file = popen(cmd, "r");
468468
if (file == NULL) {
469-
fprintf(stderr, "load_device_tree: failed to run command\n");
469+
fprintf(stderr, "load_device_tree: failed to grep /proc/cmdline\n");
470470
#ifndef NO_PYTHON
471-
PyErr_SetFromErrnoWithFilename(PyExc_IOError, cmd);
471+
PyErr_SetFromErrnoWithFilename(PyExc_IOError, "/proc/cmdline");
472472
#endif // !NO_PYTHON
473473
return BBIO_CAPE;
474474
}
475475
uboot_overlay = fgetc(file);
476476
fprintf(stderr, "load_device_tree: uboot_overlay=%c\n", uboot_overlay);
477+
pclose(file);
477478
if(uboot_overlay == '1') {
478-
fprintf(stderr, "load_device_tree: uboot_overlay is 1\n");
479-
} else {
480-
fprintf(stderr, "load_device_tree: uboot_overlay is NOT 1\n");
479+
/* Linux kernel booted with u-boot overlays enabled.
480+
Do not load overlays via slots file as the write
481+
will hang due to kernel bug in cape manager driver.
482+
Skip cape manager and just return BBIO_OK. */
483+
fprintf(stderr, "load_device_tree: u-boot overlays enable. return BBIO_OK.\n");
484+
return BBIO_OK;
481485
}
482-
pclose(file);
483486

484487
snprintf(slots, sizeof(slots), "%s/slots", ctrl_dir);
485488

0 commit comments

Comments
 (0)