haiku/docs/userguide/en/installation/install-source-linux.html

312 lines
15 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"../html-dtd/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<!--
*
* Copyright 2009, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Socapex_2K <philippe_groarke@yahoo.ca>
*
-->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="robots" content="all" />
<title>Building Haiku on linux</title>
<link rel="stylesheet" type="text/css" href="../../../Haiku-doc.css" />
</head>
<body>
<div class="logo">
<img src="../../images/logo.png" alt="logo" width="372" height="86" />
<div class="title">Building Haiku on Linux</div>
</div>
<div class="topnav">
<p>
<a href="../contents.html">Contents</a>
&#160;&#160;&#160;
Back to <a href="../installation.html">Installing Haiku</a>
</p>
</div>
<div class="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 installation on it's partition.</p>
<p><b>Note:</b> <i>This guide is based on Ubuntu 8.10, but should generally work the same way on all other Linux distributions. Some changes may apply.</i></p>
<h1>Downloading the tools and the Haiku source</h1>
<ol>
<li><p>Install all needed packages:</p>
<pre class="terminal">sudo apt-get install subversion autoconf automake texinfo flex bison gawk build-essential</pre></li>
<li><p>Create the Haiku development directories and get the Haiku build tools source:</p>
<pre class="terminal">mkdir develop
cd develop
mkdir haiku
cd haiku
svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools</pre></li>
<li><p>Build and install the Haiku Jam:</p>
<pre class="terminal">cd buildtools/jam
make
sudo ./jam0 install
cd ../..</pre></li>
<li><p>Get the Haiku source (this will take a while).<br />
For anonymous check-out:</p>
<pre class="terminal">svn checkout http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk</pre>
<p>If you have a valid Haiku developer account at Berlios:</p>
<pre class="terminal">svn checkout https://developername@svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk</pre>
<p>If there are any errors while checking out the source, just cd into the trunk directory and type <span class="cli">svn update</span> to get any missed files.<br />
This is also how you update the code in the future.</p></li>
<li><p>Build the cross compiler tools (GCC 2.95):</p>
<pre class="terminal">cd ~/develop/haiku/trunk
./configure --build-cross-tools ../buildtools/</pre>
<p>To build with GCC 4.x the configure line changes to:</p>
<pre class="terminal">./configure --build-cross-tools-gcc4 x86 ../buildtools/</pre>
<p>But keep in mind this will produce a Haiku installation which is not compatible with BeOS.</p></li>
</ol>
<p><br /></p>
<p>To download all code changes from now on, simply enter the <span class="path">haiku/trunk/</span> folder and type:</p>
<pre class="terminal">svn update</pre>
<h1>Customizing UserBuildConfig</h1>
<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 <span class="cli">UserBuildConfig</span> that can be used to customize and automate some things.</p>
<p>In <span class="path">trunk/haiku/build/jam/</span> there's a <span class="cli">UserBuildConfig.ReadMe</span> that explains various options. <b>Don't</b> simply rename it and use it as <span class="cli">UserBuildConfig</span>!</p>
<p>You start by duplicating the <span class="cli">UserBuildConfig.sample</span> and removing the <span class="cli">.sample</span> suffix to get your <span class="cli">UserBuildConfig</span>. From the <span class="cli">.ReadMe</span> you can copy interesting parts into your config and customize them there.</p>
<ol>
<li><p>First, this line is needed for the optional "OpenSSH" package:</p>
<pre>HAIKU_IMAGE_HOST_NAME = "TEST" ;</pre>
</li>
<li><p>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 <span class="path">haiku/trunk/build/jam/OptionalPackages</span>. Here's an example:</p>
<pre># 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 ;</pre>
</li>
<li><p>Now the block that sets the defaults for timezone and keymap:</p>
<pre># 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 ;</pre></li>
<li><p>The build process can be fine tuned until it fits your needs. You could create your own folder <span class="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 and their attributes, because zipping them up will preserve them on non-BFS partitions.<br />
For example:</p>
<pre># 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 ;</pre>
<p>The first line defines the location in the image where the archive will be unzipped (here: <span class="path">/boot/home/</span>). Deeper hierarchies are separated with a blank instead of the usual "<span class="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 <span class="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" ;
DefineBuildProfile vmware : vmware-image ;
switch $(HAIKU_BUILD_PROFILE) {
case "disk" : {
HAIKU_DONT_CLEAR_IMAGE = 1 ;
}
case "vmware" : {
HAIKU_IMAGE_SIZE = 900 ;
}
}</pre>
<p>The first line is especially important and <b>dangerous</b>: "<span class="path">/dev/sda7</span>"<br />
<span style="font-size: 1.2em; font-weight: bold;">The so defined partition will be irretrievably overwritten!
</span></p>
<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 <span class="app">GParted</span>.</p></li>
</ol>
<p><br /></p>
<p>Here's the complete <span class="cli">UserBuildConfig</span> once more:</p>
<pre># 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" : {
HAIKU_DONT_CLEAR_IMAGE = 1 ;
}
case "vmware" : {
HAIKU_IMAGE_SIZE = 900 ;
}
}</pre>
<p><b>Note:</b> <i>When building onto a USB memory stick, you wouldn't specify the partition number in the disk entry (ex. </i><span class="path">/dev/sdb</span><i> instead of </i><span class="path">/dev/sdb1</span><i>). This will erase your whole flash drive and it's partitions, so be cautious to use the correct drive name!</i></p>
<p>Besides these user build profiles, there are also official release profiles, see <span class="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, see <a href="#build_vmimage">Building a VMWare Image</a> a bit further down.
</p>
<h1>Building/installing Haiku Images</h1>
<p>Thanks to our <span class="cli">UserBuildConfig</span> it's all quite simple now.</p>
<h4>Installing on a partition/USB-stick</h4>
<p>To install Haiku directly onto a partition/USB-stick, you have to set the according read and write permissions.<br />
When installing to a hard drive partition, replace the drive name and use:</p>
<pre class="terminal">sudo chmod o+r /dev/sda
sudo chmod o+rw /dev/sda7
</pre>
<p>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).</p>
<p>When installing to a USB flashdrive, replace the drive name, and type:</p>
<pre class="terminal">sudo chmod o+rw /dev/sdb</pre>
<br />
<p>Now the Haiku image is built and installed on the partition:</p>
<pre class="terminal">jam -q @disk</pre>
<p>Installing to its own partition offers some interesting possibilities:</p>
<pre class="terminal">jam -q @disk update-all</pre>
<p>This updates all of the system, but leaves the home folder untouched, so all your data and settings will still be there. Note that optional packages will not be updated in this install mode.</p>
<p>You can also decide to only update certain components:</p>
<pre class="terminal">jam -q @disk update {components}</pre>
<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. <span class="path">haiku/build/jam/HaikuImage</span> lists all possible "targets".</p>
<h4><a id="build_vmimage" name="build_vmimage">Building a VMWare Image</a></h4>
<p>If you are using the <span class="cli">UserBuildConfig</span> from above, just enter:</p>
<pre class="terminal">jam -q @vmware</pre>
<p>The resulting image can be run in VMPlayer with an associated <a href="http://haiku-files.org/files/haiku.vmx">.vmx</a> file (There's also a <span class="cli">.vmx</span> file in <span class="path">haiku/3rdparty/vmware/</span>).</p>
<h1>Booting with GRUB</h1>
<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>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:</p>
<pre class="terminal">sudo gedit /boot/grub/menu.lst</pre>
<p>You'll note that GRUB uses a different naming strategy for hard drives than Linux.</p>
<p>With GRUB it's: <tt>(hdN,n)</tt></p>
<p>All harddisks start with "<i>hd</i>"<br />
"<i>N</i>" is the hard disk number, starting with "0".<br />
"<i>n</i> is the partition number, also starting with "0".<br />
The first logical partition always has the number 4, regardless of the number of primary partitions.</p>
<p>If you're still unsure, check out the <a href="http://www.gnu.org/software/grub/manual/grub.html#Naming-convention">GRUB manual</a>.</p>
<p>As an example:</p>
<p style="margin: 15pt"><span class="path">/dev/sda7</span> would be <tt>(hd0,6)</tt> in GRUB.</p>
<p>Now using your own hard drive number, type this entry in <span class="path">/boot/grub/menu.lst</span>:</p>
<pre># Haiku on /dev/sda7
title Haiku
rootnoverify (hd0,6)
chainloader +1</pre>
<p>Save, reboot and choose "Haiku" in the GRUB menu at boot-up.</p>
<h1>Accessing images/partitions</h1>
<p>Using build profiles has another advantage: You can mount a VMWare image or the partition of a Haiku installation to transfer data. If you were using the <span class="cli">UserBuildConfig</span> above, you could navigate to <span class="path">haiku/trunk/</span> and simply enter:</p>
<pre class="terminal">jam @disk mount</pre>
<p>or</p>
<pre class="terminal">jam @vmware mount</pre>
<p>You are now in the <span class="cli">bfs_shell</span>. Enter <span class="cli">help</span> to get a list of all supported commands:</p>
<pre class="terminal">fssh:/&gt; 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</pre>
<p>It all works pretty much like in your normal bash shell (besides there's sadly neither tab-completion nor command history).<br />
The one thing to remember: You have to prefix every local path (your Linux partition) with a "<tt>:</tt>".</p>
<p>Here's an example to copy the file <span class="cli">.bash_history</span> from Haiku to your Linux partition:</p>
<pre class="terminal">fssh:/&gt; cd myfs/home
fssh:/myfs/home&gt; cp .bash_history :/home/humdinger/</pre>
<p>The other way around works the same:</p>
<pre class="terminal">fssh:&gt; cp :/home/humdinger/Bilder/gazette-final.png myfs/home/</pre>
<!--To Continue?
-->
</div>
<div class="bottomnav">
<p>
<a href="../contents.html">Contents</a>
&#160;&#160;&#160;
Back to <a href="../installation.html">Installing Haiku</a>
</p>
</div>
</body>
</html>