Contents     Back to Installing Haiku

The following will show you step by step how to get Haiku's source code and build tools, how to compile it all and how to generate either a VMWare image or directly install onto a partition or USB drive. You'll also learn how to exchange data with an image or an installation on it's partition.

Note: This guide is based on Ubuntu 8.10, but should generally work the same way on all other Linux distributions. Some changes may apply.

Downloading the tools and the Haiku source

  1. Install all needed packages:

    sudo apt-get install subversion autoconf automake texinfo flex bison gawk build-essential
  2. Create the Haiku development directories and get the Haiku build tools source:

    mkdir develop
    cd develop
    mkdir haiku
    cd haiku
    svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools
  3. Build and install the Haiku Jam:

    cd  buildtools/jam
    make
    sudo ./jam0 install
    cd ../..
  4. Get the Haiku source (this will take a while).
    For anonymous check-out:

    svn checkout http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk

    If you have a valid Haiku developer account at Berlios:

    svn checkout https://developername@svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk

    If there are any errors while checking out the source, just cd into the trunk directory and type svn update to get any missed files.
    This is also how you update the code in the future.

  5. Build the cross compiler tools (GCC 2.95):

    cd ~/develop/haiku/trunk
    ./configure --build-cross-tools ../buildtools/

    To build with GCC 4.x the configure line changes to:

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

    But keep in mind this will produce binaries which are not compatible with BeOS.


To download all code changes from now on, simply enter the haiku/trunk/ folder and type:

svn update

Customizing UserBuildConfig

Now you could already start to build RAW or VMWare images. Before we come to that, however, let's have a look at the UserBuildConfig that can be used to customize and automate some things.

In trunk/haiku/build/jam/ there's a UserBuildConfig.ReadMe that explains various options. Don't simply rename it and use it as UserBuildConfig!

You start by duplicating the UserBuildConfig.sample and the remove the.sample suffix to get your UserBuildConfig. From the .ReadMe you can copy interesting parts into your config and customize them there.

  1. First, the line is needed for the optional "OpenSSH" package:

    HAIKU_IMAGE_HOST_NAME = "TEST" ;
  2. There are several optional software packages available, that are dowloaded at build time if they haven't been so already. For a list of all available packages, see haiku/trunk/build/jam/OptionalPackages. Here's an example:

    # Add these optional packages.
    AddOptionalHaikuImagePackages Beam ;
    AddOptionalHaikuImagePackages BeHappy ;
    AddOptionalHaikuImagePackages BePDF ;
    AddOptionalHaikuImagePackages Firefox ;
    AddOptionalHaikuImagePackages NetSurf ;
    AddOptionalHaikuImagePackages OpenSSL ;
    AddOptionalHaikuImagePackages OpenSSH ;
    AddOptionalHaikuImagePackages Pe ;
    AddOptionalHaikuImagePackages Vision ;
    AddOptionalHaikuImagePackages Welcome ;
    AddOptionalHaikuImagePackages WonderBrush ;
  3. Now the block that sets the defaults for timezone and keymap:

    # Add symlink/file (timezone and keymap settings) to the image.
    AddSymlinkToHaikuImage home config settings
    	: /boot/beos/etc/timezones/Europe/Paris : timezone ;
    AddFilesToHaikuImage home config settings : German 
    	: Key_map ;
  4. The build process can be fine tuned until it fits your needs. You could create your own folder haiku/trunk/user_data/ and put files there that are then copied or unzipped into the image. Zipping is important when dealing with Haiku files with their attributes, because zipping them up will preserve them on non-BFS partitions.
    For example:

    # Zip up your emails between each system update and place the archive into the
    # user_data folder to be automatically put back when building the new image.
    UnzipArchiveToHaikuImage home
    	: $(HAIKU_TOP)/user_data/mail.zip ;

    The first line defines the location in the image where the archive will be unzipped (here: /boot/home/). Deeper hierarchies are separated with a blank instead of the usual "/" (see the setting of the timezone above).
    The second line is the location of the zip file. $(HAIKU_TOP) is the lowest level of the checked out source tree, normally haiku/trunk/.

    In the same way, you use CopyDirectoryToHaikuImage and AddFilesToHaikuImage to copy whole directories or single files into the image.

  5. The above commands are executed when building any kind of image. "Build Profiles" provide the means to set commands specifically for different configurations.
    These are two profiles, one for building and installing an image directly onto a partition and the other to generate a VMWare image:

    DefineBuildProfile disk : disk : "/dev/sda7" ;
    DefineBuildProfile vmware : vmware-image ;
    
    switch $(HAIKU_BUILD_PROFILE) {
    	case "disk" : {
    	}
    
    
    	case "vmware" : {
    		HAIKU_IMAGE_SIZE = 900 ;
    		HAIKU_DONT_CLEAR_IMAGE = 1 ;
    	}
    
    }

    The first line is especially important and dangerous: "/dev/sda7"
    The so defined partition will be irretrievably overwritten!

    Before you use this profile, you should make sure that it's really the correct partition on the right harddisk or USB-stick, for example by using Ubuntu's partition editor GParted.


Here's the complete UserBuildConfig once more:

# Quick start file for UserBuildConfig. Copy it and uncomment and edit the
# lines you want. See UserBuildConfig.ReadMe for details.

