I’ve just successfully got Debian Linux running on a Raspberry Pi, having built it entirely from the balloonboard.org distribution. Why might you want to do this? Well, I did it because it gives me a small, clean Debian Linux installation which I can then customise. Here’s how I did it.
Get the software:
svn checkout svn://balloonboard.org/balloon/branches/menuconfig2 make menuconfig
- Mode Expert mode
- Balloon Board Raspberry Pi board
- Choose which buildroot version to build -> Feb 2013
- Select kernel version 3.8 (rpi)
- Select Build boot image
- Select Build kernel modules
- Select Build initrd kernel
- Select Build Raspberry Pi boot patition image
- Select Build Debian Root Filesystem
Now type make and it should all build.
Create yourself an SD card with two partitions on it: one smallish FAT partition for the boot files, and a big ext4 one for the root filesystem. Don’t forget to format them.
Into the FAT partition copy the contents of build/kernel/rpi-initrd-boot. Into the ext4 partition untar the file build/rootfs/debianrootstrap.modules.tgz.
Now put the SD card into your Pi and switch it on. This should boot into a ‘recovery kernel’ which has a minimal root filesystem in its initial ramdisk, just enough to sort out the ‘proper’ root filesystem. I used the console serial port to work with it. The HDMI and USB ports might also work but I haven’t tried them. It should come up with a login prompt. Log in as root, password rootme.
Now to configure the root filesystem:
mount /dev/mmcblk0p2 /mnt/root chroot /mnt/root
Finish the Debian installation (this has to be done now because some aspects of it need to run on the ARM processor, so it’s not easy to have your PC do it). It will ask you questions about time zones and things:
/var/lib/dpkg/info/dash.preinst install dpkg --configure -a
Set a password for the root account so you can log in
and add the serial port to the list of secure ports which are considered safe for root logins:
echo /dev/ttyAMA0 >> /etc/securetty
And shut things down
That last step will probably produce an error message, but it doesn’t matter as long as it’s written everything to the SD card.
Now put the SD card back in your PC, and copy the contents of build/kernel/rpi-boot into the FAT partition. That contains the real kernel which will mount the newly-minted root filesystem. Put it back into the Pi and boot. It will ask you to change the root password at first login.
It worked for me, though I had to ‘ifdown eth0’ and ‘ifup eth0’ again to get Ethernet to work. From that point on I was able to install Debian packages normally.