This post documents a recent build of Android 4.4.2 KitKat on a fresh installation of openSUSE 13.2 x86_64 using the Element14-provided source code for RIoTboard. 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. kk4.4.2_1.0.0-ga, 07/2014 (Android-Users-Guide.pdf)
https://source.android.com/source/initializing.html
Recompiling Android for use with Parallel RGB TFT LCD and Capacitive Touch Panel
RIoTboard - Android KitKat Build on Ubuntu 12.04.5/14.04.5 LTS
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
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.
As noted above, this procedure assumes a clean installation of openSUSE. If your installation is not "fresh," then you may need some additional configuration. The following page has information on Java configuration for recent openSUSE releases, including Version 13.2:
https://en.opensuse.org/SDB:Installing_Java
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):
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.
UNPACK ANDROID SOURCE CODE
Copy the android-imx6-kk4.4.2-1.0.0-svn2705-20140818.tar.bz2 source code file to the home directory and decompress it:
cd ~ tar -xvf android-imx6-kk4.4.2-1.0.0-svn2705-20140818.tar.bz2
SELECT SD CARD OR EMMC BUILD
Open android-imx6-kk4.4.2-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-kk4.4.2-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 from around 7 hours to 3.75 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-kk4.4.2-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-kk4.4.2-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-kk4.4.2-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-kk4.4.2-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 the U-boot boot arguments specified in the LCD8000-70T Quick Start Guide. NOTE: You must have a connection to the J18 Serial Debug Port during boot in order to execute the following commands.
Reboot the RIoTboard, press a key when the “Hit any key to stop autoboot:” message appears and use the following commands:
MX6Solo RIoTboard U-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 calibration MX6Solo RIoTboard U-Boot >saveenv
Reboot the RIoTboard, and you should see the LCD in action. While the LCD works, the touchscreen does not.
CONCLUSION
Although build times are slightly longer than with Ubuntu, openSUSE 13.2 x86_64 can also be used to build Android KitKat on RIoTboard. Thanks again to others who have made their build procedures available.