Debian

From Qi
Jump to: navigation, search

Qi-hardware's OpenWRT fork seems to be a faster and a better fit for the NanoNote Ben than Debian-based distributions. That being said, Debian-based distros do have advantages: more packages, more familiarity, and so on.

This page documents how to install Debian onto the NanoNote, and how to get sound and an X server functioning properly. There are three ways to do this:

The easiest and most reliable way seems to be the first way. Debootstrapping takes time and can go wrong, and using the Debian installer isn't that fast a process either.

There are currently two sites which have created Debian images: mister-muffin.de and pyneo.org. There does not seem to be any explanation as to how these images were created, but it was probably debootstrap or something similar.

Debian can both be run directly on the NanoNote (on its NAND memory) or on a microSD card. If you choose to run it on a microSD card, you only have to copy the Debian files to your microSD card; if you choose to run it on the NAND, you'll have to use the usbboot program -- see Xburst-tools.

This page shows how to install Debian Lenny and Debian sid. What you should choose depends on various things. Debian Lenny is stable but is getting old, while sid is unstable (or: can be unstable) but has the newest packages.


Contents

[edit] Step 1: Download the necessary files

No matter what you choose, you will need a kernel and a u-boot image. Both OpenWRT and LibreWRT kernels will do. The ones from Qi-hardware naturally works:

wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/openwrt-xburst-qi_lb60-u-boot.bin
wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/openwrt-xburst-qi_lb60-uImage.bin

[edit] Debian sid

Debian sid images are provided by mister-muffin.de.

  1. for microSD Card
wget http://mister-muffin.de/nanonote/debian-sid-mipsel.tar.lzma
  1. for NAND
wget http://mister-muffin.de/nanonote/debian-sid.ubi


[edit] Debian Lenny

Debian Lenny images are provided by pyneo.org.

  1. for microSD Card
wget http://pyneo.org/downloads/nano/debian-lenny.tgz
  1. for NAND
wget http://pyneo.org/downloads/nano/debian-lenny.ubi

If you would like a smaller Lenny, try downloading debian-lenny-mini.{tgz|ubi} instead.

[edit] Step 2: Install onto the NanoNote

[edit] for microSD card

First untar your downloaded rootfs into the first partition of your microSD card (if your microSD card has only one partition, use that). This is done in one of these two ways (depending on what Debian version you downloaded):

tar xvf debian-sid-mipsel.tar.lzma -C /path/to/sdcard/

or

tar xzf debian-lenny.tgz -C /path/to/sdcard/

After that, run:

mkdir -p /path/to/sdcard/boot/
cp openwrt-xburst-qi_lb60-uImage.bin /path/to/sdcard/boot/uImage

[edit] For NAND

Make sure you have usbboot installed, see Xburst-tools. Then run this:

usbboot -c "boot" # This will bootup the NanoNote
usbboot -c "nerase 0 4096 0 0" # This will *erase* everything
usbboot -c "nprog 0 openwrt-xburst-qi_lb60-u-boot.bin 0 0 -n"
usbboot -c "nprog 1024 openwrt-xburst-qi_lb60-uImage.bin 0 0 -n"

Now you only need to transfer the rootfs ubi file. The exact command depends on what Debian version you downloaded:

usbboot -c "nprog 2048 debian-sid.ubi 0 0 -n"

or

usbboot -c "nprog 2048 debian-lenny.ubi 0 0 -n"

When usbboot is done, you can turn off your NanoNote by pressing the reset button on the back or by taking out the battery and disconnecting the usb cable.

[edit] Step 3: Configuring your system

Once you have installed your system, it will not work very well in the beginning.


[edit] Getting internet and fixing the SSH server

