Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-01

Using FPC to write an OS.

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

James Mills

Hi,

How do you use FPC for writing your own OS, kernel etc... I've read posts of this before, saying that you use the fakertl in the FPC sources. However that doesn't help much, I need a bit more detail please...

thank you
James

Marco van de Voort
to James Mills
How do you use FPC for writing your own OS, kernel etc... I've read posts of this before, saying that you use the fakertl in the FPC sources. However that doesn't help much, I need a bit more detail please...

See it like this:

- FPC generates general 32-bit code, that is transformed into the right format by the assembler/linker. (though for some platforms FPC contains the assembler). This is in principle not OS dependant, only processor dependant.

- the rtl is OS dependant, so you'll need to start over. (partially)
- A few things (like how to exit a program) need to be always defined. This (at least part of it) is what's defined in fakertl.
- Some language features (like sets, operations on 64-bits types) require certain helpers to be defined in the rtl. A description is in the "internal" documentation has some info on that (which is usually outdated, but maybe still a good reference). I latex'ed it, and put the PDF on www.stack.nl/~marcov/comparch.pdf

Most of these are processor dependant only though, that's why there is a processor dependant include in the fakertl.

Start with the fakertl, and try to build a minimal set of required features for what you need in the kernel on top of it, build an ELF binary with it, and start it with grub :-)

James Mills
to Marco van de Voort
Marco van de Voort wrote 28 lines
> How do you use FPC for writing your own OS, kernel etc... > I've read posts of this before, saying that you use the fakertl in the > FPC sources. However that doesn't help much, I need a bit more detail > please... See it like this: - FPC generates general 32-bit code, that is transformed into the right format by the assembler/linker. (though for some platforms FPC contains the assembler). This is in principle not OS dependant, only processor dependant. - the rtl is OS dependant, so you'll need to start over. (partially) - A few things (like how to exit a program) need to be always defined. This (at least part of it) is what's defined in fakertl. - Some language features (like sets, operations on 64-bits types) require certain helpers to be defined in the rtl. A description is in the "internal" documentation has some info on that (which is usually outdated, but maybe still a good reference). I latex'ed it, and put the PDF on www.stack.nl/~marcov/comparch.pdf Most of these are processor dependant only though, that's why there is a processor dependant include in the fakertl. Start with the fakertl, and try to build a minimal set of required features for what you need in the kernel on top of it, build an ELF binary with it, and start it with grub :-)

How do you start it with grub? I have never used grub before...

cheers
James

Show quoted text 5 lines
_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Marco van de Voort
to James Mills
Show quoted text 5 lines
> Start with the fakertl, and try to build a minimal set of required features > for what you need in the kernel on top of it, build an ELF binary with it, > and start it with grub :-) How do you start it with grub? I have never used grub before...

I never tried it, but IIRC the Grub bootloader can take an ELF binary from a partition and start is as kernel.

How to do it exactly, I don't know.

James Mills
to Marco van de Voort
Marco van de Voort wrote 10 lines
> > Start with the fakertl, and try to build a minimal set of required features > > for what you need in the kernel on top of it, build an ELF binary with it, > > and start it with grub :-) > > How do you start it with grub? I have never used grub before... I never tried it, but IIRC the Grub bootloader can take an ELF binary from a partition and start is as kernel. How to do it exactly, I don't know.

Could someone explain to me how to use the fakertl to use with your own OS ? And how to install it in your Linux system. I assume that once installed you can specify your os with fpc via a switch ?

thanks in advance
James

_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Marco van de Voort
to James Mills
Show quoted text 9 lines
> > > > How do you start it with grub? I have never used grub before... > > I never tried it, but IIRC the Grub bootloader can take an ELF binary > from a partition and start is as kernel. > > How to do it exactly, I don't know. Could someone explain to me how to use the fakertl to use with your own OS ?

It is a skeleton _only_, to build on top of, you have to fill it with your own OS. Try to follow e.g. the Linux RTL (mainly the system unit), and try to understand what each procedure does, and if you need it.

And how to install it in your Linux system. I assume that once installed you can specify your os with fpc via a switch ?

No, since FPC has no support for your OS. Simply ignore that for now. Keep using the Linux target, but give it the fakertl (or a stripped down Linux system unit with all linux specific syscalls replaced by the ones of your own OS)

Unknown author
to Christophe Espern
Christophe Espern wrote 10 lines
Hello, Maybe you can take a look to Delphineos. It is an OS project based on FPC. : Sourceforge repository http://sourceforge.net/projects/delphine The homepage (in french) : http://delphine.sourceforge.net/

Impressive. It actually boots on my PC :-)
From what I gathered from a cursory glance at the sources, It bypasses almost completely the system unit issues so the hints given by Marco will not be clarified by this project I think.

Nevertheless: Nice job :-)

Michael.

Christophe Espern
to Unknown author
Impressive. It actually boots on my PC :-)

Yes. When I dream I'm thinking of using it for a minimal MIDI OS put in a rack using a 486. I must first learn how to write a driver for my MIDI device parallel port.

The source code is very clear and as you said it's a really nice job (like FPC :).

I'm following the project since few months. Not really using it for the moment.

>From what I gathered from a cursory glance at the sources, It bypasses almost completely the system unit issues so the hints given by Marco will not be clarified by this project I think.

I agree but it's interesting to see what can be done from scratch.

Cheers,

Christophe