Note: this is not yet complete documentation. It's meant to get you started. If you're following the instructions here and running into any problems, please update the page! --bero

Porting to a new board

The best way to get started is to start with what's already there for a similar board - if there's no really similar board supported already, you should probably start with the Pandaboard tree.

Set up the manifest

The first file you need is the manifest file - it is basically an XML file telling the repo tool what components you wish to build, and where to get them. If you're coming from the world of traditional Linux distributions, think of the manifest file as a list of packages to install.

Get the existing tree using

git clone git://android.git.linaro.org/platform/manifests.git

Check out the correct branch, e.g.

git checkout -b linaro_android_4.0.4 origin/linaro_android_4.0.4

Copy the manifest file of the board you're basing yours on to your file - e.g.

cp tracking-panda.xml MyNewBoard.xml

Edit the file to match what you need. The format should be fairly obvious from looking at the file. (If you wish, add some documentation here).

Typically, you need to

  • Add a board config (described in more detail in the next step - the board configs for the existing boards are the the project tags with name="device/linaro/....." attributes)

  • Adjust where the kernel (project tag with name="kernel") is pulled from (unless you're lucky and your board is already supported by the standard kernel)

You may have to

  • Adjust where the u-boot boot loader is pulled from (fortunately, Linaro u-boot already contains support for many boards, so with any luck, you can just leave it at that).

Don't worry about the other entries for now - they're userspace components and are typically identical across boards.

Save the file and commit it to a git repository (at this early stage, you may want to just do it without going through gerrit - so it may be a good idea to use a repository in git.linaro.org/people/you. Don't worry, you can move it later).

Board config

The next step is setting up the board config. Once again, it is usually best to start with what's already there for a board similar to yours.

  • Grab the repository for the board you're basing yours on from git, e.g.

git clone git://android.git.linaro.org/device/linaro/pandaboard.git
  • Edit the files to match your board - to start off, adjust the names in AndroidProducts.mk and device.mk.

Rename the board file (e.g. pandaboard.mk) to something more suitable (YourNewBoard.mk), and edit it to change the naming.

  • Edit BoardConfig.mk - this is probably the hardest of the early steps, since you need to figure out what attributes your board needs (does it use xloader? u-boot? What kernel config does it need? ...). The most important things to watch out for are

    • TARGET_BOARD_PLATFORM - the platform used (e.g. omap4, imx53)

    • TARGET_NO_BOOTLOADER - should usually be set to true, most Linaro configs use u-boot instead

    • KERNEL_CONFIG - The kernel configuration to be used (this is the filename [without directory] of the configuration file for your board inside the kernel tree you're using. The existing configs can typically be found in arch/arm/configs inside the kernel tree.

    • UBOOT_CONFIG - The u-boot configuration to be used (if using u-boot as boot loader). A list of already existing configs can be found in the file boards.cfg inside the u-boot repository. The name you specify for UBOOT_CONFIG is the name as listed in the first column of boards.cfg followed by _config, e.g. omap4_panda_config or mx53loco_config.

    • TARGET_USE_XLOADER - true if your board needs to use the xloader boot loader, otherwise false

    • XLOADER_BINARY - If TARGET_USE_XLOADER is true, name of the xloader binary. Typically, you will use device/linaro/YourNewBoard/MLO, and just check in the correct MLO file into the repository along with AndroidBoard.mk

    • TARGET_ARCH_VARIANT - Hardware type to use. This will usually be armv7-a-neon, but you might run into boards that don't have neon support, or are armv5/armv6.

  • Edit vold.fstab to point at the correct tree inside sysfs to find the sdcard. If unsure, just comment out the line, all it does is take care of automounting of /mnt/sdcard, this can be done later (after you have the possibility to get a shell on the device to browse the board's /sys tree)
  • Save, commit

Building it

Follow the instructions on the BuildSource page to make a first build. Write it to an SD card by following the instructions on /../ImageInstallation the ImageInstallation page. You may have to edit linaro-android-media-create (part of linaro-image-tools) a bit, e.g. by adding a board config to linaro_image_tools/media_create/android_boards.py. The AndroidMx53LoCoConfig board config (at the time of writing, line 219) is probably a good place to start from because it shows how to do some extra steps not needed by many other boards (creating a special boot partition).

Next steps

  1. Build and install the image
  2. boot it
  3. see what doesn't work
  4. fix it
  5. goto 1 (note that the use of a goto statement here does NOT mean you should be using it in your code ;) )

Things to watch out for

  • Does the partition layout on the SD card match what init.rc expects?
  • Android doesn't like it at all if /sys/class/power_supply isn't there (initialization will crash and the init process will loop), even if your board doesn't have support for batteries. Enable the virtual battery driver in the kernel.
  • to be continued...


CategoryAndroidTips

Platform/Android/PortingToNewBoard (last modified 2013-08-29 08:46:00)