Configuring for bare hw ia32 PC's
duane ellis
duane-newlib@duaneellis.com
Mon May 12 16:26:00 GMT 2008
Luke A. Guest wrote:
> Hi,
>
> I'm going to be looking into my OS project again and was wondering how
> to configure newlib. Should I be using i386-elf or i386-pc-elf or
> something else?
>
> I think I'm going to have to do *some* porting work to get newlib to
> compile for bare PC hw access, i.e. getting dummy I/O code working and
> also getting screen I/O to go to the BIOS framebuffer.
>
> Thanks,
> Luke.
>
>
A while back - (April) Jonathan Shapiro was asking about something like
this for his Cayotie (spelling?) Operating system
I whipped up a simple example for x86 and sent it to him, You might want
to take a look at this as starting point/example.
-Duane.
(0) My assumption is you load your kernel with something like uboot or
grub, or
and that thing can load an "elf" file - because that is what this
generates.
Basically all you need to do is:
(1) figure out your desired memory map - and thus your linker script.
(2) Add appropriate startup code to set registers - establish the stack etc.
Deal with other 'machine specific stuff'
(3) The attached example - has an example "fake_syscalls.c"
These functions could make 'bios' calls.
That is your job, you need to write that.
================
Two things to note:
(A) This might be a starting point for you.
And
(B) it might not, NEWLIB is more of an application standard C library.
Not really a "kernel standard c library"
It's a matter of personal preference. I believe kernels should have a
stripped down or reduced standard c library Apps - need the full
thing. My reasoning centers around 'syscalls' and the problem of
kernel code calling functions like 'fopen()' etc.... And - the fact that
the kernel uses a single language, and does not require things like
"locale" - the APP does - but not the kernel.
If you look at the makefile - it builds GCC in 2 stages stage 1 - is
just a straight up C compiler, nothing else. No standard library. That
should be enough to build your kernel as I describe.
==================
Also
The readme file talks about a "bios library" - if you create one - and
would like to share it - I'd appreciate it. I'm looking for something
very simple - at least the PC bios, maybe - timers maybe uart support.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86_toolkit.tar.gz
Type: application/gzip
Size: 3965 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20080512/986e6101/attachment.gz>
More information about the Newlib
mailing list