KitKat 4.4 AOSP for BeagleBone Black with accelerated graphics

After a little bit of tweaking I have got my port of Android KitKat up and running on the BeagleBone Black. For some background on why I am doing this, read my previous post about Android on the BeagleBone Black

Screenshot of BeagleBone running KK 4.4

I tested it with AOSP 4.4.4_r1 on a BeagelBone Black rev A6 with these display options:

  • LCD4
  • LCD7
  • HDMI
  • VNC server

Just to set people's expectations here, I should mention that the BeagleBone Black is in many ways not an ideal target for running Android. It is slow, has no hardware assisted media codecs (so video does not play back very well), does not implement the vsync/hwcomposer backend (so animations are jittery) and has an old kernel. But it is a very good target for prototyping and learning skills that can be used on real projects because it is cheap, has a serial console (handy for debugging), USB OTG, Ethernet and lots of capes for more exotic hardware configurations.

You can try this out in one of three ways:

  1. Copy pre-built images to a micro SD card – easy, little prior knowledge required
  2. Build SD card images from scratch – advanced, you need to set up a fast build machine and be familiar with Linux command line tools
  3. Build images for fastboot and internal flash – advanced, in addition to (2) you need a serial to USB connector fitted to the BeagleBone

Problems encountered along the way

There were two problems doing the port, both associated with the old SGX-530 graphics driver binaries which were compiled against JB 4.1.

Change to the libutils ABI

There is a class called CallStack that is used to keep track of and print the call stack for debugging purposes. In JB 4.3 the signature for the update function was

void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH);

In KK 4.4 a third optional argument, tid, was added

void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH, pid_t tid=CURRENT_THREAD);

Since the argument is optional it is backwards compatible with source code but the binary linkage changes, hence it failed when dynamically linked from gralloc.omap3.so.

The only way to solve this is to patch the AOSP code. I reverted the signature for update to that prior to 4.4:

void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH);

And added an overloaded update that takes 3 non-optional parameters

void update(int32_t ignoreDepth, int32_t maxDepth, pid_t tid);

Now everyone is happy.

EGL init

The handling of attributes in eglCreateWindowSurface (frameworks/native/opengl/libs/EGL/eglApi.cpp) changed in KK 4.4. However, a fallback was implemented specifically for the omap4/3 SoCs. You enable it by adding this to BoardConfig.mk:

COMMON_GLOBAL_CFLAGS += -DWORKAROUND_BUG_10194508=1

[Thanks to XDA developer quarx2k for pointing this out]

