forked from VOID001/neu-os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (53 loc) · 1.47 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
include Makefile.header
#AS=i686-elf-as
#LD=i686-elf-ld
#OBJCOPY=i686-elf-objcopy
#QEMU=qemu-system-i386
#BOCHS=bochs
#STRIP=i686-elf-strip
.PHONY=clean run all boot/head.o boot/bootsect boot/setup kernel/kernel.o
all: bootimg
OBJS = boot/head.o init/main.o kernel/kernel.o mm/mm.o lib/lib.o
DRIVERS = kernel/chr_drv/chr_drv.a
system: $(OBJS) $(DRIVERS)
@$(LD) -T ldS.ld $(OBJS) $(DRIVERS) -o system.sym
@$(STRIP) system.sym -o system.o
@$(OBJCOPY) -O binary -R .note -R .comment system.o system
kernel/chr_drv/chr_drv.a:
@make -C kernel/chr_drv/
kernel/kernel.o:
@make -C kernel
boot/head.o:
@make head.o -C boot
boot/bootsect:
@make bootsect -C boot
boot/setup:
@make setup -C boot
init/main.o:
@make main.o -C init
lib/lib.o:
@make lib.o -C lib
mm/mm.o:
@make -C mm
# Squash the bootimg together
bootimg: boot/setup boot/bootsect system
@echo -e "\e[1;33mStart building NEU-OS image..."
@dd if=boot/bootsect of=bootimg bs=512 count=1 2>/dev/null
@dd if=boot/setup of=bootimg bs=512 count=4 seek=1 2>/dev/null
@dd if=system of=bootimg bs=512 seek=5 2>/dev/null
@echo -e "\e[1;0;32mBuild bootimg done"
run: bootimg
$(QEMU) -boot a -fda bootimg -serial stdio
run_bochs: bootimg
$(BOCHS) -q
run_debug:
$(QEMU) -boot a -fda bootimg -S -s
disassemble: system.sym
objdump -S system.sym | less
clean:
@rm -f bootsect *.o setup *.sym bootimg a.out binary head system
@make clean -C boot
@make clean -C kernel
@make clean -C mm
@make clean -C init
@make clean -C lib