-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildscript
86 lines (72 loc) · 2.98 KB
/
buildscript
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
#!/bin/bash
echo "Bootstrap Assembly"
i686-elf-as sourcefiles/boot.s -o buildfiles/boot.o;
i686-elf-as sourcefiles/interrupts.s -o buildfiles/interrupts.o;
i686-elf-as sourcefiles/threads_asm.s -o buildfiles/threads_asm.o;
i686-elf-as sourcefiles/rng_asm.s -o buildfiles/rng_asm.o;
i686-elf-as sourcefiles/ports.s -o buildfiles/ports.o;
#Kompiluje pliki w sourcefiles
cd sourcefiles
for file in $(find . -maxdepth 1 -type f -name "*.c")
do
temp=$(echo "${file%.*}")
name=$(echo $temp | sed 's/^..//')
echo "Compilling $name"
i686-elf-gcc -c $name.c -o ../buildfiles/$name.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter
done
#Kompiluje pliki w clib
cd clib
for file in $(find . -maxdepth 1 -type f -name "*.c")
do
temp=$(echo "${file%.*}")
name=$(echo $temp | sed 's/^..//')
echo "Compilling $name"
i686-elf-gcc -c $name.c -o ../../buildfiles/$name.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter
done
#Kompiluje pliki w programs
cd ../programs
for file in $(find . -maxdepth 1 -type f -name "*.c")
do
temp=$(echo "${file%.*}")
name=$(echo $temp | sed 's/^..//')
echo "Compilling $name"
i686-elf-gcc -c $name.c -o ../../buildfiles/$name.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter
done
#Kompiluje pliki w network
cd ../network
for file in $(find . -maxdepth 1 -type f -name "*.c")
do
temp=$(echo "${file%.*}")
name=$(echo $temp | sed 's/^..//')
echo "Compilling $name"
i686-elf-gcc -c $name.c -o ../../buildfiles/$name.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter
done
#Kompiluje pliki w additions
cd ../additions
for file in $(find . -maxdepth 1 -type f -name "*.c")
do
temp=$(echo "${file%.*}")
name=$(echo $temp | sed 's/^..//')
echo "Compilling $name"
i686-elf-gcc -c $name.c -o ../../buildfiles/$name.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter
done
cd ../..
#Linkuje jądro
echo "Linking Kernel"
i686-elf-gcc -T sourcefiles/linker.ld -o buildfiles/myos.bin -ffreestanding -O2 -nostdlib buildfiles/*.o -lgcc
if grub-file --is-x86-multiboot buildfiles/myos.bin; then
echo multiboot confirmed
else
echo the file is not multiboot
fi
echo "Creating bootable image"
mkdir -p isodir/boot/grub
cp buildfiles/myos.bin isodir/boot/myos.bin
cp sourcefiles/grub.cfg isodir/boot/grub/grub.cfg
grub-mkrescue -o buildfiles/myos.iso isodir &> buildfiles/build_log
cp buildfiles/myos.bin buildfiles/myos1.bin
cp buildfiles/myos.bin buildfiles/myos2.bin
echo "Starting QEMU - receiver"
qemu-system-i386 -show-cursor -no-kvm-irqchip -netdev socket,id=user.0,listen=:1234 -device rtl8139,netdev=user.0 -kernel buildfiles/myos1.bin&
echo "Starting QEMU - transmiter"
qemu-system-i386 -show-cursor -no-kvm-irqchip -netdev socket,id=user.1,connect=:1234 -device rtl8139,netdev=user.1 -kernel buildfiles/myos2.bin&