The first step is installing the package xburst-tools, following the instructions from the Qi Hardware Wiki about reflashing your Ben Nanonote.
The package can be downloaded in .deb format for Debian-like distributions. As I am usually in Arch Linux, I installed the confuse library with pacman -S confuse , downloaded the package tarball and uncompressed it, following the instructions therein. The only drawback is that uncompressing the tarball puts the executable files in binary directories which are not in my path, and to use usbboot (the main program talking to the Ben waiting to be reflashed) I had to use global paths. No big deal, though.
After getting this program, you'll need the boot image and the kernel, which can be found in the Qi Hardware's site as Nanonote software repositories (latest) Be sure to pick one file named (something like) openwrt-xburst-qi_lb60-u-boot.bin (the boot part), and openwrt-xburst-qi_lb60-uImage (kernel image). If you want to have sound enabled in your resulting Debian system, be sure to pick also the file openwrt-xburst-qi_lb60-rootfs.tar.gz (this may be deprecated after changes in the OpenWRT build process)
Now you have the boot and kernel, you'll need to download a Debian rootfs prepared for the Ben. You can find one for Debian-Lenny in the Pyneo.org page, get it with either
wget http://pyneo.org/downloads/nano/debian-lenny-mini.ubiThe image I use is a debian-sid which you can get with
wget http://mister-muffin.de/nanonote/debian-sid.ubiYou could also follow the instructions in Qi Hardware wiki about debootstrapping any distribution for the Ben NanoNote, but it will be harder and messier.
Now you have all the ingredients to install Debian on your Nanonote.
Be sure to have it shut down and connect it with the supplied cable (directly to your computer, no USB hubs whatsoever) and start it in USB boot mode (by pressing U and the power button). Run lsusb (list USB devices) in your console to check for changes, when 601a:4740 appears (or something like Ingenic LB60, depending on your system), you are ready to do the following (as root or using fakeroot).
In what follows, path-to-loader is the path to the u-boot file, path-to-kernel to the uImage and path-to-rootfs the path to the ubi file with the filesystem (you should use the Debian you just got,
but could use Qi Hardware's OpenWRT image.
usbboot -c "boot"Don't skip step 4: I thought that the nerase part wasn't needed as I was just overwriting the filesystem, but if you don't, it won't work and you will be left wondering what is up.
usbboot -c "nprog 0 path-to-loader 0 0 -n"
usbboot -c "nprog 1024 path-to-kernel 0 0 -n"
usbboot -c "boot;nerase 16 1024 0 0"
usbboot -c "nprog 2048 path-to-rootfs 0 0 -n"
Now unplug your Nanonote, remove the battery and put it again (it is the easiest way to restart it 100% sure). Boot it up and you should get a nice Debian prompt after the kernel loading screen (which will still show OpenWRT's logo).
You are done! No, not really. This barebones system needs something useful. More so, networking and sound enabled!
Getting sound working in your Ben NanoNote with Debian
To get sound working, uncompress the rootfs.tar.gz in your /tmp/ directory. Then copy everything from /tmp/lib/modules/kernelversion/ to your card or Nanonote. In my case, kernelversion was 184.108.40.206. In your Ben, create a directory named kernelversion in /lib/modules/ and copy everything in this newly created directory. The files you just copied are the kernel modules to get sound working.
Run depmod /lib/modules/kernelversion/*.ko This will generate (among a few others) modules.dep in /lib/modules/kernelversion/. You are ready to go! Edit /etc/modules and add snd-soc-qi-lb60 at the end of the file and issue a reboot. You should see the following when the kernel ends its boot up steps:
No device for DAI jz4740-i2sSound should be working, although you will need some alsa magic to get it to do something. For it, we will need networking. By the way, Debian with sound enabled as a kernel module takes around 17 seconds to boot in my Nanonote.
asoc: jz-codec <-> jz4740 mapping ok
Networking in your Ben Nanonote
I have successfully set up this in both Linux and MacOS hosts. Start by plugging your Nanonote to your host with the supplied cable. We will configure the host system first, then the Nanonote.
echo "1" > /proc/sys/net/ipv4/ip_forwardNow you set up the network interface with
ifconfig usb0 192.168.100.1 up
There is a catch, though: it may fail to appear. To get it to appear then you have to start playing with power up power down your Nano and switching USB ports. I'm not the only one with this problem, agrajag also pointed it out.
I got my Mac to forget about previous connections by using a USB hub to plug the Nano, then unplug it and plug again in the usual spot. Rebooting the Mac also solves it.
CAUTION: I tried to use a hub to connect to internet, and after enabling internet sharing my Nano ran out of memory and ended kernel-panic-ing.
Go there and set up the newly discovered ethernet adaptor and assign an IP manually: fill in with 192.168.100.1
Common steps in the Ben Nanonote
ifconfig usb0 192.168.100.2 upAnd enable a network gateway through your host system
route add default gw 192.168.100.1Now point your DNS server to Google's DNS servers with (you'll only need to do this the first time you try networking)
echo "nameserver 220.127.116.11" >> /etc/resolv.confThis should be it check with ping google.com and it should work if the host steps were done correctly.
Installing shiny new software
Start by updating the system:
apt-get updateNow you are ready to fill it up. Recommended stuff (i. e. What I put no matter what). Small descriptions included.
emacs23nox The No-X emacs 23 build. It works pretty well in the Ben, even with just 32MB of RAM. Having emacs in your pocket is awesome.
zile Zile is lossy emacs. It is a quicker loading small clone of emacs. Mostly keybindings, but for quick edits it loads way faster than the full fledged emacs
fbterm Frame buffer terminal. With it, you can resize fonts with fbterm -s fontsize
crawl Dungeon Crawl Stone Soup, one of the best dungeon crawl games out there. To get it to work (albeit very slowly...) you will need an SD card ext2 formatted to get swap memory in it (more on this later)
nethack Works out of the box without needing swap hacks
yacas Yet Another Computer Algebra System. Sadly it is no longer maintained, but it is awesome what it can do in just a tiny machine like the Ben.
pari-gp The calculator for number-theoretic people. I have also ran some computations in Pari, its programming language is pretty simple and its high precision arithmetic routines are awesome
alsa- You will need all the family of alsa-utils, dev and so on. apt-cache search alsa and pick almost all.
madplay a command line music player I used in my powernap script
cron If you want to run something periodically you need cron
gcc Are you compiling something in your pocket or you are just happy to see me?
Caveat: You may see the dreaded Bus errorackage list 0% when apt-getting or updating. This usually solves by deleting /var/cache/apt/*.bin (or /var/apt/cache/*.bin) and apt-get update again. If this does not solve it, clean completely var/cache/apt (files and directories), reboot and apt-get update. This made the trick for me, if it does not for you... Well, you can try re-installing the system.
dd if=/dev/zero of=/mnt/swap/swapfile bs=1k count=20480This will add a 20 MB swap file to your Nanonote memory. Currently I have a 50 MB one, previously I had 5 blocks of 10 MB that I swapped on when needed.
Before unmounting the card you will need to
swapoff /mnt/swap/swapfileHappy pocket hacking!
Gcal: the ultra-powerful command line GNU calendar
Unpacking my Ben NanoNote
My first port to the Ben NanoNote: gnugo
Another Ben Nanonote port: pmars