diff options
author | Marvin Borner | 2019-09-14 17:05:06 +0200 |
---|---|---|
committer | Marvin Borner | 2019-09-14 17:05:06 +0200 |
commit | 36bbfd9184426576d38841bcabfa5ba2b59f726c (patch) | |
tree | 5f21ffd8181bdaf873fb0ed0787784392c2f8af6 /build.sh | |
parent | 119d15393abe1bd0d31e7c9864799063b9b5dc28 (diff) |
Added very basic kernel and vga driver
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e0c6270 --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh +# Builds the operating system image + +# Install and source cross compiler if not already installed +. ./cross.sh + +# Create build directories +rm -rf ./build/ ./iso/ +mkdir ./build/ + +# Make source files +i686-elf-as ./src/boot.s -o ./build/boot.o +i686-elf-gcc -c ./src/kernel.c -o ./build/kernel.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra +i686-elf-gcc -T ./src/linker.ld -o ./build/melvix.bin -ffreestanding -O2 -nostdlib ./build/boot.o ./build/kernel.o -lgcc + +# Testing +if grub-file --is-x86-multiboot ./build/melvix.bin; then + echo Multiboot confirmed +else + echo Melvix has errors and won\'t be able to multi boot! + exit +fi + +# Create ISO +mkdir -p ./iso/boot/grub +cp ./build/melvix.bin ./iso/boot/ +cp ./src/grub.cfg ./iso/boot/grub/ +grub-mkrescue -o ./build/melvix.iso ./iso/ + +# Run ISO +qemu-system-x86_64 -cdrom ./build/melvix.iso |