wiki:monza/fakebox

Fakebox

Fakebox is a cross-compilation toolkit similar to Scratchbox, but done a lot simpler. It mainly replaces tools like gcc and ld in your $PATH with versions from your toolchain. Fakebox also setups qemu target CPU emulation using binfmt_misc and a given directory tree to use as the target root filesystem (the "/" directory). You are highly encouraged to take a look at the mentioned sites.

Lintrack uses Fakebox as its build environment together with a toolchain created using either crosstool or great OpenWrt build system.

How to setup Lintrack 3.0 build environment

  1. Checkout Lintrack source code:
    svn co http://svn.asn.pl/lintrack/trunk lintrack
    
  2. Checkout Fakebox source code. You can instead create a symlink if you already have Fakebox elsewhere.
    cd lintrack
    svn co http://svn.asn.pl/fakebox/trunk fakebox
    
  3. Download and unpack toolchain from http://download.asn.pl/lintrack/lintrack-3.0/, e.g.
    wget http://download.asn.pl/lintrack/lintrack-3.0/toolchain-gcc-4.1.0-glibc-2.3.6.tar.gz
    mkdir toolchain
    tar -C toolchain -xzvf toolchain-gcc-4.1.0-glibc-2.3.6.tar.gz
    
  4. Edit makepkg.conf
    • you may be interested in FTPAGENT, MAKEFLAGS and PACKAGER
  5. Start Fakebox:
    ./fakebox/fakebox
    
  6. Now you may try compiling something or just seeing if "gcc --version" works properly, e.g.:
    pjf@fb-lt:~/lintrack$ gcc --version
    i686-lintrack-linux-gnu-gcc (GCC) 4.1.0
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
  7. Note that in Fakebox, you can use the following env variables:
    pjf@fb-lt:~/lintrack$ export | grep FB_
    declare -x FB_ARCH="i686"  <-- target architecture
    declare -x FB_NAME="fb-lt"  <-- a shortcut for this particular build environment
    declare -x FB_PATH="/home/pjf/lintrack/fakebox"  <-- path to Fakebox
    declare -x FB_PREFIX="i686-lintrack-linux-gnu"  <-- prefix for tools (gcc) in toolchain
    declare -x FB_ROOTDIR="/home/pjf/tmp/lintrack/rootfs"  <-- target virtual rootfs
    (...)
    declare -x FB_TOP="/home/pjf/tmp/lintrack"  <-- the top directory of build environment
    declare -x FB_UNAME="Linux venus.lan 2.6.24 #1 Sun Mar 16 08:05:00 CET 2008 i686 GNU/Linux"  <-- virtual uname -a output
    
  8. Now you can download and install (using installpkg; ignore ldconfig warnings) packages from http://download.asn.pl/lintrack/lintrack-3.0/dev/ in order to populate $FB_TOP/rootfs with some basic libraries and headers (needed to build some packages), what is recommended. You may also build packages in $FB_TOP/pkg one by one.
    • alternatively, you may only install the pkg package manually, and issue the following command, ignoring warnings (make sure you have 'curl' installed on your system):
      pkg install sysbase syslibs readline ncurses pcre bash flatconf
      

Notes:

  • x86_64 hosts were not tested and are generally considered unsupported
  • you may need sudo setup properly if you need qemu emulation for some reason (its disabled by default)
Last modified 11 years ago Last modified on 03/22/08 02:37:04