This post documents a recent build of Android 4.3 Jelly Bean for RIoTboard on a fresh installation of openSUSE 13.2 x86_64. The build images were transferred to an SD card using Linux commands rather than using the MFGTool.

 

HARDWARE AND BUILD OS

 

Gateway NE56R12u Laptop running openSUSE 13.2 x86_64 DVD

     2.1 GHz Intel B950 dual-core Pentium processor

     8 GB physical RAM

     135 GB /home partition for build

     60 Mbs Internet connection

 

 

RESOURCES

 

RIoTboard User Manual Version 2.1 (RioTboard-User-Manual-V2.1.pdf)

Freescale Semiconductor Android User's Guide, Document Number : AUG, Rev. jb4.2.2_1.0.0-GA, 05/2013 (android_user_guide.pdf)

https://source.android.com/source/initializing.html

Building Android from Source

RIoTboard - Android KitKat Build on openSUSE 13.2 x86_64

 

 

UPDATE openSUSE 13.2 x86_64

 

As openSUSE 13.2 has reached end-of-life, there will be no future updates via the regular repositories. If you did not update openSUSE 13.2 during installation, then use YaST or the system tray icon to do so now.

 

 

INSTALL NECESSARY PACKAGES

 

sudo zypper install git gpg2 flex bison gperf zip curl zlib-devel gcc-c++ glibc-devel-32bit ncurses-devel-32bit xproto-devel libx11-devel zlib-devel-32bit ccache Mesa-libGL-devel libxml2-2 libxml2-tools libxslt1 libxslt-tools unzip u-boot-tools libuuid-devel lzo-devel perl-Switch

 

Note that perl-Switch must also be installed in addition to the packages necessary to build Android KitKat on openSUSE 13.2.

 

 

INSTALL MAKE

 

Make is problematic in openSUSE 13.2 since the regular repositories only provide Version 4.0, but Android compilation requires Version 3.81 or 3.82. Since openSUSE 13.1 is the most recent release with Version 3.82, I used a copy of its make RPM. Here is the file source I used:

 

ftp://195.220.108.108/linux/opensuse/distribution/13.1/repo/oss/suse/x86_64/make-3.82-160.2.1.x86_64.rpm

Remove make Version 4.0 and install make 3.82:

 

sudo zypper remove make
sudo rpm -ivh make-3.82-160.2.1.x86_64.rpm

 

Once you have installed make Version 3.82, you will likely be prompted by the software updater in the system tray to update, so resist the urge to do so.

 

 

INSTALL JAVA 6 JDK

 

I had a copy of the Oracle Java 6 Update 43 JDK RPM tucked away in my archive, so I used it as the Java JDK. The “Recompiling Android” post above has a link to the more recent Oracle Java 6 Update 45 JDK RPM (remember to use the x64 version):

 

Java Archive Downloads - Java SE 6

 

Execute the .bin file to install the JDK:

 

mkdir ~/jtemp
mv jdk-6u43-linux-x64-rpm.bin ~/jtemp/
cd ~/jtemp
sudo chmod a+x jdk-6u43-linux-x64-rpm.bin
sudo ./jdk-6u43-linux-x64-rpm.bin

 

Log out and log back in.

 

