Difference between revisions of "Building OpenEmbedded (Beta)"

From Chumby Wiki
Jump to: navigation, search
m (clarify directory structure. This frustrated me for longer than I'd care to share.)
(Update to newer OE version)
Line 1: Line 1:
==Setting up the Environment==
+
==Overview==
Determine what directory will house your build systemAll of these steps must be performed under this directoryIt must contain no symlinks at all, and must be on a case-sensitive filesystem. The default is ~/oe/
+
OpenEmbedded is a build environment that contains a large number of packagesIt's possible to use OpenEmbedded to build a bootable image for certain chumby devices, such as the Falconwing-series of devicesThese instructions assume you're using Ubuntu 10.04 LTE, though they can be adapted to work on different platforms.
  
# Install the required packagesFollow the instructions for your particular operating system at http://wiki.openembedded.net/index.php/OEandYourDistro
+
Re-imaging a device requires access to the internal micro-SD port.  You will also need a USB micro-SD reader of some sortThese can be obtained very cheaply, and sometimes can be found bundled with micro-SD media.
# Install BitBake. Go to http://wiki.openembedded.net/index.php/Getting_started and follow the instructions under "Obtaining BitBake". You can either install bitbake to your system, or you can just add it to your PATH.
+
# Obtain OpenEmbedded.  Go to http://wiki.openembedded.net/index.php/Getting_started and follow the instructions under "Obtaining OpenEmbedded using Git".  Checkout the code to your build directory, by default ~/oe
+
# Download http://files.chumby.com/hacks/chumby-oe-1.2.zip and extract it to your build directoryThis will create a directory called “chumby”, and will add a script called “setup-chumby.sh”.
+
# Edit setup-chumby.sh and modify TOPDIR such that it points to your working directory.  It defaults to ${HOME}/oe.
+
  
You should now have a directory structure which looks like this:
+
==Setting up the Environment==
~/oe/setup-chumby.sh
+
This assumes you're using Ubuntu 10.04 LTE
~/oe/chumby
+
# Install prerequisites
~/oe/openembedded
+
#* {{Command|1=sudo aptitude install sed wget cvs subversion git-core coreutils unzip texi2html texinfo 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}}
 +
#Make /bin/sh not be part of dash
 +
#* {{Command|1=sudo dpkg-reconfigure dash # Select "No" at the prompt}}
 +
# Fix mmap_min_addr
 +
#* {{Command|1=sudo sh -c 'echo 0 > /proc/sys/vm/mmap_min_addr'}}
 +
#* {{Command|1=sudo sh -c 'echo "vm.mmap_min_addr = 0" >> /etc/sysctl.conf'}}
 +
# Download OpenEmbedded
 +
#* {{Command|1=mkdir chumby-oe}}
 +
#* {{Command|1=cd chumby-oe}}
 +
#* {{Command|1=wget http://files.chumby.com/hacks/meta-chumby-1.1.tar.gz}}
 +
#* {{Command|1=tar xvzf meta-chumby-1.1.tar.gz}}
 +
#* {{Command|1=wget http://download.berlios.de/bitbake/bitbake-1.12.0.tar.gz}}
 +
#* {{Command|1=tar xvzf bitbake-1.12.0.tar.gz}}
 +
#* {{Command|1=git clone git://git.openembedded.org/openembedded # This can take an hour or so}}
 +
# Setup OpenEmbedded - This command must be run each time you log on
 +
#* {{Command|1=source setup-chumby.sh # Change TOPDIR in this file if you're installing somewhere other than ~/chumby-oe}}
 +
# If desired, [[Advanced OpenEmbedded|customize the build process]].
  
 
==Building with OpenEmbedded==
 
==Building with OpenEmbedded==
  
# To set up your environment, source the “setup-chumby.sh” script.  E.g. run “. setup-chumby.sh”.  Choose Silvermoon as the preferred platform.
+
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.
# Build an image.  Available images are in openembedded/recipes/images/. For example, to build a very basic console image, run “bitbake console-image”.  TO do a fancier OPIE image, run “bitbake opie-image”.  This will take several hours, and will download a lot of code.
+
{{Command|1=bitbake console-image # As an example, build console-image}}
# Write the resulting SD image to disk. Under your working directory (by default ~/oe), there will be a new directory called “output”.  The ROM image is under output/deploy/eglibc/images/chumby-silvermoon/rom-chumby-silvermoon-[image-type].img.  Write this file to an SD card using either dd, or on Windows use win32 Image Writer.
+
 
 +
==Writing images to disk==
 +
Built images go in output-angstrom-.9/deploy/eglibc/images/.  Full, bootable ROM images are named rom-chumby-falconwing-IMAGENAME.img.  Other interesting files, such as the bootloader, boot shell, kernel, and boot graphics are also present in this directory.
  
Under linux with dd, a sample command to write it out would be
+
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
 +
*# 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.
 +
*# Unmount the drives
 +
*#* {{Command|1=for i in $(ls -1 /dev/sdb*); do sudo umount $i; done}}
 +
*# Write the ROM image out
 +
*#* {{Command|1=sudo dd if=rom-chumby-silvermoon-console-image.img of=/dev/sdX bs=8M}}
 +
* Windows
 +
*# Download win32-image-writer from https://launchpad.net/win32-image-writer
 
   
 
   
{{Command|1=dd if=rom-chumby-silvermoon-console-image.img of=/dev/sdX bs=8M}}
 
  
 
Where /dev/sdX is the device of the SD card, and bs=8M helps speed up the write dramatically. Note that you write to the raw device, /dev/sdX, and not the partitions /dev/sdX1, because the image as generated contains an MBR that it will replace on the target drive.
 
Where /dev/sdX is the device of the SD card, and bs=8M helps speed up the write dramatically. Note that you write to the raw device, /dev/sdX, and not the partitions /dev/sdX1, because the image as generated contains an MBR that it will replace on the target drive.

Revision as of 09:14, 10 April 2011

Overview

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

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 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
  2. Make /bin/sh not be part of dash
    • sudo dpkg-reconfigure dash # Select "No" at the prompt
  3. Fix mmap_min_addr
    • 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. Setup OpenEmbedded - This command must be run each time you log on
    • source setup-chumby.sh # Change TOPDIR in this file if you're installing somewhere other than ~/chumby-oe
  6. If desired, customize the build process.

Building with OpenEmbedded

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.

bitbake console-image # As an example, build console-image

Writing images to disk

Built images go in output-angstrom-.9/deploy/eglibc/images/. Full, bootable ROM images are named rom-chumby-falconwing-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-console-image.img of=/dev/sdX bs=8M
  • Windows
    1. Download win32-image-writer from https://launchpad.net/win32-image-writer


Where /dev/sdX is the device of the SD card, and bs=8M helps speed up the write dramatically. Note that you write to the raw device, /dev/sdX, and not the partitions /dev/sdX1, because the image as generated contains an MBR that it will replace on the target drive.