Building Software Image

From Qi-Hardware
Revision as of 20:51, 11 May 2011 by Erik.kugel (Talk | contribs)
Jump to: navigation, search

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

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

There are also step-by-step instructions for Debian Squeeze.

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.

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

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)

$ sudo apt-get install python 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 libssl-dev \
xsltproc fastjar libdbus-glib-1-dev jikes mercurial pngcrush imagemagick

If jikes is not in the repositories, it can be downloaded here for Ubuntu and here for Debian

Downloading sources

$ git clone git://projects.qi-hardware.com/openwrt-xburst.git # clone the git repository

Building OpenWrt base on release files

Configuration

To build an image based on the released ones, fetch the config of the latest OpenWrt images which was released: (it's maybe have all packages mark as modules so you maybe don't want compile all packages in your PC).

Fetch the VERSIONS file since you want build release images, after that. we have to checkout openwrt-xburst.git and openwrt-package.git to release commit. the second line is the openwrt-xburst.git release commit SHA1, you can also using the git tag. for example:

$ wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/VERSIONS"
$ git checkout -b local-build a0cb48741e20e3f2dd7eb546e57e0ae085eb7a31
or 
$ git tag
$ git checkout release_2011-02-23

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

checkout qipackages to release branch

$ cd feeds/qipackages/ && git checkout release_2011-02-23

you may need patch the upstream packages for compile fine. please read the README-**. for example:

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

this time we generate the real .config file. there is one option CONFIG_ALL, when enable this option OpenWrt will build all packages as modules, for compile images, we can disable this option:

$ wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/config" -O .config
$ sed -i '/CONFIG_ALL=y/d' .config

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 want full build log, ignore package compile error when it mark 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
 OpenWrt-Toolchain-xburst-for-mipsel-gcc-*.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 official software image and its overview [OpenWrt Software Image]

Building OpenWrt on last git commmit

OpenWrt uses so called "feeds" which provide 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 need to edit them. the developing feeds.conf, we using this feeds.conf for release. if you always want using last upstream packages. just remove the '@******'

$ wget http://projects.qi-hardware.com/index.php/p/openwrt-packages/source/file/master/nanonote-files/data/qi_lb60/conf/feeds.conf

our last configure file feeds.conf config.* store in package. so you have to update package 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

the start to build

$ make

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

build script files

you can find build script files using in buildhost at here

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export