Installing Haiku to a partition from Linux

Article contributed by ekdahl on Thu, 2007-09-06 16:36
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.

Comments

Re: Installing Haiku to a partition from Linux

There is now also HAIKU_DONT_CLEAR_IMAGE build variable (from r22397 on), which does not zero out the image but only initializes it.

Re: Installing Haiku to a partition from Linux

Hi everyone!

After trying out Haiku on VMWare, I followed the instructions above on my Ubuntu 7.04 and everything went like a breeze, until I rebooted and chose Haiku in my grub menu (it's on /dev/sda9, i.e hd0,8 on my SATA HD) . Then I got a segmentation fault and a kind welcome to kernel debugging, which I genuinely appreciated. At this point I have a couple of very basic questions. Thanks in advance to anyone who will bother to address them.

Does the filesystem installed on the Haiku partitions prior to writing the image on it make any difference? Should the partition be formatted prior to jamming the image on it? Should the partition be mounted?

I guess that the answers are no, it's irrelevant and no, but I am asking just in case.

Cheers and congratulations to all pursuing this marvelous project.

t

Re: Installing Haiku to a partition from Linux

IT WORKS!!!
At bootup I F2ed, just changed the SATA mode from IDE to RAID, then grubbed and Haiku flourished in all its beauty on my screen. It worked almost flawlessly. I had a look around and adjusted my keyboard settings.

Cool, cool, cool.

t

Re: Installing Haiku to a partition from Linux

That's great ! First time I've been able to install Haiku! Thanks a lot for this guide.

However, no web browser is installed by default, and I can't seem to be able to access ext3 or fat32 partitions in Haiku - nor is Ubuntu able to mount my haiku partition.

I know it's a newbie question, but how could I add at least Firefox to the system so I can download and install other applications (I don't have a CD reader :) ).

Also, "First letter: 'h' means PATA, 's' means SATA or USB drives" is sadly not true under Ubuntu - the devs seems to play with partition names, sometimes they decide to name everything sd##, sometimes it's hd##, and they have fun doing it in the same release. ATM, under Gutsy, everything is sd## (my PATA drives too...), but they might break it again by renaming everything again in a future update.

And before reboot, one step is needed :
sudo grub-install hd0

But the guide is really great, and it's really good to be able to do everything from Linux!

On another note, is it possible to install Haiku from a pre-built image (one with many included apps f.e.) onto a partition?
_________
Edit :
Just answered my first question : wget :) however haiku-os sure looks ugly in Opera 3.6 :)
The kernel crashes to fast for me to start using it yet, I think I'll wait till I got a machine powerful enough to run it under Vmware to tinker with it.

Re: Installing Haiku to a partition from Linux

Actually I managed to install haiku without building the sourcecode (of both haiku and the developer tools). Since I'm a lazy guy, I just downloaded the haiku image and then I copied it to a free partition with dd. To make the partition bootable, I downloaded and builded jam (only jam!) and then I downloaded haiku source code and builded just makebootable.

With a nigthly hd image and makebootable, you can install haiku in a minute even from linux...

Re: Installing Haiku to a partition from Linux

Indeed, what you really need is makebootable, as pre-built images are available to all.

Maybe we should package our Linux makebootable binary in order to help people avoiding the "build it" step even.

Re: Installing Haiku to a partition from Linux

phoudoin wrote:

Maybe we should package our Linux makebootable binary in order to help people avoiding the "build it" step even.

This definitely sounds like a good idea. If you do, we could store it on haiku-files.org and link to it from the downloads and development pages.

Re: Installing Haiku to a partition from Linux

A .deb package in Ubuntu's repositories would be the best :)

If makebootable builds with the traditional config/make, and the license is open source (even if not GPL) it should be straightforward, especially if makebootable is functional enough and wouldn't need to be updated at each release (it should then be picked up for each Ubuntu release).

The best would be to get a Debian guy to include the package in Sid, then we can ask for an import in Ubuntu.

Re: Installing Haiku to a partition from Linux

Hi Guys,

I tried building haiku immediately to the partition using the above under Ubuntu 7.10 but unfortunately to no avail. Here's what I get when I run jam -q:

