In our previous posts on Android R13.4-GA release from Freescale, we discussed how to boot it over NFS, and how to boot it on an SD card, making a handful of changes to the file-system images.
What we didn’t do was compile it from source. At the time of those posts, the source weren’t available except to those under NDA with Freescale, so it was difficult to describe our customizations. In this post, we’ll describe the next steps in getting, customizing, and building the Android image from source, and we’ll discuss some of the challenges along the way.
This will be a rather lengthy post, but we hope it’s worth your time. As you look to create a product based on i.MX6 (and hopefully Nitrogen6X), you’ll likely need to know some of the things described below.
Overview and highlights
The customization done in this release includes some fixes over the previous image:
- Dual display support
- Analog Audio support
- Camera support
It also has some omissions:
- Wi-Fi and Bluetooth support on Nitrogen6x
- Proper support for recovery partition
For the impatient
If you just want to grab a new release, we’ve placed one here:
Note that this is not an SD card image in the form used previously (to be restored using dd). Instead, this image is a tar-ball that contains a set of directories, one for each partition used and a README file that describes the copying process.
This is a precursor to what we’ll do in better way later. It suggests the use of the tool sfdisk to create a set of partitions on your SD card, then uses cp -ravf to copy the files.
All of this discussion starts with the Freescale R13.4-GA source package.
You should probably get and install that package into /opt/imx-android-r13.4-ga if only for the documentation (/opt/imx-android-r13.4-ga/docs/), since we’ll refer to some of the notes in the documents below, starting with the file “R13.4_Android_User_Guide.pdf”.
In that file, you’ll see roughly the steps below:
- Get repo
- Initialize a repo tree from AOSP
- Copy Freescale’s default.xml
- Sync the repo
- Grab Freescale’s kernel and RAM disk
- Apply Freescale patches using c_patch
- Build Android
What you won’t see in that document is what you’re left with on your dev machine. The result of all of the above leaves you with a partial repo repository with some references to external git servers on Google’s site, some references to git servers at Linaro, and some local git trees.
You will be able to run repo status and find local changes to the AOSP code, but not for most of the pieces we’re customizing.
While far short of the right solution, we’ve put together a combination of git repositories to allow us (and you) to track updates to the Android R13.4-GA sources for Nitrogen6X. At the end, you should be able to something a little cleaner:
~/$ mkdir myandroid ~/$ cd myandroid ~/myandroid$ repo init -u git://github.com/boundarydevices/imx-android-r13.4-ga.git -b nitrogen6x ~/myandroid$ repo sync ~/myandroid$ ... build here
Unfortunately, you can’t quite do this yet because pieces of the code base are closed source, and subject to the Freescale EULA. We’ll cover the details of how and where you can gain access in a future post.
We’ve split the various projects that comprise the Android tree and divided them up based on their open-source status. Those that are freely distributable are up on GitHub. Others are on a private server of ours running gitolite and require prior authorization.
The resulting list is available here.
We started the process of making changes by creating device/boundary/nitrogen6x, to contain the specifics. If you’ve worked with any other Android O/S builds, you know that the convention is to add board support into the device/ tree, one per directory.
All of this is open source and visible on Github:
This tree gives us a place to put the changes we’ve mentioned in previous posts, such as:
- Our SD card mounts (for top slot on Nitrogen6x, full-sized SD card on SABRE Lite),
- Our changes to vold.fstab
We’ve also uploaded our patches to ts_calibrator in a proper git repository:
Additional structural updates
All of the changes listed above were present in the prior image though. Now that we have a place to keep our changes, we can feel comfortable making additional updates without fear of losing them or losing track. You can browse the history to see some of the changes:
- Proper installation of .idc files,
- Proper creation of boot/ directory, and
- A script to create an SD card.
- We included support for building our latest U-Boot, and
- Did the same for the kernel our latest Android kernel.
New (fixed) features
As mentioned in the preface above, we also fixed some things that were broken in our previous R13-4 images.
Fixing camera support didn’t require re-compilation, or at least not re-compilation of the Android pieces. What it did require was removal of the OV56340 MIPI camera from this bit of init.rc, and removal of the same from the kernel configuration.
Dual display support also didn’t require re-compilation of any Android bits. It also didn’t require re-compilation of the kernel. What we found when tracking this down is that either or both of the following
- The HDMI display needed to be the second display (/dev/fb2), and/or
- The files /system/etc/display_fb0..2.conf need to have the proper screen resolutions
We’ve only done limited testing here, and there are some quirks:
- Dual display with RGB and LVDS doesn’t work (crashes)
- Triple display also fails
We’ll post some updates in the future. In the mean-time, if you change your display bootargs such that it has an LVDS or RGB display as mxcfb0 and the HDMI device as mxcfb2 and make sure
that /system/etc/display_fb2.txt contains the resolution found in /sys/class/graphics/fb2/mode, you should be able to get both displays working together.
Analog audio (SGTL5000)
This one took a bit longer to fix, and did require changes to the Android HAL for Nitrogen6x.
It’s also going to take a bit longer to explain, and we can’t give direct code reference, because the changes needed are in a closed-source package (hardware/imx tree).
Between R13.2 and R13.4, Freescale switched to using a hardware module named tinyalsa, located in hardware/imx/alsa/tinyalsa as the bridge between Android’s Audio Flinger and the alsa audio drivers used on the various i.MX6 boards.
In the process, they only included support for HDMI and the Wolfson Micro codecs that are present on the Freescale-branded development boards. We added support for the SGTL5000 with this patch.
The to-do list
Stay tuned for the next couple of posts which will describe:
- How to get access to the repo mentioned above, and
- How to enable Wi-Fi and Bluetooth support on Nitrogen6X.