Posted by on Set 4, 2016 in Android, AOSP, development, Linux |

I finally received my Hikey 96 board from Lemaker and I’m currently in the process of adding the phone feature to the AOSP build: let’s see how easy it will be…

Hikey 96

The Hikey 96 Board

The HiKey board was the first board to be certified 96Boards Consumer Edition compatible: mine is the one from Lemaker.

If you are wondering what 96Boards certification means, I report here a snippet of 96boards website:

96Boards is the first open specification to define a platform for the delivery of compatible low-cost, small footprint 32-bit and 64-bit Cortex-A boards from the range of ARM SoC vendors. Standardized expansion buses for peripheral I/O, display and cameras allow the hardware ecosystem to develop a range of compatible add-on products that will work on any 96Boards product over the lifetime of the platform.

To me this is a very interesting project and one of the first results is the Hikey 96: cpu ARM Cortex-A53 with 8 cores, GPU Mali-450 MP4, 1 or 2 GB of RAM.

Hikey 96 in AOSP

The Hikey is supported in AOSP, and this is probably the most important feature for Android platform developers.

In the Android website there are clear instructions on how to build the various pieces of software: just pay attention to the monitor resolution setting. I initially missed that part and lost some time struggling with an unsupported resolution in my monitor.

For adding the phone feature to the build, the first thing to be checked is the hikey device directory:

device/linaro/hikey/

The first file to be modified is the one in which the Android base makefile is set

device/linaro/hikey/hikey.mk

After downloading AOSP, the products from which the features are inherited should be changed from

$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)

to

$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)

Here it can be added also the messaging application that currently seems not to be present in the full_base_telephony build:

# Add some useful apps
PRODUCT_PACKAGES += \
    messaging

Now it should be changed the default overlay configuration in

device/linaro/hikey/overlay/frameworks/base/core/res/res/values/config.xml

To have voice capabilities change the line

<bool name="config_voice_capable">false</bool>

into

<bool name="config_voice_capable">true</bool>

For data connection using the phone the mobile the following network attribute should be added:

<item>"mobile,0,0,1,-1,true"</item>

so the array will become something like:

<string-array translatable="false" name="networkAttributes">
    <item>"mobile,0,0,1,-1,true"</item>
    <item>"wifi,1,1,1,-1,true"</item>
    <item>"wifi_p2p,13,1,0,-1,true"</item>
    <item>"ethernet,9,9,2,-1,true"</item>
</string-array>

Change the mobile network settings according to your need (e.g. to have a lower priority than the other connections).

Unfortunately I did not find any documentation about these parameters, so to understand what they do in details, you have to take a look at the code inside frameworks/base/core/java/android/net/ (see especially NetworkConfig.java).

The next step is to modify the rild properties in

device/linaro/hikey/system.prop

The AOSP build is 64 bit, so the librarypath should be uncommented and changed from

rild.libpath=/system/lib/libreference-ril.so

into

rild.libpath=/system/lib64/libreference-ril.so

If you are using a device different than ttyS0, uncomment and modify also the line

rild.libargs=-d /dev/ttyS0

My modem creates ttyACMx ports, so I used

rild.libargs=-d /dev/ttyACM0

If you are using serial devices created through USB, also the file

nano device/linaro/hikey/ueventd.hikey.rc

should be modified for having the proper file permissions on the device. For example, with my modem I added

#radio permission for modems
/dev/ttyACM0 0660 system radio
/dev/ttyACM1 0660 system radio
/dev/ttyACM2 0660 system radio
/dev/ttyACM3 0660 system radio
/dev/ttyUSB0 0660 system radio
/dev/ttyUSB1 0660 system radio
/dev/ttyUSB2 0660 system radio
/dev/ttyUSB3 0660 system radio
/dev/ttyUSB4 0660 system radio
/dev/ttyUSB5 0660 system radio

The system should now have the phone features.

Is it all so good?

Unfortunately, no.

The Hikey 96 has, in my opinion, some severe limitations on the USB side:

  • The microUSB OTG port may be used (in host or slave mode) OR the Type A host ports may be used. They may not both be used simultaneously. If a cable is inserted into the OTG port then the Type A ports and the expansion bus port will be automatically disabled. This means no adb through the microUSB if there is an usb device attached in the Type A ports. As you can understan this makes modem ril debugging quite difficult if you have an USB modem.
  • For the USB host ports all attached USB devices MUST be one of the following two options: Low Speed (1.5Mbit/sec) and Full Speed (12Mbit/sec) devices, or High Speed devices (480Mbit/sec). If a mixture of High Speed and Low/Full speed devices are attached the devices will not operate correctly. This also applies if any hubs are attached to the ports. This means that, for example, you cannot have both a mouse and a high-speed modem.

I’m still trying to figure out how to overcome this annoying problems…