-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (55 loc) · 1.67 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
CC = gcc
SHELL = bash
OBJECTS = system.o loader_ng.o vga.o gdt.o mb.o interrupt.o cmos.o clock.o kprint.o power.o panic.o uart.o memory.o pgalloc.o cpuid.o\
paging.o vaalloc.o timer.o string.o romfs.o vfs.o console.o serial.o vgacon.o
CFLAGS = -m32 -nostdlib -fno-builtin -fno-stack-protector \
-nostartfiles -nodefaultlibs -Wall -Wextra -c -g -mno-red-zone -fno-pic\
-isystem $(shell $(CC) -print-file-name=include) \
-isystem $(shell pwd)/header \
-mgeneral-regs-only -O0
#CFLAGS_INTR = -mg
LDFLAGS = -Tlink_ng.ld -melf_i386
AS = as
ASFLAGS = --32 -gstabs
.PHONY : clean
all : kernel
show-include :
$(CC) $(CFLAGS) -v -x c -
kernel : $(foreach i,$(OBJECTS),build/$(i))
ld $(LDFLAGS) $(foreach i,$(OBJECTS),build/$(i)) -o moke
strip :
strip moke -o smoke
build/%.o : %.s
$(AS) $(ASFLAGS) $< -o $@
build/%.o : %.c
$(CC) $(CFLAGS) $< -o $@
cdrom : kernel
cp moke iso/boot/moke
genisoimage -R \
-b boot/grub/stage2 \
-no-emul-boot \
-boot-load-size 4 \
-A moke \
-input-charset utf8 \
-quiet \
-boot-info-table \
-o moke.iso \
iso/
qemu : moke
qemu-system-x86_64 -m 128M -kernel moke
qemu-cd: cdrom
qemu-system-x86_64 -m 128M -cdrom moke.iso
cd-dbg: cdrom
echo Debugger listening at tcp::1234
qemu-system-x86_64 -m 512M -cdrom moke.iso -S -gdb tcp::1234
#gdb -ex "set arch i386:x86-64" -ex "target remote tcp::1234" moke
qemu-dbg : moke
qemu-system-x86_64 -m 128M -kernel moke -S -gdb tcp::1234
kvm : kernel
kvm -m 128M -kernel moke
kvm-romfs : kernel
kvm -m 128M -kernel moke -initrd moke.romfs
kvm-romfs-dbg : kernel
kvm -m 128M -kernel moke -initrd moke.romfs -S -gdb tcp::1234
clean :
- rm -rf build/* iso/boot/kernel *.iso moke smoke