Archive

Posts Tagged ‘tutorial’

Getting Started with WRTnode OpenWRT Development Board

September 18th, 2014 No comments

Seeed Studio sent me two nice little boards that can be used for IoT development: WRTNode and LinkIt ONE. Today, I’ll show pictures of WRTNode and accessories, and go through the “starting guide“, and will test LinkIt ONE board a few days later.

WRTnode Unboxing

I’ve received WRTnode by Fedex, and the board is stored in a plastic box.
WRTnode_Package
Inside the box, you’ll find the board, a “special” USB used to power the board and as an OTG adapter, a piece of paper with useful links (Wiki), and some WRTnode stickers.

WRTnode, "special" USB cable, and Quick Start Card (Click to Enlarge)

WRTnode, “special” USB cable, and Quick Start Card (Click to Enlarge)

Any micro USB to USB cable can be used to power the board, but this cable is useless to connect USB devices such as flash drives, webcams (OpenCV is supported), Bluetooth dongles, and so on. You could even connect a USB hub to connect multiple USB devices as shown below.

WRTnode_Webcam_Flash_Drive_USB_Hub

I’ve also taken a picture of both sides of the board shown the antenna on-board antennas, Mediatek MT7620n WiSoC, Elixir N2TU51216DG-AC DDR2 chip (64MB @ 400 MHz), the 16 MB SPI flash, as well as the headers for connecting various peripherals via I2C, SPI, UART, USB, etc…

WRTnode Board (Click to Enlarge)

WRTnode Board (Click to Enlarge)

You can also add Ethernet easily by making your own Ethernet cable using T568B wiring standard. I’m not 100% sure it’s safe though, as there are usually some extra components for Ethernet. I’ve included the board pinout chart for your reference.

WRTnode_pinout

WRTnode Quick Start Guide

To start the board simply connect the USB cable to a power adapter or a USB port on your computer. After about 10 seconds, you should see a blue LED lit up, and shortly after, you should see WRTnodeXXXX ESSID, where XXXX are the last 4 digit of the board MAC address. Connect it with your computer, and input the password: 12345678.
WRTNode_Access_PointNormally the board will resolve as several URL, but at first none of them worked.

$ ping i.wrtno.de
ping: unknown host i.wrtno.de
$ ping openwrt.lan
ping: unknown host openwrt.lan
$ ping wrtnode.lan
ping: unknown host wrtnode.lan

But you can check the route to see which subnet is used by your Wi-Fi connection:

$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 * 255.255.255.0 U 1 0 0 eth0
192.168.8.0 * 255.255.255.0 U 9 0 0 wlan0

I could finally ping the board with:

$ ping 192.168.8.1
PING 192.168.8.1 (192.168.8.1) 56(84) bytes of data.
64 bytes from 192.168.8.1: icmp_seq=1 ttl=64 time=12.4 ms
64 bytes from 192.168.8.1: icmp_seq=2 ttl=64 time=2.37 ms
64 bytes from 192.168.8.1: icmp_seq=3 ttl=64 time=12.1 ms

Interestingly, ping openwrt.lan, and the other two URL also work afterwards, so maybe I was a little to impatient during my testing…

The first time you need to connect to the board via telnet in order to set the root password:

$ telnet 192.168.8.1

WRTNode_Telnet

Now change the root password using passwd as you would do in any other Linux machine, and exit the connection, in order to connect via SSH instead:

$ ssh [email protected]
The authenticity of host '192.168.8.1 (192.168.8.1)' can't be established.
RSA key fingerprint is bc:00:71:ac:b1:56:e7:7b:c7:7a:9b:6a:59:8e:da:82.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.8.1' (RSA) to the list of known hosts.
[email protected]'s password:
BusyBox v1.22.1 (2014-08-13 19:31:12 UTC) built-in shell (ash)
.....
root@OpenWrt:~#

