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...

May 9, 2010

Exif?!

Did you ever examine what data your digital camera is writing inside your images? There is much more than the picture itself. It is called
EXIF = Exchangeable Image File Format
Here a shortened listing:
ExifTool Version Number : 7.30
File Name : 2OG.JPG
File Size : 831 kB
File Modification Date/Time : 2008:05:19 13:49:28
File Type : JPEG
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Make : NIKON
Camera Model Name : COOLPIX S6
Orientation : Horizontal (normal)
Software : COOLPIX S6V1.0
Modify Date : 2008:05:19 13:49:28
Y Cb Cr Positioning : Co-sited
Exposure Time : 1/125
F Number : 8.5
Exposure Program : Program AE
ISO : 50
Exif Version : 0220
Date/Time Original : 2008:05:19 13:49:28
Create Date : 2008:05:19 13:49:28
Max Aperture Value : 3.0
Flash : Off
Focal Length : 5.8 mm
Maker Note Version : 2.00
Color Mode : Color
White Balance : Auto
Focus Mode : AF-S
ISO Selection : Auto
Data Dump : (Binary data 1502 bytes, use -b option to extract)
Compression : JPEG (old-style)
Preview Image Start : 14921
Preview Image Length : 16048

Until this weekend i did not care about this information, too. But After upgrading my laptop all images loosed the right date, because with a wrong copy command the date was replaced with the current date. But with the help of exiftool (apt-get install libimage-exiftool-perl) it was easy to correct the wrong date:
$ exiftool 2OG.JPG |grep "Create Date"
Create Date : 2008:05:19 13:49:21
Using exiftool together with awk, sed and touch the date of the images can be restored without a problem...