build - compile and install the kernel
build [compile-options ...]
Build compiles the kernel sources found in a subdirectory of /usr/src,
(usually /usr/src/sys) and installs the resulting kernel image in /minix.
Build must be called from some subdirectory in the selected kernel source
directory if it is to know what it must compile. It will use
/usr/src/sys if called from /usr/src.
The kernel source tree has the following subdirectories:
The Minix kernel, the lowest layer of the operating system. (The
word "kernel" is used both for this part of the operating system,
and for the whole combination. What is meant is usually clear from
mm The Memory Manager.
fs The File System.
Contains an "init" stub routine that calls /sbin/init. Init needs
not be present in the image at boot time, so it has been replaced by
a small stub. (It could be put back if so needed.)
inet The sources of the internetworking task. Build will not compile
this task. Init and inet are seen as normal commands and are
therefore compiled from the central Makefile.
Contains the central Makefile to compile all the kernel parts and
make an image. Usually contains the same images as /minix and all
the images created in the last week. The default action of the
Makefile is to create a kernel image. Other possible actions are:
make depend, to generate Makefile dependencies, make clean, to clean
the source tree of intermediate files, and make bootable, to install
a new bootstrap and boot code into the root file system.
Contains the files version.h and revision.c. The first tells the
O.S. release and version strings. The second is the revision number
of the kernel, it is automatically increased by one each time you
call build. The concatenation of release, version and revision
numbers is used to name the image in the tools directory and /minix.
Before build is called for the first time an important decision must be
made. Do you want to do the compilation in the source directory, or in a
so-called "build-tree" full of links to the source directory? The former
pollutes your source directory with .o files and executables, but the
latter requires a lot of discipline to maintain the links. If you decide
to use a build-tree (see @build(8) for more) then use the following
commands to create it:
When executed build will simply call make in the tools directory to make
a new image. There is nothing sinister going on, you can type make in
the many kernel directories yourself if you want to, all that build does
extra is manage the images in tools and /minix. Any options given to
build are attached to the CFLAGS variable in the many Makefiles using the
OPT environment variable. (So build -O is the same as OPT=-O make ...)
There are usually two images in /minix. One that is known to work, and
one experimental. After build has made a new image it will ask which one
of these to remove. By default it will want to remove the experimental
(newest) image. You can use wildcards (*, ?) in your answer, or 'foo' or
anything else if you want to remove nothing. No questions are asked if
there are no images or just one image in /minix.
The first new kernel you would like to make is one configured for your
system. The kernel you are running now contains several hard disk
drivers you don't need, so you may want to kick them out to save a few
bytes. In the file config.h in the kernel directory you can find a
number of ENABLE_XXX variables that can be set to 0 to exclude, or 1 to
include a particular driver. Another driver related variable is
DMA_SECTORS. This variable sets the size of a buffer used by DMA based
disk drivers (all but the floppy, AT, and Adaptec drivers). Raise its
value to greatly improve throughput, especially writing. A value of 16
shows good results. (Has no effect on old interleaved drives.)
Called from the task makefiles to increase the revision number. Not
normally called by the user.
/usr/src/sys Default kernel source directory and associated
/minix Image directory.
make(1), @build(8), usage(8).
The revision number will only be increased in the kernel, mm, and fs
directories, not on a change in task.stubs for instance. So be careful
at the "removal" prompt.
Kees J. Bot (email@example.com)