Page 1 of 1

Problem with the Bare-Bones Kernel

Posted: Mon Nov 25, 2013 3:34 am
by JustJim
Hey There. After I solved the problem with my boot_sect I wanted to start with the "Just OS-Dev", meaning no Boot, no Realmode, just pure Kernel.
I used the Bare-Bones-Tut on the Wiki.
I did it several times, the last one only copy the scripts and built and executed them.
All I get (with qemu and grub) that there is no Magic Entry Point for Grub to load myOS.
When I start via qemu and -kernel it just exits with errors.

Here is what I used:
I am on a 64 Bit Machine (Ubuntu 13.04)
Bootstrap via NASM (meaning its 32Bit for me)

GCC
Couldnt use "i586-elf-gcc -c kernel.c -o kernel.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra" (there is no such command)
So I used "gcc -c kernel.c -o kernel.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra" at first.

Linking
For linkink i couldn't use "i586-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc"
So I used "gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc"
BUT There was an Error, cuz myos.bin in fact IS A 32 BIT thing while I am trying to link with other things lol.

So i added -m32 on both compile and linking.

Made the image like in the description.
Like I said, everything worked fine, til trying to boot :(
Whats wrong?
The code now is 1:1 from the website

Re: Problem with the Bare-Bones Kernel

Posted: Mon Nov 25, 2013 4:52 am
by iansjack
Did you follow the first step in the Wiki article - "Building a Cross-Compiler"?

Re: Problem with the Bare-Bones Kernel

Posted: Mon Nov 25, 2013 7:20 am
by AJ
...and if so, have you added your cross compiler binary path to the PATH environment variable?

Cheers,
Adam

Re: Problem with the Bare-Bones Kernel

Posted: Mon Nov 25, 2013 7:29 am
by JustJim
Ah a Cross-Compiler is really required? I thought it is recommended but not essential :S. Aight.
Thats my error i think haha
Thank you!

Re: Problem with the Bare-Bones Kernel

Posted: Mon Nov 25, 2013 7:45 am
by AJ
Hi,

Yes - in order to follow the tutorial verbatim, you need the cross-compiler. It just means that you are starting from a known baseline and know that the compiler isn't trying to pull in any unwanted dependencies. It also makes it easier for us to help with any other issues you encounter.

Cheers,
Adam