Bona Fide OS Development

Kernel and bootloader together
Page 1 of 1

Author:  Vilem Otte [ Mon Oct 04, 2010 3:38 am ]
Post subject:  Kernel and bootloader together


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?

Author:  Kieran [ Tue Oct 05, 2010 5:11 am ]
Post subject:  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.

Author:  Vilem Otte [ Tue Oct 05, 2010 1:01 pm ]
Post subject:  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.

Author:  Kieran [ Tue Oct 05, 2010 3:30 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group