Go to the previous, next chapter.

How do I build a kernel myself?

Introduction

Theoretically you have two options here. You can build the kernel under AmigaDOS or under NetBSD itself. Initially NetBSD was compiled under AmigaDOS, of course, but now almost everybody works under NetBSD itself. It is highly recommended that you build the kernel under NetBSD, because you save a lot of HD-space on the Amiga side and, the more important reason, the possibility that other developers can help you with the problems that might occur is much higher. The only sensible reason for compiling under AmigaDOS is that you cannot run NetBSD, because NetBSD doesn't support your harddisk-controller, and you want to develop a driver for your controller.

So, if you want to compile NetBSD under AmigaDOS, get the document RECOMPILE. Although it is old, it contains some advice for this, but again, I strongly recommend that you do any kernel-development under NetBSD itself.

Compiling a new kernel under NetBSD

This section is work-in-progress, and necessarily sketchy at the moment! I'll write something more coherent once I've pushed this revision of the FAQ outta the door - Tim

For more general information on compiling the NetBSD kernel, refer to the 386BSD-FAQ; there is a complete chapter related to the subject.

Configuring the kernel

To build the new kernel under NetBSD, make sure you have the compiler package and the kernel source tree installed. Details of where you can find the kernel source will be included just as soon as I can remember where I found it (Anyone want to send me some information I could include about the mystic intricacies of sup?).

Change to the directory /sys/arch/amiga/conf. This is where the configuration file for the kernel lives. This file details exactly what options (eg. CD file systems) you want installed, and what hardware you have. The easiest way to configure your new kernel is to copy the file GENERIC, and name it after . (My machine is called `Babylon', so my kernel config file is named BABYLON too). Edit this file, commenting in/out options you do/don't want. It should be pretty clear from the comments what you can safely remove and what you definately shouldn't.

Once you have tailored the config file to your system, you need to ask the system to build a makefile for you. This is done with the program config.new. Type the following command

config.new BABYLON

(substituting your kernel name for BABYLON, obviously ;-). The program config.new will create a directory ../compile/BABYLON (or whatever), and place a customised kernel makefile & header files in there. If all goes to plan, you should get a message along the lines of `Don`t forget to run make depend'.

Compiling your kernel

You are now about ready to compile! Change directory to the compile directory for your kernel (eg. ../compile/BABYLON), and type

make depend

The computer will take a short while sorting out some computery stuff it has to do (to be technical about it ;-), and now is probably as good a time as any to start making the buckets of coffee you will inevitably need for the full kernel recompile. When the make finishes, you can set the system off building your kernel with

make

If this is your first kernel compile, the estimated time is "Forever". Particularly if you don't have too much memory to spare; however, it is feasible to do a kernel compile in only 4MB - I have ;-).

Several cups of coffee later

Assuming you only had coffee (and nothing more, say, alcoholic...), you should be able to use your new kernel once the compilation has finished. The kernel will be named netbsd in your compile directory.

When you successfully build and installed a new kernel, you can reboot your computer into the new kernel with the following command:

cp netbsd /dev/reload

Do not delete your old kernel etc. until you have fully tested the new one; bear in mind that once you reboot into the new kernel, commands like ps wont work unless you copy the new kernel image over the one in /netbsd.

@xref{FA device-files} doesn't exist.