At this point, you’ve got another Wi-Fi access point on your network, but it’s not connected to Internet, so let’s start by locating the Wi-Fi routers with aps command:

root@OpenWrt:~# aps
WRTnode AP scaner.
Begin scaning APs, pls wait...
Finished.
APs available are...
ra0 get_site_survey:
Ch SSID BSSID Security Siganl(%)W-Mode ExtCH NT WPS DPID
1 CNX-TRANSLATION 94:0c:6d:e6:5b:10 WPA1PSKWPA2PSK/TKIPAES 100 11b/g/n ABOVE In YES

I only have one ESSID here, but this will list all ESSID in your environment. With that data, you can configure WRTnode to connect to your Wi-Fi router using vw command (vi wireless?):

root@OpenWrt:~# vw
config wifi-device 'ra0'
 option type 'ralink'
 option mode '9'
 option channel '1'
 option txpower '100'
 option ht '20+40'
 option country 'US'
 option disabled '0'
config wifi-iface
 option device 'ra0'
 option network 'lan'
 option mode 'ap'
 option encryption 'psk2'
 option key '12345678'
 option ApCliEnable '1'
 option ApCliSsid 'CNX-TRANSLATION'
 option ApCliAuthMode 'WPA2PSK'
 option ApCliEncrypType 'AES'
 option ApCliPassWord 'router_password'
 option ssid 'WRTnode9A60'

You need to change the lines in bold above using the data from aps. The first line is the Channel (Ch) , and the four lines in the wifi-iface section are pretty much self-explanatory. Save the file with Esc + “:wq”.

aps and vw do not report security features in the same way. Here’s the conversion table in case you don’t use WPA2PSK/AES:

aps:Security           vw:ApCliAuthMode/ApCliEncrypType
=========================================================
WPA1PSKWPA2PSK/TKIPAES	WPA2PSK/AES
WPA2PSK/AES		WPA2PSK/AES
WPA2PSK/TKIP		WPA2PSK/TKIP
WPAPSK/TKIPAES		WPAPSK/TKIP
WPAPSK/AES		WPAPSK/AES
WPAPSK/TKIP		WPAPSK/TKIP
WEP			WEP/WEP

Finally, restart the network:

root@OpenWrt:~# nr

and verify WRTnode got an IP address from the Wi-Fi router using DHCP:

root@OpenWrt:~# ia
apcli0 Link encap:Ethernet HWaddr 66:51:7E:32:9A:60
inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::6451:7eff:fe32:9a60/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Good 192.168.0.105 is an IP adress from local network. Let’s also check we can ping a site on the Internet:

root@OpenWrt:~# ping cnx-software.com
PING cnx-software.com (104.28.18.95): 56 data bytes
64 bytes from 104.28.18.95: seq=0 ttl=53 time=81.999 ms
64 bytes from 104.28.18.95: seq=1 ttl=53 time=87.759 ms
64 bytes from 104.28.18.95: seq=2 ttl=53 time=81.381 ms
^C
--- cnx-software.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 81.381/83.713/87.759 ms

All good!

Once I had a problem connecting to my Wi-Fi router, and it turned out my router was configured to automatically select the channel, and it had switched to Channel 4. Running vw again to change the configuration withoption channel ‘4’” made the connection work again. There’s probably an option in OpenWRT to automatically detect the channel, but I haven’t investigated.

You can also install packages for okpg. I tried to install luci, but it was pre-installed, so I added openvpn support instead:

root@OpenWrt:~# opkg update
Downloading http://d.wrtnode.com/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker.
root@OpenWrt:~# opkg install luci
Package luci (svn-r10457-1) installed in root is up to date.
root@OpenWrt:~# opkg install openvpn-easy-rsa
Installing openvpn-easy-rsa (2013-01-30-2) to root...
Downloading http://d.wrtnode.com/packages/openvpn-easy-rsa_2013-01-30-2_ramips_24kec.ipk.
Installing openssl-util (1.0.1h-1) to root...
Downloading http://d.wrtnode.com/packages/openssl-util_1.0.1h-1_ramips_24kec.ipk.
Configuring openssl-util.
Configuring openvpn-easy-rsa.
root@OpenWrt:~#

