Building OpenEmbedded

From Studio Kousagi Wiki
Revision as of 08:08, 7 December 2011 by Bunnie (talk | contribs) (Setting up the Environment)
Jump to: navigation, search

Overview

OpenEmbedded[1] is a build environment that contains a large number of packages. It's possible to use OpenEmbedded to build a bootable image for certain chumby devices, such as the Falconwing-series of devices. These instructions assume you're using Ubuntu 10.04 LTE, though they can be adapted to work on different platforms.

Re-imaging a device requires access to the internal micro-SD port. You will also need a USB micro-SD reader of some sort. These can be obtained very cheaply, and sometimes can be found bundled with micro-SD media.

These instructions assume you're running on a Falconwing platform, such as the Hacker Board or a chumby One. If you're using a Silvermoon-based platform such as Infocast 8 or chumby 8, replace all instances of "falconwing" with "silvermoon".

Quickstart

Building OE can take several hours, since it pulls down the source for the entire world and builds every piece from scratch; the initial build configuration is also a bit finicky at times.

In order to facilitate rapid evaluation and development, you can launch one of our public, pre-built Amazon EC2 cloud instance images. Please see quickstarting OE for directions on how to do this.

Setting up the Environment

This assumes you're using Ubuntu 10.04 LTE

  1. Install prerequisites
    • sudo aptitude install sed wget cvs subversion git-core coreutils unzip texi2html texinfo libtool docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libxml2-utils xmlto screen python-ply libxml2-utils xsltproc python-progressbar python-psyco
    • note that python-psyco is a JIT for python and not available on 64-bit systems (can be safely omitted)
  2. Make /bin/sh not be part of dash
    • sudo dpkg-reconfigure dash # Select "No" at the prompt
  3. Fix mmap_min_addr (required for qemu to run, generating libc keymap files, etc. has a potential security risk associated with this)
    • sudo sh -c 'echo 0 > /proc/sys/vm/mmap_min_addr'
    • sudo sh -c 'echo "vm.mmap_min_addr = 0" >> /etc/sysctl.conf'
  4. Download OpenEmbedded
  5. If desired, customize the build process.

Building with OpenEmbedded

Every time you log onto your build system, you must set up the environment. There is a command called "setup-chumby.sh" that will do this for you. You must source the command and not run it. If you've installed openembedded to a path other than ~/chumby-oe/ you must edit the command and change the variable TOPDIR.

source setup-chumby.sh # Select your platform at the prompt

Once setup, you use the bitbake command to build packages and images. Valid image files can be found in openembedded/recipes/images/and meta-chumby/recipes/images, and a full build from scratch can take ten hours or more. Building individual recipes is much quicker.

bitbake chumby-starter-image # As an example, build chumby-starter-image

Need to add information here on how to roll back to a buildable snap-shot as it seems that packages are often checked into the git repository without validating this build process.

Writing images to disk

Built images go in output-angstrom-.9/deploy/eglibc/images/. Full, bootable ROM images are named rom-chumby-MACHINE-IMAGENAME.img. Other interesting files, such as the bootloader, boot shell, kernel, and boot graphics are also present in this directory.

To write a ROM file to disk, use dd, or on Windows use win32-image-writer. If you're working on a remote system, use SCP or SFTP to download the image file locally. Then write the file out to an SD card:

  • Linux
    1. Determine what drive letter your SD card is. After inserting the card, run "dmesg" and note the drive name. For example, it might be "sdb" or "sdc" depending on how many hard drives your system has.
    2. Unmount the drives
      • for i in $(ls -1 /dev/sdb*); do sudo umount $i; done
    3. Write the ROM image out
      • sudo dd if=rom-chumby-silvermoon-chumby-starter-image.img of=/dev/sdX bs=8M
  • Windows
    1. Download win32-image-writer from https://launchpad.net/win32-image-writer

An example of a ROM image may be downloaded from [2]. Un-gzip this file and write it to an SD card, then insert the card in a Falconwing-based device. It should boot, and eventually bring up a prompt on the serial console.