Building Software Image
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 images from source
Prerequisites
Install the following packages before trying to build the software image (assuming you run Ubuntu or Debian): (cmake at version 1.8)
$ apt-get 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 libssl-dev \ xsltproc fastjar libdbus-glib-1-dev jikes mercurial
Downloading sources
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
When a release of the source is made, it is not tagged. Retrieving the source code for a release must be done by date.
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/NanoNote/Ben/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 $ yes "" | make oldconfig
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.packages_only builds ca. 2400 packages (.ipk files) 24 GB 1.6 GB
For selecting / deselecting packages which should go into the going-to-be-built image, you can run interactive ncurses-based configuration interface:
$ make menuconfig
Feeds
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.
To get and integrate the feeds simply do:
$ cp data/qi_lb60/conf/feeds.conf ./ $ make package/symlinks
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:
$ ln -s data/qi_lb60/files
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/
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