PS2Linux mini-Kernel mini-Tutorial

This tutorial shows you how to compile a smaller kernel from the _original_ PS2Linux 1.0 kernel-sources.
A smaller kernel is useful if you want to run a minimum-linux from a Memorycard on a playstation2 without a harddrive and need more space on the memorycard for your data. Do not modify the kernel on your linux-startup-card with this tutorial.

The original kernel of ps2linux has 2.1MB. If you do _not_ require harddisk-, network-, keyboard-, system V ipc-, sysctl- or Unix98 PTY-support for your standalone-memorycard-game, you can reduce the kernelsize to 1.1MB. Usually however you require more functionality and your kernel will grow to approximately 1.5MB.

The peculiarities of the PS2Linux kernel (for your information):

The PS2Linux-kernel has a few bugs in its configuration.
First you should not use "make xconfig" to configure the kernel, because if you do, you will most likely get an unusable kernel. Therefore you have to use the non-graphical "make config" to configure.
The second bug is that the dependencies are broken. This means that if you do "make config" and choose invalid combinations of functionalities, you will get a linker error after compiling. There is no simple solution to this, so usually you have to do trial & error. (I tried to avoid all invalid combinations in this tutorial. So if you stick to it, you should not get any linker-errors)

The required functionality:

Before starting through you have to decide what functionality you need for your kernel. The more functionality you want, the more space you will need for the kernel and its modules. Our mini-kernel simply is a kernel which does not include unnecessary things.

Most of the advanced functionality can be compiled as modules, which means that you can decide at runtime which functionality you want to plug into the kernel - no need to recompile the kernel every time.

However with PS2Linux there are 6 basic functionalities which cannot be compiled as a module, or where at least one part cannot be compiled as a module, or where it simply is inconvenient to have them as a module. So if you want to enable or disable one of the following, you have to recompile the kernel.

The last three only save a few kilobytes if you disable them.

Decide what functionality you need before continuing.

Configuring the kernel:

To make sure that you start off with a fresh config, change to /usr/src/linux/ and type

make clean
make mrproper
To start configuring the kernel type
make config
You will now be asked quite a few things - usually 3 answers are possible: Press <enter> to take the default.

The following is a list of answers to these questions. I only listed the answers which are different from the default, so if a question is not listed here, type <enter> to accept the default.
Note: Depending on your answers the script might skip some of the questions - this is normal.

CONFIG_NET: "y" if you want network, otherwise "n"
CONFIG_SYSVIPC: "y" if you want System V IPC, otherwise "n"
CONFIG_SYSCTL: "y" if you want Sysctl, otherwise "n"
CONFIG_KMOD: "n" (For a memcard-linux it is probably better to load the modules by hand using "insmod")
CONFIG_BLK_DEV_IDE: "y" if you want harddisk-support, otherwise "n"
CONFIG_BLK_DEV_LOOP: "m"
CONFIG_PACKET: "m" (you need to insert this module (af_packet.o) if you want dhcp to work)
CONFIG_UNIX: "m"
CONFIG_IP_MULTICAST: "n"
CONFIG_SCSI: "n"
CONFIG_UNIX98_PTYS: "y" if you want Unix98 PTY support, otherwise "n" (try setting this to "y" if you get linker errors)
CONFIG_USB: "y" if you want preliminary keyboard support, otherwise "m"
CONFIG_USB_KBD: "y" if you want preliminary keyboard support, otherwise "m"
CONFIG_USB_MOUSE: "m"
CONFIG_INPUT_KEYBDEV: "y" if you want preliminary keyboard support, otherwise "m"
CONFIG_NFS_FS: "m"
CONFIG_SMB_FS: "m" (you might want to connect to a samba-share some time)
CONFIG_PS2_PCCARDIDE: "n"
CONFIG_PS2_ETHER: "y" if you want network, otherwise "n"

Compiling the kernel:

If you are done configuring, it is time to build the kernel. Enter the following two commands:

"make dep"
"make"
Be patient. Compiling on the PS2 is slow. When everything worked, you should have a "vmlinux" in your current directory.
Copy "vmlinux" over to your memorycard and try booting it.
(If I was you, I would not mess with the kernel on the linux-startup-card, if you have only one linux-starup-card available)

If you screwed up your kernel-config, simply do "make mrproper" and "make clean" and you will start with the default-config again the next time you invoke "make config". You can also backup your current kernel-config by copying the file "/usr/src/linux/.config" to some other location and restore the config by copying the file back to this location.

After you are sure that the plain kernel works the way you want it to, you should compile the modules. You need this step to be able to "plug in" the functionality of all the items you answered with "m" or where the default was "m".

"make modules"
The modules are the .o files in the subdirectories of /usr/src/linux/modules. Pick out the ones you need end put them where ever you want.
Use "insmod " to insert a module into the kernel at runtime (with a startup-script for example).

Mr.M

Copyright (C) 2004 Michael Mahr (Michael.Mahr@fh-joanneum.at)