Starting from Rockchip Linux' source code, along with several tools, we will end up with a recovery.img file. This is used to flash the recovery partition of an RK3066 device, which will then be able to boot into Ubuntu Linux.
WARNING: You DO NOT need to follow these steps unless you want to modify the kernel!
The stock kernel from Alok Sinha works fine and is very easy to install. Follow this guide:
Assuming the kernel is compiled from an x86 PC running an Ubuntu Linux:
#get the right packages for the compiler [3]
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.8-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib sharutils lzop
#start out from the user's home and create "rk" folder for all the work
cd ~
mkdir rk
cd rk
#toolchains folder is where the ARM compiler toolchain will be downloaded to [3]
git clone https://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
#tools folder is where the mkbootimg tool (create recovery image) will be downloaded to [4]
git clone https://github.com/olegk0/tools.git
#initramfs folder is where the Picuntu kernel's .config file looks for initramfs.cpio (see CONFIG_INITRAMFS_SOURCE)
git clone https://github.com/Galland/rk30_linux_initramfs.git initramfs
cd initramfs
gzip -dc debian-3.0.8+fkubi.cpio.gz > initramfs.cpio
cd ..
#rk3x_kernel_3.0.36 is where we download the latest available Picuntu Linux kernel source code
git clone https://github.com/Galland/rk3x_kernel_3.0.36.git
cd rk3x_kernel_3.0.36/
#copy updated Picuntu kernel config file
cp config.galland .config
#set the target architecture and toolchain location (CHANGE the base folder if you are not using ~/rk/)
export ARCH=arm
export CROSS_COMPILE=~/rk/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
#launch the Kernel compilation (-j 4 indicates that 4 compiler threads run in parallel, I have a quad-core PC...)
make -j 4
#
# Kernel compilation takes some minutes...
# BTW, don't worry about the warnings while compiling
#
#last step is to generate the recovery.img to flash the recovery partition of the Android stick
cd ..
tools/mkbootimg --kernel rk3x_kernel_3.0.36/arch/arm/boot/Image --ramdisk initramfs/fakeramdisk.gz --base 60400000 --pagesize 16384 --ramdiskaddr 62000000 -o recovery.img
Now flash recovery.img into the recovery partition and boot into Linux, just like using the stock kernel!
Installing modules and firmware
In the same x86 PC as above, after the flashing step:
mkdir mod_fw
cd rk3x_kernel_3.0.36
make modules_install INSTALL_MOD_PATH=~/rk/mod_fw/
A new folder called "lib", with "modules" and "firmware" subfolders, should appear inside "mod_fw". Copy & overwrite "lib" into the Picuntu MicroSD card's root folder, start Picuntu and in a Terminal write:
sudo depmod -aAnd, after a restart, everything should be ready.
REFERENCES
[1] https://docs.google.com/folder/d/0B02hgWz32NpXcC1ONVBSLWx6RHc/edit
[2] http://www.slatedroid.com/topic/41654-pre-alpha-03-ubuntu-linux-for-mk802-iii-ug802-mk808-ug007-imito-mx1/page__view__findpost__p__502961
[3] http://www.armtvtech.com/armtvtechforum/viewtopic.php?p=5072#p5072
[4] http://www.slatedroid.com/topic/41654-pre-alpha-03-ubuntu-linux-for-mk802-iii-ug802-mk808-ug007-imito-mx1/page__view__findpost__p__495617
Nice instructions, i am thinking getting a RK3066 box like the Minix Neo X5. I prefer to have a bit larger box with more interfaces than the stick like mini computers.
ReplyDeleteI started a page on ARM devices running GNU/Linux.
http://bitkistl.blogspot.com
I have tried this with my MK808, it boots but cannot get wifi to work, I have selected RK901 as wifi driver, when compiling towards the end I get:-
ReplyDeleteERROR: "dwc_otg_clear_halt" [drivers/net/usb/asix.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
Any ideas?
The error comes from one ASIX USB-Ethernet driver, as a workaround you can edit the ".config" file in your kernel root and comment (precede with #) the line that starts with "CONFIG_USB_NET_AX8817X".
DeletePlease let me know how it works out.
Thanks that stopped the error, I got the wifi working by using a config from /proc/config.gz and tweaking it a bit. All seems good now, custom picuntu kernel on my MK808 is running just fine.
ReplyDeleteStruggling for 2 weeks to compile driver for usb generic serial but with no success.
ReplyDeleteUsed all instructions above for compilation.
But installing the driver 'usbserial.ko' returns:
insmod: error inserting '1usbserial.ko': -1 Invalid module format
I'm running the compilation on Ubuntu 11.04. running uname –a returns:
Linux ubuntu 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 18:00:43 UTC 2012 i686 i686 i386 GNU/Linux
My picuntu device is MK808B
During above steps I had missing packages that could not be found:
ia32-libs lib32z1-dev lib32ncurses5-dev
Any help will be appreciated
Above steps are for kernel, not the modules, does the compilation run fine (and the kernel works onthe MK808B) if you select the usbserial as in-kernel and not as a module? and if so, does it then work with your usb?
DeleteThanks for your prompt reply.
DeleteThe kernel compilation goes smoothly.
It was done in order to compile the usb module as it is needed prior to module compilation.
I have selected it as module.
It doesn't work with the module nor the usb as the picuntu does not install the module.
using insmod returns: insmod: error inserting 'usbserial.ko': -1 Invalid module format.
Could it be that the packages that are missing can cause this issue?
Should i use the newer kernel generated by my last compilation in order to use newly generated module?
DeleteUsed new generated kernel. The device does no boot. Alive only after flashing finless android rom.
DeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHI, the tutorial is nice, thanks! But I wonder how I get the modules and firmware, which should be placed on the SD-card.
ReplyDeleteThanks for the suggestion, I've just added a new subsection at the end with how to do that.
DeleteHi, Galland
ReplyDeleteI downloaded and flashed both kernel image above but both boot up claiming itself as 3.0.8+alok. Are you sure you pasted the correct links?
And so I built the kernel myself following your instructions and it works! The only thing I don't understand is that the recovery.img I built is about 14M, while what you pasted are about 10M. Why they differ so much?
Thanks!
If you enter in a terminal "uname -a" and the response is not "3.0.36+" then you have not flashed the kernels in this post.
DeleteSorry, Galland. I haven't explained it clearly.
DeleteI downloaded the kernels from http://hwswbits.blogspot.com/2013/05/unofficial-new-3036-kernel-for-picuntu.html. I flashed them a few times, but each time the kernel version is 3.0.8+. So I had to compile it myself following this post's instruction and succeeded. That's why I wonder if the two kernels are not the correct ones.
So my next question is why the kernel I compiled is 14M and yours are about 10M"? I'll try to do it again tonight and verify if I did something wrong.
Thanks.
Hello Galland,
ReplyDeleteI've got an external usb network adapter with the cryptic name HG20F9.
Compiling it was a success, but I did need to make some small adjustments to the code.
Do you want this code as a git diff?
Floris
Yes :) Can you open an issue with it in the github repo indicated in this blogpost? Thanks!
DeleteI don't think I can...
DeleteHi Galland,
ReplyDeleteI want to compile the kernel directly on my mk808 with picuntu already installed on it since this is my only linux machine. Could you please instruct me how to do that?
thanks!
Above steps are for x86, since for example the Android toolchain to download is a cross-compiler from x86 to ARM... good luck and don't forget to make a blogpost on how you did it! :)
DeleteHello Galland
ReplyDeleteThis is a very throughout guide for even a newbie like me to follow. Thank you very much!
I think I understand most of the steps but when it comes to generating the recovery image:
tools/mkbootimg --kernel rk3x_kernel_3.0.36/arch/arm/boot/Image --ramdisk initramfs/fakeramdisk.gz --base 60400000 --pagesize 16384 --ramdiskaddr 62000000 -o recovery.img
I am a little bit lost about the address values and their implications. I just cannot link them with the partition address values given in the parameter file used when I flash Finless's ROM to MK808B. Are there any relations between them anyway?
Thanks in advance and apologize for me bad english. I have tried my best...
No relation to the rom parameters (which are only for later flashing the recovery image), the addresses for mkbootimg are fine without change :)
DeleteThanks for your explanation~
DeleteI am completely new to kernel development.
However, I finally found that the above addresses are referring to the RAM addresses of the respectively sections when they are loaded into memory by the bootloader. So the pagesize is the pagesize of the DDR-RAMs, nothing to do with the flash.
Sorry for my ignorance :(
I adopt your code and start finding the missing bits in the kernel (for MK808B) for the RK903 wifi driver
Lets see if it is actually due to the change of wlan wake up pin of the MK808B hardware
Thanks again for your work Galland!
Hi Galland
DeleteSome news about the RK903 wifi driver on MK808B
Based on your 3.0.36+ kernel, I have sucessfully enabled the RK903 module with some PWM tricks.
I hope that someone can verify my work is correct by trying out the patch I posted Here -> http://www.freaktab.com/showthread.php?6454-Temporary-RK903-Wifi-Patch-for-MK808B
Hope it helps if someone is still struggling to enable the wifi.
Really appreciate if someone can improve my code to some stable states.
Thank you so much for contributing back! :)
DeleteHello, Galland
ReplyDeleteI could compile kernel, and create "recovery.img".
Your "recovery.img" is 10MB, but my "recovery.img" is 14MB.
Do you know why? (I was able to both boot.)
I tryed enable "Automatic process group scheduling" of "General Setup" in "make menuconfig".
But, new "recovery.img" was NOT able boot.
Can you enable "Automatic process group scheduling"?
I have a problem. I saw "top" command.
This system's "load average" is high. (2.0 - 2.4 at minimum)
I hope we can solve by enabling this option.
Sorry, my poor English.
Please, reply.
I am now using github.com/galland/Linux3188 and turning on SCHED_AUTOGROUP works well. This kernel works for rk3066 and rk3188 devices, you should try it.
DeleteThe kernel size difference is likely due to using a different .config/toolchain/initramfs
Thank you for your help.
DeleteI'm trying.
Changed from "rk3x_kernel_3.0.36" to "Linux3188".
Default setting is below, OK?
"Automatic process group scheduling" is NOT enable.
"CFQ Group Scheduling support" is NOT enable.
Device choices "3188".
"make" command is successful.
And, I create "img", using "tools/mkbootimg" and "mkkrnlimg". I tryed both.
But, I was NOT able to both boot.
Thank you for your kindness.
I failed...
DeleteI can NOT boot my MK808 using "Linux3188".
I can you enable "Automatic process group scheduling" using "rk3x_kernel_3.0.36".
But, "load average" is very high...
Can you boot the MK808 following the exact and only instructions in this blogpost?
DeleteYes, I could compile kernel using your instructions.
DeleteI have cross compile environment.
Can you boot the MK808 following the exact and only instructions in this blogpost?
DeleteYes, I can boot.
DeleteHello.
DeleteI can boot the MK808 following the exact and only instructions in this blogpost.
But, I can NOT boot the MK808 using "Linux3188".
I changed from "rk3x_kernel_3.0.36" to "Linux3188".
Is this correct?
Do I need to change the ".config"?
What I should I change to another?
--------------------
And, I back the "3.0.8+" kernel.
This kernel is very low "load average", but my problem was not resolved.
I want to try the new kernel you.
Hi awesome tutorial Galland, I was looking to use the fedora ARM spin and put it in my MK808. Do you have any tips? hehehe.
ReplyDeleteI like Debian but I'm more of a fedora user :D
1) You MIGHT have to change the contents of the initramfs.cpio (look into the txt files in github.com/Galland/rk30_linux_initramfs for more info on browsing/changing its contents), depending on what Fedora requires to init, though you may want to stick with current (Debian based) initramfs and try just next step
Delete2) instead of getting Picuntu (==Xubuntu) root file system into the uSD card labelled "linuxroot", just place a minimal Fedora ARM distro.
And then let us know of a place to download it from :D
Hi Galland, Almost there with Fedora. One thing that I noticed on the last step when you create the recovery.img is that you used -ramdisk initramfs/fakeramdisk.gz Why is that?.
DeleteAlso thanks a lot for your guide, i had to compile the kernel and make my own initramfs cause fedora using systemctl boots up differently than debian.
Okay No luck with the initramfs for Fedora I've tried all the possible variants that I know but it just don't want to start. T-T T-T
DeleteLet's try to work this out, could you share your root file system creation procedure, closest Fedora initramfs you have and any other relevant info? I may be able to help you :)
DeleteFor example: use the contact form to the right of this page with your email and I'll email you
This comment has been removed by the author.
ReplyDeleteHi Galland,
ReplyDeleteI'm trying to compile https://github.com/Galland/Linux3188 for RK3088 (MK808b) Joy-IT 2.0 'stickputer'. Getting the kernel to compile yet unable to boot it. Is the kernel generally compatible with 3066? I tried changing the platform type to RK30xx but compilation fails.
your 3.0.8 tree works.
any advice is appreciated.
Danja
Hi Galland, Thanks so much for this awesome source and tutorials. I have an mk808b original device and i tried compiling it. Only thing is i am using a rootfs created from kali linux. The kernel seems to load up but i am getting stuck in busybox prompt (initramfs)
ReplyDeleteNothing loads up after that. I am new to kernels n stuff but is it because my SD card rootfs is based on kali?
I know you are so busy and I would appreciate any wise words from you. Thanks again
if you're sure the sdcard is labelled: linuxroot
Deletethen the problem is that the rootfs doesn't match what kernel expects, but I can't help there, sorry.
Hi Galland, I try it on my pad u30gt-h, but something goes wrong. I have created recovery.img and flashed it into my pad, but after reboot nothing was saw on the screen. I did not put the sdcard into my pad, but I think something may come out on the screen. Is there any solutions? Sorry for my bad english!
ReplyDeleteThat's normal, tablets have different components than sticks/boxes, and enabling them is difficult.
DeleteI am myself reviewing tablets to get the best one to start the work of porting Linux to it. I'll post about it in the blog :)
hi Galland, i have tried to compile kernet with nand driver and point on internal nand but without success, may you do it? with this kernel we can use picuntu 4.5 on directly on nand of rk3066 device.
ReplyDeletehttp://www.freaktab.com/showthread.php?8206-Picuntu-4-5-on-MK808-amp-MK808b-SUCCESS!!
P.s. Thank you for sharing your work!
Hi Galland,
ReplyDeleteI am using your 3.0.36+ kernel and it work flawlessly with my mini headless NAS setup booting from USB! Recently I dug out my old DVB-T usb stick. I would like to add the driver for that stick into my setup for tvheadend testing. I understand, that I will have to compile whole kernel adding module for my device and then flash it to the device. The point is I would like to compile it on the device itself as it is always on! Unfortunatelly following this tutorial it fails. Please, could you assist me with compiling the kernel on the device itself? (I am running debian from https://romanrm.net/a10/debian)
Compile it as a module for the stick (you can do it in your PC with the above instructions), and then just copy it into the stick at /lib/modules followed by insmod /lib/modules/....ko
ReplyDeleteHi,
DeleteThanks for the advice for compiling the driver as a module. I did that and copied the resulting files into /lib/modules/ followed by "depmod -a".
Now when I plug the device in, it is recognized as "Afatech DVB-T 2" - it does not work thou.
In my dmesg log I have this error message:
" [ 2546.299356] dvb_usb_af9015: probe of 2-1.3:1.0 failed with error -1 "
Google search does not provide much information about this. All I have found, is that the problem may be with the missing firmware for the device, so I downloaded the firmware file (from http://palosaari.fi/linux/v4l-dvb/firmware/af9015/5.1.0.0/ ) and I put it into /lib/firmware/ but I still get same error.
Any ideas?
Hi galland i enable boot fedora from usb,, but i want to enable a partition table in to a nand memory device, do you know how to example
ReplyDeletemtdblock9
mtdblock9p1
mtdblock9p2
mtdblock9p3
Thats what i need to enable boot fedora direclty in nand memory