Skip to content

Commit

Permalink
Fallback to mounting debugfs if tracefs fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
haesbaert and nicholasberlin committed Oct 28, 2024
1 parent 148ac2d commit 51a3b02
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,16 @@ main(int argc, char *argv[])
err(1, "mount /proc");
if (mount(NULL, "/sys", "sysfs", 0, NULL) == -1)
err(1, "mount /sys");
if (mount(NULL, "/sys/kernel/tracing", "tracefs", 0, NULL) == -1)
err(1, "mount /sys/kernel/tracing");
if (mount(NULL, "/sys/kernel/tracing", "tracefs",
0, NULL) == -1) {
warn("mount /sys/kernel/tracing");
warnx("trying debugfs...");
if (mount(NULL, "/sys/kernel/debug", "debugfs",
0, NULL) == -1) {
warn("mount /sys/kernel/debug");
errx(1, "couldn't mount tracefs or debugfs");
}
}

return (execv(argv[0], argv));
}
Expand Down

0 comments on commit 51a3b02

Please sign in to comment.