Android on n810 - binaries and a fixed tutorial

Update (05/11/2008):
I've placed a backup of the android-on-n8xx patches online, in case they are of use to anyone. With Android being released proper, there might be more up-to-date resources for getting android running on you tablet. As always, YMMV.

Update (24/07/2008):

Today I played around with getting Google's Android to work on my n810 internet tablet. On the android-on-n8xx wiki there is quite an extensive tutorial. Unfortunately, certain parts of it are incorrect and will lead to a non-booting n810. Below you can find the fixed tutorial and links to binary packages with instructions on how to more easily try out android on your nokia tablet. The result: android-on-n810 photo (0.5MB)

Doing it the quick way (binaries)

Downloads

  • Maemo flasher-3.0 (http://tablets-dev.nokia.com/d3.php)
  • Prebuilt userspace tarball (http://alextreme.org/android/userspace.tar.gz) 24MB
  • Prebuilt 2.6.21 kernel image (http://alextreme.org/android/n810_android_kernel_image) 1.5MB

The steps

  1. mkfs.ext2 your miniSD card and mount it (we will use /mnt)
  2. unpack the userspace tarball. cp -a userspace/* /mnt/
  3. umount /mnt
  4. Switch your n810 off
  5. Connect your n810 using usb
  6. ./flasher-3.0 -f -k n810_android_kernel_image -R
  7. The flasher will now wait until you boot your n810. Do so, and it will flash your n810.
  8. Open an Xterm on the n810 and get root access. (http://andrew.daviel.org/N810-FAQ.html). Then, simply run the script: sh /media/mmc1/it_to_and.sh
  9. init: HOW ARE YOU GENTLEMAN

Doing it the hard way (from source)

Downloads

  • The linux vanilla 2.6.21 kernel
  • The first patch (it's the only one that doesn't brick your tablet) from the android-on-n8xx site: http://android-on-n8xx.googlecode.com/files/linux-2.6.21_rx-34_android-m5-rc14.bz2 (The site seems to have gone down, I've placed a backup copy on alextreme.org/android
  • The m3-37a Android SDK (http://dl.google.com/android/android_sdk_linux_m3-rc37a.zip)
  • The CodeSourcery ARM GNU Toolchain (http://www.codesourcery.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2)
  • busybox (source package, http://busybox.net/downloads/busybox-1.10.1.tar.bz2). You also need libncurses5-dev (or similar on non-Debian systems) for running menuconfig later on.
  • Maemo flasher-3.0 (http://tablets-dev.nokia.com/d3.php)
  • The userspace patch (http://android-on-n8xx.googlecode.com/files/userspace_android-m3-rc37a_N8XX.bz2)
  • OpenSSH for the N8XX (http://maemo.org/downloads/product/raw/OS2008/openssh/?get_installfile) (or simply a means to get root access: http://andrew.daviel.org/N810-FAQ.html)

The Kernel

It is assumed that for each step, you start out in the same directory ($ANDDIR).

  1. Unpack vanilla 2.6.21 kernel
    > wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.tar.bz2
    > tar -xjvf linux-2.6.21.tar.bz2
  2. Download & apply the appropriate patch from the download section.

    > wget
    > cd linux-2.6.21
    > bzcat ../linux-2.6.21_rx-34_android-m5-rc14.bz2 | patch -p1

  3. Download the mentioned cross compiler

    > wget http://www.codesourcery.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
    > tar -xjvf arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

  4. Compile the kernel

    > cd linux-2.6.21
    > make ARCH=arm CROSS_COMPILE=../arm-2008q1/bin/arm-none-linux-gnueabi- bzImage
    >

  5. Download flasher from http://tablets-dev.nokia.com/d3.php

    > cp flasher-3.0 $ANDDIR

  6. Install the kernel

    1. Power off the N8XX
    2. Connect the N8XX to your computer via USB
    3. Send the kernel to the N8XX

    > sudo ./flasher-3.0 -f -k linux-2.6.21/arch/arm/boot/zImage -R # this replaces the kernel on the device

    4. Power on the N8XX and the kernel will be replaced

    File System

    This section assumes you start in the same directory as The Kernel section.

  7. Download (and build!) busybox

    > wget http://busybox.net/downloads/busybox-1.10.1.tar.bz2
    > tar -xjvf busybox-1.10.1.tar.gz2
    > cd busybox-1.10.1
    > make menuconfig
    > make ARCH=arm CROSS_COMPILE=../arm-2008q1/bin/arm-none-linux-gnueabi-
    > cp busybox ../busybox

  8. Create a SD card image

    > android-sdk_m3-rc37a/tools/mksdcard -l card 100M card.img

  9. Start the emulator

    > android-sdk_m3-rc37a/tools/emulator -sdcard card.img -console -debug-kernel

  10. Wait until the emulator is fully loaded, then add busybox to the emulator from outside the emulator shell:

    > android-sdk_m3-rc37a/tools/adb -d 1 push busybox /data/busybox

  11. Inside the emulator shell, extract /system to the sdcard image

    > chmod 774 /data/busybox
    > ln -s /data/busybox /sbin/tar
    > cd sdcard
    > /sbin/tar -cvf system.tar /system

  12. Close the emulator window (not the shell).
  13. Format the MicroSD card
    1. Insert the MicroSD card into the N8XX
    2. Connect the N8XX to your computer via USB
    3. Flash the MicroSD card

    > df | grep /media/usbdisk-1 # do this to obtain what the usb device name, which
    # may vary depending on the linux installation
    # I will call mine /dev/sdc1
    > su
    > umount /dev/sdc1
    > mkfs.ext2 /dev/sdc1
    > mount /dev/sdc1 /media/usbdisk-1
    > exit

  14. Extract the userspace

    > cp android-sdk_m3-rc37a/tools/lib/images/ramdisk.img ramdisk.gz
    > gunzip ramdisk.gz
    > cd /media/usbdisk-1
    > cpio -iv < $ANDDIR/ramdisk
    > mkdir dev/log
    > touch dev/log/main
    > touch dev/log/events
    > touch dev/log/radio

  15. Extract system.tar from the sdcard image

    > su
    > mkdir card
    > mount card.img card -o loop
    > tar -xvf card/system.tar -C /media/usbdisk-1

  16. Apply the file system patch (http://android-on-n8xx.googlecode.com/files/userspace_android-m3-rc37a_N8XX.bz2)

    > cd /media/usbdisk-1
    > bzcat $ANDDIR/userspace_android-m3-rc37a_N8XX.bz2 | patch -p1

  17. Add the following file to /media/usbdisk-1 as it_to_and.sh. chmod 777 /media/usbdisk-1/it_to_and.sh:
    #!/bin/sh -x
    echo "Starting Android..."
    rm -rf /media/mmc1/tmp/*
    umount -l /proc
    umount -l /sys
    mount -t proc proc /media/mmc1/proc
    mount -t sysfs sysfs /media/mmc1/sys
    mount --bind /dev /media/mmc1/dev
    chmod -R 777 /media/mmc1 # if you know the exact permissions, email me
    umask 000
    chroot /media/mmc1 /init
  18. Unmount the volumes on your PC provided by the N8XX
  19. Disconnect the N8XX from your PC
  20. Booting Android

    Start your N8XX device. Get root access (http://andrew.daviel.org/N810-FAQ.html). Then, simply run the above script: sh /media/mmc1/it_to_and.sh

    init: HOW ARE YOU GENTLEMAN

    Notes

    • touchscreen doesn't work. The patch on the android-on-n8xx site made my tablet stop booting
    • you need the m3-37a Android SDK. the m5 one won't work.
    • kernel patches on android-on-n8xx site: (v2 (doesn't compile) / v3 (n810 doesn't boot)
    • the original tutorial totally forgets that you need to compile busybox before you can use it
    • A number of minor errors fixed from the original tutorial (ln, mount -o loop, bzcat for the userspace patch)
    • If you find errors on this page, let me know and I'll update it. I hope the writer of the original tutorial will update his page using these details though :)