Skip to content

Commit 51a3b02

Browse files
Fallback to mounting debugfs if tracefs fails
With this I can boot a centos7 3.10 kernel on qemu and run the tests successfully. Co-authored-by: Nicholas Berlin <56366649+nicholasberlin@users.noreply.github.com>
1 parent 148ac2d commit 51a3b02

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

init.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,16 @@ main(int argc, char *argv[])
6565
err(1, "mount /proc");
6666
if (mount(NULL, "/sys", "sysfs", 0, NULL) == -1)
6767
err(1, "mount /sys");
68-
if (mount(NULL, "/sys/kernel/tracing", "tracefs", 0, NULL) == -1)
69-
err(1, "mount /sys/kernel/tracing");
68+
if (mount(NULL, "/sys/kernel/tracing", "tracefs",
69+
0, NULL) == -1) {
70+
warn("mount /sys/kernel/tracing");
71+
warnx("trying debugfs...");
72+
if (mount(NULL, "/sys/kernel/debug", "debugfs",
73+
0, NULL) == -1) {
74+
warn("mount /sys/kernel/debug");
75+
errx(1, "couldn't mount tracefs or debugfs");
76+
}
77+
}
7078

7179
return (execv(argv[0], argv));
7280
}

0 commit comments

Comments
 (0)