-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (72 loc) · 2.45 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#TrOS-2 Makefile
KERNEL := bootloader/bootsector bootloader/loader kernel
USERLAND := applications/trell applications/tusse applications/cenui applications/example
FOLDERS := build build/tmp build/tmp/apps build/tmp/services tools
SUBCLEAN = $(addsuffix .clean,$(KERNEL))
IMAGE = build/tros.img
DISKTOOL = build/trfs
TOOLCHAINDEST = $(shell pwd)/tools/gcc-i386-none-elf
.PHONY: $(KERNEL) $(USERLAND) $(IMAGE)
all: kernel user
rebuild: clean all
kernel: $(FOLDERS) $(KERNEL)
user: $(USERLAND)
kernel: $(KERNEL)
$(KERNEL):
$(MAKE) -C $@
cp -r ./$@/bin/* ./build/tmp
$(USERLAND):
$(MAKE) -C $@
cp -r ./$@/bin/* ./build/tmp
clean: $(SUBCLEAN)
rm -rf build/
$(SUBCLEAN): %.clean:
$(MAKE) -C $* clean
$(IMAGE):
rm -f build/tmp/*.mbr
rm -f $@
/sbin/mkdosfs -F 12 -n "TROS" -C $@ 1440
dd if=bootloader/bootsector/bin/floppy.mbr of=$@ bs=512 count=1 conv=notrunc
mcopy -i $@ ./build/tmp/* ::
@echo "\n\n\n------------- Created Image -------------\n\n\n"
run: all qemu
qemu: $(IMAGE)
qemu-system-i386 -drive format=raw,file=$(IMAGE),index=0,if=floppy -serial stdio -m 256 -d cpu_reset
debug: $(IMAGE)
qemu-system-i386 -drive format=raw,file=$(IMAGE),index=0,if=floppy -serial stdio -m 256 -d cpu_reset -s -S
bochs: $(IMAGE)
tools/bochs/bochs -q -f bochsrc.bxrc
toolchain: $(FOLDERS)
sudo apt-get install gcc g++ nasm wget dosfstools mtools libmpc-dev
# cd tools && \
# wget http://vps1.trollcode.no/i386-elf-gcc-WSL-bin.tar.gz && \
# tar xvzf i386-elf-gcc-WSL-bin.tar.gz && \
# mv i386-gcc-WSL i386-elf-gcc && \
# rm i386-elf-gcc-WSL-bin.tar.gz
cd tools && \
wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.gz \
&& tar xvzf binutils-2.24.tar.gz \
&& cd binutils-2.24 \
&& ./configure --prefix=$(TOOLCHAINDEST) --target=i386-elf --disable-nls --disable-werror\
&& make \
&& make install \
&& cd .. \
&& rm -rf binutils-2.24 \
&& rm binutils-2.24.tar.gz
cd tools && \
wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.gz \
&& tar xvzf gcc-4.9.0.tar.gz \
&& cd gcc-4.9.0 \
&& ./configure --prefix=$(TOOLCHAINDEST) --target=i386-elf --disable-nls --enable-languages=c --without-headers --disable-werror\
&& make all-gcc\
&& make install-gcc\
&& cd .. \
&& rm -rf gcc-4.9.0 \
&& rm gcc-4.9.0.tar.gz
# cd tools && \
# wget http://vps1.trollcode.no/bochs-2.6.8-WSL-bin.tar.gz && \
# tar xvzf bochs-2.6.8-WSL-bin.tar.gz && \
# rm bochs-2.6.8-WSL-bin.tar.gz
sudo apt-get autoremove
$(FOLDERS):
mkdir $@