Running Android or Linux from an SD card on a RK3288 device - An easy way to dual boot
Post date: Dec 04, 2014 10:23:12 AM
If you are interested in dual booting Android and Linux on your RK3288 device or you simply want to try a different Android ROM or Linux distro without flashing the device, then use this method of booting from an SD card.
You will need a PC running Linux and an SD card of 8 GB or more, at least class 10 speed.
Download the tools from 'https://drive.google.com/file/d/0B99O3A0dDe67bGVqWkZMRGFCSjg'. After unzipping you will see two shell scripts called 'create-android-sdcard' and 'create-linux-sdcard', a directory called 'Tools', a file called 'RK3288Loader_uboot_V2.17.02.bin' and some '.img' files together with a 'parameter' file.
To be able to dual boot (i.e. boot directly from the device or from an SD card), you will first need to update the bootloader on your device. Either use 'AndroidTool v2.3' on Windows or 'upgrade_tool' on Linux to flash just the 'Loader' with the 'RK3288Loader_uboot_V2.17.02.bin' file.
To create a bootable SD card first put it into your PC and use a command like 'blkid' or 'lsblk' to identify its device name (e.g. /dev/sdc).
For Android, run the script 'create-android-sdcard' and pass the name and location of the Android ROM you want to install onto the SD card, e.g.:
The program will prompt you to confirm the name of the device for the SD card. Once confirmed it will then unpack the Android ROM, create partitions on the SD card that mimic the ROM including a 'user' partition that will use the remaining space of the SD card. It will then install the Android ROM to the SD card and notify you when complete.
For Linux, as currently no standard approach to creating a Linux distro exists, to allow flexibility you will have to perform some initial set up steps. I've included example kernel and resource images which work fine on the Firefly, MK802V (et al) and Orion R28 (et al). I've also included download links for example root file systems (RFSs). Download either the Ubuntu 12.04 or Xubuntu/Lubuntu 14.10 RFS and unzip and rename as 'linux-rfs.img'. If you want to try a different kernel/resource combo simply rename them as 'kernel-linux.img' and 'resource-linux.img'. You can also use the tools in the 'Tools' directory to unpack Linux distros for those who want to experiment. Just don't modify the 'boot-linux.img' or 'parameter-linux' files as these must be used rather than any supplied as part of a Linux distro for Linux to boot from SD card.
Once set up, simply run:
The program will initially prompt you to confirm the name the device for the SD card and then it will create a bootable Linux SD card from the images defined in the'*.img' files.
Now just take the SD card and insert into your RK3288 device and power on to enjoy booting either Android or Linux.
The Android script will work with any Android ROM packed as an image with a separate 'data' and 'user' partition. I recently saw a ROM with the 'user' partition effectively combined with the 'data' partition. My sketchy knowledge of Android includes the memory of some requirement to have the 'user' partition as type 'vfat' as some programs expected or required that format. So until I can confirm this, or identify which Android version release it pertains to, I've not included it yet within the script.
Both scripts work for RK3288 and RK3188 devices. They utilize the excellent work from Fukaumi-san (naobsd) who provided the binary headers required to boot from SD card (see the 'README.txt' in the 'Tools' directory for further details and the required copyright notice, conditions and disclaimer).
The other key advantage of these scripts is that they allow you to boot a 'bricked' device. Some time ago I managed to break my Orion R28 Meta such that it would not boot and could not be flashed. I've included the required functionality in the scripts to boot even if no memory can be found on the device. So now I have a working Orion R28 again, albeit just from SD card.
See https://plus.google.com/109451178006683865932/posts/22Vxc6Sr5Ei for some pictures of a MK802V running stock Android and both Linux and another Android ROM from SD card.
UPDATE: If you experience any problems try the following ...
1. Run the script as root!
2. Ensure 'gdisk' is installed:
apt-get install gdisk
3. For 64-bit Linux install 'ia32-libs' (as 'mkkrnlimg' is provided as a 32-bit binary from Rockchip). Alternatively use the 64-bit version of 'mkkrnlimg' from here 'https://github.com/phjanderson/Kernel-3188' - first change directory to 'Tools' and enter 'mv mkkrnlimg mkkrnlimg.x86' and then 'wget https://github.com/phjanderson/Kernel-3188/raw/master/mkkrnlimg' and finally 'chmod 755 mkkrnlimg'.
4. For 32-bit Linux recompile 'rkunpack' and 'rkcrc' from here 'https://github.com/naobsd/rkutils' - as a minimum install 'build-essential' and then change directory to 'Tools' and enter 'gcc rkunpack.c -o rkunpack' followed by 'gcc rkcrc.c -o rkcrc' and finally 'chmod 755 rkunpack rkcrc'. Alternatively download the two files in a zip file from 'http://freaktab.com/filedata/fetch?id=435840&d=1420410731'.
5. Running Mint? Ensure 'cpio' is the latest version ('apt-get update && apt-get upgrade'). Disable auto-mounting by entering 'gsettings set org.cinnamon.desktop.media-handling automount-open false' and 'gsettings set org.cinnamon.desktop.media-handling automount false'. Or install 'gconfig' and change the settings using 'gconf-editor'.