-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-kernel.sh
executable file
·23 lines (18 loc) · 1.19 KB
/
make-kernel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
clear
mount -t msdos image1.img /mnt -o loop
rm bin/kernel.bin
rm obj/main.o
gcc -O3 -nostdlib -nodefaultlibs -fno-stack-protector -fno-builtin -nostdinc -O -g -m32 -Wall -I. -c -o obj/textmode.o src/textmode.cpp
gcc -O3 -nostdlib -nodefaultlibs -fno-stack-protector -fno-builtin -nostdinc -O -g -m32 -Wall -I. -c -o obj/main.o src/main.cpp
gcc -O3 -nostdlib -nodefaultlibs -fno-stack-protector -fno-builtin -nostdinc -O -g -m32 -Wall -I. -c -o obj/system.o src/system.cpp
gcc -O3 -nostdlib -nodefaultlibs -fno-stack-protector -fno-builtin -nostdinc -O -g -m32 -Wall -I. -c -o obj/Interrupts.o src/Interrupts.cpp
gcc -O3 -nostdlib -nodefaultlibs -fno-stack-protector -fno-builtin -nostdinc -O -g -m32 -Wall -I. -c -o obj/timer.o src/timer.cpp
gcc -O3 -nostdlib -nodefaultlibs -fno-stack-protector -fno-builtin -nostdinc -O -g -m32 -Wall -I. -c -o obj/mm.o src/mm.cpp
nasm -f elf -o obj/load.o src/asm/loader.s
ld -T linker.ld -o bin/kernel.bin obj/Interrupts.o obj/load.o obj/mm.o obj/timer.o obj/textmode.o obj/main.o obj/system.o
cp bin/kernel.bin /mnt/boot/kernel.bin
cp bin/kernel.bin /mnt/boot/kernel.bin
chown kernel bin/kernel.bin obj/main.o
echo "Kernel Image generated succesfully!"
umount /mnt