Differences between revisions 11 and 12
Revision 11 as of 2011-07-25 12:02:23
Size: 6318
Editor: 94-195-174-26
Comment: Added dependency for ghc-paths
Revision 12 as of 2011-07-25 12:33:06
Size: 6441
Editor: 94-195-174-26
Comment: Added arm targets and minor change to make line
Deletions are marked like this. Additions are marked like this.
Line 46: Line 46:
Valid arm targets are:
{{{{
../hake/hake.sh -s .. -a arm
}}}}
or
{{{{
../hake/hake.sh -s .. -a arm11mp
}}}}
Line 61: Line 69:
To speed things up you can specify a number of jobs. This should be roughly the same as the number of cores, so on a 4-core machine you could use: To speed things up you can specify a number of jobs. This should ideally be slightly more than the number of cores, so on a 4-core machine you could use:
Line 63: Line 71:
make -j 4 make -j 5

The goal of this article is to guide you through compiling and running Barrelfish inside QEMU, and to write and run programs on Barrelfish itself. The instructions below assume you are using a recent version of Linux.

Requirements

Barrelfish requires the following tools to compile correctly:

  • GCC 4.x
    • 4.4.5 and 4.5.2 are known to work. However, 4.4.5 throws compile warnings when building the current release as it does not support flags used by the Makefile, so 4.5.x is recommended.
  • GNU binutils 2.19 and 2.20 are known to work
  • GNU make
  • GHC 6.10 or 6.12.2
    • earlier versions of GHC are unsupported. GHC 6.12.1 has a known bug and is unable to build our tools
  • The Parsec 2.1 and GHC-paths packages. These can usually be downloaded from your distribution mirrors or failing that, using cabal.
    • If in doubt, just try compiling Barrelfish and GHC will alert you if it fails to find either package installed.
  • Non-kvm QEMU. The kvm version causes runtime errors, see known issues.

Getting Barrelfish

First we need to get the latest version of Barrelfish from the mercurial repository. Use the following command:

hg clone http://hg.barrelfish.org

or, if you are using an HTTP proxy:

hg --config http_proxy.host=ipOfYourProxyServer:portOfYourProxyServer --config http_proxy.user=user --config http_proxy.passwd=password clone http://hg.barrelfish.org

Configuring

Once you have cloned the repository, cd into it, create a build directory, and enter it:

cd hg.barrelfish.org
mkdir build
cd build

Then create the required makefile:

../hake/hake.sh -s .. -a x86_64

or, if you wish to build the 32-bit version:

../hake/hake.sh -s .. -a x86_32

Valid arm targets are:

../hake/hake.sh -s .. -a arm

or

../hake/hake.sh -s .. -a arm11mp

Note: If you get the following error:

../hake/Main.hs:369:25:
    Not in scope: data constructor `Opt_DeriveDataTypeable'

Apply the following patch to hake/Main.hs: Main.hs.patch

Compiling

Now we can build Barrelfish:

make

To speed things up you can specify a number of jobs. This should ideally be slightly more than the number of cores, so on a 4-core machine you could use:

make -j 5

Once that has completed, you can issue the following command to run Barrelfish on QEMU:

make sim

To allocate more cores to QEMU, instead of the default 2, you can edit the symbolic_targets.mk file in the build directory. Do this by editing the QEMU_CMD line for the architecture you've chosen for Barrelfish.

Known Issues

QEMU-kvm

If you get the following error when booting Barrelfish:

ERROR: pci.0 in AcpiOsInstallInterruptHandler() ../usr/pci/acpica_osglue.c:831
ERROR: failed to route interrupt
Failure: (            pci) Unknown global system interrupt number [PCI_ERR_UNKNOWN_GSI]
Assertion failed on core 0 in pci: r == 0, function init_acpi, file ../usr/pci/acpi.c, line 725.
Aborted

This is most likely due to Barrelfish being run inside QEMU-kvm. To fix this you can add '-no-kvm' to the QEMU_CMD in build/symbolic_targets.mk Alternatively, if you have an intel CPU, you can issue the following command as root: 'rmmod kvm_intel kvm'

GHC 6.12.2

There is a bug in some versions of GHC 6.12.2 on ubuntu which causes the Barrelfish build to fail. If you see errors like the following:

Makefile:48: x86_32/errors/errno.o.depend: No such file or directory
Makefile:75: x86_32/usr/slideshow/_for_app_slideshow/keyboard_flounder_bindings.o.depend: No such file or directory
Makefile:130: x86_32/usr/slideshow/_for_app_slideshow/fb_flounder_bindings.o.depend: No such file or directory
...
[11 of 33] Compiling Expressions[boot] ( ../tools/fof/Expressions.lhs-boot, tools/tools/hamlet/Expressions.o-boot )
[12 of 33] Compiling IL.FoF.Compile   ( ../tools/fof/IL/FoF/Compile.lhs, tools/tools/hamlet/IL/FoF/Compile.o )
 
../tools/fof/IL/FoF/Compile.lhs:71:18:
    Can't find interface-file declaration for variable freshVar
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression: freshVar binding
    In the definition of `loc': loc = freshVar binding
    In the definition of `getFreshVar':
        getFreshVar binding
                      = (loc, binding1)
                      where
                          loc = freshVar binding
                          binding1 = binding {freshVar = loc + 1}
 
../tools/fof/IL/FoF/Compile.lhs:72:23:
    Can't find interface-file declaration for variable freshVar
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression: binding {freshVar = loc + 1}
    In the definition of `binding1':
        binding1 = binding {freshVar = loc + 1}
    In the definition of `getFreshVar':
        getFreshVar binding
                      = (loc, binding1)
                      where
                          loc = freshVar binding
                          binding1 = binding {freshVar = loc + 1}
 
../tools/fof/IL/FoF/Compile.lhs:92:6:
    Can't find interface-file declaration for variable freshVar
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression:
        stableBinding
          {freshVar = freshVar upBinding, defStructs = defStructs upBinding,
           defUnions = defUnions upBinding, defEnums = defEnums upBinding}
    In the definition of `passFreshVar':
        passFreshVar upBinding stableBinding
                       = stableBinding
                           {freshVar = freshVar upBinding, defStructs = defStructs upBinding,
                            defUnions = defUnions upBinding, defEnums = defEnums upBinding}
make: *** [tools/bin/hamlet] Error 1

Upgrade your version of GHC if possible, or compile and install a newer version of GHC from source and prepend the path where it is installed to your PATH variable.

BarrelfishWiki: Getting_Started (last edited 2016-12-22 21:49:03 by MoritzHoffmann)