Sunday, August 25, 2013

Writing Image and booting Linux from MK808/RK3066


Now you would ask me;What guts I am trying to prove on tracking the development of these mini-PC sticks?Well, nowadays ,computers are becoming smaller and smaller and that proportionate to their cost-cheaper.And I know you would believe me, single board PC did not compromise computing speed ,functionality ,efficiency yet with lesser consumption of electricity (5V/2A) ; we called this  "nano-technology" on computers.Imagine a supercomputing machine is just smaller than the palm size of your hand.Simple,with its cheap price, I can purchase numbers of minis-PC and afterwards create a prowess of varied R&D applications.A variety of testing instruments:embedded Oscilloscope,Analyzer, high speed cameras,and all the likes.Because it's a light-weight  machines ,we can  board as many PCs as we can, to make our machine or robots  think, process more  and intelligent enough to respond in our specific purpose .An out-of-the-box super computing machine, clustered mini-sticks is just an appliance that can be stored atop your desk.The rest are the R&D of a lifetime-not yet to be told-but  they're arrayed in the mind .This minute gadget is a heavenly concept making things happen in reality( :) ).

I have tried different single board PC from STMF32 ,ARM Cortex 3, Beagle board,Mini2440 and mini6440 and had experienced  the  difficulties in loading or flashing  firmwares into its embedded system.Though its quite complex , I was lucky that there were several documents available as an included resources,besides they have the technical support  on-line.Sometimes you need to decode Chinese language to know the hidden specifications-at least that could be a right path of porting different codes and libraries.

RK3066 is dual Core Cortex-A9 processor running at up to 1.6  GHz produced on 28 nm process, with quad core Mali 400 @ 533 Mhz.These features are enough to settle in the higher application system-but when it comes to controlling,brute forcing hardware applications -we have a different story.

Actually ,  I did n't have to flash android OS into Picunto or Ubunto,but it so sad that Android OS is not meant for embedded and servering applications.Another is  that Rockchip is still in the stone age, they require NDA(non disclosure agreement)  and $5000 to send you SDK for building Android images which even have no sources inside but binary blobs.So I have no choice but to change its OS into an appropriate one. Yet this is not an easy task for there is no instant or direct  Linux installations in the RK3066 chips other than android itself.

All Rockchip kernel and Linux support so far is done by group of hackers who reverse engineer their code for fun and they have already significant success.The community would like to thanks hacker/crackers who had patiently ported and given source code for free: AndrewDB,Olegk0,JustineTime4Tea,mosfet,E^3 and others.

So folks ,please read and join me as this scratch article go along the saga and odyssey of porting ,debugging and unlocking the trade secrets of this nano-made gadgets and bring the breakthrough into the open-source community.


MK808 kernel image (recovery.img)

Rooted Image files
Olegk0 Google Drive Folder

Flash Tool in Linux (rkflashtool)

Paper clip
MK808 mini-PC stick
micro-SD adapter
micro-SD card

To write and flash RK3066/MK808 image  by using Linux alone(no windows!)
To replace default android OS by Picunto/Ubunto for future system development
To maximize the applications of mini-PC MK808 as  dual core running in Linux


Download the latest release versions of MK808/RK3066 Linux image(cut & paste in your browser)*/0B6QRwjacGTzCNG45bGZWRHlycUE?h=16653014193614665626&e=download

Find the necessary tools for flashing   firmware image in the SD card
root@locahost# wget

Install the required USB software libraries in Linux OS
root@localhost#   sudo apt-get install libssl-dev libcrypto++-dev

Press down the recovery button (using a paper clip)
Power up the RK3066 device from only the OTG port using a standard usb cable

(special OTG cable required or shorting of the sense pins)
Please plugged the OTG-USB cable into your PC (running linux.)

After 5 seconds release the button. observed that no led will turn on at this point.
Run dmesg and you should see something like detail 1:
root@localhost# dmesg

Run lsusb and make note of the device id
root@localhost# lsusb
My MK808 vendor ID is 2207:300a

Let's compile the rkflashtool.c
root@localhost# tar -zxvf rkflashtool.tar.gzroot@localhost# cd rkflashtool/
root@localhost# vim  rkflashtool.c

...cut and paste the code phrase highlighted in detail (3) then run the program
root@localhost#gcc -o rkflashtool rkflashtool.c -lusb-1.0 -O2 -W -Wall -s.

We're now ready to read the flash(a moment of truth :) ).
As a first step you may dumped the entire 8GB NAND flash as a backup like so
It will take some time to backup the whole NAND.
root@locahost    rkflashtool r 0x00000000 0x01000000 > myflashbackup.bin

To quickly get an idea of where everything is in the flash you can run CLI command below . It will reveal the parameters which include the offsets for all images in NAND including boot, system and  user.
root@localhost# hexdump -C myflashbackup.bin | more

As an example to grab the kernel I did the following:
root@localhost#    rkflashtool r 0x00004000 0x00004000 > mk808kernel.img

To upload a new kernel do the following:
root@localhost#    rkflashtool e 0x00004000 0x00004000
root@localhost#    rkflashtool w 0x00004000 0x00004000 < recovery.img

After a successful loading  the kernel image (recovery.img) you can now reboot the stick  and check picture details (6 & 7)- you're on the right track brother.So you may proceed now to partitioning your SD card  and  inserting Debian file-systems into it:)

Partitioning your SD Card
root@localhost# yum install gparted*
root@localhost# gparted

1) Create an "ext4" partition
2) resize the partition atleast 5GB or larger
3) label it with "linuxroot"
4) Apply the changes

