Installing Haiku to a partition from Linux

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
/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:


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


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:


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

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 from trunk

jam -q

and subsequently

sudo jam -q

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

Edit: Added pre tags to enhance readability

Awesome stuff :slight_smile:

I was considering publishing this info also, but I could not have done a job as well as this.

Maybe you could also add instructions on how to dd a raw image to a partition and then run makebootable on it using “jam run”. Not that it would necessarily be a better solution, but only for completeness.

you beat me to it :slight_smile: Thanks!

[quote=umccullough]Awesome stuff :slight_smile:

I was considering publishing this info also, but I could not have done a job as well as this.

Maybe you could also add instructions on how to dd a raw image to a partition and then run makebootable on it using “jam run”. Not that it would necessarily be a better solution, but only for completeness.[/quote]
Thanks :slight_smile:

I’ve never installed using dd and makebootable manually. When would that way of installation be used? Only thing I come to think of is if you don’t have a build system and download a precompiled image that you want to install, but problem is without a build system you probably don’t have makebootable…

Anyway, to make an install using dd and makebootable I think the following two lines would do (if you want to install to sda6, that is):

sudo dd if=generated/haiku.image of=/dev/sda6

To copy the contents of the haiku image to the partition.

sudo jam run ':<build>makebootable' /dev/sda6

To edit the partition offset in the boot code.

And add a GRUB entry as mentioned in the first post.

Edited to use sudo

It seems that the wiki has died since I have last had a working computer, but could this thread be linked or copied to the appropriate place for end user documentation. It might be easier for others to find.

Actually, if the article was cleaned up a bit, with various commands wrapped in <pre> tags - I think we could probably publish it in the developer documents area next to Ryan’s article about building in Linux.

Does the partition haiku will be installed on has limitations? I tested 3 week ago, If the partition isn’t primary partition, then a kernel panic came out. So I install haiku on a primary partition, everything is OK.

I’m using Haiku on a logical partition and it’s working just fine here. Not sure what problem you could be having.

My hard disk has 160GB space. The logical partition allocated for installing haiku is at the end of harddrive. Maybe this is the problem

Yes, perhaps it suffers from the 137gb limit - if the partition starts past 137gb, it might not be able to find it.

From what I can tell, the Haiku boot block(s) (is this stage 1.5?) is/are essentially identical to R5 at this point… so that might be a problem.

I believe there’s only a 4-byte (32-bit) offset stored in the boot block to tell the kernel where the start of the partition is located - don’t modern systems support 48-bit now?

I might be slow but when I run:

jam run’:makebootable’ /dev/sda3

I get:

thenerd@haiku-builder:~/develop/haiku/trunk$ jam run':makebootable'/dev/sda3 don't know how to make run:makebootable ...found 2 target(s)... ...can't find 1 target(s)...

Am I doing something obviously wrong? Haiku has been dd’d to /dev/sda3…

it should be:

jam run ':<build>makebootable' /dev/sda3

make sure you get the spaces right, and <build> is important!

Update: I just realized you probably did have <build> in your post, but you didn’t use &lt; and &gt; to represent the symbols - it’s HTML afterall :wink:

Anyhow, the spaces are extremely important still - and i’m guessing that’s why it mistook your jam target.

Ahh thanks Urias and yes I did miss that space. I also put the build there but never thought of the HTML part.

I’ll give it a try when I get home later today. Sometimes I can be a real n00b lol.

I ran it this time with sudo and it seems to have worked. thanks.

Hi, I had just figured out this way of installing myself the week before - running fine, except booting only worked for partitions on the first HD.

What I am still missing instructions for is how to customize the image built - especially the keyboard layout. I got the impression that the update-image Jam target doesn’t really update much, so I seem to need to overwrite the whole image and thus reconfigure it each time.

Side note: It appears I can boot Haiku from any DOS partition and browse the volume but can only mount a secondary volume that was written to e.g. /dev/sdb as opposed to /dev/sdb1? (otherwise I get a Kernel crash)

I would apreciate it if someone would upload the makebootable binary for linux since im on dialup atm… and BeOS doesn’t like my computer (BeOS Max boots then goes into a loop).

thanks, cb88

I too would like a binary makebootable since I don’t have svn on the computer at work and I couldn’t download the whole tree.

But seeing that this hw could be very well supported, having a free partition with Windows on it (102GB what a waste), I would download the haiku.image, dd it and set it to be bootable.

Good post!

well i tried to download the svn of haiku and the buildtools but i couldn’t get a good download on the windows computer i had to use. there was an error when i tried to build jam… jam0 built but it failed later on when it was actually called i believe.

iirc someone mentioned mapping the partition in qemu and running makebootable from inside haiku on the emulator on the mapped drive could someone eleborate on that? I can boot haiku with qemu. would the syntax for mapping a drive be like qemu -hdb /dev/hdb3 ./haiku.image or qemu -hdb /dev/hdb ./haiku.image or something else im not really sure.

I have a binary Linux makebootable that you guys can download here.

It is pretty old but should still work.

that makebootable is not compiled statically ldd reportes that and are needed