If you have a notion to install OpenJDK instead of Oracle Java JDK, you will be obliged to get packages from an outside repository as openSUSE 13.2 only provides packages for OpenJDK 1.7 and OpenJDK 1.8. An OpenJDK Version 1.6 RPM release for openSUSE 12.1 x86_64 does exist, and it may or may not be adequate (it's quite old):

 

https://www.rpmfind.net/linux/RPM/opensuse/12.1/x86_64/java-1_6_0-openjdk-devel-1.6.0.0_b22.1.10.4-1.2.x86_64.html

 

Android build scripts expect Oracle Java JDK, so using OpenJDK will require script modifications. See the Building Android from Source link above for more information.

 

 

OBTAIN ANDROID SOURCE CODE

 

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
mkdir ~/android-imx6-jb4.3_1.0.0
cd ~/android-imx6-jb4.3_1.0.0
repo init --repo-url=git://github.com/android/tools_repo.git -u git://github.com/embest-tech/imx-manifest.git -m embest_android_jb4.3_1.0.0
repo sync -j4

 

 

MANUALLY APPLY GITHUB REVERSION

 

The problem: If you were to attempt to build Android 4.3 Jelly Bean right now, your effort would end in failure. Towards the end of the build process, you would see almost two dozen “cannot find symbol” errors relating to the class EthernetDataTracker as noted in the following threads:

 

Unable to do initial 'make' on Jelly Bean (4.3)
Building Android from Source

 

The cause: These errors stem from a GitHub commit to embest-tech/imx-manifest on 22 December 2014 where the embest_android_jb4.3_1.0.0 manifest was altered. As a result of this commit, one package (fsl_imx_demo) was removed, and one package (Ethernet) was added to the manifest. Unfortunately, the Ethernet package is incomplete due to missing class elements in EthernetDataTracker, and this breaks the build process.

 

The solution: Ideally, the solution would be to rescind the 22 December 2014 commit or add an additional commit restoring the embest_android_jb4.3_1.0.0 manifest to its pre-22 December 2014 state. With interest in RIoTboard waning, I wouldn't hold my breath waiting for this, although to be fair, no one has yet posted any Issue on GitHub indicating that the problem exists. Happily, the repository for fsl_imx_demo is still in place, and this leads to...

 

The workaround: It's fairly easy to manually revert the Android 4.3 source code we just obtained to a pre-22 December 2014 state. We just need to do the following:

 

1. Replace the embest_android_jb4.3_1.0.0 manifest

2. Delete the offending Ethernet package from the source tree

3. Download and install the fsl_imx_demo package into the source tree

 

For (1), go to this URL which has the various Embest Android manifests as of 1 December 2014:

 

https://github.com/embest-tech/imx-manifest/tree/72fc2a8c8e1ee0a16d5ca3d06095f16b6d8927cf

 

Click the Clone or Download button, then click the Download ZIP option, and save the file. Unzip the archive, and if you burrow into it, you will find four manifests, one of which is named embest_android_jb4.3_1.0.0. If you are cautious, you can check to make sure that fsl_imx_demo is present and not commented out in the manifest by using a text editor. You now need to copy the manifest into the ~/android-imx6-jb4.3_1.0.0/.repo/manifests directory or whatever corresponds to this if you are using a different base directory compared to what I have used in this procedure so far. You should be replacing an existing file as you do this.

 

For (2), it is necessary to delete the directory ~/android-imx6-jb4.3_1.0.0/packages/apps/Ethernet

 

For (3), you can download the fsl_imx_demo package here:

 

https://github.com/embest-tech/android_packages_apps_fsl_imx_demo

 

Click the Clone or Download button, then click the Download ZIP option, and save the file. Unzip the archive, and you will find a directory named android_packages_apps_fsl_imx_demo-master. Rename this directory to fsl_imx_demo. It should contain a directory FSLOta, a file Android.mk and a file readme. Copy this fsl_imx_demo directory to ~/android-imx6-jb4.3_1.0.0/packages/apps/.

 

You now have prospects for a successful build and functional Ethernet when finished.

 

 

SELECT SD CARD OR EMMC BUILD

 

Open android-imx6-jb4.3_1.0.0/device/fsl/RIoTboard_6solo/BoardConfig.mk in your favorite editor and change

 

BUILD_TARGET_LOCATION ?= emmc

 

to

 

BUILD_TARGET_LOCATION ?= sdmmc

 

since we want to create an SD card image. Save the file.

 

 

BUILD ANDROID

 

cd ~/android-imx6-jb4.3_1.0.0

source build/envsetup.sh

lunch (Select RIoTboard_6solo-user)

make clean

time make -j4

 

The -j4 parameter in the make command is important as this reduced build times on my dual core laptop to 2.5 hours. At the very least you want as many jobs as you have CPU cores (-j2 in my case), but in my tests, increasing beyond that yields only marginal improvement.

 

 

CREATE A BOOTABLE SD CARD

 

The resulting image files to create an SD card for booting RIoTboard are located in ~/android-imx6-jb4.3_1.0.0/out/target/product/RIoTboard_6solo/:

 

boot.img

recovery.img

system.img

u-boot.bin

 

Per the Freescale Semiconductor Android User's Guide, a Linux script to generate the necessary partitions on a blank SD card to boot Android is located in ~/android-imx6-jb4.3_1.0.0/device/fsl/common/tools/fsl-sdcard-partition.sh.

 

Determine the device designation for the SD card in your system. You can use the lsblk command to do this by executing the command first without the SD card inserted, and then again with the SD card inserted.:

 

stmorgan@GATEWAY:~$ lsblk

NAME MAJ:MIN RM SIZE   RO TYPE MOUNTPOINT

sda    8:0   0  465.8G 0  disk 

sda1   8:1   0  100M   0  part 

sda2   8:2   0  288G   0  part 

sda3   8:3   0  1K     0  part 

sda5   8:5   0  169.8G 0  part /

sda6   8:6   0  7.9G   0  part [SWAP]

sr0   11:0   1  1024M  0  rom  


stmorgan@GATEWAY:~$ lsblk

NAME MAJ:MIN RM SIZE   RO TYPE MOUNTPOINT

sda    8:0   0  465.8G 0  disk 

sda1   8:1   0  100M   0  part 

sda2   8:2   0  288G   0  part 

sda3   8:3   0  1K     0  part 

sda5   8:5   0  169.8G 0  part /

sda6   8:6   0  7.9G   0  part [SWAP]

sdd    8:48  1  29.8G  0  disk

sdd1   8:49  1  29.8G  0  part /media/9016-4EF8

sr0   11:0   1  1024M  0  rom  

 

So I would use /dev/sdd for the SD card on my system. Note that this is not an empty SD card, as indicated by the presence of the mounted sdd1 partition.


In the following discussion, /dev/sdX will be used for the SD card, BUT YOU MUST REMEMBER TO CHANGE THE DEVICE DESIGNATION TO MATCH YOUR CARD IN ALL COMMANDS THAT FOLLOW.


Use your favorite method to remove all partitions from your SD card. If the partitioning tool used to remove partitions asks whether to use an MS-DOS or GPT scheme, use MS-DOS.


Execute the following commands after an SD card with no partitions has been inserted into the system:

 

cd ~/android-imx6-jb4.3_1.0.0/device/fsl/common/tools
sudo ./fsl-sdcard-partition.sh /dev/sdX

 

Eject the SD card from the system and reinsert it. This is a necessary step on my Gateway laptop, otherwise the following commands will not generate a usable image, although they give the outward appearance of doing what they are supposed to do.

 

cd ~/android-imx6-jb4.3_1.0.0/out/target/product/RIoTboard_6solo
sudo dd if=u-boot.bin of=/dev/sdX bs=1K skip=1 seek=1; sync
sudo dd if=boot.img of=/dev/sdX1; sync
sudo dd if=system.img of=/dev/sdX5; sync
sudo dd if=recovery.img of=/dev/sdX2; sync

 

The SD card can now be used to boot Android on the RIoTboard.

 

It's worth mentioning that there is a difference between the partition organization yielded by the above procedure versus that used in the Element14 pre-built SD card image. The Element14 image uses a partitioning scheme identical to that described in the Freescale Semiconductor Android User's Manual (presumably a byproduct of using MFGTool in a Windows environment), so the partitions are physically ordered as follows:

 

PARTITION TYPE/INDEX     NAME

N/A                      U-Boot Loader

Primary 1                Boot

Primary 2                Recovery

Logical 5 (Extended 3)   SYSTEM

Logical 6 (Extended 3)   CACHE

Logical 7 (Extended 3)   Device

Logical 8 (Extended 3)   Misc

Primary 4                DATA

 

The procedure used above reverses the Extended 3 and Primary 4 partitions, so the resulting physical order is as follows:

 

PARTITION TYPE/INDEX     NAME

N/A                      U-Boot Loader

Logical 1                Boot

Logical 2                Recovery

Logical 3                (small stub)

Logical 4                DATA

Logical 5                SYSTEM

Logical 6                CACHE

Logical 7                Device

Logical 8                Misc

 

For those too young to remember, the above references to Primary and Extended partitions go all the way back to Microsoft MS-DOS where you could have a maximum of either four Primary partitions on a (usually hard) disk drive or three Primary partitions and one Extended partition which could be populated with one or more Logical partitions. The procedure above just generates a sequence of Type 0x083 GNU/Linux partitions.

 

 

ENABLE 7-INCH LCD DISPLAY

 

The LCD8000-70T 7-inch LCD can be used with the resulting build by using almost all of the U-boot boot arguments specified in the LCD8000-70T Quick Start Guide:

 

Press a key when the “Hit any key to stop autoboot:” message appears, and use the following commands:

 

MX6Solo RIoTboardU-Boot >setenv bootargs console=ttymxc1,115200 init=/init nosmp video=mxcfb0:dev=lcd,7inch_LCD,if=RGB565 video=mxcfb1:off fbmem=10M vmalloc=400M androidboot.console=ttymxc1 androidboot.hardware=freescale
MX6Solo RIoTboardU-Boot >saveenv

 

Note that the setenv command does not have the “calibration” argument suggested by the Quick Start Guide. If the “calibration” argument is present, the calibration screen will appear, but the touchscreen does not respond, and the boot process will hang.

 

Reboot the RIoTboard, and you should see the LCD in action. While the LCD works, the touchscreen does not.

 

CONCLUSION

 

As with Android KitKat, openSUSE 13.2 x86_64 can be used to build Android Jelly Bean 4.3 for RIoTboard.  Hopefully, the GitHub reversion workaround will allow folks to again build Jelly Bean on all hosts.