/Documents/Programming/haiku$ jam -q
...patience...
don't know how to make stage1.bin
...patience...
don't know how to make ./../early-image-script.sh
don't know how to make libbe.so
don't know how to make ./../late-image-script.sh
...found 2334 target(s)...
...updating 4 target(s)...
...can't find 4 target(s)...
...can't make 5 target(s)...
InitScript1 generated/haiku.image-init-vars
...skipped file-data-RAWT:666:BootCode-stage1.bin.rsrc for lack of stage1.bin...
...skipped makebootable for lack of file-data-RAWT:666:BootCode-stage1.bin.rsrc...
...skipped haiku.image-init-vars for lack of makebootable...
InitScript1 generated/haiku.image-make-dirs
InitScript1 generated/haiku.image-copy-files
...skipped haiku.image-copy-files-dummy-beos/system/lib for lack of libbe.so...
InitScript1 generated/haiku.image-unzip-files
...skipped sda3 for lack of haiku.image-init-vars...
...skipped 5 target(s)...
...updated 4 target(s)...

Afterwards, I tried building Haiku normally (deleting the UserBuildConfig file of course) and an image is successfully created. I dd-ed this image to the partition, but now the only step left is making this partition bootable. I tried:

sudo jam run ':makebootable' /dev/sda3

but that does me give the following error:

:~/Documents/Programming/haiku$ sudo jam run ':makebootable' /dev/sda3
[sudo] password for tim:
don't know how to make makebootable
...found 2 target(s)...
...can't find 1 target(s)...
...can't make 1 target(s)...
...skipped run_0 for lack of makebootable...
...skipped 1 target(s)...

so does anyone have an idea on how I can get Haiku to boot on my machine using one of these approaches? I tried making the partition bootable using zeta, but it does not boot on the new machine (core2duo and sata drive)...Anyway would love to try out Haiku on this new machine because both vista and Ubuntu are making me somewhat nauseous ;)

regards,

Tim

Re: Installing Haiku to a partition from Linux

It appears you probably copied UserBuildConfig.sample to UserBuildConfig mostly unmodified. This is probably a bad idea as UserBuildConfig.sample includes a BUNCH of other stuff that you don't need or want unless you know what you're doing.

My recommendation would be to take only the settings from UserBuildConfig.sample that you really need and create a new UserBuildConfig - either that or comment out every other setting from the sample that you don't need by putting # in front of them (this is usually what I do)

Note that jam is very particular about spaces - spaces before and after equals, spaces before the final semicolon, etc.

(editing my comment):

As for the problem with makebootable, I think the proper command is actually:

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

see here:

http://dev.haiku-os.org/ticket/1544

Re: Installing Haiku to a partition from Linux

Major Thanks!

I now managed to build Haiku using your first suggestion of just keeping UserBuildConfig to the essential. Haiku now installs and boots from its partition. However, right after the bootscreen I end in KDL, something about not being able to mount the partition. I'll try and have a look at the cause and submit a bug report!

regards,

Tim

Re: Installing Haiku to a partition from Linux

What's the correct usage of HAIKU_DONT_CLEAR_IMAGE?

My UserBuildConfig looks like this

HAIKU_IMAGE_NAME       = sdb2 ;
HAIKU_IMAGE_DIR        = /dev ;
HAIKU_DONT_CLEAR_IMAGE = 1 ;

But when running

$ jam -q
$ sudo jam -q

to install Haiku, the partition is just reinstalled (deleting all settings) and when using jam -q update-image, the build process is very short, but the image (i.e. the partition) isn't touched (i.e. settings are kept and revision just stays the same).

Re: Installing Haiku to a partition from Linux

I believe the HAIKU_DONT_CLEAR_IMAGE = 1 just tells the build system not to bother writing 0's across the entire image length before initializing it... pretty much just a short-cut feature to save time. I believe the reason the 0's are written is so that someone building raw haiku images doesn't send someone some garbage data off their disk in the area of the image that wasn't filled - and it will compress down better with all 0's in the freespace area.

I believe the use of update-image requires you to specify a target to update on the image (such as a driver, a library, etc.)

There's a way to change the buildsystem to "update-mode" by enabling the following rule in your UserBuildConfig:

SetUpdateHaikuImageOnly 1 ;

At which point you can use

sudo jam -q haiku-image

and it should update all targets without reinitializing the partition first. I'm having mixed results with this method, however... so you may need to play with it a bit to see how well it works.

If you want to build a complete image again, you'll need to remove that setting.

(A note for others reading this: in the above jam usage - the lack of any target specified defaults to the "haiku-image" target currently, and the use of -q tells jam to quit on the first failed target.)

Re: Installing Haiku to a partition from Linux

Can someone send me "makebootable" compiled statically for Linux?
Thanks a lot.

Re: Installing Haiku to a partition from Linux

