This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Configuring for bare hw ia32 PC's

Luke A. Guest wrote:

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.


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.


(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.
   (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.


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.

Attachment: x86_toolkit.tar.gz
Description: application/gzip

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]