[Barrelfish-users] Hake building

Timothy Roscoe troscoe at inf.ethz.ch
Sun Mar 25 11:52:20 CEST 2018

Dear Tim,

What you're trying to do (running different kernels on different
cores) makes sense - Barrelfish is designed so that the kernel
makes no assumptions about having the whole machine to itself, and we
regularly run different kernels alongside each other in the same

However, if you want use a completely different for building
Barrelfish, you might have some work to do. 

Given the vagaries of compilers and utilities, it's really hard to
support building a complete OS using multiple build environments, and
we're just a university research group.  We support Ubuntu LTS
(currently 16.04), and the getting started guide has a list of the
main Ubuntu packages we require to build Barrelfish.  In practice, we
had to pick a toolchain to support, and so we chose standard Ubuntu.
Even the Microsoft folks would build Barrelfish with Ubuntu inside

Note that we take care not to use any GPLed code in the OS itself
(hence the MIT-style licence), but as you point out we employ many GPL
tools in the toolchain.

Barrelfish uses a number of domain-specific languages (of which Hake
is one); these are all implemented using Haskell, either as embedded
DSLs or, more commonly, a compiler from the DSL to C.  Haskell turns
out to be a highly convenient language for implementing little

No Haskell code is executed at runtime.  When the OS boots, it's all
hand-written C, C generated by DSLs implemented in Haskell, or Prolog.

Hake is used to solve the problem of simultaneously building both
parts of the toolchain, and the OS and libraries themselves for
multiple architectures all at once (since Barrelfish images can
contain multiple different architecture targets).

The way Hake works is to take the specifications in all the Hakefiles
in the source tree, and generate a single, very large but very simple
Makefile for the whole OS.  We are, in fact, big fans of make - it is
incredibly fast at building source, particularly when there are hardly
any symbolic targets in the Makefile, and so we consciously avoid
replacing it with anything.  

The "source directory" that Hake (or rather, its bootstrap script
hake.sh) needs is simply the top of the Barrelfish source directory.
It's a good idea to have your build directory (the cwd when you run
hake.sh) as separate from this, due to the way Hake searches the
source tree for Hakefiles.  It looks from your example like you're
including your build directory inside the source tree, which works,
but can be inconvenient and/or slow. 

Hope this helps,

 -- Timothy Roscoe

At Sat, 24 Mar 2018 16:55:39 -0400, Tim Kelly <gtkelly at dialectronics.com> wrote:
> Hello all,
> I have a project in which Barrelfish looks to be a great solution.  I'm
> working with an unsupported BSD-licensed single processor (unthreaded)
> OS (obviously not a *BSD).  I've got a BSD-licensed toolchain (not
> clang).  The toolchain builds itself and the OS.  I have a particular
> executable to run on SBC hardware, which will be dedicated for running
> that executable (no, I'm not bitcoin mining, it's systems of ODEs).  The
> SoC is multi-core x86, and I have code that can be parallelized
> (ensembles with different initial conditions).  I'd like to run the OS I
> have on CPU0 and then run Barrelfish on CPU[1-3], using shared memory
> (2-4G total on-chip).  In theory, perhaps the OS could run on top of
> Barrelfish and I could run my executable on all four CPUs.
> However, even getting started is proving a bit difficult.  Barrelfish
> builds with Hake, but building Hake requires the Glasgow-Haskell
> compiler (GHC).
> # ../hake/hake.sh -s ../
> Install directory defaulting to '.'
> Source directory is ../
> Architectures to build: "x86_64"
> Setting up hake build directory...
> You already have Config.hs, leaving it as-is.
> Building hake...
> ghc: not found
> (It's a little unclear to me from TN-003-Hake what /home/barrelfish/src
> is supposed to be.  There's no src/ directory in the download.  I am
> using /home/barrelfish as the source directory.  I ran the hake.sh file
> from the build/ directory.)
> GHC requires several non-BSD-licensed tools to build (perl, python, git,
> gnu binutils, etc).  Other than nano and gunzip, I'm not using any GNU
> tools (that I know of, I replace them when I find them with BSD-licensed
> alternatives).  It's bad enough I have to use configure, but a lot of
> times I can run the stock Makefile or use the .in template with a few
> tweaks.  I'm not a fan of make, but replacing it with something that
> requires GHC to be built is a bit of a tall order for my project.
> Is the Haskell language used in any of the Barrelfish OS code itself?
> Thank you,
> tim
> --
> Every gun that is made, every warship launched, every rocket fired,
> signifies, in the final sense, a theft from those who hunger and are not
> fed, those who are cold and are not clothed.
> 		-- Dwight D. Eisenhower, 34th U.S. President
> _______________________________________________
> Barrelfish-users mailing list
> Barrelfish-users at lists.inf.ethz.ch
> https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users

More information about the Barrelfish-users mailing list