# Optional package OpenSSH needs this variable set
HAIKU_IMAGE_HOST_NAME = "TEST" ;

# Add these optional packages.
AddOptionalHaikuImagePackages Beam ;
AddOptionalHaikuImagePackages BeHappy ;
AddOptionalHaikuImagePackages BePDF ;
AddOptionalHaikuImagePackages Firefox ;
AddOptionalHaikuImagePackages NetSurf ;
AddOptionalHaikuImagePackages OpenSSL ;
AddOptionalHaikuImagePackages OpenSSH ;
AddOptionalHaikuImagePackages Pe ;
AddOptionalHaikuImagePackages Vision ;
AddOptionalHaikuImagePackages Welcome ;
AddOptionalHaikuImagePackages WonderBrush ;

# Add symlink/file (timezone and keymap settings) to the image.
AddSymlinkToHaikuImage home config settings
	: /boot/beos/etc/timezones/Europe/Paris : timezone ;
AddFilesToHaikuImage home config settings : German 
	: Key_map ;

DefineBuildProfile disk : disk : "/dev/sda7" ;
DefineBuildProfile vmware : vmware-image ;

switch $(HAIKU_BUILD_PROFILE) {
	case "disk" : {
	}


	case "vmware" : {
		HAIKU_IMAGE_SIZE = 900 ;
		HAIKU_DONT_CLEAR_IMAGE = 1 ;
	}

}

Note: when building an a USB memory stick, you wouldn't specify the partition number in the disk entry (ex. /dev/sdb instead of /dev/sdb1). This will erase your whole flash drive and it's partitions, so be cautious to use the correct drive name!

Besides these user build profiles, there are also official release profiles, see ReleaseBuildProfiles in the same folder. The profiles alpha-raw and alpha-vmware will build all officially planned components for the alpha release. They are invoked just like the user profiles, see Building a VMWare Image a bit further down.

Building/installing Haiku Images

Thanks to our UserBuildConfig it's all quite simple now.

Installing on a partition/USB-stick

To install Haiku directly onto a partition/USB-stick, you have to set the according read and write permissions.
When installing to a hard drive partition, replace the drive name and use:

sudo chmod o+r /dev/sda
sudo chmod o+rw /dev/sda7

Note that the read permission is set for the whole disk (1st line) while the write permission is limited to one specific partition (2nd line).

When installing to a USB flashdrive, replace the drive name, and type:

sudo chmod o+r /dev/sda

Now the Haiku image is built and installed on the partition:

jam -q @disk

Installing to its own partition offers some interesting possibilities:

jam -q @disk update-all

This updates all of the system, but leaves the home folder untouched, so all your data will still be there.

You can also decide to only update certain components:

jam -q @disk update {components}

Just replace the {components} with the program/component to be updated, e.g. kernel, StyledEdit or libmedia.so or more than one, separated with blanks. haiku/build/jam/HaikuImage lists all possible "targets".

Building a VMWare Image

Just enter:

jam -q @vmware

The resulting image can be run in VMPlayer with an associated .vmx file (There's also a .vmx file in haiku/3rdparty/vmware/).

Booting with GRUB

If you installed Haiku directly onto a USB-stick, you just have to make sure the boot order in the BIOS looks first for USB devices to have Haiku boot right up from the stick.

If Haiku was installed on a partition on your hard drive, you have to adjust the boot loader accordingly. This is how it's done with GRUB:

sudo gedit /boot/grub/menu.lst

You'll note that GRUB uses a different naming strategy for hard drives than Linux.

With GRUB it's: (hdN,n)

All harddisks start with "hd"
"N" is the hard disk number, starting with "0".
"n is the partition number, also starting with "0".
The first logical partition always have the number 4, regardless of the number of primary partitions.

If you're still unsure, check out the GRUB manual.

As an example:

/dev/sda7 would be (hd0,6) in GRUB.

Now using your own hard drive number, type this entry in /boot/grub/menu.lst:

# Haiku on /dev/sda7
title		Haiku
rootnoverify	(hd0,6)
chainloader	+1

Save, reboot and choose "Haiku" in the GRUB menu at boot-up.

Accessing images/partitions

Using build profiles has another advantage: You can mount a VMWare image or the partition of a Haiku installation to transfer data. Navigate to haiku/trunk/ and simply enter:

jam @disk mount

or

jam @vmware mount

You are now in the bfs_shell. Enter help to get a list of all supported commands:

fssh:/> help supported commands:
cd               - change current directory
chmod            - change file permissions
cp               - copy files and directories
exit             - quit the shell
help             - list supported commands
info             - prints volume informations
ln               - create a hard or symbolic link
ls               - list files or directories
mkdir            - create directories
mkindex          - create an index
query            - query for files
quit             - quit the shell
rm               - remove files and directories
sync             - syncs the file system

It all works pretty much like in your normal bash shell (besides there's sadly no tab-completion).
The one thing to remember: You have to prefix every local path (your Linux partition) with a ":".

Here's an example to copy the file .bash_history from Haiku to your Linux partition:

fssh:/> cd myfs/home
fssh:/myfs/home> cp .bash_history :/home/humdinger/

The other way around works the same:

fssh:> cp :/home/humdinger/Bilder/gazette-final.png myfs/home/

Contents     Back to Installing Haiku