Starting with Haiku operating system

Lee Mon
2 min readMar 3, 2019

--

Took Haiku image,
Ran it on my computer -
The fog is thinner.

Install Haiku on Qemu from ISO image

Let’s start Haiku in our qemu machine:

# install qemu for x86_64 and i386
apt install qemu-system-x86
# download haiku
wget -c https://cdn.haiku-os.org/haiku-release/r1beta1/haiku-r1beta1-x86_64-anyboot.zip
# check sha256
sha256sum haiku-r1beta1-x86_64-anyboot.zip
# unpack haiku into the folder "haikuos"
unzip haiku-r1beta1-x86_64-anyboot.zip -d ./haikuos
# create a qemu disk image
qemu-img create -f qcow2 image_haiku.qcow2 10G
# install Haiku OS on the created driver
qemu-system-x86_64 -drive file=image_haiku.qcow2 -enable-kvm -m 1024 -cdrom haiku-release-anyboot.iso

Now, we should be able to run Haiku with the following line:

qemu-system-x86_64 -drive file=image_haiku.qcow2 -enable-kvm -m 1024

Build Haiku from sources

Here, we want to build Haiku from soure. Let’s obtain the required tools for a host system (Debian in my case)(info page for differen host OSes):

# install required packages
sudo apt install git nasm autoconf automake texinfo flex bison gawk build-essential unzip wget zip less zlib1g-dev xorriso libtool mtools gcc-multilib python3

You can also install additional packages for ARM but we are not going to do it now, since, we want to work with x86.

Now, it’s time to create the project dir:

export HAIKU_PROJECT_DIR=/path/to/project
cd $HAIKU_PROJECT_DIR

Let’s obtain source-sode:

# obtain tools
git clone https://git.haiku-os.org/buildtools
# obtain haiku
git clone https://git.haiku-os.org/haiku
# project structure
export HAIKU_DIR=$HAIKU_PROJECT_DIR/haiku
export BUILDTOOLS_DIR=$HAIKU_PROJECT_DIR/buildtools

Now, we have to configure and build jam and cross-compiler:

# build files here
mkdir -pv $HAIKU_PROJECT_DIR/build
cd $HAIKU_PROJECT_DIR/build
# build jam
cd $BUILDTOOLS_DIR/jam
make
jam
export JAM_EXEC=$BUILDTOOLS_DIR/jam/bin.linuxx86/jam
# make sure that it works
$JAM_EXEC -v
# build a legacy compiler for BeOS apps compatibility
mkdir generated.x86_gcc2 && cd generated.x86_gcc2
$HAIKU_DIR/configure --build-cross-tools x86_gcc2 $BUILDTOOLS_DIR
# build a modern compiler
mkdir generated.x86 && cd generated.x86
$HAIKU_DIR/configure --build-cross-tools x86 $BUILDTOOLS_DIR
# or we can use a hybrid cross-compiler:
mkdir generated.x86 && cd generated.hybrid
$HAIKU_DIR/configure --build-cross-tools x86_gcc2 $BUILDTOOLS_DIR --build-cross-tools x86
# let's use only one cross-compiler
export HAIKU_TOOLSET=$HAIKU_PROJECT_DIR/build/generated.hybrid

And we can build the Haiku image

cd $HAIKU_TOOLSET
$JAM_EXEC -q @nightly-raw

and execute the raw image in Qemu (it will launch installation on the first start up)

qemu-system-i386 -hda haiku-nightly.image -enable-kvm -m 1024

And we have a working copy of Haiku!

--

--