-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (34 loc) · 1.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
QEMU_FLAGS ?= -kernel linux -initrd rootfs.cpio.zst -m 1024
cpio: install
cd rootfs; find | cpio --quiet -H newc -o | zstd > ../rootfs.cpio.zst
install: build directory
install target/x86_64-unknown-linux-musl/debug/init rootfs
install target/x86_64-unknown-linux-musl/debug/schelp rootfs/bin
install target/x86_64-unknown-linux-musl/debug/id rootfs/bin
install target/x86_64-unknown-linux-musl/debug/ls rootfs/bin
install target/x86_64-unknown-linux-musl/debug/display rootfs/bin
install target/x86_64-unknown-linux-musl/debug/input rootfs/bin
install target/x86_64-unknown-linux-musl/debug/segfault rootfs/bin
install target/x86_64-unknown-linux-musl/debug/ps rootfs/bin
install target/x86_64-unknown-linux-musl/debug/echo rootfs/bin
ln -rs rootfs/bin/schelp rootfs/bin/sh
# Make a copy of the root/
directory:
rm -rf rootfs
cp -r root rootfs
build:
cargo build
run:
qemu-system-x86_64 $(QEMU_FLAGS) -nographic -append "console=ttyS0 loglevel=6"
view:
# enabling kvm gives some issues when trying to use vga
# vga can be enabled but the console doesn't open in it correctly
# instead you can open the console in serial
# qemu-system-x86_64 $(QEMU_FLAGS) -vga virtio -append "console=ttyS0 loglevel=6" -enable-kvm
qemu-system-x86_64 $(QEMU_FLAGS) -vga virtio -append "loglevel=6"
debug:
qemu-system-x86_64 $(QEMU_FLAGS) -nographic -append "console=ttyS0 loglevel=8" -s -S
clean:
rm -f rootfs.cpio*
rm -fr rootfs
cargo clean