-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (106 loc) · 2.98 KB
/
Copy pathMakefile
File metadata and controls
122 lines (106 loc) · 2.98 KB
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
CPP=gcc
AS=as
LD=ld
ASM=nasm
ASMFLAGS= -f elf
CPPFLAGS = -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings
ASFLAGS = --32
LDFLAGS = -melf_i386
SHELL = /bin/bash
GRUB = ~/local/bin
BOCHS=/usr/local/bin/bochs
DEBUG=-g
objects = LILO/loader.o \
kernel/gdt.o \
Memory/MemoryManagement.o \
Drivers/IOPorts.o \
CPU/Interrupts.o \
CPU/Execptions/GPF.o \
CPU/Execptions/IOC.o \
CPU/Execptions/DFault.o \
Drivers/AM79C973.o \
kernel/MultiTask.o \
Drivers/Driver.o \
CPU/PowerControl.o \
Drivers/Keyboard.o \
Drivers/HDD-ATA.o \
Drivers/VGADriver.o \
Shell/Shell.o \
CPU/syscall.o \
loaders/JD1618.o \
Include/string.o \
Structures/list.o \
Filesystem/MSDOSPT.o \
Filesystem/FATFS.o \
Drivers/Mouse.o \
Drivers/RTC.o \
Hardcom/SerialPort.o \
CPU/interruptstab.o \
Hardcom/pci.o \
Network/EtherFrame.o \
Network/arp.o \
Network/InternetProtocolV4.o \
Network/ICMP.o \
Network/udp.o \
Network/tcp.o \
kernel/kernel.o
prep:
@printf "Preparing...\n"
@sudo apt-get install xorriso mtools grub-pc-bin nasm build-essential
CPU/PowerControl.o: CPU/PowerControl.cpp CPU/shutdown.o
$(CPP) $(CPPFLAGS) -c -o $@ CPU/PowerControl.cpp CPU/shutdown.o
%.o: %.cpp
@printf "\e[1;32m[1/3]Compiling $<\n\e[0m"
$(CPP) $(DEBUG) $(CPPFLAGS) -c -o $@ $<
%.o: %.s
@printf "\e[1;32m[1/3]Compiling $<\n\e[0m"
$(AS) $(DEBUG) $(ASFLAGS) -o $@ $<
%.o: %.asm
@printf "\e[1;32m[1/3]Compiling $<\n\e[0m"
$(ASM) $(ASMFLAGS) -o $@ $<
SectorOS_Kernel.bin: LILO/linker.ld $(objects)
@printf "\e[1;33m[2/3]Linking object files\n\e[0m"
@$(LD) $(LDFLAGS) -T $< -o $@ $(objects)
@printf "Linking $(objects) to make $@\n"
@printf "Linking finished\n"
install: SectorOS_Kernel.bin
sudo cp $< /boot/SectorOS_Kernel.bin
SectorOS.iso: SectorOS_Kernel.bin
@printf "\e[1;34m[3/3]Building ISO file $@\n\e[0m"
@mkdir -pv iso
@mkdir -pv iso/boot
@mkdir -pv iso/boot/grub/
@cp $< iso/boot
@echo 'set timeout=3' >> iso/boot/grub/grub.cfg
@echo 'set default=0' >> iso/boot/grub/grub.cfg
@echo '' >> iso/boot/grub/grub.cfg
@echo 'menuentry "SectorOS" { '>> iso/boot/grub/grub.cfg
@echo 'multiboot /boot/SectorOS_Kernel.bin' >> iso/boot/grub/grub.cfg
@echo 'boot' >> iso/boot/grub/grub.cfg
@echo '}' >> iso/boot/grub/grub.cfg
@if [ $(GRUB) == "pt" ];then\
grub-mkrescue --output=$@ iso;\
else\
$(GRUB)/grub-mkrescue --output=$@ iso;\
fi
@rm -rf iso
move: SectorOS.iso
@printf "\e[1;35mMoving $< to Build_files\n\e[0m"
@mkdir Build_files
@mv *.iso SectorOS_Kernel.bin Build_files/
runQEMU: SectorOS.iso
qemu-system-i386 -boot d -cdrom SectorOS.iso -s -m 2048 &
runVBOX: SectorOS.iso
@printf "Starting VirtualBox\n";
@(killall VirtualBoxVM && sleep 1) || true
VirtualBoxVM --startvm 'SectorOS' --dbg &
runBOCHS: SectorOS.iso
@printf "Starting Bochs\n";
@(killall bochs && sleep 1) || true
$(BOCHS) -q -f bochsrc.txt &
stopVBOX:
killall VirtualBoxVM
.PHONY: clean
clean:
@printf "\e[1;31mCleaning the object files...\n\e[0m"
@rm -f $(objects) CPU/shutdown.o SectorOS_Kernel.bin SectorOS.iso