RK30xx kernel source for custom modding...

Re: RK30xx kernel source for custom modding...

Postby eCCoMaNia » Fri Nov 23, 2012 10:52 am

AndrewDB wrote:Hi everybody,
Just a very short update post: Rockchip HDMI Analog Stereo ALSA device (a.k.a. sound) is finally working in Ubuntu Linux on the UG802, thanks to the "riko kernel".
Anybody wanting to compile the kernel: use the "hotdog" config file as a base configuration for all the PC stick format RK3066 devices.

EDIT: and also I retested the USB transfer rates reading/writing to a USB key and the issues I was having last week with slow transfer rates seem to be solved (I am getting the USB key's rated speed on reads and writes).

you really are amazing ! :D thank you for all your efford AndrewDB, when do you think you can post beta or alpha image for ug802 linux ? I'm just getting really excited about this !
eCCoMaNia
 
Posts: 111
Joined: Wed Sep 26, 2012 10:56 am

Re: RK30xx kernel source for custom modding...

Postby mitchb » Fri Nov 23, 2012 12:28 pm

Thanks Andrew for all the work you have done ! I just can't wait to try it on my MK808.

I am also ready to test ! Alpha, beta, bring it on ! :-)
mitchb
 
Posts: 4
Joined: Thu Oct 04, 2012 10:19 am

Re: RK30xx kernel source for custom modding...

Postby aloksinha2001 » Fri Nov 23, 2012 1:27 pm

AndrewDB wrote:Hi everybody,

Anybody wanting to compile the kernel: use the "hotdog" config file as a base configuration for all the PC stick format RK3066 devices.



Andrew: Cud u pls elaborate ?

Alok
aloksinha2001
 
Posts: 41
Joined: Thu Nov 08, 2012 11:11 pm

Re: RK30xx kernel source for custom modding...

Postby mosfet » Fri Nov 23, 2012 2:49 pm

Hi mosfet,
The MK808 is slightly more practical to flash because the USB otg port is not shared between the WiFi and the OTG functions (on the MK808 the WiFi uses SDIO, not USB).

Yes, please could you post some details on how you use the Linux tool rkflashtool? Do you have to short two pins on the MK808 to enter Flash mode, or is pressing the hidden button while connecting it to the PC enough?

Thanks!


Hi AndrewDB,

It's interesting that UG802 share the OTG port with WiFi over SDIO. I know the MK808 has a bootstrap ROM on the RK3066 chip that checks for the “recover” button to be pressed during power up and switches to a basic OTG device mode where it can be programmed using rkflashtool when plugged in a host PC.

In order to get rkflashtool to work with your given model (provided the OTG port works the same way as the MK808) you'll need to figure out what USB device ID UG802 has:


1. hold down the recovery button (using a paperclip) and power up the RK3066 device from only the OTG port using a standard usb cable (no special OTG cable required or shorting of the sense pins) plugged in to your PC running linux.
2. After 5 seconds release the button. No led will turn on at this point.
3. Run dmesg and you should see something like this:

Code: Select all
[  205.907467] usb 2-2: USB disconnect, device number 2
[  227.990348] usb 2-2: new high-speed USB device number 5 using ehci_hcd
[  228.122866] usb 2-2: unable to get BOS descriptor


4. Run lsusb and make note of the device id (in my case for the MK808 it is 2207:300a)
5. Next open up rkflashtool.c from the supplied archive and add a conditional if statement (Third if) for your device as follows (Note: place your device ID that you identified with lsusb):

Code: Select all
    if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x290a)))
        if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x281a)))
           if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x300a)))
                  fatal("cannot open device\n");


6. Save the file and run make (ensure you have libusb and liusb dev packages installed)
7. This should have built rkflashtool with your specific arm device id. (I have already added the device id for MK808 to the file)
8. Now you're ready to read the flash. As a first step I dumped the entire 8GB nand flash as a backup like so (it will take some time to backup the whole nand):
Code: Select all
rkflashtool r 0x00000000 0x01000000 > myflashbackup.bin


10. To quickly get an idea of where everything is in the flash you can run “hexdump -C myflashbackup.bin | more” to reveal the params which include the offsets for all images in nand including boot, system, user.
11. In my case, to grab the kernel I did the following:

Code: Select all
rkflashtool r 0x00004000 0x00004000 > mk808kernel.img


12. To upload a new kernel do the following:

Code: Select all
rkflashtool e 0x00004000 0x00004000
rkflashtool w 0x00004000 0x00004000 < mynewkernel.img


13. After the flash tool is done its operation, simply unplug and plug in the RK3066 devices to reboot it or run rkflashtool b to reboot the device.
14. To recover from a kernel firmware load do the following run:

Code: Select all
rkflashtool e 0x00000000 0x00008000
rkflashtool w 0x00000000 0x00008000 < myflashbackup.bin



Your mileage may vary in terms of success. The above steps worked for me using the MK808 using Ubuntu 12.04 LTS 64bit on the host pc. I have also tried using VirtualBox under Windows 7 64 but the OTG device is not properly translated in windows and rkflashtool cannot “claim the device.”

