Article Index

 Step 4: making it bootable

The last thing we need to do, is make the image bootable. For that we need some more stuff:

  • The bootloader; on 'normal' computers this would have been grub, but on the Raspberry Pi we need a custom bootloader. This is also called the 'firmware'.
  • Kernel; This will be a Linux kernel. It is actually also included in the bootloader/firmware package.
  • Sysvinit; The 'init' program used by default by Raspbian.
  • Udev; Tool for automatically creating device nodes
  • Mount; Tools for mounting the filesystems.
  • Rsyslog; Syslog daemon used by a lot of programs to log messages/warnings/errors.
  • Login and passwd; Login is the application asking for your password (on the command line). Login also starts your shell after a successful login. The package passwd gives you some tools to manage users and groups.
  • Bash; The default shell we will be using. Note that we already have the statically linked version of bash copied to the system. But we want the 'regular' package installed.
  • A few other tools and packages needed by installation scripts or applications. For example locales should be installed.

Installing these packages is now quite easy, because apt will do the hard work for us. We should install them in the right order however, because some packages do not depend on other packages according to the meta data, but they are needed by the installation scripts.

  1. So, let's chroot to our new environment and start installing the base packages needed by other tools.
    chroot /target
    apt-get update
    apt-get install base-passwd apt-utils ncurses-term ncurses-base gzip mawk hostname dialog
    apt-get install locales
  2. So, that's a good start, now configure the locales. At least create the locale specified by the environment variables displayed when you run 'locale'. You can create locales by running this command:
    dpkg-reconfigure locales
  3. And finally the last packages really needed for booting the system:
    apt-get install login
    apt-get install passwd
    apt-get install raspberrypi-bootloader sysvinit udev mount rsyslog bash
    apt-get install kmod

Almost there! Just a little bit of configuration to be done and then we're finished!

  • Create /etc/hostname and make up a host name. The file should only contain this host name.
  • Either give your root user a password with 'passwd'
    OR
    Create a regular user and install 'sudo'. Configure 'sudo' so your regular user can run sudo.
  • Create /etc/fstab and put your default mount points in it. The file should look like this:
    proc            /proc           proc    defaults          0       0
    /dev/mmcblk0p1 /boot vfat defaults 0 2
    /dev/mmcblk0p2 / ext4 defaults,noatime 0 1
  • Edit¬†/etc/network/interfaces and either:
    - Configure a static IP address for your eth0 device
    OR
    - Configure eth0 to use dhcp to get an IP address. For this, you'll need to install 'isc-dhcp-client'.

  • And last, but certainly not least, configure the firmware. It is best/easiest to copy the configuration from your host system. In your host environment (so not in the chrooted environment, you can exit by typing 'exit'), run this:
    cp -vi /boot/cmdline.txt /target/boot/cmdline.txt
    cp -vi /boot/config.txt /target/boot/config.txt

This should be it. You are done! \o/

Add comment


Security code
Refresh