Building Software Image

From Qi-Hardware
Revision as of 18:14, 18 November 2010 by Alanpost (Talk | contribs)
Jump to: navigation, search

The linux embedded distribution OpenWrt is used for the official software images.

Currently we use our own repository for development, however merge from and to OpenWrt-mainline in a regular interval.

In case of OpenWrt-related problems, please consider taking a look into the OpenWrt documentation / FAQ / wiki.

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.


Contents

Building OpenWrt-image from source

Prerequisites

Install the following packages before trying to build the software image (assuming you run Ubuntu or Debian):

$ sudo aptitude install sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils \
gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath flex libncurses5 \
libncurses5-dev libxml-simple-perl zlib1g-dev pkg-config gettext libxml-simple-perl guile-1.8 cmake liblzo2-dev

Downloading sources

Building a software image requires at least 12GB of disk space. Make sure the directory you download the source code to has enough disk space available.

Tracking OpenWrt Release (Backfire)

The release software images are based on the current stable branch of OpenWrt: Backfire. We have a local source repository on top of the Backfire branch, called tracking_backfire, the master branch have NanoNote special commits. so we always use master branch for build the image, Checkout the source repository for building images like this:

$ git clone git://projects.qi-hardware.com/openwrt-xburst.git # clone the git repository
$ cd openwrt-xburst # change-dir into the sourcecode directory
$ cp data/qi_lb60/conf/feeds.conf ./ 
$ ln -s data/qi_lb60/files  
$ cp data/qi_lb60/conf/config.full_system .config  
$ yes "" | make oldconfig  
$ make menuconfig   #if you want change setting
$ make 

When a release of the source is made, it is not tagged. Retrieving the source code for a release must be done by date.

Feeds

OpenWrt uses so called "feeds" which provide openwrt-packages for software beyond the default minimal system.

"feeds" are defined within the files <feeds.conf> respective <feeds.conf.default> (former one overrides latter one) - however normally you shouldn't be needed to touch them.

To get and integrate the "feeds" simply do:

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

Configuration

To build an image based on the released ones, fetch the config of the latest official software which was released:

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

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

$ cp data/qi_lb60/conf/config.full_system .config

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

$ make menuconfig

If you just want to use the config.full_system as-is, run this command instead:

cp data/qi_lb60/conf/config.full_system  .config
yes "" | make oldconfig

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:

$ ln -s data/qi_lb60/files

Building Images

Having downloaded, updated, and configured your source, you are ready to build the software:

$ make

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

If everything is configured properly this command will play ready-to-flash+use images in bin/xburst/:

 $ ls bin/xburst
 OpenWrt-ImageBuild-xburst-*.tar.bz2
 OpenWrt-SDK-xburst-*.tar.bz2
 OpenWrt-Toolchain-xburst-for-mipsel-gcc-*.tar.bz2
 openbrt-xburst-qi_lb60-rootfs.tar.gz
 openwrt-xburst-qi_lb60-root.ubi
 openwrt-xburst-qi_lb60-u-boot.bin
 openwrt-xburst-qi_lb60-uImage.bin
 packages/
 uboot-xburst-qi_lb60

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

Yippieh! :)

Official binary images can be found here official software image and its overview [Official Software Image]

Porting projects to OpenWrt

Please refer to

  • the new wiki's Creating packages page
  • the old wiki's page (has more examples, including uclibc++ - not sure if these are out of date)

A short guide

You'll definitely need to read the above, but the main ideas are:

  • Use the instructions on this page to download and configure the source code.
  • when you run make menuconfig, select some useful looking unselected package and make it an 'M', and make sure you can compile/install it (look for the output ipkg in bin/xburst/packages, copy to nanonote, then use opkg there):
 make package/packagename-compile V=99
 make package/feeds/qipackages/packagename-compile V=99
  • add your own Makefile in the appropriate packages directory, and do the same as the above. Then watch it fail when the original authors haven't really thought about cross-compiling! Fix problems. Keep trying.

openwrt-package

  • some nanonote packages not in openwrt are at qi-hardware-packages
  • one idea would be to clone this repo and add new ports to it (with appropriate symlinks) for easy pulls

feeds.conf

FAQ

  • Read openwrt FAQ first :-)
  • Where is the source?

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

  • Where is image (bootloader kernel rootfs)?
 /PATH/TO/OPENWRT/bin/xburst
  • Where is toolchain?
 /PATH/TO/OPENWRT/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin
  • How make available the toolchain?
Add this line to your .bashrc file (/home/your_user/.bashrc)
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?
  • Where is Qi-Hardware's package?

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

Which pulls them into the package system.

  • Where is 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
  • 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
Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export