Building Software Image

From Qi-Hardware
Jump to: navigation, search

The embedded Linux distribution OpenWrt is used for the software images.

Currently we use our own repository for development, however merges from and to OpenWrt-mainline occur at regular intervals.

In case of OpenWrt-related problems, please consider taking a look into the OpenWrt Wiki especially...

There are also step-by-step instructions for building OpenWrt on Debian Squeeze.

This page describes how to build OpenWrt for the NanoNote. This page corresponds to the more general OpenWrt wiki page "How to build OpenWrt". This page does not repeat the general build instructions, but instead focuses specifically on how to build OpenWrt for the NanoNote.

These instructions automatically build the cross-compiler, kernel and packages all under the build directory. You do not need root privileges to build software images.

No extra work than is explained below is required to build u-boot.bin, uImage and .ipk packages ready for installation on your NanoNote.

Resource Requirements for Different Configurations
Configuration Description Disk Space Sources Downloaded During Build Build Time (AMD64 2.4Ghz Single Core)
data/qi_lb60/conf/config.minimal builds minimal NAND image (bootable rootfs about 3 MB) 3.1 GB 174 MB 1 hour 40 minutes
data/qi_lb60/conf/config.xbboot builds zImage bootable from USB-boot mode 3.2 GB 171 MB 2 hours
data/qi_lb60/conf/config.full_system builds the full OpenWrt NanoNote NAND image (rootfs about 300 MB) 17 GB 844 MB 10 hours 20 minutes
data/qi_lb60/conf/config.full_system with CONFIG_ALL=y builds ca. 2400 packages (.ipk files) 24 GB 1.6 GB ~30 hours

Contents

[edit] Prerequisites

Install the following packages before trying to build the software image (assuming you run Ubuntu or Debian):
(cmake at version 1.8, install at version 8.2)

$apt-get install python 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 flex libncurses5 \
libncurses5-dev  zlib1g-dev pkg-config gettext libxml-simple-perl guile-1.8 cmake libssl-dev \
xsltproc fastjar mercurial pngcrush imagemagick tcl

If you happen to not have some necessary package, the OpenWrt build system will inform you about that anyway.

[edit] Downloading Sources

$ git clone git://projects.qi-hardware.com/openwrt-xburst.git # clone the git repository
$ cd openwrt-xburst # change to our source directory

[edit] Building OpenWrt Based on Release Files

[edit] Configuration

To build an image based on the released ones - i.e. reproduce the official release build (http://en.qi-hardware.com/wiki/Official_Software_Image#Change_Log), fetch the VERSIONS file of the latest OpenWrt images which were released. This file indicates what versions of base OpenWrt system and feeds were used during the time of release.

Fetch the VERSIONS file since you want to build release images. After that, we have to checkout openwrt-xburst.git to release commits. The second line of VERSIONS file (starts with openwrt git...) has the openwrt-xburst.git release commit SHA1. Alternatively you can use the git branch. For example:

$ wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/VERSIONS"
$ git checkout -b local-build 43a86619c3cb9aceaace51097bc35d59b7b8a4fc
or 
$ git branch -a # you will see the list of branches. You need to choose the latest release, which you want to base upon.
$ git checkout -b local-build remotes/origin/release_2011-05-28 # release_2011-05-28 is just an example, you should use the latest release_* branch

[edit] Feeds

The .config file downloaded below causes make package/symlinks to skip the OpenWRT menu that is otherwise presented.

$ wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/config" -O .config

To get and integrate the release feeds simply do:

$ wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/feeds.conf
$ make package/symlinks

Note that the feeds.conf already contains information about the versions of git/svn repositories as of the time of release image building.

You might need patch the upstream packages to compile (or run) fine. Please read the README-**. For example:

http://downloads.qi-hardware.com/software/images/NanoNote/Ben/2011-02-23/patches/

Though as of the time of writing, when 2011-05-28 is the latest image, no additional patches are required.

This time we generate the real .config file. There is one option CONFIG_ALL, which enables OpenWrt to build all packages as modules. You probably don't need to have all the packages, because it is also time consuming to build it all. So, we can disable this option:

$ sed -i '/CONFIG_ALL=y/d' .config
$ sed -i '/=m$/d' .config
$ yes "" | make oldconfig

[edit] Building Images

There are several NanoNote-specific configuration files that are part of the root filesystem. These must be symlinked into the location that the OpenWRT build expects to find them, in early release the data folder is under the openwrt-xburst.git, after 2011-03-22 we move the data folder to openwrt-package.git. After that the command should be:

$ ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files

If you don't want too much details, just run:

$ make

If you want full build log:

$ make V=99

If you haven't removed the CONFIG_ALL=y above and have some packages selected as modules (=m in .config), ignore package compile error when it is marked as module:

$ make V=99 IGNORE_ERRORS=m

If you'd like to run this at a lower priority level, leaving your machine available for other work, try this instead:

 $ ionice -c 3 nice -n 20 make

Hopefully you will now have ready-to-flash files in bin/xburst/:

 $ ls bin/xburst
 OpenWrt-ImageBuild-xburst-*.tar.bz2
 OpenWrt-SDK-xburst-*.tar.bz2
 openbrt-xburst-qi_lb60-rootfs.tar.gz
 openwrt-xburst-qi_lb60-root.ubi    # the root file system
 openwrt-xburst-qi_lb60-u-boot.bin  # the boot loader
 openwrt-xburst-qi_lb60-uImage.bin  # the kernel
 packages/  # .ipk files for individual packages that were built

Compiling an image with the default software configuration takes about 6 hours on a decent machine.

Yippieh! :)

OpenWrt binary images can be found here [1] and its overview [OpenWrt Software Image]

[edit] Building OpenWrt on the Last Git Commit

OpenWrt uses so called "feeds" which provide packages for software beyond the default minimal system. Feeds are defined within the files feeds.conf and feeds.conf.default with the former one overriding the latter one. However, you shouldn't normally need to edit them.

The development feeds.conf is being used for releases. If you always want to use the latest upstream packages just remove the '@******'

$ wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/feeds.conf

Our latest configuration files (feeds.conf and config.*) are stored in the packages repository, so you have to update from that repository first:

$ ./scripts/feeds update -a
$ ./scripts/feeds install -a

However, if you're working against master branch, the config file from the latest release might be out of date. Copy it from the repository instead:

$ cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/config.full_system .config
$ yes "" | make oldconfig  

We have to overwrite some default files for nanonote:

$ ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files

For selecting / deselecting packages which should go into the going-to-be-built image, you can run interactive ncurses-based configuration interface:

$ make menuconfig

Then start the build:

$ make

[edit] FAQ

Read openwrt FAQ first :-)

Where is the source?

The git archives are at projects.qi-hardware.com

Where is the image (bootloader kernel rootfs) found?

/PATH/TO/OPENWRT/bin/xburst

Where is toolchain found?

/PATH/TO/OPENWRT/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin

How do you make the toolchain available?

Add this line to your .bashrc file (found in your home directory):

export PATH=$PATH:/PATH/TO/OPENWRT/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin

How to add package to rootfs?

For OpenWrt to even produce a package (as an .ipk file), it should be set in the .config file. For example:

CONFIG_PACKAGE_pygame=y

You may need to run the following afterwards:

make oldconfig

Where are Qi-Hardware's packages?

They are in feeds/qipackages. If you look in feeds.conf.default, you will see the following line:

 src-git qipackages git://projects.qi-hardware.com/openwrt-packages.git

This pulls them into the package system.

Where is the kernel's menuconfig?

make kernel_menuconfig

How to compile one package?

make package/PACKAGE_NAME/compile V=99
make package/PACKAGE_NAME/{clean,compile} V=99

Note that a package file may not be produced unless CONFIG_PACKAGE_PACKAGE_NAME=y is present in the configuration.

How to compile one package from a feed?

make package/feeds/FEED_NAME/PACKAGE_NAME/compile V=99

How to compile just the kernel?

make target/linux/install

[edit] Build Script Files

You can find build script files using in buildhost at here.

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export