Archive

Posts Tagged ‘tutorial’

Rockchip RK3288 Android 4.4.2 SDK and Schematics Released for Firefly Board

September 2nd, 2014 10 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 11 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

How to Use an Android TV Box as a Wi-Fi Access Point

July 3rd, 2014 3 comments

Today, I’ve come across another potential use case for Android TV boxes with Wi-Fi and Ethernet. Let’s say you are in a room with Ethernet, but there’s no Wi-Fi signal or the signal is too weak, and want to use your smartphone to connect to the Internet via Wi-Fi. If you don’t have one of these small (openWRT) Wi-Fi router with you, but instead brought an Android mini PC, you can configure the “Portable Hotspot” function to transform it into a secure Wi-Fi access point.

Assuming you’ve connect an Ethernet cable, and powered the device, first make sure Ethernet is enabled\, and Wi-Fi is disabled in the Settings menu. To click on Settings->More.. in the Wireless & Networks section, and select “Tethering & portable hotspot” or simply “Portable hotspot” depending on your firmware. In the next menu, click on Portable Wi-Fi hotspot to enabled it, then “Set up Wi-Fi Hospot” to optionally change the Network SSID and Security protocol, and enter a password. Click on Save, and you’re done. Now you can connect with your smartphone to you Android mini PC SSID, by default “AndroidAP”. I’ve tested it with Tronsmart Vega S89 Elite, and it worked nicely.

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 Try Android L Developer Preview in Ubuntu 14.04

June 27th, 2014 No comments

As mentioned yesterday, Android L Developer Preview was about to be released, and this is now done with images for Nexus 5 “Hammerhead” and Nexus 7 “razor” available right now. However, if you don’t have either of these devices, or you’d rather not install a beta version on the phone you use everyday, you can still give a try in the SDK emulator.

I’ve tried Android L myself in Ubuntu 14.04. Here’s what you have to do:

  1. Install Android Studio IDE in Ubuntu, and Create a new Project  or open an existing project (Android Studio Version is now 0.61)
  2. Click on Tools->Android->SDK Manager in the top menu, and select the Android L (API 20, L Preview) packages as shown below, and click on “Install xx Packages” button.
    Android_SDK_Manager_Android_L
    Accept the license as required, and click Install. This step can take countless hours…
  3. Now we’ll need to create a Virtual Device for the emulator. Go to Tools->Android->AVD Manager, select “Device Definitions” tab, and you’ll see some new types of devices like Android TV and Android Wear Round and Square.
    Android_L_Virtual_Device
    But I just scrolled down and selected “Nexus 7″ and clicked on “Create AVD” button…
    Nexus_7_Android_L_Intel_Atom_WXGA720
    …and configured the system to use “Android L (Preview) with the Intel Atom (x86) CPU/ABI, and WXGA720 skin, and clicked OK.
  4. Your Nexus 7 with an Intel Atom processor :), running Android L should now show in the list of devices. Make sure it is selected, click on the Start button, and then Launch.
    Nexus_7_AVD_Android_L
  5. After a little while, you should be able to access Android L!

    Android L Screenshots (Click to Enlarge)

    Android L Screenshots (Click to Enlarge)

The screenshot on the right, is the blue and red rectangles animation that starts when you click 7 times on the Android version… There’s no Google Play in the emulator, so you’ll need to sideload the apps, or install a third party market such as Amazon Market to try out apps.

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 for Rockchip RK3066/RK3188 Devices with the Command Line in Linux

May 25th, 2014 7 comments

Previously I wrote an article entitled “How to Flash Rockchip RK3066 / RK3188 Firmware in Linux” explaining how to use a graphical tool called RkFlashKit to upgrade firmware on Rockchip devices using a Linux computer. This tool had some limitations, and it would just have a subset of features of RkAndroidTool (Windows), and it was not possible to flash “update.img” type of firmware which are often provided and flashed with RkBatchTool in Windows.

Luckily there’s now a command line tool called upgrade_tool that allows you to flash the “update.img” firmware files directly from Linux. I’ve already shown how to use it with Radxa Rock, but it’s buried with other instructions, so I’ve decided to make a separate post. This has been tested in Ubuntu 14.04 with Radxa Rock (RK3188) and Measy U2C (RK3066).

Ready? Let’s start by installing upgrade_tool in a terminal:

wget http://dl.radxa.com/rock/tools/linux/Linux_Upgrade_Tool_v1.16.zip
unzip Linux_Upgrade_Tool_v1.16.zip

Installation is now complete. You could also choose to add it to your PATH.

Now download the firmware for your device, let’s call it “android-5.0_rk3xxx.img”, and enter recovery more in your device. This is usually done by connecting a USB to micro USB cable between the OTG port of your device and your PC, and press a “recovery” or “reset” button on your device with a sharp object (e.g. toothpick) and turning on the device.

Now complete the firmware upgrade with the two command below:

sudo ./upgrade_tool lf
sudo ./upgrade_tool uf android-5.0_rk3xxx.img

Done. It’s that easy. Now just restart your device to boot the new firmware.

The full output during the firmware update procedure should look like:

$ sudo ./upgrade_tool lf
 Lower Format Device,total(2048),current(2044)
 Lower Format Device OK.
 $ sudo ./upgrade_tool uf android-5.0_rk3xxx.img
 Loading firmware...
 Support Type:RK30 FW Ver:5.0.02 FW Time:2014-11-27 17:19:47
 Loader ver:3.23 Loader Time:2014-10-03 18:08:37
 Upgrade firmware ok.

You can also flash individual files (parameter, boot.img, system.img, etc…) with upgrade_tool utility, as well as do some checks with the NAND flash. More details can be found in linux_upgrade_tool_v1.16_help(Chinese).pdf in the zip file used for installation.

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