4. Build Your Kernel

4.1. Before you begin

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.

4.2. Make sure you use 32-bit mode

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.

4.3. Supported Linux Kernel Versions

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.

4.4. Required Kernel Configuration Options

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.

For all JavaStations™, you want to enable PCI support:

CONFIG_PCI=y 

Don't forget your mouse:

CONFIG_BUSMOUSE=y 
CONFIG_SUN_MOUSE=y 

You'll want video, done with the Linux framebuffer interface:

CONFIG_FB_TCX=y (for Mr. Coffee) 
CONFIG_FB_PCI=y 
CONFIG_FB_IGA=y (for Krups/Espresso) 

Audio is done with the Crystal Audio 4231 chipset:

CONFIG_SPARCAUDIO=y 
CONFIG_SPARCAUDIO_CS4231=y 

Don't forget your network interface:

CONFIG_SUNLANCE=y (Mr. Coffee) 
CONFIG_HAPPYMEAL=y (Krups/Espresso) 

You'll no doubt need to support a filesystem:

CONFIG_EXT2_FS=y 

You'll want IP autoconfiguration, and RARP/BOOTP support:

CONFIG_IP_PNP=y 
CONFIG_IP_PNP_BOOTP=y 
CONFIG_IP_PNP_RARP=y 

When doing the NFS-Root filesystem configuration, you will need both NFS and NFS-Root support:

CONFIG_NFS_FS=y 
CONFIG_ROOT_NFS=y 

When doing the Embedded-Root filesystem, configure both RAM disks and initial ramdisk support:

CONFIG_BLK_DEV_RAM=y 
CONFIG_BLK_DEV_INITRD=y   (for 2.4.x, also configure size of ramdisk)

You can get a working .config file which has the required options set later in this chapter.

4.5. Necessary Patch for Embedded-Root FS Configurations

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:

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

If you can not do this, the patch below makes the edit for you.

4MB to 16MB kernel patch file is at: http://dubinski-family.org/~jshowto/Files/patches/ramdisk_patch.txt

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.

4.6. Build the JavaStation™-Ready Kernel

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.

4.7. Convert Kernel from ELF to a.out format

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.

4.8. JavaStation™-Ready Kernel Images, System.map and .config File Samples

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.

4.8.1. 2.3.99pre3_embedded_RSD

.config (md5sum c59329ceb2e831f2502c1e410ece141c): http://dubinski-family.org/~jshowto/Files/kernels/2.3.99pre3_embedded_RSD/config__2.3.99pre3_embedded_RSD.txt

kernel (md5sum 8e8d28b13961b92e3f95e4ba98f6f319): http://dubinski-family.org/~jshowto/Files/kernels/2.3.99pre3_embedded_RSD/vmlinux__2.3.99pre3_embedded_RSD.bz2

System.map (md5sum 43205a86fcb0b16ecae7313d38fcbb2c): http://dubinski-family.org/~jshowto/Files/kernels/2.3.99pre3_embedded_RSD/system.map__2.3.99pre3_embedded_RSD.txt

Description:

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.

Tested on Mr. Coffee: YES

Tested on Krups: YES

Tested on Espresso: NO

4.8.2. 2.3.99pre3_nfsroot_RSD

.config (md5sum e715370346ac298555dd7ce099c8f80a): http://dubinski-family.org/~jshowto/Files/kernels/2.3.99pre3_nfsroot_RSD/config__2.3.99pre3_nfsroot_RSD.txt

kernel (md5sum fd141e8e8f639df67427d5ecd0ecba76): http://dubinski-family.org/~jshowto/Files/kernels/2.3.99pre3_nfsroot_RSD/vmlinux__2.3.99pre3_nfsroot_RSD.bz2

System.map (md5sum fd141e8e8f639df67427d5ecd0ecba76): http://dubinski-family.org/~jshowto/Files/kernels/2.3.99pre3_nfsroot_RSD/system.map__2.3.99pre3_nfsroot_RSD.txt

Description:

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.

Tested on Mr. Coffee: YES

Tested on Krups: YES

Tested on Espresso: NO

4.8.3. 2.4.2_embedded_RSD

.config (md5sum dd1a9dd2e92b9b175b7ba747c94edca7): http://dubinski-family.org/~jshowto/Files/kernels/2.4.2_embedded_RSD/config__2.4.2_embedded_RSD.txt

kernel (md5sum 5a1592b7e0a37909ae16374296a7070e): http://dubinski-family.org/~jshowto/Files/kernels/2.4.2_embedded_RSD/vmlinux__2.4.2_embedded_RSD.bz2

System.map (md5sum 1de202e0fab7a9e661bebc80255605b7): http://dubinski-family.org/~jshowto/Files/kernels/2.4.2_embedded_RSD/system.map__2.4.2_embedded_RSD.txt

Description:

This kernel is donated by Robert Dubinski. It is a demonstration kernel for the 2.4.x series, and has not been tested...yet. It includes support for both Mr. Coffee and Krups machines.

Tested on Mr. Coffee: NO

Tested on Krups: NO

Tested on Espresso: NO

4.8.4. 2.4.2_nfsroot_RSD

.config (md5sum cabd1d98613ad169b372666b7eaa869b): http://dubinski-family.org/~jshowto/Files/kernels/2.4.2_nfsroot_RSD/config__2.4.2_nfsroot_RSD.txt

kernel (md5sum c24f42f72c58920c00ac7ff7aaffadde): http://dubinski-family.org/~jshowto/Files/kernels/2.4.2_nfsroot_RSD/vmlinux__2.4.2_nfsroot_RSD.bz2

System.map (md5sum 6af2b374c7d3fc3f97d48ab71b335062): http://dubinski-family.org/~jshowto/Files/kernels/2.4.2_nfsroot_RSD/system.map__2.4.2_nfsroot_RSD.txt

Description:

This kernel is donated by Robert Dubinski. It is a demonstration kernel for the 2.4.x series, and has not been tested...yet. It includes support for both Mr. Coffee and Krups machines.

Tested on Mr. Coffee: NO

Tested on Krups: NO

Tested on Espresso: NO

4.8.5. Outside kernel mirrors

Other sites mirror the kernels here or other kernel samples. Here are a few known sites as of Oct-31-2001: