2 ==========================
3 This is a overview into the process of building HAIKU from source.
4 An online version is available at <https://haiku-os.org/guides/building/>.
6 Official releases of Haiku are at <https://haiku-os.org/get-haiku>.
7 The (unstable) nightly builds are available at <https://download.haiku-os.org/>.
9 We currently support the following platforms:
16 ----------------------------
17 Tools provided within Haiku's repositories:
18 * `jam` (Jam 2.5-haiku-20111222)
19 * Haiku's cross-compiler (needed only for non-Haiku platforms)
21 The tools to compile Haiku will vary, depending on the platform that you are
22 using to build Haiku. When building from Haiku, all of the necessary
23 development tools are included in official releases (e.g. R1 alpha4) and in the
27 * `ssh` (for developers with commit access)
28 * `gcc`/`g++` and binutils (`as`, `ld`, etc., required by GCC)
30 * `bison` (2.4 or better)
31 * `flex` and `lex` (usually a mini shell script invoking `flex`)
32 * `makeinfo` (part of `texinfo`, only needed for building GCC 4)
33 * `autoheader` (part of `autoconf`, needed for building GCC)
39 * `cdrtools` (**not** `genisoimage`!)
40 * case-sensitive file system
42 Whether they are installed can be tested by running them in a shell with
43 the `--version` parameter.
45 The following libraries (and their respective headers) are required:
50 If you want to compile Haiku for ARM, you will also need:
52 * `mkimage` (<http://www.denx.de/wiki/U-Boot/WebHome>)
53 * Mtools (<https://gnu.org/software/mtools/intro.html>)
57 Disk Utility can create a case-sensitive disk image of at least 3 GiB in size.
58 The following ports need to be installed:
73 More information about individual distributions of Linux and BSD can be found
74 at <https://haiku-os.org/guides/building/pre-reqs>.
76 Downloading Haiku's sources
77 --------------------------------------------------
78 There are two parts to Haiku's sources — the code for Haiku itself and a set
79 of build tools for compiling Haiku on an operating system other than Haiku.
80 The buildtools are needed only for non-Haiku platforms.
84 git clone https://git.haiku-os.org/haiku
85 git clone https://git.haiku-os.org/buildtools
87 (You can also use the `git://` protocol, but it is not secure).
89 If you have commit access:
91 git clone ssh://git.haiku-os.org/haiku
92 git clone ssh://git.haiku-os.org/buildtools
96 -------------------------------------------
97 (*This step applies only to non-Haiku platforms.*)
99 Change to the `buildtools` folder and run the following commands to
100 generate and install `jam`:
106 Or, if you don't want to install `jam` systemwide:
108 ./jam0 -sBINDIR=$HOME/bin install
111 Configuring the build
112 -------------------------------------
113 The `configure` script generates a file named `BuildConfig` in the
114 `generated/build` directory. As long as `configure` is not modified (!) and the
115 cross-compilation tools have not been updated, there is no need to call it again.
116 For rebuilding, you only need to invoke `jam` (see below). If you don't
117 update the source tree very frequently, you may want to execute `configure`
118 after each update just to be on the safe side.
120 Depending on your goal, there are several different ways to configure Haiku.
121 You can either call configure from within your Haiku trunk folder. That will
122 prepare a folder named 'generated', which will contain the compiled objects.
123 Another option is to manually created one or more `generated.*` folders and run
124 configure from within them. For example, imagine the following directory setup:
128 haiku-trunk/generated.x86gcc2
131 ### Configure a GCC 2.95 Hybrid, from a non-Haiku platform
133 cd haiku-trunk/generated.x86gcc2
134 ../configure --use-xattr-ref \
135 --build-cross-tools x86_gcc2 ../../buildtools/ \
136 --build-cross-tools x86
139 ### Configure a GCC 2.95 Hybrid, from Haiku
141 cd haiku-trunk/generated.x86gcc2
142 ../configure --target-arch x86_gcc2 --target-arch x86
145 Additional information about GCC Hybrids can be found on the website,
146 <https://haiku-os.org/guides/building/gcc-hybrid>.
148 ### Configure options
149 The various runtime options for configure are documented in its onscreen help
155 ----------------------------
157 Haiku can be built in either of two ways, as disk image file (e.g. for use
158 with emulators, to be written directly to a usb stick, burned as a compact
159 disc) or as installation in a directory.
163 There are various ways in which you can run `jam`:
165 * If you have a single generated folder, you can run 'jam' from the top level of Haiku's trunk.
166 * If you have one or more generated folders, (e.g. generated.x86gcc2),
167 you can `cd` into that directory and run `jam`.
168 * In either case, you can `cd` into a certain folder in the source tree (e.g.
169 src/apps/debugger) and run jam -sHAIKU_OUTPUT_DIR=<path to generated folder>
171 Be sure to read `build/jam/UserBuildConfig.ReadMe` and `UserBuildConfig.sample`,
172 as they contain information on customizing your build of Haiku.
174 ### Building a Haiku anyboot file
176 jam -q @anyboot-image
179 This generates an image file named `haiku-anyboot.image` in your output
180 directory under `generated/`.
182 ### Building a VMware image file
186 This generates an image file named `haiku.vmdk` in your output
187 directory under `generated/`.
189 ### Directory Installation
191 HAIKU_INSTALL_DIR=/Haiku jam -q @install
194 Installs all Haiku components into the volume mounted at "/Haiku" and
195 automatically marks it as bootable. To create a partition in the first place
196 use DriveSetup and initialize it to BFS.
198 Note that installing Haiku in a directory only works as expected under Haiku,
199 but it is not yet supported under Linux and other non-Haiku platforms.
201 ### Building individual components
202 If you don't want to build the complete Haiku, but only a certain
203 app/driver/etc. you can specify it as argument to jam, e.g.:
207 Alternatively, you can `cd` to the directory of the component you want to
208 build and run `jam` from there. **NOTE:** if your generated directory is named
209 something other than `generated/`, you will need to tell `jam` where it is:
211 jam -q -sHAIKU_OUTPUT_DIR=<path to generated folder>
213 You can also force the rebuild of a component by using the `-a` parameter:
220 Generally there are two ways of running Haiku: on real hardware using a
221 partition, and on emulated hardware using an emulator (like VirtualBox, or QEMU).
224 If you have installed Haiku to its own partition you can include this
225 partition in your bootmanager and try to boot Haiku like any other OS you
226 have installed. To include a new partition in the Haiku bootmanager, start
227 the BootManager configurator by running:
232 ### On Emulated Hardware
233 For emulated hardware you should build disk image (see above). How to set up
234 this image depends on your emulator. If you use QEMU, you can usually just
235 provide the path to the image as command line argument to the `qemu`