haiku/docs/userguide/en/installing.html
Joachim Seemer e564a3c1f7 * Added more CSS control for menus, buttons, app names, shell commands, paths.
* Always wanting keyboard graphics for shortcuts, Jorge suggested simple borders
  for simplicity. Great idea! Added.
* Added Jorge's rounded boxes for note/warning/stop plus symbols.
* If anyone wants to fine tune esp. colours, go ahead. Jorge and I are both
  challenged in that department. :)
* A few small corrections and reformatting here and there.
* Excluded the topic "Installation" from the contents until it's further along.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29269 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-21 11:40:17 +00:00

245 lines
13 KiB
HTML

<?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:
* Humdinger <humdingerb@gmail.com>
* Ryan Leavengood
* Fredrik Ekdahl
*
-->
<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>Compiling/installing from source</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">Compiling/installing from source</div>
</div>
<div class="topnav">
<p>
<a href="contents.html">Contents</a>
&#160;&#160;&#160;
Next: <a href="bootloader.html">Boot Loader</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 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><a name="download">Downloading the tools and the Haiku source</a></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 binaries which are 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><a name="userbuildconfig">Customizing UserBuildConfig</a></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 the remove 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, the line needed for the optional "OpenSSH" package:</p>
<pre>HAIKU_IMAGE_HOST_NAME = "TEST" ;</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 : <keymap>German
: Key_map ;</keymap></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 with 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_ADD_ALL_OPTIONAL_PACKAGES = 1 ;
}
case "vmware" : {
HAIKU_IMAGE_SIZE = 900 ;
HAIKU_DONT_CLEAR_IMAGE = 1 ;
HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1
}
}</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 symlink/file (timezone and keymap settings) to the image.
AddSymlinkToHaikuImage home config settings
: /boot/beos/etc/timezones/Europe/Paris : timezone ;
AddFilesToHaikuImage home config settings : <keymap>German
: Key_map ;
DefineBuildProfile disk : disk : "/dev/sda7" ;
DefineBuildProfile vmware : vmware-image ;
switch $(HAIKU_BUILD_PROFILE) {
case "disk" : {
HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ;
}
case "vmware" : {
HAIKU_IMAGE_SIZE = 900 ;
HAIKU_DONT_CLEAR_IMAGE = 1 ;
HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ;
}
}</pre>
<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, s. <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>
<h2><a name="install_partition">Installing on a partition/USB-stick</a></h2>
<p>To install Haiku directly onto a partition/USB-stick, you have to set the according read and write permissions. In our example it's done with:</p>
<pre class="terminal">sudo chmod o+rw /dev/sda7
sudo chmod o+r /dev/sda</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>Now the Haiku image is built and installed on the partition:</p>
<pre class="terminal">sudo jam -q @disk</pre>
<p><br /></p>
<p>
Installing to its own partition offers some interesting possibilities:</p>
<pre class="terminal">sudo jam -q @disk update-all</pre>
<p>This updates all of the system, but leaves the home folder untouched, so all your data will still be there.</p>
<p><br /></p>
<p>You can also decide to only update certain components:</p>
<pre class="terminal">sudo 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>
<h2><a name="build_vmimage">Building a VMWare Image</a></h2>
<p>Just enter:</p>
<pre class="terminal">sudo jam -q @vmware</pre>
<p>You have to rededicate the generated image to satisfy the VMPlayer, before you can run it 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>
<pre class="terminal">sudo chown [YourUsername] haiku.image</pre>
<h1><a name="grub">Booting with GRUB</a></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><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>
<p>Open the list of boot options, shown when pressing <span class="key">ESC</span> at the beginning of the boot process:</p>
<pre class="terminal">sudo gedit /boot/grub/menu.lst</pre>
<p>You'll note that GRUB uses a different naming strategy for harddrives 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>" N 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 have 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><span class="path">/dev/sda7</span> would be <tt>(hd0,6)</tt> in GRUB.</p>
<p>The entry in <span class="path">/boot/grub/menu.lst</span> would then be:</p>
<pre># Haiku on /dev/sda7
title Haiku
rootnoverify (hd0,6)
chainloader +1</pre>
<p><br /></p>
<p>Save, reboot, press <span class="key">ESC</span> when GRUB starts and choose "Haiku" in the menu.</p>
<h1><a name="bfs_shell">Accessing images/partitions</a></h1>
<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 <span class="path">haiku/trunk/</span> and simply enter:</p>
<pre class="terminal">sudo jam @disk mount</pre>
<p>or</p>
<pre class="terminal">sudo jam @vmware mount</pre>
<p>Now you're 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 no tab-completion).<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>
</div>
<div class="bottomnav">
<p>
<a href="contents.html">Contents</a>
&#160;&#160;&#160;
Next: <a href="bootloader.html">Boot Loader</a>
</p>
</div>
</body>
</html>