That’s it the quick start guide is completed.

I’ve also run some command to show memory and storage usage:

root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 7.3M 348.0K 7.0M 5% /
/dev/root 7.5M 7.5M 0 100% /rom
tmpfs 30.2M 80.0K 30.1M 0% /tmp
/dev/mtdblock5 7.3M 348.0K 7.0M 5% /overlay
overlayfs:/overlay 7.3M 348.0K 7.0M 5% /
tmpfs 512.0K 0 512.0K 0% /dev

root@OpenWrt:~# free -m
total used free shared buffers
Mem: 61852 29084 32768 0 3536
-/+ buffers: 25548 36304
Swap: 0 0 0

Out of the 16Mb SPI flash, only 7.3M available are available for OpenWRT, the  rest is probably used by the bootloader. There’s nearly 64MB RAM available, and 29MB free.

If you are interested in the board, you can purchase it from Seeed Studio ($25), which provided the board for this review, but it’s also available on other shops such as DFRobot or Eleduino for the same price, although shipping fees may vary. To go beyond this Quick Start Guide, visit WRTnode WiKi to access the source code, schematics, and various documentation including tutorials.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Creating and Flashing an Android Image from Rockchip RK3288 SDK

September 17th, 2014 10 comments

Following up on my post explaining how to build Android for RK3288 TV box, I’ve generated a firmware image, and flashed it to Tronsmart Orion R28 Meta TV box to see if it could boot properly. There’s basically no information in the Andoird SDK explaining how to do basic things like building from source, and generating and flashing the resulting image, so I’d like to thanks Linuxium, Droidmote and Naobsd for their various tips.

Launcher Part of Android SDK for RK3288 (Click for Original Size)

Launcher Part of Android SDK for RK3288 (Click for Original Size)

Since I’ve built everything from source, I’m using a Linux machine, but you should be able to create and flash the Android image in Windows using tools in RKTools/windows folder.

First let’s copy the required, and freshly built, files to create the firmware:

