Installing Haiku to a partition from Linux

2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

This is a guide for you who have already been able to build an image of Haiku under Linux and running that with an emulator such as QEMU or VMWare and want to try Haiku natively with your real hardware.

Disclaimer: Do this on your own risk. I don't take any resposibility for any data loss caused by using this guide.

The following procedure have been tested with Kubuntu 7.04

I assume the following:

  • You are using Linux
  • You have a build system up and running
  • You are using GRUB as boot loader
  • You have a spare partition on which you want to install Haiku

The first thing you need to find out is the Linux name of your partition. A simple way of finding that is to run a partition editor. If you're using Gnome or Xfce, then use the application GParted, and if you are using KDE, the app to use is QTParted. In those applications you get a graphical view of your harddrives and partition layout.
The name of the partition can for example be
/dev/hdb3 - which means the third primary partition on the second PATA hard drive
or
/dev/sda6 - which means the second logical partition on the extended partition on the first SATA hard drive

Short simplified explanation of naming:
First letter: 'h' means PATA, 's' means SATA or USB drives
Third letter: 'a' means first drive, 'b' means second drive, and so on...
Digit: Partition number, 1-4 is primary partitions, one of these can be an extended partition which in turn contains logical partitions. The numbering of logical partitions start with 5.

Next step is to tell the build system that the "image" used for installing haiku on should be your partition instead of the file haiku.image which you have used previously. That can be done by overriding the variables HAIKU_IMAGE_NAME and HAIKU_IMAGE_DIR. The recommended way of doing that is to create a file called UserBuildConfig under trunk/build/jam. All your customizations to the image can be done here, like if you want to include extra drivers or applications which are not part of the standard image.
If your partition was at location /dev/sda6 the contents of UserBuildConfiq should read:

HAIKU_IMAGE_NAME	= sda6 ;
HAIKU_IMAGE_DIR		= /dev ;

Make sure that you wrote the right partition, because the partition will be overwritten.

Now you're set to build Haiku. Issue this command in a terminal (under the trunk directory):

jam -q

If no errors occured you will be flooded with messages like
Error: Failed to open connection to FS shell: No such file or directory
But that's to expect, since you dont have write access to the partition you're trying to install haiku on.

To complete the installation simply run

sudo jam -q

And the actual installation to the partition will be performed. The reason for not running with sudo the first time is that you want the ownership of the compiled files to be your user account.

Now it's time to add a boot entry for Haiku in GRUB.
To edit GRUB's entries run

sudo kate /boot/grub/menu.lst

or

sudo gedit /boot/grub/menu.lst

depending on what editor you use.

GRUB uses a different naming strategy for harddrives than Linux. It uses a scheme like this:

(hdN,n)

Where N is the hard disk number, starting on 0. And all hard disks' name start with hd.
And n is the partition number, also starting on 0. The first logical partition always have the number 4, regardless of the number of primary partitions.
If you're still unsure, check out
http://www.gnu.org/software/grub/manual/grub.html#Naming-convention

As an example
/dev/sda6 would be (hd0,5) in GRUB (if there are no PATA drives installed).

The entry would finally be

# Haiku on /dev/sda6
title		Haiku
rootnoverify	(hd0,5)
chainloader	+1

This should be somewhere in your /boot/grub/menu.lst file.

That's it! Reboot to test. Good luck, you'll need it.

If you have updated the source and want to reinstall Haiku, just run

jam -q

from trunk and subsequently

sudo jam -q

And your partition once again is populated by a fresh install.