[Prev][Next][Index][Thread]
Re: build
mdaljeet <mdaljeet@in.ibm.com> writes:
> Hi, Instead of using the whole OSKIT tree, I want to extract the
> code that is required only for building a 'hello' kernel for
> x86. Can somebody tell me how to do that?
Interpreting "extract" as meaning "compile" (i.e., you don't want to
build the entire multi-megabyte OSKit just to build a 4000 byte
kernel), you could use Knit.
http://www.cs.utah.edu/flux/knit/
Knit lets you define components by listing the files they're composed
of, the imports (undefined symbols) and the exports (defined symbols)
and lets you combine components into programs by explicitly saying
which imports are connected to which export. It even lets you create
multiple instances of components if you want.
Since Knit "knows" what functions you actually need and exactly which
components those functions are implemented in, it only compiles the
files it needs so small kernels can be rebuilt from scratch really
fast.
Knit was explicitly designed with the OSKit in mind and one of the
first examples we built was, of course, the hello world kernel. If
you build the hello world kernel the normal way, it comes out as about
40kbytes. When you build it using Knit, you start wondering if you
really need to include things like serial line support, command-line
parsing, malloc, getenv, etc. and, before you know it, it drops in
size to about 4kbytes. (It drops by a further 2kbytes if you change
it to use puts instead of printf - but that's clearly cheating.)
We have split the OSKit into something like 300 components. You can
browse them online at:
ftp://flux.cs.utah.edu/flux/knit/current/oskit/index.html
OSKit users who don't use Knit might find this view of the code useful
too.
[Knit does a bunch of other things like automatically generating code
to initialize the components and detecting errors in component
connections like interrupt handlers manipulating locks but they don't
seem relevant to your question so I'l skip it.]
--
Alastair Reid reid@cs.utah.edu http://www.cs.utah.edu/~reid/
References:
- build
- From: mdaljeet@in.ibm.com