From Qi-Hardware
Jump to: navigation, search


[edit] Running the Debian Installer on Nanonote

[edit] Status of this Page / Call for Help

Also see Debootstrap for a method a bit like this, but with less trouble.

These instructions have been written after performing a successful installation of Debian Squeeze on the Nanonote. Instructions given here have been adjusted to what the auther learned during that installation. Not all of the adjusted instructions have been tested by the author himself. Please report problems and document any workarounds you need. If you can, please also take and contribute screenshots during your installation experience.

[edit] Preparation

Get yourself a sufficiently large micro-SD card. 2GB should suffice. Try to get your hands on a fast card, as a slow card is going to slow down installation considerably. You also need card reader to format and prepare the micro-SD card using your PC. This manual assumes that you have access to a Desktop PC running Linux (preferably of the Debian/Ubuntu ecosystem).

Make sure your Nanonote is flashed with a recent version of u-boot. Older versions have problems booting from micro-SD cards. As of this writing, the latest released u-boot version (2010-06-15) can boot micro-SD cards, but crashes on larger SD cards. This pre-release version made available by Xiangfu fixes these bugs.

See here for how to install the latest released u-boot version. Lower-level flashing information are provided here, for those who want to install the pre-release u-boot image.

[edit] Preparing your micro-SD card

Partition your micro-SD card using a card-reader connected to your Desktop PC running Linux. We cannot easily re-partition the card when the Debian-installer is running, since Linux won't be able to re-read the modified partition table as long as the Debian-installer's partition is still mounted. Also (of course) we'll have to prepare the installer's partition first.

Using your favorite partitioner, create 3 primary partitions on the micro-SD card:

  • the 1st partition should get most of the card for use as root file-system
  • the 2nd partition is going to be used for the Debian installer; we need about 32Mb
  • the 3rd partition is used for swap (this is important! the installer won't be able to finish installation on 32Mb RAM only); allocate about 64Mb

Note about performance: you can try to align the partition starts on sector numbers divisible by 8192, as flash memory works on very large blocks of memory. Not all partitioning tools can easily do that, however.

Now download the Debian-installer image for mips-el malta:


If you want to run a different version or flavour of Debian, just use a different repository and/or replace 'squeeze' with 'sid' or 'testing' or whatever you want. You also might be able to use gNewSense's longsoon installer image instead.

Unpack and install the image to the 2nd partition created above. This assumes your micro-SD card is /dev/sdb. Make sure you know your micro-SD card's device file. Using a wrong device file may lead to severe data loss!

mkfs.ext2 /dev/sdb2
mount /dev/sdb2 /mnt
gunzip -c initrd.gz | (cd /mnt && cpio -i)
umount /mnt

Important Note You will have to re-run these image installation commands whenever you abort and want to restart the installation. Explanation: the mips malta installer image is meant to be loaded into RAM, so the Debian installer assumes all modifications to files are undone at reboot. As we are conserving RAM and putting the installer image onto the SD card, we'll have to re-initialize it manually.

Also prepare the 3rd partition for swap, so the installer can use it from early on during the installation

mkswap /dev/sdb3

[edit] Preparing Network Access

The Debian installer loads all installation data over the internet. Configure your Desktop PC to allow the Nanonote's Ethernet-over-USB interface access to the internet. A simple way to do that via NAT-forwarding is described here. As an alternative to NAT, you could install the squid proxy on your Deskotp (which is somewhat safer security-wise). On the Desktop, type:

sudo apt-get install squid

Then uncomment the following line in /etc/squid/squid.conf

http_access allow localnet

This works if your Nanonote is using the default IP address of Then on the desktop you only need to activate the ethernet interface:

ifconfig usb0 up

[edit] Installation

Insert the micro-SD card into your nanonote and just normally boot the Open-WRT system. Enable your Destop side's network by running the commands described above. Then ssh into the nanonote:

 ssh root@

(Might need to set the root password on the nanonote first using 'passwd')

[edit] Starting the Debian Installer

Mount and cd into the installer's partition:

mkdir /mnt/mmcblk0p2
mount /dev/mmcblk0p2 /mnt/mmcblk0p2
cd /mnt/mmcblk0p2/

Prepare the system for the installer. This is a little hacky (todo: document any more workarounds needed):

killall -9 gmenu2x
killall -9 hotplug2
killall -9 udevd

chroot . ./init

You must run this! Though it's going to hang after setting up. Wait some time, then abort via Ctrl+C. Then enter the installer via:

chroot . sbin/debian-installer-startup
swapon /dev/mmcblk0p3
chroot . sbin/debian-installer

[edit] Configuring the Network

Work yourself through the Debian installer, as usual. At some point you'll have to configure the network. Configure a static IP address, that exactly matches your current IP configuration (i.e. /

In case you're using the squid proxy on your host (as described above), you'll also configure a proxy for accessing the Debian mirror. The proxy is

Important Note: During the Debian Installer's network detection/configuration, the usb0 interface on your Desktop-PC may be reset, and your SSH session is going to hang. In that case, just issue a new 'ifconfig usb0 up' command on your host. Do not close the SSH session, or you'll have to restart installation from scratch!

TODO: I just realized that nanonote's Open-WRT comes with 'screen'. Maybe we should instruct people to run the installer from within screen? That way we would have some resistance against lost network connection.

[edit] Partation Hard Disks

In the partitioner select hard disk partition mmcblk0p1 as root filesystem with ext2 partition. Select mmcblk0p3 as swap space. Do not use partition mmcblk0p2. Do not change the partition table.

[edit] Fixup

After the debian installer completed, you'll have to manually install kernel and kernel modules. You also have to change the name for /sbin/init :

SSH into the OpenWRT system, and enter the Debian root filesystem:

 ssh root@
 cd /mnt/mmcblk0p1/target/

Put a kernel image into /boot/uImage:

 export http_proxy=
 wget -O boot/uImage

(If not using squid on your host, omit the 'export http_proxy=' line)

Copy the kernel modules from your Open-WRT installation into the Debian filesystem (make sure they math your kernel's version):

cp -r /lib/modules/ lib/modules/

Link 'init' to /etc/preinit, which is the where the kernel looks for 'init':

cd etc && ln -s ../sbin/init ./preinit

[edit] Reboot into your Debian System

TODO: how do we safely unmount everything and reboot?

Boot your nanonote by holding down the On+'M' key, to boot from the micro-SD card. After booting into the Debian system, you can SSH from your host to the user account created during installation, using the IP address you configured.

Note: SSH is going to complain about a host key mismatch. Simple workaround is to rm .ssh/known_hosts. A better workaround would be to change your Nanonote's IP-address when running Debian.

During my installation Debian only created an empty /etc/fstab. TODO: why is that so? If it happens to you manually create it, else you won't have swap space, which cripples your system's usability. Use this fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mmcblkp1   /       ext2    errors=remount-ro       0       1
/dev/mmcblkp3   none    swap    sw      0       0

[edit] TODO

  • Sound doesn't work. Need to load modules in proper order? Give users the proper config files.
  • wifi
Personal tools