Android on Freerunner

From Openmoko

Revision as of 04:07, 3 February 2009 by Coolcat (Talk | contribs)

Jump to: navigation, search


Contents

Android.png

Introduction

This page is dedicated to the installation of Android (an Open Handset Alliance Project) on the Neo 1973 and Neo FreeRunner handsets.

Freerunner-android-01.png

You can find other information, such as porting, development and day to day usage here : Android

Configuring the Bootloader

The Android kernel image can be more than 2MB in size. The UBoot environment that comes with your FreeRunner is only able to boot a kernel less than 2MB in size. To use a kernel larger than 2MB you need to:

  • Change to the Qi Bootloader. It supports 2MB kernels out of the box.
  • adjust your Uboot environment to support a Kernel of more then 2 MB [[1]]

Installing Android on the Internal Flash

Preparing the SD Card

The SD Card in your FreeRunner needs to be configured with two 2 primary partitions before Android will boot. First a VFAT/MSDOS (16 or 32) which acts as the '/sdcard' storage area (for pictures, movies, music, etc). Second an ext3 primary partition which Android uses as '/data' with in which it stores settings, caches, etc.

Linux

Insert the Mico SD Card from your FreeRunner into your Linux desktop then bring up a Terminal and type

   $ dmesg | grep sd

You will get an output like this, in this instance we can see that the SD Card has been assigned the device name 'sde'

   ...
   sd 9:0:0:0: [sde] Attached SCSI removable disk
   ...
   

Now, as root, use 'fdisk' to partition the device.

  # fdisk /dev/sde 

Pressing 'p' will show you the current partitions on the SD Card 'd' will delete them and 'n' will create a new one. Create a primary partition for your media. Then another primary partition for Android to store it's data on.

On a 1Gig card I used 768MB for the first partition ('+768MB' in fdisk) and the remainder for Android data. Here is fdisk's partition output:

      Device Boot      Start         End      Blocks   Id  System
   /dev/sde1               1         769      750513+  83  Linux
   /dev/sde2             770        1016      241072   83  Linux

Now all that's left to do is format the partitions with the appropriate filesystem But first hit 'w' in fdisk to write the changes to the SD Card.

Format like this:

   # mkfs.vfat -v -n and-media /dev/sde1
   # mkfs.ext3 -v -L and-data /dev/sde2

That's it, you can now remove the SD card from your desktop. If you re-insert it you will have two new usb disk devices.

NOTE: You will only be able to access the 'data' disk as root.

There is no need to populate the ext3 partition at all. The VFAT partition can be populated with media content (ring tones etc.) if you so desire.

NOTE: It can be worth reformatting the data partition when you upgrade the Android OS on your phone. Old settings can result in problems, wifi for example. But remember that formatting the Data partition will result in your preferences, text messages and contacts etc. being erased.


Mac

Windows

Flashing the FreeRunner

There are currently a few prebuild images:

Michael Trimarchi's images with latest fixes Sean McNeil images

I have placed an older 2.6.26 kernel with Android support at:

   uImage-android

I have put up a jffs2 image that replaces rootfs on the Freerunner at:

  androidfs.jffs2

As noted above, this installation requires you to wipe out the existing kernel and rootfs in NAND on your Freerunner.

With your SDCARD all set, you are ready to flash the kernel and rootfs:

   sudo {path_to}/dfu-util -d 0x1d50:0x5119 -a kernel -D uImage-android
sudo {path_to}/dfu-util -d 0x1d50:0x5119 -a rootfs -D androidfs.jffs2

Installing Android on an SD card

Images

There are currently a few prebuild images: Radek Polak's SD card images (install on ext3, first partition on SD must be FAT16)

Using jffs2 images

