This repository has been archived by the owner on Oct 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compilerun.sh
79 lines (43 loc) · 1.84 KB
/
compilerun.sh
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
echo "Compiling Minister..."
export PATH=$PATH:/usr/local/i686elfgcc/bin
echo "Compiling Misc Assembly Files..."
nasm asm/bootload.asm -f bin -o bin/asm/bootload.bin
nasm asm/sectrfix.asm -f bin -o bin/asm/sectrfix.bin
nasm asm/krnlentr.asm -f elf -o bin/asm/krnlentr.bin
echo "Compiling Kernel..."
i686-elf-g++ -ffreestanding -m32 -g -c kernel/base/base.cpp -o bin/kernel/base.o
i686-elf-g++ -ffreestanding -m32 -g -c kernel/base/hardwarecom.cpp -o bin/kernel/hardwarecom.o
i686-elf-g++ -ffreestanding -m32 -g -c kernel/base/hardwareinfo.cpp -o bin/kernel/hardwareinfo.o
i686-elf-g++ -ffreestanding -m32 -g -c kernel/time/datetime.cpp -o bin/kernel/datetime.o
i686-elf-g++ -ffreestanding -m32 -g -c kernel/io/out.cpp -o bin/kernel/out.o
i686-elf-g++ -ffreestanding -m32 -g -c kernel/main.cpp -o bin/kernel/main.o
echo "Compilng the rest of the OS..."
echo "Linking Kernel..."
i686-elf-ld -o bin/kernel/krnl.bin -Ttext 0x1000 bin/asm/krnlentr.bin bin/kernel/base.o bin/kernel/hardwarecom.o bin/kernel/datetime.o bin/kernel/hardwareinfo.o bin/kernel/out.o bin/kernel/main.o --oformat binary
echo "Linking the rest of the OS..."
echo "Linking Assembly Files..."
cat bin/asm/bootload.bin bin/kernel/krnl.bin bin/asm/sectrfix.bin > bin/mnstros.bin
echo "Creating Floppy Disk Image"
dd if=/dev/zero of=bin/mnstros.img bs=512 count=2880
dd if=bin/mnstros.bin of=bin/mnstros.img seek=0 conv=notrunc
echo "Creating ISO"
cd bin
mkdir cdiso
cp mnstros.img cdiso
mkisofs -no-emul-boot -o mnstros.iso -V Minister -b mnstros.img cdiso
cd ..
echo "Cleaning up..."
cd bin
cd cdiso
rm mnstros.img
cd ..
rmdir cdiso
cd asm
rm bootload.bin krnlentr.bin sectrfix.bin
cd ..
cd kernel
rm krnl.bin base.o hardwarecom.o datetime.o hardwareinfo.o out.o main.o
cd ..
cd ..
echo "Done, running..."
qemu-system-x86_64 -drive format=raw,file=bin/mnstros.bin,index=0 -m 32M