My favorites | Sign in
Logo
             
Search
for
Updated Dec 18, 2009 by joel.stan
LinuxChromiumArm  
Building Chromium for ARM

Cross compiling

Due to the lack of ARM hardware with the grunt to build Chromium native, cross compiling is currently the recommended method of building for ARM.

Building a toolchain

Pre-built

CodeSourcery has prebuilt cross-compilers available for download here: http://www.codesourcery.com/sgpp/lite/arm/portal/release1039

Chromium developers have tested using 2009q3. Older versions are known to cause errors when building Chromium.

Build your own

crosstool-ng is a set of scripts capable of building a cross-toolchain from source.

  1. Download and install from http://ymorin.is-a-geek.org/projects/crosstool
  2. Configure
  3.    $ mkdir toolchain-build
       $ cd toolchain-build
       $ ct-ng arm-unknown-linux-gnueabi
  4. Build. Adjust the number following build to the same number as you would pass to -j when running make.
  5.    $ ct-ng build.6

This will build a toolchain and place it in ~/x-tools/arm-unknown-linux-gnueabi/.

The toolchain-build directory can be safely removed after the build has completed.

Building a rootfs

The easiest way to build a rootfs for linking against is to copy the directories /lib and /usr/lib from the ARM system to a rootfs directory on the build machine. You must take care to ensure any copied symlinks are relative to the copied directory, not to the build machine's root.

If you do not have a pre-existing rootfs, Ubuntu's rootstock tool can be used to create a working ARM system. It is available in Ubuntu 9.10 (Karmic) and newer.

The following example builds an Ubuntu Karmic system. The list of packages to install come from LinuxBuildInstructionsPrerequisites#Ubuntu_Setup, and as such may be out dated. An alternate list may be found in $lib_list from build/install-build-deps.sh.

 $ sudo apt-get install rootstock
 $ sudo rootstock --fqdn beagleboard --login ubuntu --password temppwd \
   --imagesize 2G --seed xfce4,gdm,pkg-config,python,perl,g++,bison,flex,\
   gperf,libnss3-dev,libgtk2.0-dev,libnspr4-0d,libasound2-dev,libnspr4-dev,\
   libgconf2-dev,libcairo2-dev,libdbus-1-dev,libstdc++6-4.4-dev,libexpat1-dev,\
   libxslt1-dev,libxml2-dev,libbz2-dev  --dist karmic

Compiling

  1. Set the following gyp variables in ~/.gyp/include.gypi and regenerate your build files by running gclient sync.
  2. {
      'variables': {
        'target_arch': 'arm',
        'sysroot': '/path/to/rootfs',
        'disable_nacl': 1,  # NaCL does not build for ARM.
        'linux_use_tcmalloc': 0, # tcmalloc does not build for ARM.
        'armv7': 1, # Optional, for targeting ARMv7.
        'arm_thumb': 1, # Optional, for targetting thumb.  Combine with armv7 to target thumb2.
      }
    }
  1. Set your toolchain environment variables:
  2.   export CROSSTOOL=~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi
      export CXX=$CROSSTOOL-g++
      export CC=$CROSSTOOL-gcc
      export AR=$CROSSTOOL-ar
      export AS=$CROSSTOOL-as
      export RANLIB=$CROSSTOOL-ranlib
      export LD=$CROSSTOOL-ld
  3. Build as normal
  4.   make -r -j6 BUILDTYPE=Release chrome

Testing

If you don't have a real ARM machine, you can test with QEMU. For instance, there are some prebuilt QEMU Debian images here: http://people.debian.org/~aurel32/qemu/. Another option is to use the rootfs generated by rootstock, as mentioned above.

Here's a minimal xorg.conf if needed:

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "pc105"
        Option          "XkbLayout"     "us"
EndSection

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
EndSection

Section "Device"
        Identifier      "Configured Video Device"
        Driver  "fbdev"
        Option          "UseFBDev"              "true"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        DefaultDepth 8
        SubSection "Display"
            Depth 8
            Modes "1024x768" "800x600" "640x480"
        EndSubSection
EndSection

Notes