Page 1 of 1

GRUB Problem... again!

Posted: Thu Feb 20, 2003 9:40 pm
by Mastermind
I'm trying to switch to using GRUB to boot up my OS. I've got it installed on my floppy disk. I cannot load my OS from it. I figured that this may be because my OS is not "multiboot compliant." What is "multiboot compliance" and how can I make my OS compliant? Is there a solution?

The OS runs fine from my current loader, so it cannot be a programming error...

??? ??? ??? ???

Re:GRUB Problem... again!

Posted: Thu Feb 20, 2003 10:05 pm
by Parabola1
Just did this today for myself. :)

Here are a few links to help you.

The big multiboot specification: http://www.mcc.ac.uk/grub/multiboot_toc.html

The "quickstart" guide to grub and multiboot: http://osdev.neopages.net/tutorials/grub.php

That last link was the most helpful. Just compile your kernel as an ELF executable and use the "simple multiboot header" there.

What I did is create a simple multiboot ASM file with:

Code: Select all

MULTIBOOT_PAGE_ALIGN    equ     1<<0
MULTIBOOT_MEMORY_INFO   equ     1<<1

MULTIBOOT_HEADER_MAGIC  equ     0x1BADB002
MULTIBOOT_HEADER_FLAGS  equ     MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)

    ; The Multiboot header (in NASM syntax)
        align 4
        dd MULTIBOOT_HEADER_MAGIC
        dd MULTIBOOT_HEADER_FLAGS
        dd CHECKSUM
and then used my build script to build and link it:

Code: Select all

#!/bin/bash

nasm -f elf -o bin/mbhead.o code/mbhead.s
gcc -fno-builtin -c code/kernel.c -o bin/kernel.o
ld -o kernel.bin --oformat elf32-i386 -Ttext 0x100000 -e kernel bin/mbhead.o bin/kernel.o
and voila! (I think). While grub seems to like the kernel, and it seems to be booting, the catch is that since my kernel currently consists of a "while (1) do;", i'm not sure what is actually happening yet. :-D

Good luck!

GRUB Problem... solved!

Posted: Fri Feb 21, 2003 10:22 am
by Mastermind
:) :) Cool! Got it working! Thanks!!! :) :)