Sunday, August 25, 2013

Writing Image and booting Linux from MK808/RK3066









Introductions:

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.


Requirements:

Software:
MK808 kernel image (recovery.img)
https://github.com/olegk0/rk3066-kernel

Rooted Image files
 http://cdn03.arctablet.com/mirrors/picuntu_home-io/homeio_rc1.tar.gz
Olegk0 Google Drive Folder  
https://drive.google.com/folderview?id=0B6QRwjacGTzCU3RWZ1M2d1FkcTg&usp=drive_web

Flash Tool in Linux (rkflashtool)
https://github.com/justgr/arnova-tools

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

Objectives:
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

Methodology:

Download the latest release versions of MK808/RK3066 Linux image(cut & paste in your browser)
https://doc-0c-b8-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/5c55spo7th4lg7cfnlu8e07a5edfmro1/1384315200000/09152317978381813842/*/0B6QRwjacGTzCNG45bGZWRHlycUE?h=16653014193614665626&e=download

Find the necessary tools for flashing   firmware image in the SD card
root@locahost# wget 
https://github.com/justgr/arnova-tools/blob/master/rkflashtool/rkflashtool.c

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

Note:
(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
Note:
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

Tips!:
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
or
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


Details:

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













 


Remarks:
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

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




24 comments:

  1. Hi Folks!

    Next is the quad core version.. or
    If any body could sponsor RK3188, we will going to hack it into a linux distro.. :)

    Thanks

    E^3

    ReplyDelete
    Replies
    1. Hi.
      Any progress with rooting rk3188?

      Delete
    2. Actually it's been tested already by some groups..

      I have kernel image and rooted ubunto/picunto just for the qemu..:)
      I didn't have the gadget to test it -my apology for that..

      Try this one brother, I think they've used it in a new Picunto 4.5 (release) version.
      https://github.com/crewrktablets/rk3x_kernel_3.0.36

      Good Luck & Cheers

      -E^3

      Delete
    3. I will try although it's a new world for me (imaging, rooting...etc.).
      I was wondering if this item: http://www.alibaba.com/product-gs/1150813596/Amazing_32GB_internal_Flash_Android_Tv.html would work with the firmware you suggested?
      Thx

      Delete
    4. Hi Pff Ostro,

      Yes it will be possible(100%) , of-course you need to check some driver's hardware compatibility.

      But there are a lot of forums /thread that you can post your queries but eventually you can get through it...

      Good Luck & Cheers!

      -E^3

      Delete
    5. Microcontroller Embedded Design: Writing Image And Booting Linux From Mk808/Rk3066 >>>>> Download Now

      >>>>> Download Full

      Microcontroller Embedded Design: Writing Image And Booting Linux From Mk808/Rk3066 >>>>> Download LINK

      >>>>> Download Now

      Microcontroller Embedded Design: Writing Image And Booting Linux From Mk808/Rk3066 >>>>> Download Full

      >>>>> Download LINK lb

      Delete
  2. Thanks a million, been searching for a nice clear howto on flashing the MK808 for weeks. Believe it or not, all the information I've found so far has been missing steps, conflicting instructions, or just plain incomprehensible. This handy set of instructions not only answered all my questions but has the great added bonus of working completely from linux, without the need for a windows box and the nightmare (for me) of installing the right windows drivers or indeed getting windows to recognise the device at all in the first place. The hint about shorting pins led me to discover how OTG cables differ from normal USB cables - obvious if you already know I guess. Nice one.

    ReplyDelete
    Replies
    1. No problem Sir..

      Its our hobby to debug and hack devices for the open community. If I could have a lot of stuff maybe I could hack more...

      Cheers!

      -E^3
      Philippines

      Delete
    2. I'm glad you were able to follow the instructions, but I am failing on the very first step: the wget of "https://docs.google.com/folderview?usp=sharing id=0B6QRwjacGTzCX0UyOXNGSU5iMGc" results in a 500 error on the Google website.

      Delete
    3. Hi bro,

      please try this..
      https://github.com/olegk0/rk3066-kernel

      Thanks E^3

      Delete
  3. Is it possible to achieve the same using an arnova 97 G4 ?

    ReplyDelete
    Replies
    1. Hi Sir,

      Good Day...

      as long as it is a Rockchip RK306X model that could be achievable, there you have a source code to tweak it...

      Good Luck and Cheers!

      E^3

      Delete
  4. Hi
    "Download the latest release versions of MK808/RK3066 Linux image"
    does not retrieve any data??

    ReplyDelete
    Replies
    1. Hi Paul,

      You may try to browse Olegk0's google drive

      https://drive.google.com/folderview?id=0B6QRwjacGTzCU3RWZ1M2d1FkcTg&usp=drive_web


      ..then download " recovery.img"

      Thanks

      -E^3

      Delete
    2. Hi Sir Paul Richards,

      Welcome and please share your progress too...


      Thanks

      -Christopher

      Delete
  5. Is it possible to have everything working on nand? I have a small business with about 25 mk808s and growing. I don't want to buy an sd card for each device.

    ReplyDelete
    Replies
    1. Hello Josep Chillemi,

      Good Day.

      One thing I am certain you can directly boot Linux(Ubuntu) without SD Card ,you may follow the instruction in this link..
      http://ubuntu.g8.net/index.php/14-sample-data-articles/86-picuntu-4-5-nand-released

      I think the limit is up to the maximum size of a NAND can handle..

      Thanks

      -E^3

      Delete
    2. It is a pitty but the link is mising

      Delete
  6. I am so impressed by your site and these projects! I've been looking for a comprehensive guide to putting linux on the MK 808. I'd love to chat with you about a freelance project when you have a moment. I'm not sure how to reach out to you other than a message on this post.

    Hope you are well!
    Gabriel

    ReplyDelete
    Replies
    1. Hi Sir Naylor ,

      I am a freelance R&D Engineer here in the Philippines.
      Actually I am documenting all my hacks & cracks about Embedded PC
      and put the copy here..

      Anytime Sir Naylor, just give me your e-mail and we can talk/discuss about it

      -E^3
      Philippines

      Delete
  7. Hi E³,
    Yust want to say hallo and thank You for Your efforts.
    My Interest is to put Linux on small and mobile devices,
    replacing Android and Winz. I have 40 computers and 9
    Guitars. My Desktop is running in 18mb ram.
    Herbs from Germany

    ReplyDelete
    Replies
    1. Hi Arnold,

      Sorry for this late reply, so how is the setting now?

      Thanks

      E^3

      Delete
  8. Microcontroller Embedded Design: Writing Image And Booting Linux From Mk808/Rk3066 >>>>> Download Now

    >>>>> Download Full

    Microcontroller Embedded Design: Writing Image And Booting Linux From Mk808/Rk3066 >>>>> Download LINK

    >>>>> Download Now

    Microcontroller Embedded Design: Writing Image And Booting Linux From Mk808/Rk3066 >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete