Building Software Image
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.
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)
$ 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
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). first time we got this .config file is for make package/symlinks don't bring up the make menuconfig
$ wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/config" -O .config
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
To get and integrate the release feeds simply do:
$ wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/feeds.conf $ ./scripts/feeds update -a
checkout qipackages to release branch
$ cd feeds/qipackages/ && git checkout release_2011-02-23 $ 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 feeds/qipackages/nanonote-files/data/qi_lb60/files
download the .config again. for real using.
$ wget "http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/config" -O .config
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:
$ sed -i '/CONFIG_ALL=y/d' .config $ yes "" | make oldconfig $ 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]
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
#!/bin/bash
OPENWRT_DIR_NAME="openwrt-xburst."$1
OPENWRT_DIR="/home/xiangfu/${OPENWRT_DIR_NAME}/"
CONFIG_FILE_TYPE="config."$1
MAKE_VARS=" V=99 IGNORE_ERRORS=m "
########################################################################
DATE=$(date "+%Y-%m-%d")
TIME=$(date "+%H-%M-%S")
DATE_TIME=`date +"%m%d%Y-%H%M"`
GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh"
BASE_DIR="/home/xiangfu/compile-log/"
IMAGE_DIR="${BASE_DIR}/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
mkdir -p ${IMAGE_DIR}
BUILD_LOG="${IMAGE_DIR}/BUILD_LOG"
VERSIONS_FILE="${IMAGE_DIR}/VERSIONS"
########################################################################
cd ${OPENWRT_DIR}
echo "make distclean ..."
make distclean
echo "updating git repo..."
git fetch -a
git reset --hard origin/master
if [ "$?" != "0" ]; then
echo "ERROR: updating openwrt-xburst failed"
exit 1
fi
echo "update and install feeds..."
./scripts/feeds update -a && ./scripts/feeds install -a
cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config
#sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
yes "" | make oldconfig > /dev/null
make package/symlinks
if [ "$?" != "0" ]; then
echo "ERROR: update and install feeds failed"
exit 1
fi
echo "copy files, create VERSION, copy dl folder, last prepare..."
rm -rf files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
rm -rf dl && ln -s ~/dl
mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
echo "patch openwrt "
${PATCH_OPENWRT_SH} ${OPENWRT_DIR}
echo "starting compiling - this may take several hours..."
time make ${MAKE_VARS} > ${IMAGE_DIR}/BUILD_LOG 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: Build failed! Please refer to the log file"
tail -n 100 ${IMAGE_DIR}/BUILD_LOG > ${IMAGE_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
fi
echo "getting version numbers of used repositories..."
${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}
echo "copy all files to IMAGE_DIR..."
cp .config ${IMAGE_DIR}/config
cp feeds.conf ${IMAGE_DIR}/
cp -a bin/xburst/* ${IMAGE_DIR} 2>/dev/null
mkdir -p ${IMAGE_DIR}/files
cp -a files/* ${IMAGE_DIR}/files/
(cd ${IMAGE_DIR}; \
bzip2 -z BUILD_LOG; \
bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
)
echo "DONE :)"