compile.sh refactor

pull/20/head
E. Almqvist 3 years ago
parent aa38917ca8
commit f5f14f2844
  1. 15
      compile.sh

@ -1,16 +1,27 @@
#!/usr/bin/bash #!/usr/bin/bash
done="[OK]" option=$1
fail="[FAIL]"
srcDir=src srcDir=src
binDir=bin binDir=bin
compile_bootloader() {
echo "Compiling bootloader... " echo "Compiling bootloader... "
nasm -f bin $srcDir/bootloader/bootloader.asm -i $srcDir/bootloader -o $binDir/bootloader.bin nasm -f bin $srcDir/bootloader/bootloader.asm -i $srcDir/bootloader -o $binDir/bootloader.bin
}
compile_kernel() {
echo "Compiling kernel... " echo "Compiling kernel... "
gcc -fno-pie -m32 -Os -ffreestanding -c $srcDir/kernel/kernel.c -o $binDir/kernel.o && gcc -o $binDir/kernel.bin $binDir/kernel.o -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32 gcc -fno-pie -m32 -Os -ffreestanding -c $srcDir/kernel/kernel.c -o $binDir/kernel.o && gcc -o $binDir/kernel.bin $binDir/kernel.o -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32
}
create_os_image() {
echo "Creating OS image... " echo "Creating OS image... "
cat $binDir/bootloader.bin $binDir/kernel.bin > $binDir/os-image cat $binDir/bootloader.bin $binDir/kernel.bin > $binDir/os-image
}
compile_bootloader
compile_kernel
create_os_image

Loading…
Cancel
Save