Problem like these will continue to exist as log as we have binary-only components with no open source alternatives. While there has been progress in this area, notably the fact that Boardcom released the source to the VideoCore IV graphics core, there is very little coming out of Imagination Technologies. There is an open source community initiative (http://powervr.gnu.org.ve/) but it is a little stalled.

Copy pre-built images to a micro SD card

You will need a microSD card of at least 4 GiB

Get the pre-built image

Plug the SD card into your card reader: it will show up as something like /dev/mmcblk0 or /dev/sdc. Make absolutely sure that you know which it is before continuing because hard drives also show up as /dev/sd* and writing this image to your hard drive will make your computer unbootable!. Assuming that the card reader is mmcblk0, write the image using a command like this:

$ sudo sh -c "unzip -p BBB-aosp-4.4.4_r1-sd-img.zip | dd of=/dev/mmcblk0 bs=4M"

Now put the SD card in your BeagleBone. Depending on what is in your on-board eMMC flash, you may need to hold down the boot button while powering on to get it to load U-Boot from the SD card. All being well, you should see the "Android" boot animation after about 30 seconds and the launcher screen after 90 to 120 seconds. The second time the boot should be faster, I find it to be about 30 seconds.

Build SD card images from scratch

Follow the instructions in README.md at https://github.com/csimmonds/bbb-android-device-files/tree/kk4.4-sdcard

Build images for fastboot and internal flash

Follow the instructions in README.md at https://github.com/csimmonds/bbb-android-device-files/tree/kk4.4-fastboot

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Windows USB Driver

Thanks for writing up these articles, really very useful.

I've downloaded the image and got it running on a BBB. When I plug it into a windows machine it shows up but does not find an appropriate driver. Any ideas what USB driver it should use?

I hacked the Google USB Driver by adding a section to the android_winusb.inf with the correct VendorID and ProductID, and that allowed me to get a driver installed and get adb running. However, when I enable USB Debugging I am not seeing the RSA Fingerprint dialog (and no adbkeys file is being created in /data/misc/adb/ and I suspect this is maybe why when I actually attempt to start gdbserver I get a permission denied error.

Any thoughts?

Cheers
Malcolm

Has anyone succeed on adding gapps to the SD card images?

I somehow managed to resize the partitions so I could fit the GMS apps on the system partition. I followed the instructions on http://e2e.ti.com/support/embedded/android/f/509/t/228822.aspx, but it got stuck at the boot animation and I saw several failures at logcat.

Has anyone succeed ?

Thanks,
André Oriani

Android-4.4 on Beaglebone Black

I downloaded the pre-built image, installed on SD. And could successfully boot Android. I could adt via Linux development machine.
Then downloaded apk and Installed "Terminal Emulator" app and ran successfully. However looks like the device is not rooted. So I couldn't su. The device says "uid xxxxxx is not allowed to su".

Some discussion in the community, suggested to use UnlockRoot (http://www.unlockroot.com/). When I downloaded it, my both Chrome browser and AVG (Virus detection tool) warned me. So I didn't try.

Could you please advise on how to Proceed? Eventually my plan is to build from source. But I want still get comfortable with the pre-built image first.

-Hemant

Hi, I cannot find the config

Hi,

I cannot find the config file for Building the Kernel, am335x_evm_android_defconfig, inside /arch/arm/configs.
Please, post the same.

Thanks,
Rajiv.

Nice work

Hi,

Thanks for the nice work !

What needs to be done for WIFI enabling on your work.. Also have you checked that when we boot from emmc, the normal SD Card is not detected .. any suggestion will be very helpul

Thanks
Rahul

Re: nice work

Hi. WiFi support is high on my list. Watch this space. External sdcard is a known problem, I will post a fix as soon as I have time to look at it.

wifi support instruction

wifi support instruction would be a blast!!! will follow this page carefully

File-System mounted as Read-Only

Hi Chris,

I am following your blog and the way, mentioned in GIT Hub Page to port, Kit-Kat4.4
on BBB, and did an EMMC Build. I am able to successfully build the Filesystem, Kernel
and SGX Drivers. Building the SGX Drivers, were bit tricky, but i managed to build it,
successfully.

Finally, later, i flashed the Images, system.img, cache.img, boot.img and userdata.img
on my BBB. The Board booted up, and the Filesystem got mounted and everything looked
fine.

However, later, when i tried to install an App, and run it, i got error, like,
"Filesystem is Read-Only: Permission denied". I guess, fastboot, has mounted system.img,
as read-only on system partition. In, that case, can you please suggest, how, we can
install any App, on BBB running on Kit-Kat4.4 from EMMC ?

Regards,
Rajiv.

Re: File-System mounted as Read-Only

Hi, it is normal (even required) for system to be mounted read-only. That is the Android way. Apps are installed into /data/app, which is always read-write.

Maybe you are installing an app that needs a "rooted" device? Android for BBB is not rooted, but it is an engineering build, not a user build. That means that "adb shell" gives you a root shell and that you can make system temporarily read-write with the command "adb remount".

camera support?

Does the android 4.4 or 4.3 on the beagle bone black support the camera cape or a usb webcam?

Thank you.
Eric.

Re: camera support?

Hi Eric. I have not tested camera support yet. Watch this space though because it is on my list.

Ethernet Support and android apps Running

Hi ,

Thank you for giving great tutorial,
i need some small help.
i want to enable wifi configurations and android apps support on beagle bone black.
please tell me how to do this

Microphone setup

Could you give me a quick pointer on where to look in the kernel in terms of configuring a virtual microphone on the BB black? I'm no stranger to Linux or Android but it is the first time I have looked into modifying the kernel and am interested in feeding in streams from other devices to use with local android apps.

Thanks,

Ron

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Youtube and Vimeo video links are automatically converted into embedded videos.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.