You can also boot from the SD Card using the pre built images like so :-

  • Mount the image using this script like so
  sudo ./Mntjffs.sh freerunner-v5.jffs2 image/
  • Then copy (cp -R) the files in directory image/ to any of the first three partitions on the SD Card (if using Qi) eg cp -R /your-path/image/* /media/android/
  • cd /media/android.
  • wget http://activationrecord.net/radekp/openmoko/android/init.rc .
  • mkdir boot
  • copy the kernel here and name it uImage-GTA02.bin


Some notes about booting android from sdcard :

Setup

  • Build android from source. See koolu website for directions.
  • Use the first script in this mail (adapt to your filesystem) to stage your android install.
  • copy the contents of this directory on a ext3 partition on your sdcard.
  • add a /boot directory on your sdcard.
  • copy the uImage-android kernel (see above) and copy it inside your /boot with the exact name uImage-GTA02.bin
  • I changed the init.rc (in your root on the sd) to remove mounts that could be problematic (/data for example) :
--- filesystem/root/init.rc	2008-12-15 17:51:14.000000000 +0100
+++ phyce.init.rc	2008-12-19 15:56:25.000000000 +0100
@@ -24,7 +24,7 @@
     mkdir /sqlite_stmt_journals 01777 root root
     mount tmpfs tmpfs /sqlite_stmt_journals size=4m
 
-    mount rootfs rootfs / ro remount
+    mount rootfs rootfs / rw remount
 
     write /proc/sys/kernel/panic_on_oops 1
     write /proc/sys/kernel/hung_task_timeout_secs 0
@@ -38,14 +38,14 @@
 #    mount yaffs2 mtd@system /system ro remount
 
     # We chown/chmod /data again so because mount is run as root + defaults
-    mount ext3 /dev/block/mmcblk0p2 /data nosuid nodev
-    chown system system /data
-    chmod 0771 /data
+#    mount ext3 /dev/block/mmcblk0p2 /data nosuid nodev
+#    chown system system /data
+#    chmod 0771 /data
 
     # Same reason as /data above
-    mount yaffs2 mtd@cache /cache nosuid nodev
-    chown system cache /cache
-    chmod 0770 /cache
+#    mount yaffs2 mtd@cache /cache nosuid nodev
+#    chown system cache /cache
+#    chmod 0770 /cache
  • Install Qi on you NAND flash. You can still boot whatever distro you've got on internal flash using the NOR bootloader. You should try the magic file in /boot to show kernel messages.
  • boot the GTA02, and pray.

Status

Most of the hardware on Freerunner seems to work on latest Android images, but not always perfectly.

If you want to see details of what is already usable, please have a look at: Android_usage


Android Debug Bridge

To assist in debugging and to gain shell access to the phone with Android, you can use the instructions found here: Android debug bridge

See also


Distributions

Personal tools


Contents

Android.png

Introduction

This page is dedicated to the installation of Android (an Open Handset Alliance Project) on the Neo 1973 and Neo FreeRunner handsets.

Freerunner-android-01.png

You can find other information, such as porting, development and day to day usage here : Android

Configuring the Bootloader

The Android kernel image can be more than 2MB in size. The UBoot environment that comes with your FreeRunner is only able to boot a kernel less than 2MB in size. To use a kernel larger than 2MB you need to:

  • Change to the Qi Bootloader. It supports 2MB kernels out of the box.
  • adjust your Uboot environment to support a Kernel of more then 2 MB [[1]]

Installing Android on the Internal Flash

Preparing the SD Card

The SD Card in your FreeRunner needs to be configured with two 2 primary partitions before Android will boot. First a VFAT/MSDOS (16 or 32) which acts as the '/sdcard' storage area (for pictures, movies, music, etc). Second an ext3 primary partition which Android uses as '/data' with in which it stores settings, caches, etc.

Linux

Insert the Mico SD Card from your FreeRunner into your Linux desktop then bring up a Terminal and type

   $ dmesg | grep sd

You will get an output like this, in this instance we can see that the SD Card has been assigned the device name 'sde'

   ...
   sd 9:0:0:0: [sde] Attached SCSI removable disk
   ...
   

Now, as root, use 'fdisk' to partition the device.

  # fdisk /dev/sde 

Pressing 'p' will show you the current partitions on the SD Card 'd' will delete them and 'n' will create a new one. Create a primary partition for your media. Then another primary partition for Android to store it's data on.

On a 1Gig card I used 768MB for the first partition ('+768MB' in fdisk) and the remainder for Android data. Here is fdisk's partition output:

      Device Boot      Start         End      Blocks   Id  System
   /dev/sde1               1         769      750513+  83  Linux
   /dev/sde2             770        1016      241072   83  Linux

Now all that's left to do is format the partitions with the appropriate filesystem But first hit 'w' in fdisk to write the changes to the SD Card.

Format like this:

   # mkfs.vfat -v -n and-media /dev/sde1
   # mkfs.ext3 -v -L and-data /dev/sde2

That's it, you can now remove the SD card from your desktop. If you re-insert it you will have two new usb disk devices.

NOTE: You will only be able to access the 'data' disk as root.

There is no need to populate the ext3 partition at all. The VFAT partition can be populated with media content (ring tones etc.) if you so desire.

NOTE: It can be worth reformatting the data partition when you upgrade the Android OS on your phone. Old settings can result in problems, wifi for example. But remember that formatting the Data partition will result in your preferences, text messages and contacts etc. being erased.


Mac

Windows

Flashing the FreeRunner

There are currently a few prebuild images:

Michael Trimarchi's images with latest fixes Sean McNeil images

I have placed an older 2.6.26 kernel with Android support at:

   uImage-android

I have put up a jffs2 image that replaces rootfs on the Freerunner at:

  androidfs.jffs2

As noted above, this installation requires you to wipe out the existing kernel and rootfs in NAND on your Freerunner.

With your SDCARD all set, you are ready to flash the kernel and rootfs:

   sudo {path_to}/dfu-util -d 0x1d50:0x5119 -a kernel -D uImage-android
sudo {path_to}/dfu-util -d 0x1d50:0x5119 -a rootfs -D androidfs.jffs2

Installing Android on an SD card

Images

There are currently a few prebuild images: Radek Polak's SD card images (install on ext3, first partition on SD must be FAT16)

Using jffs2 images

You can also boot from the SD Card using the pre built images like so :-

  • Mount the image using this script like so
  sudo ./Mntjffs.sh freerunner-v5.jffs2 image/
  • Then copy (cp -R) the files in directory image/ to any of the first three partitions on the SD Card (if using Qi) eg cp -R /your-path/image/* /media/android/
  • cd /media/android.
  • wget http://activationrecord.net/radekp/openmoko/android/init.rc .
  • mkdir boot
  • copy the kernel here and name it uImage-GTA02.bin


Some notes about booting android from sdcard :

Setup

  • Build android from source. See koolu website for directions.
  • Use the first script in this mail (adapt to your filesystem) to stage your android install.
  • copy the contents of this directory on a ext3 partition on your sdcard.
  • add a /boot directory on your sdcard.
  • copy the uImage-android kernel (see above) and copy it inside your /boot with the exact name uImage-GTA02.bin
  • I changed the init.rc (in your root on the sd) to remove mounts that could be problematic (/data for example) :
--- filesystem/root/init.rc	2008-12-15 17:51:14.000000000 +0100
+++ phyce.init.rc	2008-12-19 15:56:25.000000000 +0100
@@ -24,7 +24,7 @@
     mkdir /sqlite_stmt_journals 01777 root root
     mount tmpfs tmpfs /sqlite_stmt_journals size=4m
 
-    mount rootfs rootfs / ro remount
+    mount rootfs rootfs / rw remount
 
     write /proc/sys/kernel/panic_on_oops 1
     write /proc/sys/kernel/hung_task_timeout_secs 0
@@ -38,14 +38,14 @@
 #    mount yaffs2 mtd@system /system ro remount
 
     # We chown/chmod /data again so because mount is run as root + defaults
-    mount ext3 /dev/block/mmcblk0p2 /data nosuid nodev
-    chown system system /data
-    chmod 0771 /data
+#    mount ext3 /dev/block/mmcblk0p2 /data nosuid nodev
+#    chown system system /data
+#    chmod 0771 /data
 
     # Same reason as /data above
-    mount yaffs2 mtd@cache /cache nosuid nodev
-    chown system cache /cache
-    chmod 0770 /cache
+#    mount yaffs2 mtd@cache /cache nosuid nodev
+#    chown system cache /cache
+#    chmod 0770 /cache
  • Install Qi on you NAND flash. You can still boot whatever distro you've got on internal flash using the NOR bootloader. You should try the magic file in /boot to show kernel messages.
  • boot the GTA02, and pray.

Status

Most of the hardware on Freerunner seems to work on latest Android images, but not always perfectly.

If you want to see details of what is already usable, please have a look at: Android_usage


Android Debug Bridge

To assist in debugging and to gain shell access to the phone with Android, you can use the instructions found here: Android debug bridge

See also


Distributions