May 15, 2010

Building Virtualbox from scratch

Virtualbox can be used with two licenses. Here the official statement from the website:
The full VirtualBox package is available in binary (executable) form free of charge from the Downloads page. This version is free for personal use and evaluation under the terms of the VirtualBox Personal Use and Evaluation License.
If, instead, you wish to purchase licenses for enterprise use and/or enterprise support for VirtualBox, please do not hesitate to contact your Sun representative or buy online from the Web Store
The VirtualBox Open Source Edition (OSE) is the one that has been released under the GPL and comes with complete source code. It is functionally equivalent to the full VirtualBox package, except for a few features that primarily target enterprise customers. This gives us a chance to generate revenue to fund further development of VirtualBox.

So if you want to use Virtualbox under GPL you have to build it from scratch. This is not very difficult:

  1. Download the OSE (Open Source Edition) from Virtualbox
  2. Take a look at the build instructions
  3. If you are running Debian, you have to install the following packages:
    apt-get install bin86 bcc iasl libxml2-dev libxslt-dev liborbit-de libcurl4-openssl-dev libpng12-dev libsdl1.2-dev libxcursor-dev libxmu-dev python-dev libpulse-dev libcap-dev libqt4-opengl-dev
  4. Unpack the tarball
    tar -jxf VirtualBox-3.1.8-OSE.tar.bz2
  5. Configure the package
    ./configure -help
    Usage: ./configure [OPTIONS]...

    Configuration:
    -h, --help display this help and exit
    --nofatal don't abort on errors
    --disable-xpcom disable XPCOM and related stuff
    --disable-python disable python bindings
    --disable-sdl-ttf disable SDL_ttf detection
    --disable-alsa disable the ALSA sound backend
    --disable-pulse disable the PulseAudio backend
    --disable-dbus don't use DBus and hal for hardware detection
    --disable-kmods don't build Linux kernel modules (host and guest)
    --disable-opengl disable OpenGL support
    --enable-webservice enable the webservice stuff
    --disable-hardening don't be strict about /dev/vboxdrv access
    --build-libxml2 build libxml2 from sources
    --build-libxslt build libxslt from sources
    --setup-wine setup a Wine directory and register the hhc hack

    Paths:
    --with-gcc=PATH location of the gcc compiler [gcc]
    --with-g++=PATH location of the g++ compiler [g++]
    --with-kbuild=DIR kbuild directory [/tmp/VirtualBox-3.1.8_OSE/kBuild]
    --with-iasl=PATH location of the iasl compiler [iasl]
    --with-mkisofs=PATH location of mkisofs [mkisofs]
    --with-linux=DIR Linux kernel source directory [/lib/modules/2.6.28.7/build]
    --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
    --with-openssl-dir=DIR directory for OpenSSL headers/libraries
    --out-path=PATH the folder to which configuration and build output
    should go

    Build type:
    -d, --build-debug build with debugging symbols and assertions
    --build-profile build with profiling support
    --build-headless build headless (without any GUI frontend)
  6. schroff@hades:$ ./configure
    Checking for environment: Determined build machine: linux.x86, target machine: linux.x86, OK.
    Checking for kBuild: found, OK.
    Checking for gcc: found version 4.3.2, OK.
    Checking for as86: found version 0.16.17, OK.
    Checking for bcc: found version 0.16.17, OK.
    Checking for iasl: found version 20061109, OK.
    Checking for xslt: found, OK.
    Checking for pthread: found, OK.
    Checking for libxml2: found version 2.6.32, OK.
    Checking for libxslt: found version 1.1.24, OK.
    Checking for libIDL: found version 0.6.8, OK.
    Checking for ssl: found version OpenSSL 0.9.8g 19 Oct 2007, OK.
    Checking for libcurl: found version 7.18.2, OK.
    Checking for zlib: found version 1.2.3.3, OK.
    Checking for libpng: found version 1.2.27, OK.
    Checking for SDL: found version 1.2.12, OK.
    Checking for X libraries: found, OK.
    Checking for Xcursor: found, OK.
    Checking for Xmu: found, OK.
    Checking for Mesa / GLU: found version 1.2, OK.
    Checking for Qt4: found version 4.4.3, OK.
    Checking for Qt4 devtools: found version 4.4.3, OK.
    Checking for python support: found version 2.5.2, OK.
    Checking for static stc++ library: found, OK.
    Checking for Linux kernel sources: found version 2.6.28, OK.
    Checking for ALSA: found version 1.0.16, OK.
    Checking for PulseAudio: found version 0.9.10 API version 11, OK.
    Checking for libcap library: found, OK.
    Checking for compiler.h: compiler.h not found, OK.

    Successfully generated '/tmp/VirtualBox-3.1.8_OSE/AutoConfig.kmk' and '/tmp/VirtualBox-3.1.8_OSE/env.sh'.
    Source '/tmp/VirtualBox-3.1.8_OSE/env.sh' once before you start to build VBox:

    source /tmp/VirtualBox-3.1.8_OSE/env.sh
    kmk

    To compile the kernel modules, do:

    cd ./out/linux.x86/release/bin/src
    make


    +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++
    Hardening is enabled which means that the VBox binaries will not run from
    the binary directory. The binaries have to be installed suid root and some
    more prerequisites have to be fulfilled which is normally done by installing
    the final package. For development, the hardening feature can be disabled
    by specifying the --disable-hardening parameter. Please never disable that
    feature for the final distribution!
    +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++

    Enjoy!
  7. source ./env.sh 
  8. kmk all
  9. cd out/linux.x86/release/bin/components
    ln -s ../VBoxDDU.so .
    ln -s ../VBoxREM.so .
    ln -s ../VBoxRT.so .
    ln -s ../VBoxVMM.so .
    ln -s ../VBoxXPCOM.so .
  10. Last but not least follow the instructions here to build the kernel modules und to run Virtualbox...
If this was to much work, just do the three steps here and use official binaries...

1 comment:

  1. Great beat ! I would like to apprentice while you amend your site,
    how could i subscribe for a blog website? The account helped me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast provided bright clear idea

    ReplyDelete