Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 178 lines (166 sloc) 9.473 kB
86ae92f @jezze Added a proper makefile
authored
1 ARCH=x86
13f84e1 @jezze moved makefile to top directory
authored
2 DIR_IMAGE=build/root
0bcdc93 @jezze changed name from bin to user
authored
3 DIR_SOURCE_USER=user
13f84e1 @jezze moved makefile to top directory
authored
4 DIR_SOURCE_KERNEL=kernel
c0e2305 @jezze big change. moved arch folder into kernel folder
authored
5 DIR_SOURCE_ARCH=kernel/arch/${ARCH}
13f84e1 @jezze moved makefile to top directory
authored
6 DIR_SOURCE_LIB=lib
7 DIR_SOURCE_MODULES=modules
86ae92f @jezze Added a proper makefile
authored
8
9 ASM=nasm
10 ASMFLAGS=-f elf
11 GCC=gcc
6d5b121 @Max-Might Make it possible to build the OS on a x86_64 host.
Max-Might authored
12 GCCFLAGS=-c -O2 -Iinclude -Wall -Wextra -ffreestanding -nostdlib -nostartfiles -nodefaultlibs -m32
13 GCCFLAGS_RAMDISK=-c -O2 -Iinclude/lib -Wall -Wextra -ffreestanding -nostdlib -nostartfiles -nodefaultlibs -m32
86ae92f @jezze Added a proper makefile
authored
14 LD=ld
c0e2305 @jezze big change. moved arch folder into kernel folder
authored
15 LDFLAGS=-T${DIR_SOURCE_ARCH}/linker.ld -melf_i386
6d5b121 @Max-Might Make it possible to build the OS on a x86_64 host.
Max-Might authored
16 LDFLAGS_RAMDISK=-e main -melf_i386
86ae92f @jezze Added a proper makefile
authored
17
69da054 @jezze changed makefile
authored
18 .PHONY: all clean kernel user ramdisk sda iso hda
86ae92f @jezze Added a proper makefile
authored
19
17321f5 @jezze modified Makefile some
authored
20 all: ramdisk
86ae92f @jezze Added a proper makefile
authored
21
50ac634 @jezze added makefile for modules
authored
22 kernel:
2ba1881 @jezze added makefile for kernel
authored
23 @make -C lib/
24 @make -C kernel/
25 @make -C kernel/arch/x86/
50ac634 @jezze added makefile for modules
authored
26 @make -C modules/
c129e0e @jezze Large module cleanup
authored
27 @${LD} ${LDFLAGS} \
b077dfc @jezze created error functions
authored
28 ${DIR_SOURCE_KERNEL}/error.o \
70ae6bf @jezze added event handlers
authored
29 ${DIR_SOURCE_KERNEL}/event.o \
09ee8d2 @jezze more Makefile fixes
authored
30 ${DIR_SOURCE_KERNEL}/initrd.o \
31 ${DIR_SOURCE_KERNEL}/kernel.o \
32 ${DIR_SOURCE_KERNEL}/log.o \
33 ${DIR_SOURCE_KERNEL}/modules.o \
6991866 @jezze began work on runtime lib
authored
34 ${DIR_SOURCE_KERNEL}/runtime.o \
5b24890 @jezze seperated syscall in a general and arch specific version
authored
35 ${DIR_SOURCE_KERNEL}/syscall.o \
09ee8d2 @jezze more Makefile fixes
authored
36 ${DIR_SOURCE_KERNEL}/vfs.o \
d522f76 @jezze restructured alot
authored
37 ${DIR_SOURCE_MODULES}/ata/ata.o \
09ee8d2 @jezze more Makefile fixes
authored
38 ${DIR_SOURCE_MODULES}/elf/elf.o \
d522f76 @jezze restructured alot
authored
39 ${DIR_SOURCE_MODULES}/io/io.o \
40 ${DIR_SOURCE_MODULES}/io/ios.o \
41 ${DIR_SOURCE_MODULES}/kbd/kbd.o \
42 ${DIR_SOURCE_MODULES}/pci/pci.o \
43 ${DIR_SOURCE_MODULES}/pit/pit.o \
44 ${DIR_SOURCE_MODULES}/rtc/rtc.o \
ae898e5 @jezze changed some headers
authored
45 ${DIR_SOURCE_MODULES}/rtl8139/rtl8139.o \
d522f76 @jezze restructured alot
authored
46 ${DIR_SOURCE_MODULES}/serial/serial.o \
2aaa2da @jezze added stream device and changed how fudge handles device numbering
authored
47 ${DIR_SOURCE_MODULES}/stream/stream.o \
09ee8d2 @jezze more Makefile fixes
authored
48 ${DIR_SOURCE_MODULES}/tty/tty.o \
d522f76 @jezze restructured alot
authored
49 ${DIR_SOURCE_MODULES}/vga/vga.o \
c0e2305 @jezze big change. moved arch folder into kernel folder
authored
50 ${DIR_SOURCE_ARCH}/arch.o \
51 ${DIR_SOURCE_ARCH}/calls.o \
52 ${DIR_SOURCE_ARCH}/cpu.o \
53 ${DIR_SOURCE_ARCH}/fpu.o \
54 ${DIR_SOURCE_ARCH}/fpus.o \
55 ${DIR_SOURCE_ARCH}/gdt.o \
56 ${DIR_SOURCE_ARCH}/gdts.o \
57 ${DIR_SOURCE_ARCH}/idt.o \
58 ${DIR_SOURCE_ARCH}/idts.o \
59 ${DIR_SOURCE_ARCH}/init.o \
60 ${DIR_SOURCE_ARCH}/irqs.o \
61 ${DIR_SOURCE_ARCH}/isrs.o \
62 ${DIR_SOURCE_ARCH}/irq.o \
63 ${DIR_SOURCE_ARCH}/isr.o \
64 ${DIR_SOURCE_ARCH}/mmu.o \
65 ${DIR_SOURCE_ARCH}/mboot.o \
66 ${DIR_SOURCE_ARCH}/syscall.o \
67 ${DIR_SOURCE_ARCH}/tss.o \
68 ${DIR_SOURCE_ARCH}/tsss.o \
09ee8d2 @jezze more Makefile fixes
authored
69 ${DIR_SOURCE_LIB}/memory.o \
70 ${DIR_SOURCE_LIB}/file.o \
71 ${DIR_SOURCE_LIB}/string.o \
72 -o ${DIR_IMAGE}/boot/kernel
86ae92f @jezze Added a proper makefile
authored
73
69da054 @jezze changed makefile
authored
74 user:
0bcdc93 @jezze changed name from bin to user
authored
75 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/cat.c -o ${DIR_SOURCE_USER}/cat.o
76 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/cd.c -o ${DIR_SOURCE_USER}/cd.o
77 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/clear.c -o ${DIR_SOURCE_USER}/clear.o
78 @${ASM} ${ASMFLAGS} ${DIR_SOURCE_USER}/cpu.s -o ${DIR_SOURCE_USER}/cpus.o
79 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/cpu.c -o ${DIR_SOURCE_USER}/cpu.o
80 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/date.c -o ${DIR_SOURCE_USER}/date.o
81 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/echo.c -o ${DIR_SOURCE_USER}/echo.o
82 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/event1.c -o ${DIR_SOURCE_USER}/event1.o
83 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/event2.c -o ${DIR_SOURCE_USER}/event2.o
84 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/event3.c -o ${DIR_SOURCE_USER}/event3.o
85 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/hello.c -o ${DIR_SOURCE_USER}/hello.o
86 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/init.c -o ${DIR_SOURCE_USER}/init.o
87 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/ls.c -o ${DIR_SOURCE_USER}/ls.o
88 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/reboot.c -o ${DIR_SOURCE_USER}/reboot.o
89 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/shell.c -o ${DIR_SOURCE_USER}/shell.o
90 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/tar.c -o ${DIR_SOURCE_USER}/tar.o
91 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/timer.c -o ${DIR_SOURCE_USER}/timer.o
92 @${GCC} ${GCCFLAGS_RAMDISK} ${DIR_SOURCE_USER}/vga.c -o ${DIR_SOURCE_USER}/vga.o
93 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/cat.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/cat
94 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/cd.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/cd
95 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/clear.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/clear
96 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/cpu.o ${DIR_SOURCE_USER}/cpus.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/cpu
97 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/date.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/date
98 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/echo.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/echo
99 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/event1.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/event1
100 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/event2.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/event2
101 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/event3.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/event3
102 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/hello.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/hello
103 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/init.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/init
104 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/ls.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/ls
105 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/reboot.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/reboot
106 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/shell.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/shell
107 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/tar.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/tar
108 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/timer.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/timer
109 @${LD} ${LDFLAGS_RAMDISK} ${DIR_SOURCE_USER}/vga.o ${DIR_SOURCE_LIB}/memory.o ${DIR_SOURCE_LIB}/string.o ${DIR_SOURCE_LIB}/file.o ${DIR_SOURCE_ARCH}/calls.o -o ${DIR_IMAGE}/bin/vga
69da054 @jezze changed makefile
authored
110
111 ramdisk: kernel user
50ac634 @jezze added makefile for modules
authored
112 @cp ${DIR_SOURCE_MODULES}/test/test.o ${DIR_IMAGE}/lib/modules/test.ko
113 @cp ${DIR_SOURCE_MODULES}/ata/ata.o ${DIR_IMAGE}/lib/modules/ata.ko
114 @cp ${DIR_SOURCE_MODULES}/elf/elf.o ${DIR_IMAGE}/lib/modules/elf.ko
115 @cp ${DIR_SOURCE_MODULES}/io/io.o ${DIR_IMAGE}/lib/modules/io.ko
116 @cp ${DIR_SOURCE_MODULES}/io/ios.o ${DIR_IMAGE}/lib/modules/ios.ko
117 @cp ${DIR_SOURCE_MODULES}/kbd/kbd.o ${DIR_IMAGE}/lib/modules/kbd.ko
118 @cp ${DIR_SOURCE_MODULES}/pci/pci.o ${DIR_IMAGE}/lib/modules/pci.ko
119 @cp ${DIR_SOURCE_MODULES}/pit/pit.o ${DIR_IMAGE}/lib/modules/pit.ko
120 @cp ${DIR_SOURCE_MODULES}/rtc/rtc.o ${DIR_IMAGE}/lib/modules/rtc.ko
121 @cp ${DIR_SOURCE_MODULES}/rtl8139/rtl8139.o ${DIR_IMAGE}/lib/modules/rtl8139.ko
122 @cp ${DIR_SOURCE_MODULES}/serial/serial.o ${DIR_IMAGE}/lib/modules/serial.ko
123 @cp ${DIR_SOURCE_MODULES}/tty/tty.o ${DIR_IMAGE}/lib/modules/tty.ko
124 @cp ${DIR_SOURCE_MODULES}/vga/vga.o ${DIR_IMAGE}/lib/modules/vga.ko
c9e982e @jezze Added a cpio ramdisk too
authored
125 @tar -cvf initrd.tar ${DIR_IMAGE}
126 @find ${DIR_IMAGE} -depth -print | cpio -ov > initrd.cpio
cda3cc9 @jezze cleaned up makefile
authored
127 @mv initrd.tar ${DIR_IMAGE}/boot
128 @mv initrd.cpio ${DIR_IMAGE}/boot
86ae92f @jezze Added a proper makefile
authored
129
5643ef1 @jezze added new target
authored
130 sda:
c129e0e @jezze Large module cleanup
authored
131 @dd if=/dev/zero of=fudge.img bs=512 count=2880
09ee8d2 @jezze more Makefile fixes
authored
132 @dd if=${DIR_IMAGE}/boot/grub/stage1 conv=notrunc of=fudge.img bs=512 seek=0
133 @dd if=${DIR_IMAGE}/boot/grub/stage2 conv=notrunc of=fudge.img bs=512 seek=1
c129e0e @jezze Large module cleanup
authored
134 @dd if=menu.lst conv=notrunc of=fudge.img bs=512 seek=200
09ee8d2 @jezze more Makefile fixes
authored
135 @dd if=${DIR_IMAGE}/boot/kernel conv=notrunc of=fudge.img bs=512 seek=300
136 @dd if=${DIR_IMAGE}/boot/initrd.tar conv=notrunc of=fudge.img bs=512 seek=400
f59c62f @jezze fixed image creation
authored
137 @sh x86-write-image.sh
86ae92f @jezze Added a proper makefile
authored
138
17321f5 @jezze modified Makefile some
authored
139 iso:
09ee8d2 @jezze more Makefile fixes
authored
140 @genisoimage -R -b boot/grub/iso9660_stage1_5 -no-emul-boot -boot-load-size 4 -boot-info-table -o fudge.iso ${DIR_IMAGE}
17321f5 @jezze modified Makefile some
authored
141
5643ef1 @jezze added new target
authored
142 hda:
143 @dd if=/dev/zero of=hda.img bs=512 count=2880
144
86ae92f @jezze Added a proper makefile
authored
145 clean:
fbc86b6 @jezze added makefile for lib
authored
146 @make -C lib/ clean
2ba1881 @jezze added makefile for kernel
authored
147 @make -C kernel/ clean
be82ae1 @jezze created makefile for arch
authored
148 @make -C kernel/arch/x86/ clean
50ac634 @jezze added makefile for modules
authored
149 @make -C modules/ clean
c129e0e @jezze Large module cleanup
authored
150 @rm -f fudge.img
151 @rm -f fudge.iso
5643ef1 @jezze added new target
authored
152 @rm -f hda.img
09ee8d2 @jezze more Makefile fixes
authored
153 @rm -f ${DIR_IMAGE}/bin/cat
154 @rm -f ${DIR_IMAGE}/bin/cd
155 @rm -f ${DIR_IMAGE}/bin/clear
156 @rm -f ${DIR_IMAGE}/bin/cpu
157 @rm -f ${DIR_IMAGE}/bin/date
158 @rm -f ${DIR_IMAGE}/bin/echo
03fc05f @jezze added an event example
authored
159 @rm -f ${DIR_IMAGE}/bin/event1
62f2f4c @jezze added a pit event
authored
160 @rm -f ${DIR_IMAGE}/bin/event2
f0ce316 @jezze added another test
authored
161 @rm -f ${DIR_IMAGE}/bin/event3
09ee8d2 @jezze more Makefile fixes
authored
162 @rm -f ${DIR_IMAGE}/bin/hello
295992b @jezze added init file
authored
163 @rm -f ${DIR_IMAGE}/bin/init
09ee8d2 @jezze more Makefile fixes
authored
164 @rm -f ${DIR_IMAGE}/bin/ls
165 @rm -f ${DIR_IMAGE}/bin/reboot
166 @rm -f ${DIR_IMAGE}/bin/shell
167 @rm -f ${DIR_IMAGE}/bin/tar
168 @rm -f ${DIR_IMAGE}/bin/timer
169 @rm -f ${DIR_IMAGE}/bin/vga
efac7c3 @jezze updated makefile
authored
170 @rm -f ${DIR_IMAGE}/lib/modules/*.ko
09ee8d2 @jezze more Makefile fixes
authored
171 @rm -f ${DIR_IMAGE}/boot/kernel
172 @rm -f ${DIR_IMAGE}/boot/initrd
173 @rm -f ${DIR_IMAGE}/boot/initrd.tar
174 @rm -f ${DIR_IMAGE}/boot/initrd.cpio
0bcdc93 @jezze changed name from bin to user
authored
175 @rm -f ${DIR_SOURCE_USER}/*.o
09ee8d2 @jezze more Makefile fixes
authored
176 @rm -f ${DIR_SOURCE_KERNEL}/*.o
86ae92f @jezze Added a proper makefile
authored
177
Something went wrong with that request. Please try again.