(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

 

4. Build Your Kernel

4.1. Before you begin

This chapter assumes you wish to compile your own Linux kernel for the JavaStation. It assumes you already know how to compile Linux kernels in general, perhaps on 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, this HOWTO assumes you do it on a Linux/Sparc based server running in 32-bit mode.

4.2. Make sure you use 32-bit mode

When compiling your own JavaStation-capable kernel, you need to make sure the Sun server you are working on is set to 32-bit mode. So, if you're on an Ultra-class machine, be sure you 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 on which model of JavaStation you have.

Mr. Coffee support has worked 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. Pete Zaitcev added Krups support in the early 2.3.x sequence, but the MMU changes to the 32-bit SPARC kernel kept it from compiling cleanly until later on. The kernel is known to compile cleanly with the Mar. 17, 2000 CVS kernel, and should compile cleanly with any 2.3.99pre3+ version kernel. Krups support has been backported by Varol Kapton , and it is fully supported in the 2.2.15-prepatch versions; it should hopefully work with all later 2.2 kernels too.

The JavaStations support should be included in the now-stable 2.4 kernel series, but it has not been tested by the HOWTO author.

If you can not get a kernel to compile, you may 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:

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 

You can get a working ".config" file which has these 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 change by 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://javastation-howto.homeip.net/Files/patches/ramdisk_patch.txt

It should 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 "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.

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.

4.7. 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 by myself for you to get up-to-speed quickly. Warning: These kernel images are long since out of date, and you should use these only as a starting point, in case there are security problems that have been patched in latter kernel revs. If you want to see more updated kernel images, feel free donate to me a cheap SPARC workstation to prepare them on.

If you mirror these files, PLEASE email me so I can add your site address here.

4.7.1. Sample ".config" Files

http://javastation-howto.homeip.net/Files/kernels/kernel_embedded_config_2_3_99pre3_20000317.txt

This is a ".config" file donated by Robert Dubinski . It was used at Marquette University to build an embedded boot image from the Mar. 17, 2000 CVS kernel version. This includes support for both Mr. Coffee and Krups in an "Embedded-Root" filesystem configuration. These options should be valid for newer kernels as well; Perform a make oldconfig when using with latter kernels.

http://javastation-howto.homeip.net/Files/kernels/kernel_nfsroot_config_2_3_99pre3_20000317.txt

This is an nfs-root capable version of the above ".config" file.

4.7.2. Sample JavaStation-Ready Kernel Files

http://javastation-howto.homeip.net/Files/kernels/vmlinux_embedded_2_3_99pre3_20000317.gz

This is a kernel file donated by Robert Dubinski . It was built for Marquette University and is based off the Mar. 17, 2000 CVS kernel version.

This kernel image includes support for both Mr. Coffee and Krups models in an "Embedded-Root" filesystem configuration.

This boot kernel image has already been converted to the required AOUT executable format.

The md5sum of this file is: 7dd30780648016a39c781809fe924d2d

This file is gzipped. You should ungzip it once downloaded.

If for some reason you have troubles downloading, try holding left-shift on your browser as you click the link.

http://javastation-howto.homeip.net/Files/kernels/vmlinux_nfsroot_2_3_99pre3_20000317.gz

This is the nfs-root version of the above kernel.

The md5sum of this file is: 8f9c2c2eaec85ac802adc17060026b57

This file is gzipped. You should ungzip it once downloaded.

If for some reason you have troubles downloading, try holding left-shift on your browser as you click the link.

http://javastation-howto.homeip.net/Files/kernels/system.map_embedded_2_3_99pre3_20000317.txt

The System.map for the embedded kernel image.

http://javastation-howto.homeip.net/Files/kernels/system.map_nfsroot_2_3_99pre3_20000317.txt

The System.map for the nfsroot kernel image.