I've attached an archive that also includes a precompiled version of rkflashtool for Ubuntu 12.04 LTS 64 for MK808.

Here it is:
rkflashtool.tar.bz2


Good luck and let me know how it goes.
You do not have the required permissions to view the files attached to this post.
mosfet
 
Posts: 17
Joined: Thu Nov 22, 2012 1:04 pm

Re: RK30xx kernel source for custom modding...

Postby AndrewDB » Fri Nov 23, 2012 4:05 pm

Thank you mosfet for the great write up and detailed explanations, great post!
I am going to try it ASAP! :geek:
AndrewDB
 
Posts: 144
Joined: Sun Oct 28, 2012 5:53 pm

Re: RK30xx kernel source for custom modding...

Postby llewelld » Fri Nov 23, 2012 9:48 pm

Hi Guys,

Can anyone tell me, is the work being done here only for Ubuntu for RK-3066, or will it also be for android?

I have an MK808 and have been searching hi & low for a rom with true 1080p desktop, not the scaled 1280x672.

Many of the existing Android roms for me would be near perfect, except for the screen resolution issue.

Cheers for any feedback and cant wait to test out Ubuntu.
llewelld
 
Posts: 24
Joined: Thu Nov 15, 2012 1:57 am

Re: RK30xx kernel source for custom modding...

Postby vampirex » Fri Nov 23, 2012 10:24 pm

mosfet wrote:
...... I have also tried using VirtualBox under Windows 7 64 but the OTG device is not properly translated in windows and rkflashtool cannot “claim the device.....


What about VMware player?
http://www.vmware.com/products/player/

You can find some precompiled Linux vm images for VM player here:
http://www.thoughtpolice.co.uk/vmware/
vampirex
 
Posts: 28
Joined: Wed Oct 31, 2012 10:32 pm

Re: RK30xx kernel source for custom modding...

Postby fun » Fri Nov 23, 2012 11:30 pm

AndrewDB wrote:Yes, please could you post some details on how you use the Linux tool rkflashtool? Do you have to short two pins on the MK808 to enter Flash mode, or is pressing the hidden button while connecting it to the PC enough?


just FYI,

there are 2 kind of special boot mode on RK device.

1. read initial boot code from USB, then enter NAND read/write mode
2. read initial boot code from NAND, then enter NAND read/write mode

if you short 2 pins on NAND which disables NAND, or press equivalent button which is available on some(few?) devices, "1" will be started.

if you press a button for "upgrade", "restore", or something else, or run "reboot bootloader" from shell/adb, "2" will be started. for "2", proper boot code need to be flashed in NAND.

rkflash/rkflashtool can work with "2" only, and only MTD partitions which can be accessed from Android/recovery are supported. rkflash/rkflashtool can't read/write initial boot code area in NAND.

official tools from Rockchip can work with both "1" and "2". they can send initial boot code via USB for "1", and they can access initial boot code area in NAND.

--
if you bricked your device by e.g. flashing invalid boot code into NAND, you need to do "1" with official tools to unbrick.

to support "1" in rkflash/rkflashtool, at least, unknown "extra 2 bytes" need to be solved.
viewtopic.php?f=66&t=212&start=160#p2519
fun
 
Posts: 124
Joined: Wed Nov 07, 2012 11:09 am

Re: RK30xx kernel source for custom modding...

Postby fun » Fri Nov 23, 2012 11:47 pm

AndrewDB wrote:3) I have started investigating the NAND driver.


by the way, I think Rockchip's NAND/MTD driver is very strange. standard MTD tools such as flash_image/erase_image don't work correctly. probably ERASE ioctl doesn't work.

block device(/dev/block/mtdblock*) is also strange. writing some amount of data to mtdblock from userland(cat, dd, etc) will lead oops/data corruption. I guess erasesize of 0xff need to be written before writing data, and/or some special handling is needed even for block device.
(read/write thru kernel, i.e. read/write files on mounted file system works fine, of course)

I'm not sure standard Linux mkfs/fsck can run properly on RK's mtdblock.
Last edited by fun on Sat Nov 24, 2012 12:45 am, edited 3 times in total.
fun
 
Posts: 124
Joined: Wed Nov 07, 2012 11:09 am

Re: RK30xx kernel source for custom modding...

Postby mosfet » Sat Nov 24, 2012 12:06 am

Lots of great activity on this thread!

AndrewDB: If you need any help with testing let me know.

llewelld: I've been playing with the kernel AndrewDB uploaded to github and have successfully enabled 1080p on the MK808 using Android 4.1.1. Unfortunately, at this time the RK901 WiFi driver isn't working and I have some errors showing up relating to dynamic voltage and frequency management. Also, I noticed that when running in 1080p the graphics are a bit more sluggish but not bad.

vampirex: thanks for the vmware image resource. I haven't yet tried rkflashtool under vmware.

fun: Interesting info about the nand flash loading. It seems like it is a multistage boot loader. Can you explain which two bytes you're refering to for mode 1?

cheers
mosfet
 
Posts: 17
Joined: Thu Nov 22, 2012 1:04 pm

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 0 guests