This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
forked from charlotte-os/charlotte-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
183 lines (160 loc) · 7.96 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#x86_64
default: run-x86_64-debug
install-requirements:
chmod +x ./tools/install-requirements.sh
./tools/install-requirements.sh
limine:
@if [ ! -d "limine" ]; then \
git clone https://github.com/limine-bootloader/limine.git --branch=v8.x-binary --depth=1;\
fi
make -C limine
ovmf-x86_64:
mkdir -p ovmf-x86_64
cd ovmf-x86_64 && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASEX64_OVMF.fd
build-x86_64-debug: limine
cd charlotte_core && cargo build --target x86_64-unknown-none
rm -rf iso_root
mkdir -p iso_root
cp -v charlotte_core/target/x86_64-unknown-none/debug/charlotte_core \
limine.conf limine/limine-uefi-cd.bin iso_root/
mkdir -p iso_root/EFI/BOOT
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o charlotte_core-x86_64-debug.iso
rm -rf iso_root
run-x86_64-debug: ovmf-x86_64 build-x86_64-debug
qemu-system-x86_64 -enable-kvm -M q35 -cpu host -m 2G -bios ovmf-x86_64/OVMF.fd -cdrom charlotte_core-x86_64-debug.iso -boot d -serial stdio
run-x86_64-debug-multicore: ovmf-x86_64 build-x86_64-debug
qemu-system-x86_64 -enable-kvm -M q35 -smp 8 -cpu host -m 2G -bios ovmf-x86_64/OVMF.fd -cdrom charlotte_core-x86_64-debug.iso -boot d -serial stdio
run-x86_64-debug-numa: ovmf-x86_64 build-x86_64-debug
qemu-system-x86_64 -enable-kvm -M q35 -cpu host -m 8G -bios ovmf-x86_64/OVMF.fd -cdrom charlotte_core-x86_64-debug.iso -boot d -serial stdio -smp 4 -object memory-backend-ram,size=4G,id=m0 -object memory-backend-ram,size=4G,id=m1 -numa node,memdev=m0,cpus=0-1,nodeid=0 -numa node,memdev=m1,cpus=2-3,nodeid=1
run-x86_64-extdb: ovmf-x86_64 build-x86_64-debug
qemu-system-x86_64 -enable-kvm -s -S -M q35 -m 2G -bios ovmf-x86_64/OVMF.fd -cdrom charlotte_core-x86_64-debug.iso -boot d -serial stdio
run-x86_64-log: ovmf-x86_64 build-x86_64-debug
qemu-system-x86_64 -enable-kvm -M q35 -cpu host -m 12G -bios ovmf-x86_64/OVMF.fd -cdrom charlotte_core-x86_64-debug.iso -boot d -serial file:log_x86_64.txt
build-x86_64-release: limine
cd charlotte_core && cargo build --target x86_64-unknown-none --release
rm -rf iso_root
mkdir -p iso_root
cp -v charlotte_core/target/x86_64-unknown-none/release/charlotte_core \
limine.conf limine/limine-uefi-cd.bin iso_root/
mkdir -p iso_root/EFI/BOOT
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o charlotte_core-x86_64-release.iso
rm -rf iso_root
run-x86_64-release: ovmf-x86_64 build-x86_64-release
qemu-system-x86_64 -enable-kvm -M q35 -cpu host -m 12G -bios ovmf-x86_64/OVMF.fd -cdrom charlotte_core-x86_64-release.iso -boot d
check-x86_64:
cd charlotte_core && cargo check --target x86_64-unknown-none
# aarch64
ovmf-aarch64:
mkdir -p ovmf-aarch64
cd ovmf-aarch64 && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASEAARCH64_QEMU_EFI.fd
build-aarch64-debug: limine
cd charlotte_core && cargo build --target aarch64-unknown-none
charlotte_core-aarch64-debug.iso: build-aarch64-debug
rm -rf iso_root
mkdir -p iso_root
cp -v charlotte_core/target/aarch64-unknown-none/debug/charlotte_core \
limine.conf limine/limine-uefi-cd.bin iso_root/
mkdir -p iso_root/EFI/BOOT
cp -v limine/BOOTAA64.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o charlotte_core-aarch64-debug.iso
rm -rf iso_root
run-aarch64-debug: ovmf-aarch64 charlotte_core-aarch64-debug.iso
qemu-system-aarch64 -M virt -cpu cortex-a72 -device ramfb -device qemu-xhci -device usb-kbd -m 2G -bios ovmf-aarch64/OVMF.fd -cdrom charlotte_core-aarch64-debug.iso -boot d
run-aarch64-log: ovmf-aarch64 charlotte_core-aarch64-debug.iso
qemu-system-aarch64 -M virt -cpu cortex-a72 -device ramfb -device qemu-xhci -device usb-kbd -m 2G -bios ovmf-aarch64/OVMF.fd -cdrom charlotte_core-aarch64-debug.iso -boot d \
-serial file:log_aarch64.txt
build-aarch64-release: limine
cd charlotte_core && cargo build --target aarch64-unknown-none --release
charlotte_core-aarch64-release.iso: build-aarch64-release
rm -rf iso_root
mkdir -p iso_root
cp -v charlotte_core/target/aarch64-unknown-none/release/charlotte_core \
limine.conf limine/limine-uefi-cd.bin iso_root/
mkdir -p iso_root/EFI/BOOT
cp -v limine/BOOTAA64.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o charlotte_core-aarch64-release.iso
rm -rf iso_root
run-aarch64-release: ovmf-aarch64 charlotte_core-aarch64-release.iso
qemu-system-aarch64 -M virt -cpu cortex-a72 -device ramfb -device qemu-xhci -device usb-kbd -m 2G -bios ovmf-aarch64/OVMF.fd -cdrom charlotte_core-aarch64-release.iso -boot d
# riscv64
ovmf-riscv64:
mkdir -p ovmf-riscv64
cd ovmf-riscv64 && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASERISCV64_VIRT_CODE.fd && dd if=/dev/zero of=OVMF.fd bs=1 count=0 seek=33554432
build-riscv64-debug:
cd charlotte_core && cargo build --target riscv64gc-unknown-none-elf
charlotte_core-riscv64-debug.iso: build-riscv64-debug
rm -rf iso_root
mkdir -p iso_root
cp -v charlotte_core/target/riscv64gc-unknown-none-elf/debug/charlotte_core \
limine.conf limine/limine-uefi-cd.bin iso_root/
mkdir -p iso_root/EFI/BOOT
cp -v limine/BOOTRISCV64.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o charlotte_core-riscv64-debug.iso
rm -rf iso_root
run-riscv64-debug: ovmf-riscv64 charlotte_core-riscv64-debug.iso
qemu-system-riscv64 -M virt -cpu rv64 \
-device ramfb -device qemu-xhci -device usb-kbd -m 2G -drive if=pflash,unit=0,format=raw,file=ovmf-riscv64/OVMF.fd \
-device virtio-scsi-pci,id=scsi -device scsi-cd,drive=cd0 -drive id=cd0,format=raw,file=charlotte_core-riscv64-debug.iso
run-riscv64-debug-log: ovmf-riscv64 charlotte_core-riscv64-debug.iso
qemu-system-riscv64 -M virt -cpu rv64 \
-device ramfb -device qemu-xhci -device usb-kbd -m 2G -drive if=pflash,unit=0,format=raw,file=ovmf-riscv64/OVMF.fd \
-device virtio-scsi-pci,id=scsi -device scsi-cd,drive=cd0 -drive id=cd0,format=raw,file=charlotte_core-riscv64-debug.iso \
-serial file:log_riscv64.txt
build-riscv64-release:
cd charlotte_core && cargo build --target riscv64gc-unknown-none-elf
charlotte_core-riscv64-release.iso: build-riscv64-release
rm -rf iso_root
mkdir -p iso_root
cp -v charlotte_core/target/riscv64gc-unknown-none-elf/release/charlotte_core \
limine.conf limine/limine-uefi-cd.bin iso_root/
mkdir -p iso_root/EFI/BOOT
cp -v limine/BOOTRISCV64.EFI iso_root/EFI/BOOT/
xorriso -as mkisofs \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_root -o charlotte_core-riscv64-release.iso
rm -rf iso_root
run-riscv64-release: ovmf-riscv64 charlotte_core-riscv64-release.iso
qemu-system-riscv64 -M virt -cpu rv64 \
-device ramfb -device qemu-xhci -device usb-kbd -m 2G -drive if=pflash,unit=0,format=raw,file=ovmf-riscv64/OVMF.fd \
-device virtio-scsi-pci,id=scsi -device scsi-cd,drive=cd0 -drive id=cd0,format=raw,file=charlotte_core-riscv64-release.iso
# clean commands
clean:
cd charlotte_core && cargo clean
rm -rf ovmf-aarch64
rm -rf ovmf-riscv64
rm -rf ovmf-x86_64
rm -f charlotte_core-aarch64-debug.iso
rm -f charlotte_core-riscv64-debug.iso
rm -f charlotte_core-x86_64-debug.iso
rm -f charlotte_core-aarch64-release.iso
rm -f charlotte_core-riscv64-release.iso
rm -f charlotte_core-x86_64-release.iso
rm -f log_aarch64.txt
rm -f log_riscv64.txt
rm -f log_x86_64.txt
distclean: clean
rm -rf limine