[Prev][Next][Index][Thread]

Re: Environment required for minimal libc



------- Forwarded Message
Date:    Fri, 19 May 2000 12:57:05 -0600
From:    Alastair Reid <reid@cs>
To:      Lars Reuther <reuther@os.inf.tu-dresden.de>
cc:      oskit@fast
Subject: Re: Environment required for minimal libc 


Hi Lars,

I've been working on improving the componentisation of the OSKit -
including eliminating the services database and the libc_environment
and automatically generating initialisation sequences.  The new system
isn't ready for public release yet but recent oskit releases contain
the hooks needed to make it work and it should be possible to use
those same hooks.

> - oskit_clientos_init failes because it can not allocate memory in
>   oskit_services_create (com/services.c). Are there other functions
>   which must be overwritten and do I need oskit_clientos_init at all if 
>   I just want to use the minimal libc?

The only bit you really need from clientos is
clientos/{mem,morecore}.c.  If you compile these with -DCPUNITS, this
defines a symbol called "oskit_mem_object" (a pointer to a COM
object).  This needs no initialisation (because the only thing it
really needs is malloc_lmm which is initialized by multiboot_init
which is the first thing called by any kernel).

libc/malloc/*.c normally requires libc_memory_object and
oskit_library_services_lookup but if you compile it with -DCPUNITS
all it needs is "libc_memory_object" which should be a pointer to the
same object that oskit_mem_object points to.  

You can either arrange to initialise libc_memory_object by running an
initialiser along the lines of:

  libc_memory_object = oskit_mem_object;

but, as you've probably discovered, kernels start allocating memory
quite early on so it's hard to put the initialization in the right
place.  A better approach then is to compile clientos/mem.c with
- -Doskit_mem_object=libc_memory_object and let cpp and the linker do
the rest.

> - oskit_libkern is required to link a program (otherwise, ld misses
>   oskit_sendsig_init). Can I replace this by a dummy function?

If you can kill enough of clientos, the ndefined symbol will go away
(I think).


Alastair
------- End of Forwarded Message