Sunday , 20 April 2014

Multi-Boot a Raspberry Pi with Berryboot

The Raspberry Pi is a fantastic little computer capable of all sorts of things, but unfortunately it only supports one operating system at a time.
Berryboot allows you to boot into as many Raspberry Pi operating systems as you want.

 


berryboot-menu

Berryboot is pretty self-explanatory. Just install Berryboot on your SD card and run the program. That fill format your SD card and give you an option to download a few of the more popular operatings systems like Rasbian, Sugar, and others. You can also add your operating systems as well, but it takes a bit of work in the command line. It’s easy enough to manually swap operating systems on a Raspberry Pi since they’re just installed on an SD card, but if you want to have them all on one card Berryboot is an easy way to do it.

For people short on SD cards:
Berryboot is a simple boot selection screen, allowing you to put multiple Linux distribution on a single SD card.
In addition it allows you to put the operating system files on an external USB hard drive instead of on the SD card itself.

Download link Berryboot for the Raspberry Pi: berryboot-20130225.zip
SourceForge project directory: BerryBoot

To install:
Extract the contents of the .zip file to a normal (FAT formatted) SD card, and put it in your Raspberry Pi. This can be simply done under Windows without any special image writer software.
Once you start your Pi it will start an installer that reformats the SD card and downloads the operating systems files from the Internet.

 

Walkthrough


bb1
 

If your Pi is connected to the Internet BerryBoot will try to detect your location based on your IP-address, and set the right timezone automatically. Verify that it is correct and press “ok”

 


bb2
 

Select where you want to store the operating system files, and press “format” You can install the operating system files on the SD card itself or an external USB stick/disk. Be aware that if you choose an external drive, the files of the operating system will be stored there, but you still need to keep the SD card in the Pi to boot from.

  • WARNING: all existing files on the disk will be erased.

 


bb3
 

Select which operating system you want to install. You can add more later.

 


bb4
 

It will download the files from the Internet automatically.

 


bb5
 

In the Berryboot menu editor you can install more operating systems, rename them, delete them, etc. Press “exit” to exit the editor and start using the operating system you installed.

 

HDMI CEC Support

When attached to a HDMI TV, you can also use the arrows on your TV remote to select an operating system to boot, instead of using your keyboard or mouse.

 

Alternative Installation Method Using Disk Image

If you are experiencing problems unpacking the installation files to a FAT formatted SD card (the easiest and recommend installation method), you can alternatively use a tool like Win32diskimager or dd to write this disk image to the card.
The disk image is meant to install Berryboot on another device, but it includes the Raspberry Pi boot files as well.

 

Headless Installation

(for advanced users)

Normal wired network headless installation

If you would like to use Berryboot without having a display attached, open the file named cmdline.txt located on the SD card in a text editor, and append the following settings to the same line as the other options:

vncinstall ipv4=192.168.88.88/255.255.255.0/192.168.88.1

The network information is in IP/netmask/gateway format.
You can then start a VNC client program on your normal computer, and connect to the IP-address you specified.

Wireless headless installation

To start a headless installation using wifi, append to cmdline.txt on the same line as the existing options:

vncinstall ipv4=192.168.88.88/255.255.255.0/192.168.88.1/wlan0

And create a file called wpa_supplicant.conf on the FAT partition of the SD card with the wifi SSID and password in the following format:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
 
network={
    ssid="ssid-of-accesspoint"
    psk="wpa-password"
}

 

Adding Your Own Custom Operating System to Menu

(for advanced users)

You can add your own extra operating systems to the menu. However this requires that you convert your file system image to SquashFS format first.

Most Raspberry Pi operating system images are disk images containing two partitions. A FAT partition with the boot loader and kernel files, and a second ext4 partition with everything else. We are interested in the second partition.

With a regular Linux desktop computer that has kpartx and mksquashfs installed, you can convert the second partition to SquashFS like this:

$ sudo kpartx -av image_you_want_to_convert.img
add map loop0p1 (252:5): 0 117187 linear /dev/loop0 1
add map loop0p2 (252:6): 0 3493888 linear /dev/loop0 118784
$ sudo mount /dev/mapper/loop0p2 /mnt
$ sudo sed -i 's/^\/dev\/mmcblk/#\0/g' /mnt/etc/fstab
$ sudo mksquashfs /mnt converted_image_for_berryboot.img -comp lzo -e lib/modules
$ sudo umount /mnt
$ sudo kpartx -d image_you_want_to_convert.img

Notes:

  • If kpartx reports it created a mapping different than loop0p2 (e.g. loop4p2) mount that instead. This can happen if loop0 is already in use by something else on the system.
  • We are excluding /lib/modules from the image, because the kernel modules shipped with Berryboot are used instead, and shared with all distributions.
  • Some older versions of mksquashfs do not support the ”-comp lzo” option. You can leave it out to let it use gzip compression instead. Advantage of LZO is that it is faster to uncompress, which is a big plus on slow ARM devices, and therefore preferred. This does come at a cost of reduced compression ratio (LZO images are larger than gzip ones).

Put your SquashFS formatted image on a USB stick, go to the “Operating system installer”, hold down your mouse button over “Add OS” and select “Install from USB stick”

If your image prefers to have a certain memory split use the extension .img128 .img192, .img224 or .img240 instead of .img.

 

Source Code

Source code is available at: https://github.com/maxnet/berryboot