Home > Android, Rockchip RK30xx > Getting Started with Raxda Rock – Building an Android 4.2 Image from Source

Getting Started with Raxda Rock – Building an Android 4.2 Image from Source

I’ve posted some pictures, and show some basics how to get started in my first post about Radxa Rock. Today, I’ll post my experience trying the instructions to build Android for Radxa Rock in Ubuntu 13.10. Many of the instructions are also valid for other RK3188 devices.

Radxa_AndroidThe source code is currently located in a private git repository, and if you’re sure you want to get the Android source  code, you should send an e-mail to [email protected] to be granted access to their private repo. Within minutes, I’ve received an email with the subject “GitLab | Account was created for you” to register an account. You’ll then need to add an SSH key just like you’d do for Github.

Assuming you’re already using a service like github, you should already have SSH key. Simply type cat ~/.ssh/id_rsa.pub, copy the output, and go to git.linux-rockchip.org/profile/keys, login if needed, and click on “Add SSH key”, enter a description, copy your public SSH key, and click on “Add Key” to confirm. You should then receive an email with the subject “GitLab | SSH key was added to your account” to confirm the key has been added.

While you are waiting for your Gitlab account email, you can start by installing depencies and tools in your Ubuntu or Debian computer:

sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
g++-multilib mingw32 tofrodos gcc-multilib ia32-libs \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
gcc-arm-linux-gnueabihf lzop libncurses5-dev libssl1.0.0 libssl-dev

If you’ve already registered your gitlab account, and added an SSH key, you can now get the source code:

mkdir radxa
cd radxa
git clone -b radxa-dev [email protected]:radxa/radxa_rock_android.git
cd radxa_rock_android

“git clone…’ step will take a while to process depending on the Internet connection between your PC and linux-rockchip server. It took almost 2 hours in my case.

You should then be ready to build the Linux kernel:

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
cd kernel
make rk3188_radxa_rock_defconfig
make -j8 kernel.img 
cd ..

If you want to change kernel options just make menuconfig after rk3188_radxa_rock_defconfig

The kernel is now ready, time to build Android per se:

source build/envsetup.sh
lunch rk31sdk-eng
make -j8

The last step will took a while depending on your computer’s CPU, memory, and storage. It took about 43 minutes on my build machine (AMD FX8350, 16 GB RAM). You may have to change -j8 to match the number of core of your CPU, some recommend to set the value to 1.5x CPU cores. So if you have 4 cores, -j6 may be the optimal value.

The finally step is to create a firmware image (update.img):

./mkimage.sh ota

You should now a firmware image in rockdev/update.img. You need to flash the image to your Radxa board. Instructions are available both for Linux and Windows, but since we’ll done all previous steps in Linux, let’s keep it that way.
Rockchip has recently release a binary only tool for Linux called Linux Upgrade Tool, let’s download and extract it:

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

Before you can flash your newly built firwmare to your Radxa board you need to enter recovery mode. There are 2 ways depending on the status of your board:

  • The board not powered on -  Press and hold the RECOVERY switch,  and connect a micro USB to USB cable to your PC. Note that If no recovery activity is found, the board will turn off after two minutes.
  • The board is powered on -  Plug an micro USB to USB cable to your PC first, then press and hold the RECOVERY switch, followed by the RESET switch on the other side of the board.

If you’ve connected Radxa board to your HDMI monitor / TV, you should see the recovery menu. Time to complete the last step, and flash the firmware:

./upgrade_tool uf rockdev/update.img 
Loading firmware...
Support Type:RK31    FW Ver:4.2.02    FW Time:2014-01-15 20:37:05
Loader ver:1.24    Loader Time:2013-06-20 16:58:25
Upgrade firmware ok.

The first time I had the error “No found any rockusb device,please plug device in!”, and it was time to go to bed. The next morning it worked just fine. So if you have the previous error message, you may want to reboot your Radxa board and/or your computer.

If you have error during upgrading, you can try to low level format the nand flash first with following command:

   sudo ./upgrade_tool lf

In case you only want to flash some partitions, you can use RKFlashKit instead. This GUI tool does not work with upgrade.bin, only with individual partition, e.g. system.img.

After successful firmware upgrade, you can reboot your board to start Android. Unfortunately in my case, the very last step did not go as expect, since the board is stuck during boot showing the animated logo forever. I’ve documented the issue in Radxa Rock Google Group. Time to give a try at build a Ubuntu image…

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

  1. adem
    January 17th, 2014 at 17:03 | #1

    thats cool i might get one of these boards just need to save up some money $$$

  2. Behr
    January 18th, 2014 at 07:16 | #2

    I’m curious on your opinions/experience running/compiling Ubuntu

  1. January 27th, 2014 at 17:15 | #1