Merge pull request #20 from E-Almqvist/dev

GRUB!
pull/25/head
Elias Almqvist 3 years ago committed by GitHub
commit ae6578e25c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      compile.sh
  2. 20
      grub_compile.sh
  3. 0
      src/bootloader/bios.asm
  4. 0
      src/bootloader/bios/convert.asm
  5. 0
      src/bootloader/bios/disk.asm
  6. 0
      src/bootloader/bios/print.asm
  7. 2
      src/bootloader/bootloader.asm
  8. 0
      src/bootloader/equ/ascii.asm
  9. 0
      src/bootloader/equ/bios.asm
  10. 0
      src/bootloader/equ/vga.asm
  11. 0
      src/bootloader/pm.asm
  12. 0
      src/bootloader/pm/gdt.asm
  13. 0
      src/bootloader/pm/vga/print.asm
  14. 3
      src/grub/grub.cfg
  15. 0
      src/kernel/kernel.c
  16. 2
      src/kernel/lib/vga.c

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

@ -0,0 +1,20 @@
#!/usr/bin/bash
srcdir=src
bindir=bin
make_grub() {
echo "Making GRUB..."
mkdir -p $bindir/boot/grub
cp $bindir/kernel.bin $bindir/boot/eOS.bin
cp $srcdir/grub/grub.cfg $bindir/boot/grub/grub.cfg
grub-mkrescue -o $bindir/eOS.iso $bindir
}
compile_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
}
compile_kernel
make_grub

@ -38,7 +38,7 @@ BEGIN_PM:
load_kernel: load_kernel:
mov bx, KERNEL_OFFSET ; Load kernel at the kernel offset mov bx, KERNEL_OFFSET ; Load kernel at the kernel offset
mov dh, 7 ; Read 15 sectors mov dh, 9 ; Read 15 sectors
mov dl, [BOOT_DRIVE] ; Drive index mov dl, [BOOT_DRIVE] ; Drive index
call disk_read ; Load the kernel call disk_read ; Load the kernel

@ -0,0 +1,3 @@
menuentry "eOS" {
multiboot /boot/eOS.bin
}

@ -13,7 +13,7 @@ char* get_cursor_pos(unsigned int col, unsigned int row) {
void print(char* str, unsigned int str_len) { void print(char* str, unsigned int str_len) {
for( char* c = str; *c != '\0'; c++ ) for( char* c = str; *c != '\0'; c++ )
*get_cursor_pos( GET_INDEX(str, c), cursor_y ) = 'Y'; *get_cursor_pos( GET_INDEX(str, c), cursor_y ) = *c;
} }
void println(char* str, unsigned int str_len) { void println(char* str, unsigned int str_len) {
Loading…
Cancel
Save