-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile
executable file
·54 lines (45 loc) · 1.4 KB
/
compile
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
#!/bin/sh
echo "Compiling FAT12 driver..."
as -o fat12.o fat12.s
echo "Compiling first stage bootloader..."
as -o boot_firststage.o boot.s
ld.bfd --oformat binary -o boot_firststage.img -T linker.ld boot_firststage.o fat12.o
if [ -e boot_firststage.img ]
then
echo "First stage bootloder compilation OK"
else
echo "First stage bootloder compilation FAILED"
exit 0
fi
echo -e "\n\nobjdump output - First stage bootloader"
echo "####################"
objdump -D -b binary -m i8086 boot_firststage.img
echo "Compiling second stage bootloader..."
as -o boot_secondstage.o boot2.s
ld.bfd --oformat binary -o LINKSCND.BTT -T linker-2nd.ld boot_secondstage.o fat12.o
if [ -e LINKSCND.BTT ]
then
echo "Second stage bootloder compilation OK"
else
echo "Second stage bootloder compilation FAILED"
exit 0
fi
echo -e "\n\nobjdump output - Second stage bootloader"
echo "####################"
objdump -D -b binary -m i8086 LINKSCND.BTT
echo -e "\nCompile successful."
echo -e "\n\nCreating Disk image..."
su root -c "./pseudodisk"
sleep 0.4
if [ $1 = "d" ]; then
echo "Starting qemu"
echo -e "\nNOTE: Qemu started in Debug mode, vm execution is paused.\n"
qemu-system-i386 -m 32M -fda boot_fin.img -bios bios.bin -s -S
elif [ $1 = "w" ]; then
su root -c "dd if=boot_fin.img of=/dev/sda"
sleep 0.5
else
echo "Starting qemu."
whoami
qemu-system-i386 -m 32M -fda boot_fin.img -bios bios.bin
fi