Android on the MIPS CI20

From eLinux.org
Revision as of 11:11, 19 December 2014 by Crlarsen (talk | contribs) (Describe allocation of NAND space for use with the Android image.)
Jump to: navigation, search

Flashing the Android Image to NAND

Data is stored on the NAND using Unsorted Block Images (aka UBI). When Linux accesses the data stored on the NAND it does so through UBIFS, which is a layer of logic on top of UBI.

The steps for flashing the NAND are

  • Erase the NAND
  • Write the Secondary Program Loader (SPL)
  • Write the U-Boot image
  • Write the default U-Boot environment variables
  • Create the UBI "system" partition; this step allocates the remaining NAND space for use by the target operating system. In this case, Linux/Android. The space is then subdivided into UBI volumes. The Linux OS sees the UBI volumes as partitions which may cause some confusion. Linux partitions are not the same thing as UBI partitions.. In particular, the UBI "system" partition should not be confused with the Linux "system" partition. The Linux UBIFS "system" partition corresponds to the UBI "system" volume within the UBI "system" partition.
    • Allocate 8MBs for the Linux "boot" partition. For this, and all Linux partitions, the actual size will be rounded up to the next whole number of Logical Erase Blocks (LEBs), as needed to fill the request for space.
    • Allocate 8MBs, for the Linux "recovery" partition.
    • Allocate 40MBs for the Linux "system" partition.
    • Allocate 256MBs for the Linux "cache" partition.
    • Allocate 4GBs for the Linux "data" partition.
  • Copy the boot.img, recovery.img, and system.img files from SD card into memory, and then into their respective UBI volumes (Linux partitions).

For more detailed information about how U-Boot commands are used to perform this work start by booting the CI20 from an SD card programmed with the Android installation image. When prompted, press a key to interrupt the U-Boot automatic boot process. By default, if the automatic boot process had been allowed to continue it would execute the bootcmd command as defined in the U-Boot environment variables. At the U-Boot shell prompt you can print the value of the bootcmd variable/command using "printenv bootcmd". That is the starting point for reflashing the NAND. For information about commands native to the U-Boot shell you can use the shell's "help" command. For commands which aren't documented using the shell's help facility, use "printenv command" to see the command's definition.

Using the Android Debugger (adb) with CI20

To get adb access while running Android on the CI20 refer to the hardware diagram and set up the board using the following steps:

  • If there is a jumper on the USG OTG SELECT header, remove it.
  • If there is a cable connected to the USB OTG HOST port, disconnect it.
  • Attach a micro-USB cable to USB OTG DEVICE port.
  • Attach the other end of the USB cable to the host system from which you'll be running adb.
  • Boot the CI20 board and wait for Android to come up.
  • Verify that the host system can see the USB device. On Linux this will normally be done using the command lsusb. If the CI20 is visible to the host system it will appear with the Manufacturer ID/Device ID 18d1:dddd. Again, if your host machine is running Linux lsusb will also identify the CI20 with the description "Google Inc.".
  • Start adb on the host system. If you use 'adb shell' you'll automatically be running a shell on the CI20. Many of the standard POSIX/Linux commands are available.