Please guys, help me install Haiku, you have just to send me the makebootable executable compiled statically...
Damn it, isn't it easy?

Greetings from Italy

Re: Installing Haiku to a partition from Linux

You would have far more luck asking this question on the haiku-development mailing list rather than in the comments on an article posted to the website months ago.

I personally wouldn't know how to trick the Haiku build system into building a statically-linked version of makebootable... I'm sure some mangling of the Jamfile is possible - but you'll be better off asking the Jam experts themselves on the mailing list.

On the other hand, I don't understand what's preventing you from downloading the sources and building it yourself - that's far easier in my opinion!

Re: Installing Haiku to a partition from Linux

I will follow your suggestion ;)
I'm just lazy!

EDIT:
svn checked out, compiled cross tools, compiled makebootable.
One question: when I run makebootable I get Segmentation Fault (core dumped).
Olè!

Re: Installing Haiku to a partition from Linux

Can i extract all haiku from raw image and later put it in a beos clean partition, to boot it with grub?
i want try it but i dont know how give that format with linux.

Re: Installing Haiku to a partition from Linux

I wrote the below script to carry out the initial steps in haiku's install process
Tested on Ubuntu Linux 8.04.
---------------------------------------------------------------------------------------------------------
#!/bin/bash
apt-get -y install autoconf automake build-essential texinfo flex bison gawk subversion db4.6-util subversion-tools

BUILD_DIR=/mnt/sda2
#there is where we will work
#this is where we will mount our partition
#you may rename it if you'd like

TYPE=ext3
#this is the filesystem type

PART=/dev/sda2
#this is the partition that we will use
#of course, change /dev/sda2 to w/e partition it is being installed on

mkdir -v $BUILD_DIR

mount -v -t $TYPE $PART $BUILD_DIR

cd $BUILD_DIR

svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools
#build tools

svn checkout svn://svn.berlios.de/haiku/haiku/trunk haiku
#haiku

cd buildtools/jam

make

./jam0 install
#installed jam

cd $BUILD_DIR/haiku

./configure --build-cross-tools-gcc4 x86 ../buildtools/

---------------------------------------------------------------------------------------------------------

Once the script finishes the haiku partition is still mounted on /mnt/sda2. Is this a problem or do I have to unmount the partition to carry out the actual install?

Re: Installing Haiku to a partition from Linux

Friend,
take one usb pendrive and from linux, use this command:

dd if=myhaikuimage.img of=/dev/sdX
where X is the number of your pendrive device.
Now you have to boot your computer from the USB pendrive...

It worked for me, I was able to play with haiku on my new Asus EeePC 901. Man, this is really fast.. Cant wait to show haiku at the next Linux Day here in Italy..

Re: Installing Haiku to a partition from Linux

how to install Haiku from image to hd with DD?

Re: Installing Haiku to a partition from Linux

Loïc wrote:

Also, "First letter: 'h' means PATA, 's' means SATA or USB drives" is sadly not true under Ubuntu - the devs seems to play with partition names, sometimes they decide to name everything sd##, sometimes it's hd##, and they have fun doing it in the same release. ATM, under Gutsy, everything is sd## (my PATA drives too...), but they might break it again by renaming everything again in a future update.

That is not just Ub, Fedora 8-9 (as well as the current Rawhide) did that as well... there as been a reason change in the upstream kernel, the use of libATA, that seems to make every drive as a SATA drive (regardless of what it really is). It's rather disturbing that for the sake of clean code, this big logic error was created... and has yet to be corrected.

Re: Installing Haiku to a partition from Linux

Why do you consider it a "big logic error" that the drive naming was consolidated?

If you need to refer to some particular disk most often you will find one of the links in /dev/disk/ is more useful than directly referring to /dev/sd*.

For example, the links in /dev/disk/by-uuid/ will always refer to a partition with some particular filesystem on it using the UUID. So even if you unplug the disk from an eSATA port and then connect it via a USB adapter, it will still have the same name. Or if you dd the raw filesystem from a USB disk onto an old IDE drive, the same applies.

Or consider the links in /dev/disk/by-id/ which allow you to talk about disk or partition by the type, manufacturer, model and serial number, so that you can refer to the second partition on the SATA disk you just bought, even if you reformat that partition or plug the disk into a different SATA port.

Re: Installing Haiku to a partition from Linux