cp rockdev/Image-rk3288/* RKTools/linux/Linux_Upgrade_Tool_v1.2/rockdev/Image/
cp RKTools/rk3288-3.10-uboot-data1G.parameter.txt RKTools/linux/Linux_Upgrade_Tool_v1.2/rockdev/parameter
cp RKTools/bootloader/uboot-emmc/RK3288Loader_uboot_Apr212014_134842.bin RKTools/linux/Linux_Upgrade_Tool_v1.2/rockdev/
cd RKTools/linux/Linux_Upgrade_Tool_v1.2/rockdev/

We’ll also need to edit package-file follows (I only had to change the bootloader field):

# NAME Relative path
#
#HWDEF HWDEF
package-file package-file
bootloader RK3288Loader_uboot_Apr212014_134842.bin
parameter parameter
misc Image/misc.img
kernel Image/kernel.img
boot Image/boot.img
recovery Image/recovery.img
system Image/system.img
backup RESERVED
#update-script update-script
#recover-script recover-script

And now create the firmware file:

./mkupdate
start to make update.img...
Android Firmware Package Tool v1.0
------ PACKAGE ------
Add file: ./package-file
Add file: ./RK3288Loader_uboot_Apr212014_134842.bin
Add file: ./parameter
Add file: ./Image/misc.img
Add file: ./Image/kernel.img
Add file: ./Image/boot.img
Add file: ./Image/recovery.img
Add file: ./Image/system.img
Add CRC...
Make firmware OK!
------ OK ------
********RKImageMaker ver 1.61********
Generating new image, please wait...
Writing head info...
Writing boot file...
Writing firmware...
Generating MD5 data...
MD5 data generated successfully!
New image generated successfully!
Making update.img OK.
Press any key to quit:

The firmware file update.img can be flashed with upgrade_tool in Linux, or AndroidTool in Windows. Orion R28 also supports updates from SD card, but I don’t know how to generate such images (yet).

First you need to enter recovery mode. Connect the USB OTG port of your device to your PC, insert a toothpick in the AV port of your device to press the recovery push button (location of recovery button will differ between products), turn on the device, and release the button after a few seconds.

The first time I used upgrade_tool, I got the error “Creating Comm Object failed!”,  changing udev rules in Ubuntu will fix the issue (Source Radxa website):

sudo sh -c 'echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"2207\", MODE=\"0666\", GROUP=\"plugdev\" > /etc/udev/rules.d/51-android.rules'
sudo udevadm control --reload-rules
sudo udevadm trigger

Orion_R28_106k8Finally flash the firmware:

./upgrade_tool uf rockdev/update.img
Loading firmware...
Support Type:RK32 FW Ver:4.4.02 FW Time:2014-09-17 14:55:05
Loader ver:0.02 Loader Time:2014-04-21 15:36:59
Upgrade firmware ok.

Now cross your fingers, and restart your TV box: Google TV logo… Android animation… and after asking a few questions about Google Play, the system asks you which launcher you want to select: stock Android, or a custom launcher as shown in the top of this post. That means it works! Great!

Unfortunately, I quickly realized Ethernet does not work, as the MAC Address is 00:00:00:00:00:00, and the firmware version of the SDK (106k4) does not match with the firmware version originally flashed into Orion R28 Meta (108k4), and they’ve now updated it to 109k4. Wi-Fi did work fine however, I could login to Google Play, and install ES File Explorer. XBMC 13.1 Gotham is also part of that firmware, but won’t work that well based on testing from other RK3288 TV boxes.

I had initially planned to test Tronsmart Orion R28 Meta with the firmware built from the SDK, but unfortunately the SDK and actual released firmware are out of sync, which means the SDK is not really useful, and I don’t think the manufacturers are interested in released up-to-date source code. So instead I’ll do some hardware testing using the provided firmware.

If you want to play around Rockchip RK3288, including testing Ubuntu on your device, you may want to checkout Firefly-RK3288 Wiki, now updated with English instructions partially inspired from Radxa and Androtab websites.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Build Android 4.4 for Rockchip RK3288 Devices (Tronsmart Orion R28)

September 16th, 2014 8 comments

After blowing up my ATX power supply, and learning such things as “FULL” power supplies do exists, I finally managed to build Android for Tronsmart Orion R28 using the provided SDK. I haven’t tried to load it on the device yet, but the build could complete successfully after following the steps below in Ubuntu 14.04. The SDK is probably not specific to one device, so it might just also work on other RK3288 TV boxes and tablets.
Android_4.4_SDK_Orion_R28

First download Android 4.4 SDK for RK3288, or use the one in the micro SD card provided with the Beta version of R28 Pro and Meta.

Install some dependencies:

sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev \
squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 \
libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \
lib32readline-gplv2-dev gcc-multilib libswitch-perl gcc-arm-linux-gnueabi lzop libncurses5-dev \
libssl1.0.0 libssl-dev

Extract the SDK:

tar xvf Orion_R28_SDK_doc.tar.gz

And build the kernel first:

  1. Enter the kernel directory:
    cd RK3288_R-BOX_ANDROID4.4.2-SDK_V1.0.0/kernel/
  2. Change arch/arm/boot/dts/Makefile to use RK3288 device tree file instead of an RK3188 (may not be needed, but the build failed for me without that change…):
    dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3288-box.dtb

    It’s also quite possible you need to extract the device tree file from your firmware or device.

  3. Building the kernel and resources (device tree + logo) images:
    make ARCH=arm rockchip_box_defconfig
    make rk3288-box.img -j8
    cd..
  4. Done
    It will fail with:

    drivers/usb/dwc_otg_310/dwc_otg_hcd.c: In function ‘dwc_otg_hcd_rem_wakeup_cb’:
    drivers/usb/dwc_otg_310/dwc_otg_hcd.c:446:31: error: inlining failed in call to always_inline ‘dwc_otg_hcd_to_hcd’: function body not available

  5. Edit the culprit file, remove the inline directive, and continue the build:
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
  6. Similar errors will occur one or twice more, so repeat step 5 as needed….
  7. Create kernel.img (not sure the command line is correct)
    ./mkkrnlimg arch/arm/boot/Image kernel.img rk3288-box
    cd..

Before building Android, you need to make sure you use the right version of Java. I recently build AOSP for ARMv8 which requires OpenJDK 1.7 in Ubuntu, but this version requires Oracle 1.6 SE.  At first I used JDK 6u45 (1.6.045), but I got some errors:

In file included from external/chromium_org/content/common/android/hash_set.cc:5:0:
out/target/product/rk3288/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:10:26: error: extra tokens at end of #ifndef directive [-Werror]

Based on a thread on XDA developer forums, I installed Java 1.6.0.27 instead, which you can download here:

chmod +x jdk-6u27-linux-x64.bin
./jdk-6u27-linux-x64.bin
sudo mkdir -p /usr/lib/jvm
sudo mv jdk1.6.0_27/ /usr/lib/jvm/

Now add the new Java version to the “alternatives”:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_27/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_27/bin/javac 1
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_27/bin/javap 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_27/bin/javaws 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_27/bin/javadoc 1
sudo update-alternatives --install /usr/bin/javadoc javah /usr/lib/jvm/jdk1.6.0_27/bin/javah 1

and make sure Java 1.6.0.27 is used by default:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javap
sudo update-alternatives --config javaws
sudo update-alternatives --config javadoc
sudo update-alternatives --config javah

I’m not sure all six tools need to be configured, but it probably does no hurt to do so.

Finally, you just need to run a script to build Android:

./3288.sh

Be patient, and it should finish with something like:

Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 1792/65536 inodes and 149182/262144 blocks
+ '[' 0 -ne 0 ']'
Install system fs image: out/target/product/rk3288/system.img
out/target/product/rk3288/system.img+out/target/product/rk3288/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=1096212480 blocksize=135168 total=598297319 reserve=11083776
TARGET_PRODUCT=rk3288
TARGET_HARDWARE=rk30board
system filesysystem is ext4
make ota images...
create boot.img with kernel... done.
create recovery.img with kernel... done.
create misc.img.... done.
create system.img... done.
*******************************
3288_4.4 sdk do finish
*******************************

All relevant files can be found in rockdev/Image-rk3288 directory:

6.7M Sep 17 10:53 boot.img
5.6M Sep 17 10:53 kernel.img
48K Jun 19 11:11 misc.img
48K Jun 19 11:11 pcba_small_misc.img
48K Jun 19 11:11 pcba_whole_misc.img
9.6M Sep 17 10:53 recovery.img
113K Sep 17 10:53 resource.img
573M Sep 17 10:53 system.img

Next step is to flash it to the device, and see if it can boot.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Rockchip RK3288 Android 4.4.2 SDK and Schematics Released for Firefly Board

September 2nd, 2014 19 comments

Firefly-RK3288 development board was first announced in July. I still don’t have news about availability nor pricing, but the T-Firefly website launched yesterday. They seem do have a nice Wiki, but unfortunately everything is currently in Chinese, except when you go to the download page. You’ll find firmware upgrade_tool for Linux and Windows, the USB drivers for rooting and firmware update, firmware images (Android 4.4.2, Ubuntu 14.04, and dual boot), the board schematics (PDF), and Android KitKat 4.4.2 SDK with U-Boot, Linux, and Android source code, some documentation, XBMC apk (no source) with H.265 hardware decode support for MP4, MOV and MKV container formats.

Android_4.4._Linux_Rockchip_RK3288

The SDK is available on Bitbucket. I planned to test it, but unfortunately my network connection is very slow (and unstable) to this server, and I failed to retrieve it with git clone. The company also posted the build instructions in Chinese in their website, but I’ll reproduce them here for Ubuntu 14.04.

  1. Install required packages:
    sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev \
    libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl \
    libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils \
    xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \
    lib32readline-gplv2-dev gcc-multilib libswitch-perl gcc-arm-linux-gnueabihf \
    lzop libncurses5-dev  libssl1.0.0 libssl-dev
  2. Checkout the SDK:
    mkdir -p ~/edev/firefly
    cd ~/edev/firefly
    git clone https://bitbucket.org/T-Firefly/firefly-rk3288.git
    
  3. Build the Linux kernel:
    cd firefly-rk3288/kernel
    make firefly-rk3288_defconfig
    make -j8 rk3288-box.img
  4. Build Android:
    cd ..
    make -j8
    ./mkimage.sh ota

And after some patience, Android should be fully build. Instructions to create a Ubuntu image are also available in the Wiki, but only in Chinese.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Build and Run Android L 64-bit ARM in QEMU

August 23rd, 2014 12 comments

Most people can’t afford Juno Cortex A57/A53 development board, and mobile processors based on the latest 64-bit ARM cores are only expected by early 2015. But thanks to a small team at Linaro, you can now build and run Android L 64-bit ARM in the latest version of QEMU that supports Aarch64. Alex Bennée, an engineer working for Linaro, wrote a blog post in Linaro’s Core Dump blog explaining the Android emulator is actually based on QEMU,  the differences compared to mainline QEMU, the work they’ve done on Android L at Linaro, and most importantly, provided the basic steps showing how to build and try Android L 64-bit ARM (ARMv8) in QEMU. I’ve just done that, but unfortunately, albeit the builds complete, I could not manage to start Android L in QEMU yet. [Update: working now]. If you want to give it a try, you’ll need a Linux PC, and patience, as it may take about one day to retrieve the source code, and build everything from source.

Android_L_64-bit_ARM_QEMU

I’ve done all this in a computer running Ubuntu 14.04 with an AMD FX8350 processor and 16 GB RAM.

First, you’ll need to install an ARM 64-bit toolchain, some dependencies, and tools:

sudo apt-get install gcc-aarch64-linux-gnu build-essentials git bison zlib1g-dev \
libglib2.0-dev libpixman-1-dev gperf android-tools-adb vncviewer

The next step is to cross-compile a Linux 3.10 kernel for Android:

mkdir -p ~/edev/linaro
git clone https://git.linaro.org/people/christoffer.dall/linux-android.git
cd linux-android
git checkout ranchu-linaro-beta1

There’s a bug include the current version of the toolchain in Ubuntu 14.04 (https://bugs.launchpad.net/linaro-linux-baseline/+bug/1258013) which prevents the build to complete. You can either remove CONFIG_DEBUG_INFO=Y in arch/arm64/configs/ranchu_defconfig (I did that), or update your toolchain. Let’s complete the build:

ARCH=arm64 make ranchu_defconfig
ARCH=arm64 make CROSS_COMPILE=aarch64-linux-gnu- -j8

Now you need to build the Android Open Source Project (AOSP). If you haven’t done so, you’ll have to install the repo tool:

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Then get AOSP source code (master as below, or l-preview branch):

cd ..
mkdir AOSP
repo init -u https://android.googlesource.com/platform/manifest
repo sync

The last step can take a few hours depending on your internet connection to Google servers.
Now download and apply a patch made by Linaro:

wget http://people.linaro.org/~christoffer.dall/linaro-devices.tar.gz
tar -xvf linaro-devices.tar.gz

Possibly configure git:

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

You need to apply a patch for qemu:

pushd system/core
wget http://people.linaro.org/~alex.bennee/android/android-init-tweaks.diff
patch -p1 < android-init-tweaks.diff 
popd

And build Android L for ARMv8:

source build/envsetup.sh
lunch ranchu-userdebug
m -j8

The last step will again take a while. It took my machine 2 or 3 hours, and the total time was actually a bit more than than as my PC suffered two thermal shutdowns during the build, and I had to restart the build twice. The last time, I decided to underclock my CPU to 3.4 GHz, and the build went through.

The last step before running Android L is to build QEMU:

cd ..
git clone https://git.linaro.org/people/peter.maydell/qemu-arm.git
cd qemu-arm
git checkout ranchu-linaro-beta1
make -j8

Builds should now all be successfully complete. We just need to create some symlinks helping to shorten qemu command line, start the ADB server, and run QEMU:

cd ..
ln -s linux-android/arch/arm64/boot/ ranchu-kernel
ln -s AOSP/out/target/product/ranchu/ ranchu-build
adb start-server
./qemu-arm/aarch64-softmmu/qemu-system-aarch64 -cpu cortex-a57 -machine type=ranchu -m 4096 \
-kernel ./ranchu-kernel/Image -append 'console=ttyAMA0,38400 keep_bootcon' -monitor stdio \
-initrd ranchu-build/ramdisk.img -drive index=2,id=userdata,file=ranchu-build/userdata.img \
-device virtio-blk-device,drive=userdata -device virtio-blk-device,drive=cache \
-drive index=1,id=cache,file=ranchu-build/cache.img -device virtio-blk-device,drive=system \
-drive index=0,id=system,file=ranchu-build/system.img -netdev user,id=mynet \
-device virtio-net-device,netdev=mynet -show-cursor

That’s the output I get:

QEMU 2.0.50 monitor - type 'help' for more information
console on port 5554, ADB on port 5555
VNC server running on `127.0.0.1:5900'

So it’s quite possible there’s a problem with adb, but Google did not help, and I failed to go further. More detailed instructions will soon be posted in Linaro Wiki, so I may be able to find out where I made a mistake once it’s posted.

Finally, start vncviewer to access Android user’s interface:

vncviewer 127.0.0.1:5009

Here’s a screenshot of the “About Device” menu in Android L 64-bit ARM running in QEMU.
Android_64-bit_ARM_Qemu

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Upgrade Firmware in Rockchip RK3288 Android TV Boxes

August 12th, 2014 4 comments

For some reasons, Rockchip is extremely fond of Windows based firmware tools, and instead of providing a simple SD card method, they’ve continued to use these awful tools to upgrade firmware for Rockchip RK3288 devices. I don’t mean to say these are useless, but they should not be used by end users, unless their device is bricked. Nevertheless, Rockchip has now release version 2.3 of their Android tools for Windows, and GeekBuying has published a guide showing how to do, which I’ll summarize below. Rockchip will most probably also release an updated version for the Linux Upgrade Tool (upgrade_tool) soon, as part of their SDK, that also supports RK3288.

  1. The first thing to do is to make sure you’ve got the latest Rockchip USB drivers installed, the same as for RK3288 root method.
  2. Download and extract AndroidTool_Release_v2.3.zip which contains both AndroidTool for firmware flashing, and some development tools such as AFPTool.exe and RKImageMaker.exe
  3. Enter AndroidTool_Release_v2.3/AndroidTool_Release_v2.3 directory, and click on AndroidTool.exe to start the program.
  4. Connect the USB OTG port of your RK3288 device to your Windows computer, making USB debug is enabled in Android
  5. AndroidTool now merges the functionalities of RkBatchTool (single file firmware) and RkAndroidTool (flash the NAND flash with an image corresponding to a particular partition such as kernel, system,. boot, etc..), and hence supports the two methods:
    • Single file (firmware.img) – Select Upgrade Firmware, load your device firmware, and click on Upgrade

      Click to Enlarge

      Click to Enlarge

    • If you’ve got several images for the kernel, recovery, boot, parameter, etc.., you need to click on Download Image, and load the images for the partitions would want to flash, before clicking on Run to complete the firmware upgrade.

      Click to Enlarge

      Click to Enlarge

  6. Be patient, and the firmware update should be done after a while.

I haven’t tried it myself since I don’t currently own any products powered by Rockchip RK3288. There’s also an Advanced Function menu, that will extract kernel.img, recovery.img, boot.img, system.img, etc.. from a single “firmware.img” firmware file, read the Flash ID, get Flash info, read the IDB, and so on.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

DIY Power Measurement Board

July 23rd, 2014 6 comments

When I review media player or development boards, I’m often asked about power consumption figures. One way to measure power consumption is to use a Kill-a-Watt, but for low power devices it’s not always accurate enough, and it also includes the heat dissipation from the power adapter, which may or may not be useful depending on what you want to measure. For USB powered devices or boards, an easy way to measure power consumption is to use CHARGER Doctor, a small $5 USB dongle that displays both voltage and current alternatively. Unfortunately, most products I’ve received lately use barrel type connectors, so this little tool has not been as useful as I hoped. The only solution is then to measure voltage and current with a multimeter. Voltage is measured in parallel, so you just need to point the multimeter’s leads where you want to perform the measurements. However, the current is measure in series, so you need to insert the multimeter in the circuit somehow. A few possibilities:

  1. Unsoldering a component on the board to place the multimeter in series.
  2. Cut one wire of the power cable to insert the multimeter.
  3. Get and make a board to insert the multimeter.

Solutions 1 and 2 are not really desirable, so I decided to look into solution 1, and since I could not find any board that could match my requirements, I decided to work out a solution by myself allowing various power inputs and outputs.

Click to Enlarge

Click to Enlarge

The board can take power adapter using micro USB, mini USB or 5.5/2.1mm barrel connectors, 32 different output connectors thanks to two cables, and header pins are used to connect the multimeter’s leads.

Here’s the different components required for this solution:

  • 1x perfboard or veroboard
  • Some 2.54mm pin headers (straight and right angle)
  • micro USB breakout board – $1.50 on Adafruit, but shipping + insurance was $12, so instead I purchased 5x micro USB charging board for $4.24 on Ebay (asp_ezone)
  • mini USB breakout board – $1.95 on Sparkfun, but shipping killed it again, so I purchase 2x mini USB charging boards for $2.75 on asp_ezone shop.
  • 5.5/2.1mm DC power socket –  $4.18 for 10 pieces
  • USB Female DIP Socket Connector – $1.73 for 10 pieces
  • 6-in-1 Universal USB charging cable – $3.41
  • Universal 28-in-1 DC power socket / plug converter for laptop – $11.30

If you purchase everything from scratch the cost would be around $35.

In case the introduction is not clear, the board description below may help.

Power_Measurement_Board_Description

Iv’e also included the back of the board with the soldering for reference.

Power_Measurement_Board_BackAfter double checking I had made mistake inverting GND and VCC, which could be fatal, I tried it out by making some power measurements with Tronsmart Vega S89 Elite.

Tronsmart_Vega_S89_Elite_Power_Off_Power_ConsumptionIn power off mode, I get 115 mA (~ 575 mW @ 5V), so I’m confident it’s working just fine… Unfortunately, I quickly realized something is wrong as the boot does not complete most of the time, as it reaches 1A, the boot just simply stops, or I just get a blue screen. Only once or twice did I managed to get to the home screen (about 0.52A after most background tasks are done), but starting an app will hang the system most of the time. So  I’ve tried to replace the multimeter by a breadboard female to female cable, and everything works normally. So I suspect the contact surface with the leads is not large enough, or the multimeter introduces some noise that disturbs the device…. I’ll get some crocodile clips to see if things work out better…

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Hardware Tags: how-to, power, tutorial