Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: a separate build of libc



On Mon, Sep 22, 2014 at 10:05:47PM +0200, u-6hol%aetey.se@localhost wrote:
 > > If what you are trying to do is port NetBSD's libc to a different OS,
 > > please say so, because that has been done before and we can give you a
 > > much better idea what it entails.
 > 
 > No, this is not the case.
 > (I guess you mean Minix or was there another effort?)

I personally have used NetBSD's libc in two different research OSes,
and I'm not the only person to have done that. The Minix thing
happened much later.

 > > If what you are trying to do is reorganize the NetBSD sources so that
 > > libc is a clearly defined component instead of being casually mixed
 > > with the kernel, please say so, because that has been done before and
 > > we can give you a much better idea what it entails.
 > 
 > This looks much nearer to what I do. I take piece by piece, not only
 > the libc but "everything", carefully avoiding artificial/redundant
 > interconnections (like unrelated libraries sharing the same directory,
 > if such an illustration helps).
 > 
 > > If you are doing neither of these things, I must say I haven't the
 > > slightest idea what you're trying to accomplish, and it might be
 > > helpful to explain.
 > 
 > I would be thankful for suggestions of how to extract all the necessary
 > and only the necessary source needed to build libc (among others not
 > the source for the binaries being used to build - unless they are to
 > contain hardcoded knowledge about the internals of the libc to be build,
 > I expect not :) I hope that by now I have learned enough to be able to
 > do this on my own but extra pointers are of course appreciated.

I still don't really understand what you're trying to accomplish, but
here goes:

   - the libc sources are in src/lib/libc
   - some additional sources are in src/common/lib/libc
   - you will also need the base includes (src/include) and the main
     kernel includes (src/sys/sys, src/arch/*/include)
   - you may need other kernel includes (e.g. src/sys/ufs/*/*.h or
     src/sys/uvm/*/*.h)

Some of the material in src/include is not actually libc (e.g. util.h
is for libutil) but you will need to sort this out on a file-by-file
basis. Similarly, much of the material in the kernel headers is
actually just kernel internals but you will also need to sort this out
on a file-by-file basis. A good starting point is to take the header
files that are installed by "make includes" (you can safely ignore
those that aren't) and strip out all the parts that are #ifdef _KERNEL.

You'll need a fairly thorough understanding of Unix and Unix library
interfaces (both historical and as reflected in various standards) to
get this right. It's not a small undertaking, and it's not something a
newbie can reasonably expect to be able to do.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index