David Reyes, from Tuxbrain did a great work by porting gnuchess to the Nano and documenting it in his blog.
Of course, I want to port big things, but I'm not a great Linux guy, just average, so this tutorial makes a great starting point. I first tried to port gforth... But cross-compiling a compiler like gforth is really painful. I'll give it more tries, but it will take a really long time. For now, I'll show you how I ported gnugo to the NanoNote.
With respect to usability, the small screen in the Nano does not allow us to play a full 19x19 game (not in a way I'm aware of), but it can play 9x9 as you can see in the picture I posted.
Setting up the developing framework
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make gettext unzip libz-dev libc6 ncurses-dev subversion libxml-simple-perl gawk git-core
git clone git://projects.qi-hardware.com/openwrt-xburst.git
git fetch origin
git checkout --track -b xburst origin/xburst
Now, start the porting process.
PortingCreate a directory where we will keep all our porting applications:
# Copyright (C) 2008 OpenWrt.org
# This is free software, licensed under the GNU General Public License v2.
## Package name
## Package version we need (to match our download source)
## Release version (don't really needed, just for completeness)
## Name of the file we will download, with the previous package name definitions
## Url with the PKG_SOURCE file
## Program to uncompress the sources
# Definition of the package, for adding to menuconfig and creating the ipkg.
TITLE:=Go GNU from FSF
# Directory where the sources will be uncompiled and built BUILD_DIR
# is an env variable from the OpenWrt toolchain, you don't need to set
# Long description of the package
GNU Go is a free program that plays the game of Go. GNU Go has played thousands of games on the NNGS Go server. GNU Go is now also playing regularly on the Legend Go Server in Taiwan, on the WING server in Japan, and many volunteers run GNU Go clients on KGS. GNU Go has established itself as the leading non-commercial go program in the recent tournaments that it has taken part in.
# If ./configure does not need any options, leave it as follows
# Where will be copied the binaries and libraries after installation.
# Gnugo creates the binary executable in the interface directory.
$(INSTALL_BIN) $(PKG_BUILD_DIR)/interface/gnugo $(1)/usr/sbin/
# Final step for bulding the package
$(eval $(call BuildPackage,gnugo))
cp feeds.conf.default feeds.confAnd add this line to the end of the file feeds.conf:
src-link ports route/to/your/ports/dirand update the feeds:
./scripts/feeds update -aGood, almost ready to go. What is the main problem for cross-compiling gnugo? Gnugo uses intermediate programs that process information and generate intermediate code, that is then compiled. And these intermediate programs can not be created by a cross-compiler: they have to be created for the host architecture.
./scripts/feeds install -a
My take on it was to download gnugo's sources, ./configure and make gnugo. Then use the generated intermediate files to generate the target files. And it worked!
Thus, now create a directory ~/testing-gnugo/ where you download gnugo's tar.gz sources, and uncompress it. Copy that directory into gnugo-3.8-mod and gnugo-3.8-old. And do the ./configure make stuff in the original gnugo-3.8. You will have some files in gnugo-3.8/patterns named mkpat, joseki, mkeyes and a few more. These are the key files!
Patching gnugo's makefile
diff -crB gnugo-3.8-old/ gnugo-3.8-mod/ > 001_static_definition.patch
Go to the trunk directory, make menuconfig and go to the Games section. Select gnugo with "M" to generate a separate package, exit and save. Now
make package/gnugo/compile V=99If everything works correctly, there won't be any errors and you can end the process with
make package/gnugo/install V=99
Now you can transfer (with the Ethernet via USB connection) the file in trunk/bin/xburst/packages, named gnugo-3.8-3-xburst.ipk to the NanoNote, where you can install by going to the directory where you have copied the ipk file and
opkg install gnugo-3.8-3-xburst.ipk
Unpacking my Ben NanoNote
Another Ben Nanonote port: pmars
Nanonote ports: Yacas, 4th (forth compiler and interpreter)
Gcal: the ultra-powerful command line GNU calendar