Howto install Debian/armel with a custom kernel

In this doc, we show howto use Debian-installer on platforms not supported officially in Debian.

Prequisites

Hardware requirements

These are the normal Debian Requirements:

RAM

Installation space

Minimum

32MB

512MB

Recommended

64MB

1G

Installation may be performed on a hard drive, USB mass storage, SD/other memory card or even via NFS.

Some kind of installation media support is needed as well: ethernet network, hard drive or cd/dvd-rom.

Working kernel

Generally it is preferable to have a kernel that is as close to mainline (Linus' kernel) as possible. Theoretically, 2.6.16 is the oldest kernel that can run Debian/armel, but kernels newer than 2.6.24 are recommended. For the method outlined here, there are many drivers you will need compiled _into_ the kernel, not as modules:

Installation media support

This means you need to have support both for the media installed FROM, as well as TO the installation target.

Networking support

Unless you opt for a support-only installation from a DVD/USB device, the kernel needs to have all networking (either built-in ethernet or usb-ethernet) compiled into the kernel.

Filesystems

ext3 is the default filesystem for Debian. You will need to compile the support _into_ the kernel (not a as a module) regardless of filesystem you decide to use as boot media. tmpfs support is needed for initramfs.

Bootloader that can load kernel and initramfs

At least the following bootloaders are known to be sufficient:

Case example for Marvell 78x00 developer platform

First, build a kernel suitable for the installer:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- mv78xx0_defconfig

mv78xx0_defconfig doesn't have initrd support, so use menuconfig to change that. Also, ensure that filesystems (ext3,tmpfs), sata and network drivers are enabled.

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

Build the kernel:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
mkimage -A arm -O linux -T kernel -C none -a 0x200000 -e 0x200000 -n "Linux" -d vmlinux  uImage.db78x00_bp

Convert the initrd into uboot uimage format:

wget http://ftp.fi.debian.org/debian/dists/lenny/main/installer-armel/current/images/versatile/netboot/initrd.gz
mkimage -A arm -O linux -T ramdisk -C gzip -n "netboot image" -a 0x300000 -e 0x300000 -d initrd.gz uImage.db78x00_initrd

Now we copy these files to a tftp server. These files can be alternatively loaded anywhere that uBoot's ext2load or fatload commands can read the files.

For the tftp method, if you have ip and tftp host already set up, enter on u-boot console:

tftpboot 0x2000000 uImage.db78x00_bp
tftpboot 0x3000000 uImage.db78x00_initrd
bootm 0x2000000 0x3000000

The magic numbers are the memory locations of kernel and initramfs.

You can also load these file using a usb key. The file must be present on the first partition with a fat (vfat should work) filesystems. Enter on u-boot console:

usb reset;
fatload usb 0:1 0x2000000 uImage.db78x00_bp;
fatload usb 0:1 0x3000000 uImage.db78x00_initrd;
usb stop;

Inside Debian-installer

The installation generally follows the standard Debian-installer guide.

However, the installer will show some error messages due to the lack of kernel udebs and some platform code in d-i:

The first one would need kernel module udebs. The second one is fixable. The third one can be fixed if a vendor provides a kernel package and a Debian repository from where to download it from.

These errors will cause d-i to drop into "expert" mode, where d-i asks more questions than a regular install.

Tips and tricks

If you install from a local storage media (instead of tftp), you can put a Debian-installer .iso file to the same media and the installer will use them (instead of network).

You can use preseed file to provide default answers to questions asked by installer. You can even make the install fully automatic!

After install

The main thing left is setting up the bootloader to load the kernel, and pass proper root= flag to kernel. You will want to ensure that interesting stuff is installed before rebooting. So, in the D-I install complete screen:

install complete -> back -> shell

chroot /target
apt-get install openssh-server # and anything else you want 

Also you'll want to enable serial console by default, in /etc/inittab:

T0:23:respawn:/sbin/getty -L ttyS0 115200 linux

urn to di, reboot, and enter uboot, and boot this time without the ramdisk.