Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 11:48 am



Post new topic Reply to topic  [ 4 posts ] 
 Kernel and bootloader together 
Author Message

Joined: Mon Oct 04, 2010 3:17 am
Posts: 2
Post Kernel and bootloader together
Hello,

I've decided to try writing small OS, just for educational purposes (I have lots of experience with development under DOS, VESA modes, even driver development (for later OSes like Linux and Windows), and also some apis), although I hit a brick wall (e.g. get stucked) with a bit of problem.

I've got my own bootloader, that I've written in past time (few weeks ago I started) and this is what I'm running, I'm testing inside Oracle Virtual Box (maybe you can suggest me better enviroment) using ISOs ... everything under debian-based linux (although I think I'll soon get to roof and setup good ol' Pentium with floppy on it).
I compile bootloader assembly source with NASM, then I have kernel ... so kernel starter is in assembly, compiled with NASM with aout parameter to object file and kernel in C through gcc (with -melf_i386 parameter, as I'm using x86_64 operating system on x86_64 hardware), though incremental linking with ld -i doesn't work ... I get an error:
ld: Relocatable linking with relocations from format a.out-i386-linux (Kernel_start.o) to format binary (../Boot.bin) is not supported
Which is saying me, that Kernel_start, is in i386 aout format, but Boot.bin is in pure binary format. My question is, is there something I'm doing wrong (of course it is) ... and what?


Mon Oct 04, 2010 3:38 am
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post Re: Kernel and bootloader together
A binary image, like your boot.bin holds no link information (found in object type compiler output) and thus cannot be linked with your kernel object.

_________________
Thank you for reading,

Kieran C G Foot


Tue Oct 05, 2010 5:11 am
Profile WWW

Joined: Mon Oct 04, 2010 3:17 am
Posts: 2
Post Re: Kernel and bootloader together
Okay, so probably best would be to compile and link kernel into another binary? How to put it into iso then (and also how to run it from bootloader then? copying from drive (in vbox is my iso as drive) to memory and just jumping to the memory physicall address where I load it?) ... so I need kernel to be another raw binary (or not?) placed right after first 512 bytes in the iso (as I don't have any larger experience with iso files, could someone briefly explain how to add another file to iso ... is is using mkisofs with some parameters or?

Thanks for the response.


Tue Oct 05, 2010 1:01 pm
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post Re: Kernel and bootloader together
What I would say is to have the bootloader as a binary, which is in the boot sector, which loads and then jumps to your kernel, which for pure ease of use could be in binary or if you are willing to put in the work you could write code into your bootloader to load an ELF/COFF kernel.

_________________
Thank you for reading,

Kieran C G Foot


Tue Oct 05, 2010 3:30 pm
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.