After the kernel image was flashed, it's time to copy your linuxroot(File System), be sure that you are in a root mode
root@localhost@ tar-zxvfp home_io.tar.gz  /run/media/robook/linuxroot
root@localhost# tar -zxvf home_io.tar.gz
root@localhost# cd picunto_linuxroot_rc
root@localhost# cp -R * /run/media/robook/linuxroot

Note! Please wait until all files are copied to avoid errors in the picunto boot up


1) Please run the lsusb command

2)Next run the dmesg command  to find vendors ID

(3)After finding the vendors ID ,copy the highlighted code in the rkflashtool.c

(4)Testing rkflashtool-> dumping NAND

(5)Flashing the new kernel image "recover.img"

(6)Booting the MK808 in Linux -pre install "BusyBox OS"

(7)System and files

(8) Partitioning the SD card ("ext4"-File System- 5++ GB

(9) MK808 device using HDMI VGA adapter

10) Picunto2.2 Login

11)Picunto 2.2  Desktop (xfce)

12) Checking OS libraries and apps


Accomplished the easy task (?) of booting MK808 in Linux

Trouble: BusyBox not booting

Shooting: Please redump the micro-SD card using the rkflashtool

Trouble: Need complete files

Shooting: Please get the latest kernel image and rooted image linux files(application etc)

Trouble: "Mountall Event Fail

Shooting: Try recopying the linuxroot by using "cp -a * or tar -zxvpf" to transfer the compress files into the SD card  "ext4" linuxroot directory.
1) Incomplete/unfinished copy
2) Fail with root permission and authorizations transfer of files

I have a mini-PC MK808 (dual core) running in Linux(how about that bro?)

Tuesday, August 13, 2013

USBasp + Arduino(Mega)2560 bootloading in Linux Arduino IDE (ACEduino2560)


Just recently,we've been trough the use of an open-source  applications and patronizing its community development ; surprisingly   enthusiasts all over the globe are   very much overwhelmed in participating  the  continuous evolutions of an open-source technology.And we are not far from the said expectations , our electronic stores are now tapping-up the distributions of these materials to the cheapest cost that local geeks and enthusiasts are able to afford of.Gone are those days when we are under the verdict of proprietary vendors such as Zilog,PIC,Renessas and other microchip distributors. I want to mention the following e-stores in the city: Alexan ,e-Gizmo and other on-line stores (tipidPC, ,ayos dito) are vendors where we can buy the  series of MCUs especially Arduino with reasonable price.

Well, our concerns are embedded kits ;yes, the Arduino things and other assorted gadgets ,this rebranded MCU is having the domination in the global e-store.We have noticed that Arduino sheilds' package is the included Atmel microchips , and became an open hardware and software  that completely sets the requirement of starting and advancing the learning curve of an embedded system design.This is the main reason that  enticed our local e-hobbyists to avail the Arduino MCUs  which had given all their resources completely  open and free  for modifications i,e: DIY,documents,source code and innovations. Perhaps Arduino unravel the "Mt. everest" of complex embedded system into the level of laymen's know-how. E-hobbyists are introduced to their  limitless creativity and ingenuity-we could be one of them.

So, this techno blog is all about giving you the idea on how to work on Arduinos using pure Linux for its compiler and IDE.And the purpose is to reload  and  upgrade default firmware  to its new release versions  that will be published in the Arduino web site( This time,I will give you the how-tos  of firmware upgrading or bootloading the  ACEduino Mega 2560 with USBasp programmer which can be purchased in Alexan and e-Gizmo respectively.So folks please have a try.. :)

arduino IDE version 1.5X
Arduino Mega 2560

To solve  USBasp programmer usb setting in Linux
To use USBasp programmer in Arduino IDE


I) Installations
root@locahost# yum install arduino*
root@localhost# yum install gcc-*
root@localhost# yum install avrdude*

2) Testing avrdude
root@localhost# lsusb
root@localhost# avrdude

3) Bootloading using avrdude
root@localhost# cd /usr/share/arduino/hardware/arduino/bootloaders/stk500v2/
root@localhost# avrdude -c usbasp -p m2560 -u -U flash:w:stk500boot_v2_mega2560.hex

4) Using Arduino IDE
root@localhost# arduino

5) Bootloading using Arduino IDE
5.1) Tools-> Programmer->USBasp
5.2) Tools->Board->Arduino Mega 2560
5.3) Tools->Bootloader
5.4)  Note!
      Check bootloading process and if see trouble shooting if there are errors

6) New Sketch-> Basic->Digital->Blink
6.1)  Compile the program
6.2)  Load the program
6.3) Note!
     ..A LED on pin # 13  must be blinking


1) ACEduino 2560 from Alexan Store

2) USBasp clone from e-gizmo

3) ICSP pin settings of Arduino Mega2560 and USBasp clone

4) Connecting ACEduino2560 and USBasp programmer

5) Setting usb driver in udev rules

6)Successful loading firmware/bootloader in CLI avrdue

7) Firmware bootloading using arduino 1.5 IDE

(8) Sample blinking program in Arduino Mega2560


avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc

root@localhost# cd /etc/udev/rules.d/
root@localhost# vim 77-coballes.rules
copy and paste this texts:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="plugdev", MODE="0667"

root@localhost# chmod 777 77-coballes.rules
root@locahost# chown -R "user"."group"  77-coballes.rules
root@localhost# /etc/init.d/udev restart

Then try methodology no. 6

2) Trouble:
no avrdude:

root@localhost# which avardude
root@localhost# yum install avr*

Solved : Loading bootloader in Arduino Mega 2560 using USBasp in Linux :)