ELF kernel building on NetWinder

This document is outdated and will be removed soon. Please see the Kernel-HOWTO (available here) for newer information.

Last updated: Dec 28, 1998.

DISCLAIMER: Building your own kernel is an activity that you do entirely at your own risk. If it kills your system, damages your hard disk or wipes out your 50 gig collection of mp3's, then it is your own fault. The information on this page is meant for hackers who want to experiment.

VERY IMPORTANT: Upgrade your firmware to 2.0 and take the time to learn how it works before you start building or installing kernels! The new firmware allows you to specify which kernel to boot (by giving a file name) so in the event of a disaster, you will still be able to boot your system with the original kernel stored in /boot/vmlinux or perhaps /boot/vmlinux.rescue.

The following steps are needed to build a kernel on a NetWinder. The process is pretty much like building on x86, but there are a couple of gotchas. The paragraphs that follow explain some of the steps in detail. Read the whole page before starting! When you're done, you might want to check out the notes on booting an ELF kernel.

  1. Obtain the kernel source and untar it wherever you want. Typically you would put it in /usr/src/linux-2.0.3X (be sure to nuke or move any previous contents of that directory first).

  2. Ensure that the symbolic link /usr/src/linux points to the source tree that you just installed:

    	ln -s YOURPATH /usr/src/linux

  3. In the top-level of the source tree, enter 'make menuconfig' to configure the kernel. Below you will find a whole section on configuring the kernel. For most people, the default configuration will get you going. Note that even if you don't change anything, you must save your kernel configuration when asked, otherwise it won't build at all.

  4. Now build the kernel:
    	make dep
    	make clean
    	make modules

    If anything fails along the way, do not continue until you solve the problem. (There are many warnings along the way that have yet to be cleaned up; don't worry about them... but if there is an error, that is a problem).

  5. Install the modules into the appropriate place (this must be done as root but I'm sure I didn't need to tell you that):

    	make modules_install
  6. It is suggested that you keep your "active" kernels in the /boot directory: (be sure not to overwrite the existing vmlinux, or you might not be able to boot if your new kernel doesn't work!)

  7. 	cp vmlinux /boot/YOUR-NEW-KERNEL
  8. Reboot your system, and then in the firmware, set the kernfile entry to point at your new kernel:
    	setenv kernconfig fs
    	setenv kerndev /dev/hda1		# adjust as needed
    	setenv kernfile /boot/YOUR-NEW-KERNEL	# ditto
    You may wish to make the new settings permanant by issuing the save-all command. Then type boot to continue.

(Note for users of older (pre-2.0) firmware: The older firmware cannot load an ELF kernel directly. If you really want to use the older firmware, you need to munge the ELF kernel into a.out format using the vmelf program. This will generate a munged kernel called vm.elf which you can then copy onto your boot partition with the command dd if=vmlinux of=/dev/hda1 seek=1. In this case you will also have to set the kernconfig variable in the firmware to partition.)

If your new kernel won't boot, then you probably forgot some important hardware support when you built it. You should try with the default configuration (stored in arch/arm/defconfig) before reporting it as an error. To "recover" your system, all you need to do is reboot and changed the kernfile entry in the firmware to point back at your original kernel (/boot/vmlinux) and everything should be back to the way it was.

Kernel configuration

The default configuration (stored in arch/arm/defconfig) will build a kernel with all the core features you need, and anything else that you could conceivably want built as a module. As of the 2.0.35 kernel series, versioning is working, but the frame pointer option must not be enabled.

General Setup -->
	* Networking support
	* Kernel support for a.out   !!! must be built-in, 
	* Kernel support for ELF     !!! rather than a module

Floppy, IDE, block devices -->
	* Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
	* Other IDE chipset
	* W83C553 PCI Bus Master IDE DMA support

Networking Options -->
	* TCP/IP networking
        * Disable NAGLE algorithm
	* Drop source routed frames
	* Allow large windows

SCSI Support -->
	not needed, but if you wish you can built ZIP support as module

Network Device Support -->
	* Network device support
	* Ethernet (10 or 100 Mbit)
	* Other ISA cards
	* NE2000/NE1000 support		!!! this is for the 10-base-T

	If you want to support the 100-base-T ethernet then:
	* EISA, VLB, PCI and on-board controllers
	M DECchip tulil (dc21x4x) PCI support

Filesystems -->
	* Second extended fs support	!!! built-in, not module!
	* /proc filesystem

	If you want to to remote booting over NFS, then:
	* NFS filesytem			!!! built-in, not module!
	* Root filesystem on NFS
	* BOOTP support

Character Devices -->
	* Standard/generic serial port support
	* Mouse support
	* PS/2 mouse (aka "auxiliary device") support
	* Watchdog timer support
	* Netwinder watchdog
	* Enhanced Real Time Clock support
	* Thermostate device support (for VNC)	!! built-in

Sound, Hacking --> 
	not critical, config if you wish it.
	(Base address 0x250, IRQ 28, DMA 3 and 7).
	!! On 2.0.35 kernels the interrupt is moved to 12.

DO NOT OMIT the Thermostate support otherwise you fan won't work,
and for sure your machine will overheat and die a miserable death.