This chapter assumes you wish to compile your own Linux
kernel for the JavaStation.
If this is something you can not do, there are sample kernels pointed
to at the end of this chapter.

This chapter assumes you already know how to compile
Linux kernels in general, perhaps
on a PC, a SPARC server
running Linux, or any of the
other Linux ports. If not, read the
Kernel-HOWTO and the README file of your kernel source.

Compiling a kernel for a JavaStation is not
much different than compiling a Linux kernel
elsewhere. You just need to know the right options to pick. In general,
you're compiling for a Sun4M class architecture, and
enabling JavaStation-specific options. The
following sections in this chapter will take you through the steps.

While it may be possible to compile the JavaStation
-enabled kernel on alternate platforms by way of a cross-compiler, this
HOWTO assumes you will do it on a Linux/Sparc based server
running in 32-bit mode. Cross-compiling will not be covered, and
questions regarding it will not be entertained.

When compiling your own JavaStation-capable
kernel on a Sun server, you need to make sure the machine you work on is
set to 32-bit mode. So, if you're on an Ultra-class machine, be sure to
first switch to 32-bit mode before you begin compiling.

To check what mode you're in, do a uname -a. If it
says "sparc", you're in 32-bit mode and don't have to do
anything. If it reports "sparc64", then you should perform
a sparc32 bash first to switch to 32-bit mode. A
subsequent uname -a should reflect the change.

The kernel source revision you should use depends both on which model of
JavaStation you have, and which series
kernel you are using. The current "stable" series of Linux kernels is
2.4.x, but as we will read in a minute, this may not be the best bet
to use.

First, a few note on the 2.2.x and 2.3.x series.
Mr. Coffee has had kernel support since about
kernel version 2.2.5, and definitely works out of the box with the
RedHat 6.0+/SPARC distribution kernels.
Krups support did not work well out of the
box until the latter 2.3.x kernel cycle. Krups support was added
in the early 2.3.x sequence, but the MMU changes
to the 32-bit SPARC kernel had kept it from
compiling cleanly until later on.

Kernels for both Mr. Coffee and Krups compiled cleanly by the HOWTO
author with the Mar. 17, 2000 CVS kernel, and are included in the
Sample Kernels section.. Krups support was
backported into the 2.2.x kernels (where x>15). The latest 2.2.x
kernel "should" compile cleanly for the Mr. Coffee and Krups models,
but your mileage may vary.

Now onto the 2.4.x series.

The only kernel which has been tested and compiles cleanly for Mr. Coffee
and Krups is version 2.4.2. All other versions are broken or require a
patch.

The reason for this is that the sparc32 branch of the kernel has not had
an active maintainer for many months. Some are contributing fixes, but
without an active maintainer things go slow.

There is another reason to be weary of the 2.4.x series. From 2.4.0 through
2.4.9, the VM of the kernel was found to be inadequate under heavy loads,
and was subsequently replaced in 2.4.10+. This was a big change for the
so-called "stable" series of kernels.

To add further insult to injury, there have been security flaws detected
in all of 2.2.x kernel series and up through 2.4.12. This is patched
in pre-2.2.20 and 2.4.12+. As of this writing, 2.4.12+ has not been checked
by the author as functioning on the JavaStations.

So basically, it has been a crap-shoot over which kernel to choose.
Try a few until you find one that suits you best.

If you can not get a kernel to compile, or wish to avoid the headache or
trying, you may try the samples pointed to by this document.

When you do your make config command to enter the
kernel configuration stage, there are a few things you are required to
enable. Note that the following option names are from a 2.2.x kernel,
and may be slightly different on a 2.4.x series kernel. If in doubt,
check the sample files later in the chapter.

If you have decided to go with the "Embedded-Root" filesystem
option, you will want to make a patch to the RAMdisk
driver source first.

The default size of a RAM disk when using the RAM
disk driver is 4 MB. Chances are that you will
want an embedded filesystem of more than that size, particularly when you
start thinking about running an X server, or
including a Java runtime.

You can do this for 2.2.x kernels by a manual edit yourself, or by using the
patch pointed to below. The change is a one-line edit in the file
<LINUXROOT>/drivers/block/rd.c . Look for a line that says:

int rd_size = 4096; /* Size of the RAM disks */

and change it to the size of the RAMdisk you wish.
Typically, most embedded systems are under 16 MB, so
a common edit is to change the line to:

Kernels in the 2.4.x series allow you to select the amount of RAM
as a configuration option. The patch is no longer needed for those
kernels.

It should also be noted in this section that there is currently a limit on the
size of Linux boot image for all
JavaStation models, due to the implementation
of PROLL. This limit is technically 8
MB. This topic is mentioned again in
the "Questions and TroubleShooting" section of this document.

To build the kernel, you type make vmlinux. If you
come from an x86 Linux background, you might be
surprised that you do not perform a make bzImage
or make zImage. Do not be alarmed: this command
is correct.

When the compile is finished, you will find a file named "vmlinux
" in the kernel source root directory. You are almost ready to
put this kernel to use.

You need to make one more change to your kernel before it is ready for
use. You need to convert it from ELF to AOUT
executable format. You can do this with the "elftoaout
" utility included in most Linux/SPARC
distributions.

To convert your kernel image to the AOUT executable format,
you issue the command:

elftoaout -o vmlinux.aout vmlinux

You will probably now want to rename the image file to a longer name
which includes the current date and kernel revision you used, so as not
to get confused with when you have multiple boot kernel images down the road.

The elftoaout program should come with your SparcLinux distribution.
If not, try VGER or your favorite kernel mirror.

Here are some sample ".config" and JavaStation
-ready kernel images. They were prepared and donated
to help get you up-to-speed quickly.

Warning: Some of these kernel images are considered out of date,
and should be avoided in a production environment. It is up to
you to decide how much of a liability you feel running them holds.
The document author and kernel contributors cannot be held liable
for any damage caused by the use of these kernels. They are provided
with absolutely no warranties.

If for some reason you have troubles downloading, try holding left-shift
on your browser as you click the link. Kernel images are compressed
with bzip2 compression. They must be uncompressed before use. Kernel
images are already converted to a.out format.

If you mirror these files, or can verify they work on a machine not yet
confirmed, PLEASE email me so I can add your information
here.

This kernel is donated by Robert Dubinski. It was used at Marquette
University to build an embedded root boot image. This is based off of the
Mar. 17, 2000 CVS kernel. It includes support for both Mr. Coffee and
Krups machines.

This kernel is donated by Robert Dubinski. It was used at Marquette
University to prototype a filesystem. This is based off of the
Mar. 17, 2000 CVS kernel. It includes support for both Mr. Coffee and
Krups machines.