-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (39 loc) · 1.02 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
include config.mk
.PHONY: all iso sys clean
QEMUOPTS = -kernel build/kernel.elf -m 128M -S -nographic
tool:
cd tools && make all
ifeq ('$(wildcard ./a.img)','')
@echo 'Cannot find `a.img`...'
@echo 'Trying to make one ...'
@dd if=/dev/zero of=./a.img bs=1024k count=20
@echo 'Make FS...'
@mkfs.vfat -F 32 a.img
@echo 'Making disk OK!'
endif
all: sys
cd kernel && make -s
qemu:
qemu-system-i386 -kernel ./build/kernel.elf -nographic -gdb tcp::6666 -S
sys:
-cd sys && make all
-cd lib && make all
iso: build/kernel.elf
-cp build/kernel.elf isodir/boot/kernel.bin
nm build/kernel.elf | grep '[0-9|a-f]* [T|B] [^$$]*' > isodir/boot/kernel.map
grub-mkrescue -o qnos.iso isodir
qemu-img convert -f raw -O vmdk a.img disk.vmdk
clean:
cd kernel && make clean
cd sys && make clean
cd tools && make clean
cd lib && make clean
-rm isodir/boot/sys/*.*
-rm isodir/boot/sys/* -rf
-rm isodir/boot/kernel.bin
-rm build/kernel.elf
-rm qnos.iso
-rm *.img
-rm *.vmdk
count:
find . -name "*[.h|.c|.sh]"|xargs cat|grep -v ^$|wc -l