-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`make initramfs.gz` builds an `initramfs.gz` that contains all quark utilities statically compiled, as well as a super simple init that sets the environment so that quark can run. The purpose is to be able to test different kernels and run `quark-mon` or `quark-btf` as you run normally. This is the main infrastructure for the future `quark-test` which will be a single binary that tests "everything", it forks, execs, and whatnot. How to test it: $ make initramfs.gz $ qemu-system-x86_64 -initrd initramfs.gz -kernel linux-image-x86_64-5.10.92-2 \ -nographic --append "console=ttyS0 quark-mon -kvvv" You can pass parameters normally to the binary, see `append` above.
- Loading branch information
Showing
7 changed files
with
114 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
/* Copyright (c) 2024 Elastic NV */ | ||
|
||
#include <err.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
|
||
#include <sys/mount.h> | ||
#include <sys/stat.h> | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
if (argc < 2) | ||
err(1, "no binary to execute"); | ||
|
||
argc--; | ||
argv++; | ||
|
||
if (mkdir("/proc", 0666) != 0) | ||
err(1, "mkdir /proc"); | ||
if (mkdir("/sys", 0666) != 0) | ||
err(1, "mkdir /sys"); | ||
|
||
if (mount("proc", "/proc", "proc", 0, NULL) == -1) | ||
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"); | ||
|
||
return (execv(argv[0], argv)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters