<divclass="title">Compiling/installing from source</div>
</div>
<divclass="topnav">
<p>
<ahref="contents.html">Contents</a>
   
Next: <ahref="bootloader.html">Boot Loader</a>
</p>
</div>
<divclass="content">
<p>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 installtion on it's partition.<br/>
It's all based on Ubuntu 8.10, but should work generally the same on all other distributions.</p>
<h1><aname="download">Downloading the tools and the Haiku source</a></h1>
<p>If there are any errors while checking out the source, just cd into the trunk directory and type <spanclass="cli">svn update</span> to get any missed files.<br/>
<p>Now you could already start to build RAW or VMWare images. Before we come to that, however, let's have a look at the <spanclass="cli">UserBuildConfig</span> that can be used to customize and automate some things.</p>
<p>In <spanclass="path">trunk/haiku/build/jam/</span> there's a <spanclass="cli">UserBuildConfig.ReadMe</span> that explains various options. <b>Don't</b> simply rename it and use it as <spanclass="cli">UserBuildConfig</span>!</p>
<p>You start by duplicating the <spanclass="cli">UserBuildConfig.sample</span> and the remove the <spanclass="cli">.sample</span> suffix to get your <spanclass="cli">UserBuildConfig</span>. From the <spanclass="cli">.ReadMe</span> you can copy interesting parts into your config and customize them there.</p>
<li><p>The build process can be fine tuned until it fits your needs. You could create your own folder <spanclass="path">haiku/trunk/user_data/</span> 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.<br/>
<p>The first line defines the location in the image where the archive will be unzipped (here: <spanclass="path">/boot/home/</span>). Deeper hierarchies are separated with a blank instead of the usual "<spanclass="path">/</span>" (see the setting of the timezone above).<br/>
The second line is the location of the zip file. <tt>$(HAIKU_TOP)</tt> is the lowest level of the checked out source tree, normally <spanclass="path">haiku/trunk/</span>.</p>
<p>In the same way, you use <tt>CopyDirectoryToHaikuImage</tt> and <tt>AddFilesToHaikuImage</tt> to copy whole directories or single files into the image.</p></li>
<li><p>The above commands are executed when building any kind of image. "Build Profiles" provide the means to set commands specifically for different configurations.<br/>
These are two profiles, one for building and installing an image directly onto a partition and the other to generate a VMWare image:</p>
<pre>DefineBuildProfile disk : disk : "/dev/sda7" ;
<p>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 <spanclass="app">GParted</span>.</p></li>
<p>Besides these user build profiles, there are also official release profiles, see <spanclass="cli">ReleaseBuildProfiles</span> in the same folder. The profiles <i>alpha-raw</i> and <i>alpha-vmware</i> will build all officially planned components for the alpha release. They are invoked just like the user profiles, s. <ahref="#build_vmimage">Building a VMWare Image</a> a bit further down.
<p>Just replace the <tt>{components}</tt> with the program/component to be updated, e.g. <tt>kernel</tt>, <tt>StyledEdit</tt> or <tt>libmedia.so</tt> or more than one, separated with blanks. <spanclass="path">haiku/build/jam/HaikuImage</span> lists all possible "targets".</p>
<p>You have to rededicate the generated image to satisfy the VMPlayer, before you can run it with an associated <ahref="http://haiku-files.org/files/haiku.vmx">.vmx</a> file (There's also a <spanclass="cli">.vmx</span> file in <spanclass="path">haiku/3rdparty/vmware/</span>):</p>
<p>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.</p>
<p><br/></p>
<p>If Haiku was installed on a partition on your harddrive, you have to adjust the boot loader accordingly. This is how it's done with GRUB:</p>
<p>Using build profiles has another advantage: You can mount a VMWare image or the partition of a Haiku installation to transfer data. Navigate to <spanclass="path">haiku/trunk/</span> and simply enter:</p>