Ok, I've just downloaded Haiku in 25 minutes and JAM'd Haiku in 45 minutes in Ubuntu 8.10 (Intrepid Ibex) on my system that takes BeOS about 2 hours to do each. I now have a nice, shiny new copy of "haiku.image" (r2870x) I wish to install onto the 9.7Gbyte BFS partition I kept, when I replaced BeOS with Ubuntu 8.10 on this system, earlier today.

Anyone know/have a nice, simple, step-by-step way of doing this? Seems there's a bit of conflicting information concerning how to go about doing this, and I can't make much sense of it.

Instructions specific to Ubuntu would be appreciated.

Re: Installing Haiku to a partition from Linux

Read the UserBuildConfig.ReadMe (you'll find it in the trunk/build dir) - it explains how to create a build profile that points to a partition which you can use to jam -q @mydisk or whatever you choose to name it.

Re: Installing Haiku to a partition from Linux

umccullough wrote:

Read the UserBuildConfig.ReadMe (you'll find it in the trunk/build dir) - it explains how to create a build profile that points to a partition which you can use to jam -q @mydisk or whatever you choose to name it.

I've read it, but it doesn't make any real sense to me.

My second 9.7Gbyte partition ("unknown" by Ubuntu 8.10, since it's a BFS partition) is called /dev/sda2.

I'm still in the Terminal, having just JAM'd the latest revision of Haiku in Ubuntu 8.10.

Can you or someone else give me a step-by-step guide how to get haiku.image (residing in /generated) to that partition and get a Boot menu thingy (GRUB?) going, so I can then select Ubuntu or Haiku at bootup?

There are simply too many little bits and pieces in replies and conflicting comments by various people, for me to figure out exactly what I need to do. HELP?!?

I've just had an awesomely wonderful day downloading and JAM'ing Haiku in Ubuntu 8.10 (it's blisteringly blazingly fast!). Being able to actually install and boot into this latest revision, tonight, would make today 110% PERFECT!

Re: Installing Haiku to a partition from Linux

Luposian wrote:

Can you or someone else give me a step-by-step guide how to get haiku.image (residing in /generated) to that partition and get a Boot menu thingy (GRUB?) going, so I can then select Ubuntu or Haiku at bootup?

This very article has a set of steps that should get you there, simply ignore the comments unless you run into problems...

Re: Installing Haiku to a partition from Linux

umccullough wrote:
Luposian wrote:

Can you or someone else give me a step-by-step guide how to get haiku.image (residing in /generated) to that partition and get a Boot menu thingy (GRUB?) going, so I can then select Ubuntu or Haiku at bootup?

This very article has a set of steps that should get you there, simply ignore the comments unless you run into problems...

Ok, I finally figured out how to get the GRUB menu done. The menu displays "Haiku" at the top and (thanks to my previous install still residing on the 2nd partition) boots up to Senryu automatically (apparently "default 0" in GRUB means the 1st (topmost) item in the bootmenu, which so happens to be "Haiku" (thank you, alphabetical order!), so if I want Ubuntu 8.10 to automatically boot (after timeout), I now have to specify "default 1" in GRUB. I'll do that later.

I still have to get Haiku INTO that partition, to replace Senryu. And the instructions (thus given here and by others) for doing so are still a bit difficult for me to figure out.

Oh, trust me... when this is all said and done, I plan to write up such a set of over-simplified instructions, that ANYONE will know EXACTLY what to do and how to do it, in Ubuntu 8.10. No more fumbling through a dozen messages and having to figure it out by yourself! No-siree... I believe in making things EASY and FUN for people, not... "I think this is what I need to do... oops, made a mistake... maybe this? Nope. How about this? Aw, darn, I just screwed up my entire system, so now nothing boots!"

The harder people make it for me, the easier I'll make it for those AFTER me. If this is the way it must be, then so be it. CHARGE!!!!

Re: Installing Haiku to a partition from Linux

Mission Accomplished!!!

Other than the fact the animated Haiku splash screen didn't appear, Haiku R28711 came right up after a few seconds.

Now, time to condense and simplify the instructions from all that I've read and done today, into a set of instructions that ANYONE will be able to follow!

Considering just how fast Ubuntu 8.10 was able to download and JAM Haiku on an aging system like Athlonica... I can't wait to see how fast everything happens on QuadSlacker!

For those interested in getting my "Simplified Instructions" ASAP, just Email me. I'll begin working on them tonight and hopefully have them ready in a couple days.

All I can say is this... BeOS, as a download/build platform, is worthless to even consider nowadays (I'll never touch it again). Use Ubuntu 8.10 and discover just how fast you can get and JAM Haiku! You won't believe your eyes!