Problem with the Bare-Bones Kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
JustJim
Posts: 5
Joined: Sun Nov 24, 2013 6:35 am

Problem with the Bare-Bones Kernel

Post 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
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Problem with the Bare-Bones Kernel

Post by iansjack »

Did you follow the first step in the Wiki article - "Building a Cross-Compiler"?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Problem with the Bare-Bones Kernel

Post by AJ »

...and if so, have you added your cross compiler binary path to the PATH environment variable?

Cheers,
Adam
JustJim
Posts: 5
Joined: Sun Nov 24, 2013 6:35 am

Re: Problem with the Bare-Bones Kernel

Post 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!
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Problem with the Bare-Bones Kernel

Post 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
Post Reply