Kernel Executable format
Kernel Executable format
I am going to use virtual memory and paging for my OS and some people reccomended I use an executable format instead of plan binary. My operating system is going to be portible across architectures such as the i386+, 68020+, DEC Alpha, MIPS R4000+ and the PowerPC so I would like to keeps thins orginized.
I want to have virtual memory, paging, PNP and the like. I'm really considering taking the microkernel approch but a monlithic kernel is still on the table.
Right now my kernel is being compiled into plan binary format using JLOC. I'm using NASM 0.98 and Watcom C/C++ which at first were a pain to use but thanks to Ryu making an OBJ patcher for FIXUPP (They use the OMF object file) things run ok. I have no memory manager which brings me here. Because I'm using virtual memory and paging I'm going to have to relocate my kernel (its the most logical thing to do) however being the person that I am I like to plan things out in advance so I don't hit road blocks later on. The Watcom linker can do the MZ or PE executable format but I could use the GCC LD Linker (Does that accpect OMFs) for another executable format.
I'm also going to need to code my bootloader to load the kernel and when it comes to loading executables and relocation I'm lost.
If anyone can help me at all that would be great I'm really lost when it comes to this stuff
I want to have virtual memory, paging, PNP and the like. I'm really considering taking the microkernel approch but a monlithic kernel is still on the table.
Right now my kernel is being compiled into plan binary format using JLOC. I'm using NASM 0.98 and Watcom C/C++ which at first were a pain to use but thanks to Ryu making an OBJ patcher for FIXUPP (They use the OMF object file) things run ok. I have no memory manager which brings me here. Because I'm using virtual memory and paging I'm going to have to relocate my kernel (its the most logical thing to do) however being the person that I am I like to plan things out in advance so I don't hit road blocks later on. The Watcom linker can do the MZ or PE executable format but I could use the GCC LD Linker (Does that accpect OMFs) for another executable format.
I'm also going to need to code my bootloader to load the kernel and when it comes to loading executables and relocation I'm lost.
If anyone can help me at all that would be great I'm really lost when it comes to this stuff
In general you'll have to compile a gcc toolchain for OS development. Before building this compiler target platform and output-format can be choosen. GCC supports a wide range of architecures and should run on most of those mentioned by you. Choosing ELF as the file-format sounds like a reasonable idea.ELF sounds good then. I guess the GCC LD linker can output to that format?
a) Install Cygwin on your system
b) Create a toolchain for your target
I remember that we already talked about this some time ago (link). The precompiled binaries I uploaded back then should still be available if you want to avoid building it youself.
Everything but OMFWhat input object files does it take?
The format is really old and never was much more than an extention to its 16bit predecessor. You might just update your compiler and use some more modern and powerful object-file format (ELF, COFF, PE). Have a look at the osfaq for a list of supported input formats.
But your kernel already gets relocated to offset 0x10000 ? There are many reasons to use a proper binary-format but it's certainly not needed for virtual-addressing.Because I'm using virtual memory and paging I'm going to have to relocate my kernel
Why do you think that paging couldn't be used with a binary kernel ?
regards,
gaf
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
You mean RDOFF[2]?TheQuux wrote:RODFF?gaf wrote:Everything but OMFWhat input object files does it take?
I don't believe ld supports this format, no. However, I've worked with the rdoff2 object format. It's pretty straightforward and simple (the design goal), so adding it into ld probably wouldn't be difficult.
--Jeff
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
-
- Posts: 5
- Joined: Mon Nov 06, 2006 2:40 pm
- Location: Germany
I you're developing on windows, it should be most conveniant to use the PE format. This can be easily loaded by your booloader and a bit easier by grub.
I've built an PE loader into my os-project too and it makes the development workflow a lot smoother when you can work with the tools that you are used to, and not with tools that you _must_ choose because of a specific needed output format. In my opinion this should be the most importent base for the decision which binary format you want to use. Base it on the tools you are conveniant with and which your are used to, and than invest the little work to load your choosen format as is.
This will be the right thing in the long run.
I've built an PE loader into my os-project too and it makes the development workflow a lot smoother when you can work with the tools that you are used to, and not with tools that you _must_ choose because of a specific needed output format. In my opinion this should be the most importent base for the decision which binary format you want to use. Base it on the tools you are conveniant with and which your are used to, and than invest the little work to load your choosen format as is.
This will be the right thing in the long run.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
While I definitely agree with your logic, I'd just like to toss out there that, imo, ELF is superior to PE. If ELF interests you, you might want to start with PE and then transition to ELF (forgive me if this is what your last point is saying, I wasn't entirely sure).martin.zielinski wrote:I you're developing on windows, it should be most conveniant to use the PE format. This can be easily loaded by your booloader and a bit easier by grub.
I've built an PE loader into my os-project too and it makes the development workflow a lot smoother when you can work with the tools that you are used to, and not with tools that you _must_ choose because of a specific needed output format. In my opinion this should be the most importent base for the decision which binary format you want to use. Base it on the tools you are conveniant with and which your are used to, and than invest the little work to load your choosen format as is.
This will be the right thing in the long run.
Cheers,
Jeff
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
PE is a complex beast, and for what i've seen the documentation isnt really good. ELF however has a good formal specification, and compared to PE its relatively easy to use. The app that loads, relocates, and starts ELF executables in my os is just over 1.8kb
If you're used to GCC, you can build an ELF cross-compiler in 15 minutes.
As for the tool argument, some IDEs allow you to choose/configure for a specific compiler/target. If you are used to Visual Studio however, then you might indeed want to stick to PE as its afaik the only thing it'll do properly.
If you're used to GCC, you can build an ELF cross-compiler in 15 minutes.
As for the tool argument, some IDEs allow you to choose/configure for a specific compiler/target. If you are used to Visual Studio however, then you might indeed want to stick to PE as its afaik the only thing it'll do properly.
correction:As for the tool argument, some IDEs allow you to choose/configure for a specific compiler/target. If you are used to Visual Studio however, then you might indeed want to stick to PE as its afaik the only thing it'll do properly.
PE is the only format the MS compiler/linker will easily handle
if you want, you can use the visual studio IDE with GCC or any other command line compiler