How-Tos‎ > ‎

Linux for RK3288 whilst preserving Android

posted 9 Oct 2014, 06:38 by Ian MORRISON   [ updated 5 Dec 2015, 17:16 ]
Want to try Linux on your brand new shiny RK3288 device but don't want the hassle of hooking it up to a PC and flashing firmware or loosing your Android environment?

I've developed a prototype that allows you to temporarily convert your Android stick to a Linux stick and run Ubuntu from the SD card. Once finished playing with Linux you can revert your device back to Android with everything the same as before you started. 

You will need an RK3288 device that is rooted, a terminal emulator and a compression program.  I recommend installing 'Terminal Emulator for Android' by Jack Palevich (see https://play.google.com/store/apps/details?id=jackpal.androidterm) and 'RAR for Android' by RARLAB (see https://play.google.com/store/apps/details?id=com.rarlab.rar).

Still interested?  You need to download a couple of zipped files.  The first contains some programs that will convert your device from Android to Linux and back again.  The second is an Ubuntu root file system that allows you to run Ubuntu off an SD card.

Now whilst there is no "flashing" of firmware in the conventional sense of having to connect your device to a Windows or Linux PC, obviously the boot and kernel images will need to be swapped between Android and Linux and this is achieved using the provided programs which run directly on your RK3288 device.

So whilst it is not totally risk free, it is relatively simple and should things really go south you can always recover by flashing stock firmware.

Okay, not frightened off yet?  First download the zipped file 'linuxium-rfs.img.7z' from  https://drive.google.com/file/d/0B99O3A0dDe67dGtGSVZaX2RoU1k and unzip it and write it to an SD card in either Windows (using 'Win32 Disk Imager') or Linux (using 'dd'). If you haven't got a PC you can still do this on Android using the terminal emulator and the 'dd' command although I had problems resizing the SD card afterwards.

Next on your Android RK3288 device download the zipped file 'linux4android.7z' from https://drive.google.com/file/d/0B99O3A0dDe67NDliOTFsaEh2Vlk and unzip it.  You will see the following files:

aFLASH-PARTITIONS
aRESTORE-PARTITIONS
aSAVE-PARTITIONS
RESTORE-PARTITIONS
boot.par
kernel.par
resource.par

Now you need to make a copy of some important Android partitions first so enter:

sh aSAVE-PARTITIONS all

and this will create 'boot.sav', 'kernel.sav' and 'resource.sav'.  Keep these files as you will need them to revert back to Android.

To convert your device to Linux enter:

sh aFLASH-PARTITIONS all

Finally put your SD card into the slot and type 'reboot' to start Ubuntu (username linuxium with password 'p'). You will notice that the Android partitions are accessible from Linux under '/media'.  Obviously if you start altering anything on them you will affect how Android works so stay clear of them to stay safe!  Depending on how you created the SD card, the first thing you might need to do is to resize it using the 'resize2fs' command.

When you want to go back to Android, enter 'sudo su -' and go to the directory where the '.sav' files were saved (in my case it is '/media/ROCKCHIPS/Download' which is the default download directory under Android).  Enter the command:

sh RESTORE-PARTITIONS all

and then enter 'halt' to shutdown the device.  Take the SD card out and power the device back up.  You will now boot back into Android.

To swap back to Linux you only need to run the 'aFLASH-PARTITIONS' command from within Android (and put the SD card back in) and to swap back run the 'RESTORE-PARTITIONS' command from within Linux.

Just to be complete, the 'aRESTORE-PARTITIONS' command allows you to restore the Android partitions from with Android.

This is just a prototype and uses a Linux kernel built from the Firefly source code. And yes, you could use the same techniques to put Linux on the recovery partition and have dualboot just like the early days of the RK3188 devices.  Enjoy!

Comments