2011-03-29 13:51:07 +03:00
|
|
|
1. Obtain u-boot's mkimage
|
|
|
|
|
|
|
|
wget ftp://ftp.denx.de/pub/u-boot/u-boot-2009.11.tar.bz2
|
|
|
|
tar xfj u-boot-2009.11.tar.bz2
|
|
|
|
cd u-boot-2009.11
|
|
|
|
touch include/config.{h,mk}
|
|
|
|
make SUBDIRS=tools BIN_FILES-y=mkimage tools
|
|
|
|
cp tools/mkimage /usr/local/bin
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
2. Build the kernel
|
|
|
|
|
|
|
|
git clone git://projects.qi-hardware.com/qi-kernel.git
|
|
|
|
cd qi-kernel
|
|
|
|
git checkout ben-wpan
|
|
|
|
cp ../ben-wpan-config-2.6.38 .config
|
2011-03-29 15:51:51 +03:00
|
|
|
patch -p1 -s <../openwrt-preinit-hack.patch
|
2011-03-29 13:51:07 +03:00
|
|
|
OWRT make ARCH=mips CROSS_COMPILE=mipsel-openwrt-linux- vmlinux.bin
|
|
|
|
Jlime make ARCH=mips CROSS_COMPILE=mipsel-linux- vmlinux.bin
|
2011-03-29 15:51:51 +03:00
|
|
|
gzip -9 -f arch/mips/boot/vmlinux.bin
|
|
|
|
OWRT mkimage -A mips -O linux -T kernel -a 0x80010000 \
|
2011-03-29 13:51:07 +03:00
|
|
|
-C gzip -e 0x`mipsel-openwrt-linux-nm vmlinux | \
|
|
|
|
grep " kernel_entry" | cut -f1 -d ' '` \
|
|
|
|
-n 'Ben NanoNote Linux Kernel' \
|
|
|
|
-d arch/mips/boot/vmlinux.bin.gz uImage
|
2011-03-29 15:51:51 +03:00
|
|
|
Jlime mkimage -A mips -O linux -T kernel -a 0x80010000 \
|
|
|
|
-C gzip -e 0x`mipsel-linux-nm vmlinux | \
|
|
|
|
grep " kernel_entry" | cut -f1 -d ' '` \
|
|
|
|
-n 'Ben NanoNote Linux Kernel' \
|
|
|
|
-d arch/mips/boot/vmlinux.bin.gz uImage
|
2011-03-29 13:51:07 +03:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
3. Install the kernel
|
|
|
|
|
|
|
|
Using usbboot:
|
|
|
|
|
|
|
|
- remove battery and USB
|
|
|
|
- wait 15 seconds
|
|
|
|
- press the "U" key on the Ben
|
|
|
|
- insert USB while keeping "U" pressed
|
|
|
|
- release the "U" key
|
|
|
|
- on the host, run
|
|
|
|
usbboot -c "boot;nprog 1024 qi-kernel/uImage 0 0 -n"
|
|
|
|
- disconnect USB
|
|
|
|
- wait 15 seconds
|
|
|
|
- connect USB again
|
|
|
|
|
|
|
|
Using nandwrite:
|
|
|
|
|
|
|
|
- set up TCP/IP networking with the Ben
|
|
|
|
- get the Ben's IPv4 address:
|
|
|
|
NN=`ifconfig usb0 |
|
|
|
|
sed '/.*inet addr:\([^ ]*\).*/{s//\1/;s/100$/101/;s/200$/202/;p;};d'`
|
2011-03-29 15:51:51 +03:00
|
|
|
# should be NN=192.168.254.101 for OpenWRT,
|
|
|
|
# NN=192.168.1.202 for Jlime
|
2011-03-29 13:51:07 +03:00
|
|
|
- copy the kernel:
|
|
|
|
scp qi-kernel/uImage $NN:
|
|
|
|
- flash the kernel, clean up, and reboot:
|
|
|
|
ssh $NN 'PATH=$PATH:/usr/sbin;
|
|
|
|
flash_eraseall /dev/mtd1 && nandwrite -p /dev/mtd1 uImage &&
|
|
|
|
rm -f uImage && sync && sleep 1 && sync && sleep 1 &&
|
|
|
|
/sbin/reboot -f'
|
2011-03-29 15:51:51 +03:00
|
|
|
- press ^C to return to the shell
|
2011-03-29 13:51:07 +03:00
|
|
|
|
|
|
|
4. Set up the user space on the Ben
|
|
|
|
|
2011-03-29 15:51:51 +03:00
|
|
|
- connect to the Ben
|
|
|
|
ssh $NN
|
|
|
|
- run the following commands:
|
|
|
|
OWRT opkg install ip
|
|
|
|
OWRT opkg install ldconfig
|
|
|
|
mkdir -p /usr/local/var/run
|
|
|
|
exit
|
2011-03-29 13:51:07 +03:00
|
|
|
|
|
|
|
5. Build libnl-1 for cross-development and install the run-time library
|
|
|
|
|
|
|
|
wget http://www.infradead.org/~tgr/libnl/files/libnl-1.1.tar.gz
|
|
|
|
tar xfz libnl-1.1.tar.gz
|
|
|
|
cd libnl-1.1
|
2011-03-29 15:51:51 +03:00
|
|
|
OWRT gcc=`readlink -f \`which mipsel-openwrt-linux-gcc\``
|
2011-03-29 13:51:07 +03:00
|
|
|
OWRT ./configure --prefix=${gcc%/bin/*} --host=mipsel-openwrt-linux
|
2011-03-29 15:51:51 +03:00
|
|
|
Jlime patch -p1 -s <../libnl-1.1-limits.patch
|
|
|
|
Jlime inc=`mipsel-linux-cpp -v </dev/null 2>&1 | grep usr/include | tr -d \ `
|
|
|
|
Jlime ./configure --prefix=${inc%/include} --host=mipsel-linux
|
2011-03-29 13:51:07 +03:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
|
|
|
|
scp lib/libnl.so.1.1 $NN:/usr/lib
|
|
|
|
ssh $NN /sbin/ldconfig
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
6. Build the user space tools of the linux-zigbee project
|
|
|
|
|
|
|
|
wget http://ufpr.dl.sourceforge.net/project/linux-zigbee/linux-zigbee-sources/0.2.2/lowpan-tools-0.2.2.tar.gz
|
|
|
|
tar xfz lowpan-tools-0.2.2.tar.gz
|
|
|
|
cd lowpan-tools-0.2.2
|
|
|
|
OWRT ./configure --host=mipsel-openwrt-linux
|
|
|
|
JLime ./configure --host=mipsel-linux
|
|
|
|
make
|
|
|
|
|
|
|
|
scp src/iz src/izcoordinator src/izchat $NN:/usr/sbin/
|