-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
29 lines (22 loc) · 1.25 KB
/
build.sh
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
set -e
rm -rf *.o
clang --target=i686-pc-none-elf -march=i686 -I. -Imain -Istdlib -ffreestanding -fno-builtin -nostdlib -nostdinc -c main/io.c -o io.o
clang --target=i686-pc-none-elf -march=i686 -I. -Imain -Istdlib -ffreestanding -fno-builtin -nostdlib -nostdinc -c main/main.c -o main.o
clang --target=i686-pc-none-elf -march=i686 -I. -Imain -Istdlib -ffreestanding -fno-builtin -nostdlib -nostdinc -c modules/serial/serial.c -o serial.o
clang --target=i686-pc-none-elf -march=i686 -I. -Imain -Istdlib -ffreestanding -fno-builtin -nostdlib -nostdinc -c modules/vga/vga.c -o vga.o
clang --target=i686-pc-none-elf -march=i686 -I. -Imain -Istdlib -ffreestanding -fno-builtin -nostdlib -nostdinc -c stdlib/stdio.c -o stdio.o
clang --target=i686-pc-none-elf -march=i686 -I. -Imain -Istdlib -ffreestanding -fno-builtin -nostdlib -nostdinc -c stdlib/string.c -o string.o
nasm -f elf main/boot.asm -o boot.o
clang --target=i686-pc-none-elf -ffreestanding -O2 -nostdlib -T linker.ld -o kernel.sys *.o
# Make GRUB disc
grub-file --is-x86-multiboot kernel.sys
mkdir -p isodir
mkdir -p isodir/boot
mkdir -p isodir/boot/grub
cp kernel.sys isodir/boot/kernel.sys
cat > isodir/boot/grub/grub.cfg << EOF
menuentry "myos" {
multiboot /boot/kernel.sys
}
EOF
grub-mkrescue -o build.iso isodir