The first thing that may bother you is that the ssh server may not work. To fix this, you need internet (or maybe you don't? Alternative suggestions welcome), so start by taking a look at Ethernet over USB. After that, run this:

apt-get install --reinstall openssh-server
ifconfig usb0 192.168.254.101

Now SSH should work.


[edit] Setup swapfile

Debian is a bit more hungry for memory than e.g. OpenWRT. You will surely need swap since you'll get a lot of complains when, for instance, depackaging stuff.

# dd if=/dev/zero of=/swapfile bs=1024 count=65536
# mkswap /swapfile
# swapon /swapfile

To enable it at boot time, edit /etc/fstab to include:

/swapfile swap swap defaults 0 0
Note: It might not be possible to create a swapfile on the NAND memory (or is it?), but it seems to work fine on microSD cards.


[edit] Upgrade system

Run this:

apt-get update
apt-get -y upgrade


[edit] Setup sound

The NanoNote requires kernel modules for sound to work. These kernel modules can be copied from Qi-hardware's OpenWRT rootfs image.

On the NanoNote:

mkdir -p /lib/modules/

On your computer:

wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/openwrt-xburst-qi_lb60-rootfs.tar.gz
mkdir openwrt-rootfs; tar xzf openwrt-xburst-qi_lb60-rootfs.tar.gz -C openwrt-rootfs
scp -pr openwrt-rootfs/lib/modules/* root@192.168.254.101:/lib/modules/

On your NanoNote:

depmod -a

After this, add the following line to /etc/modules:

snd-soc-qi-lb60

Then reboot.


[edit] How to setup an X server

While the framebuffer works just fine in Debian, running an X server can also be useful. This howto documents how to run ratpoison, a mouse-free window manager.

First, install these packages (not all are absolutely necessary):

apt-get -y install x11-xserver-utils xserver-xfbdev xterm feh \
x11-apps unclutter xdotool xmacro xbindkeys x11-utils menu ratpoison

Then save the following text as .Xmodmap in your home directory:

keycode 21 = equal plus asciitilde 3

keycode 24 = q Q exclam
keycode 25 = w W at
keycode 26 = e E numbersign
keycode 27 = r R dollar
keycode 28 = t T percent
keycode 29 = y Y asciicircum
keycode 30 = u U ampersand 7
keycode 31 = i I asterisk 8
keycode 32 = o O parenleft 9
keycode 33 = p P parenright

keycode 38 = a A aring
keycode 39 = s S 0x00A8
keycode 40 = d D ae
keycode 41 = f F minus
keycode 42 = g G underscore
keycode 43 = h H braceleft
keycode 44 = j J bracketleft 4
keycode 45 = k K bracketright 5
keycode 46 = l L braceright 6

keycode 52 = z Z oslash

keycode 57 = n N less 1
keycode 58 = m M greater 2
keycode 59 = comma semicolon apostrophe
keycode 60 = period colon quotedbl
keycode 61 = slash question less 0

keycode 123 = Prior
keycode 122 = Next

keycode 111 = Up
keycode 114 = Right
keycode 116 = Down
keycode 113 = Left

keycode 95 = Prior F9 F11
keycode 96 = Next F10 F12

keycode 22 = BackSpace BackSpace Delete

clear Control
keycode 105 = Control_R
add Control = Control_R
keycode 108 = Mode_switch
keycode 37 = Undo

Then save the next piece of text as startx.sh:

#!/bin/sh

. /etc/profile

export DISPLAY=:0.0
export HOME=/root

# Start X
Xfbdev -screen 320x240x32 r -rgba rgb -br -keybd \
    evdev,,device=/dev/input/event1,xkbmodel=pc105 &

sleep 1

# Hide the cursor
unclutter -root -idle 1 &

# Start ratpoison
ratpoison &

sleep 2

# Load keymap for modifier keys
xmodmap $HOME/.Xmodmap

Now, whenever you want to start an X server with ratpoison, just run startx.sh. If you want to start this automatically whenever you start your NanoNote, add a line with the path of startx.sh to /etc/rc.local.

Note: The X server does not understand the fn key. To enter a number, you have to press Shift and Mode_switch (the key with the red arrow) at the same time. The job of the fn key is to press the two keys, but it does not work out of the box in X servers. This has been solved in Jlime with a small program fnkey (link) which can be used to listen to /dev/input/event*. This just doesn't seem to work properly in Debian.
TODO: Make the fn key recognizable as a combination of Shift and Mode_switch, and by that make it easier to enter numbers.


[edit] Useful packages

apt-get install fbterm emacs23-nox alsa-utils alsa-base bash bash-completion \
mtd-utils screen file pm-utils rsync librsvg2-bin fbreader fbgrab fbset python \
ncdu tree build-essential libgtk2.0-bin fbi tudu tina mplayer
Note: If you use an X server, you can install emacs23 instead of emacs23-nox.


[edit] Framebuffer utils

Gives you a slightly smaller font. Lowest readable setting:

fbterm --font-size=8

Nice image viewer for the frambuffer

Todo managers

For PIM: I tried abook, but it needs minimum terminal size of 70x20. You can get it with fbterm --font-size=7, but it is hardly readable.


[edit] gmu on debian

After some fiddling with libraries, got it working on debian. A very nice and lightweight music player. Runs very smoothly :)

an important final detail was to add the correct fb mode to /etc/fb.modes: (just the output of fbset)

   mode "320x240-103"
     # D: 19.884 MHz, H: 27.090 kHz, V: 103.005 Hz
     geometry 320 240 320 240 32
     timings 50291 140 273 20 2 1 1
     rgba 8/16,8/8,8/0,8/24
   endmode

Working on packaging in - calamarz


[edit] Mplayer

apt-get install mplayer

Use this script to transcode video. Holy cow, it works!

TODO: package ingenic patched version that profits the IPU.


[edit] Screenshots

Emacs.debian.ben.nanonote.png Irc.emacs.debian.ben.nanonote.png Mult.windows.emacs.debian.ben.nanonote.png

Emacs-gtk.png

[edit] Quick flash install

Connect your NanoNote to your host computer and boot the NanoNote into USB Boot mode as you would normally perform a flash. Run the script below to install Debian Lenny mini on your NanoNote:

 #!/bin/sh -e
 # This script flashes Debian Lenny mini onto a Ben Nanonote.
 # Niklas A. Femerstrand <qnrq@pipemail.org>
 
 echo 'Finding attached Nanonote...'
 lsusb | grep 601a:4740
 echo 'Fetching requirements...'
 wget http://downloads.qi-hardware.com/software/images/NanoNote/Ben/latest/openwrt-xburst-qi_lb60-u-boot.bin
 wget http://pyneo.org/downloads/nano/openwrt-xburst-qi_lb60-uImage.bin
 wget http://pyneo.org/downloads/nano/debian-lenny-mini.ubi
 echo 'Flashing...'
 usbboot -c "boot"
 usbboot -c "nerase 0 4096 0 0"
 usbboot -c "boot"
 usbboot -c "nprog 0 openwrt-xburst-qi_lb60-u-boot.bin 0 0 -n"
 usbboot -c "nprog 1024 openwrt-xburst-qi_lb60-uImage.bin 0 0 -n"
 usbboot -c "nprog 2048 debian-lenny-mini.ubi 0 0 -n"
 echo 'Done!'

When the script has finished its execution, simply reboot your NanoNote. In the setup tty1 (the active console after boot) is dedicated to logging and does not show a login. Activate the second console (Alt-F2 or Alt-Right) to get a login prompt.

[edit] How to create two partitions on a microSD card using fdisk

Run this:

# umount /dev/sdb1
# fdisk /dev/sdb (make sure the /dev/sdb is your SD card. you can check that by 'dmesg' message)

Do this:

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
        switch off the mode (command 'c') and change display units to
        sectors (command 'u').

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (2-129651, default 2): 
Using default value 2
Last cylinder, +cylinders or +size{K,M,G} (2-129651, default 129651): +2G

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (67653-129651, default 67653): 
Using default value 67653
Last cylinder, +cylinders or +size{K,M,G} (67653-129651, default 129651): 
Using default value 129651

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Then run this:

# sudo mkfs.ext2 /dev/sdb1

[edit] Compiling a Kernel

Debian/Kernel using the openwrt toolchain

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export