How-Tos‎ > ‎

Linuxium's Bootloader

posted 30 Dec 2013, 01:10 by Ian MORRISON   [ updated 5 Dec 2015, 17:14 ]
Linuxium's bootloader software allows you to boot either Android and/or Linux. And it allows you to boot from NAND and/or from an SD card. This means you can boot different distros of Linux like Debian and Ubuntu as well as Android. Also there is a simple way to save and restore existing NAND installations of Android or Linux.

The source code is provided so you can choose from Stock Android, a specific custom Android ROM or any Linux kernel as well as offering the capability of compiling your own Linux kernel.


This latest version will:

  • Check if there is an SD card with Linux and then offer to:
Boot Linux from SD card or
Install Linux to NAND
  • Check if there is an SD card with Android and then offer to:
Boot Android from SD Card or
Install Android to NAND
  • Check if Linux is installed on NAND and then offer to:
Boot Linux from NAND or
Remove Linux from NAND or
Save Linux to SD card
  • Check if Android is installed on NAND and then offer to:
Boot Android from NAND or
Remove Android from NAND or
Save Android to SD card

as well as offering access to the command-line by invoking a shell.

The provided binaries are for the new model MK802IV with the latest firmware (131107) but can easily be tailored to support any device or specific configuration requirement, for example just have the device running Linux but also boot Android from SD card if one is loaded.

I've also provided five utilities to create an empty Linux or an empty Android SD card, or create an empty SD card for either Linux or Android and create an SD card with either Linux or Android installed on it.


Installation - using Windows

First load the Android ROM, Linux kernel and the bootloader software to your device so you can boot to Android.  Download and unzip 'bin.7z' (https://drive.google.com/file/d/0B99O3A0dDe67bmF6OXpXTDlmb3c).  Connect your 3188 device in bootloader mode using 'RKAndroidToolv1.37' (https://docs.google.com/file/d/0B99O3A0dDe67dUQ4VzVvZERfWW8) and first "EraseIDB" and then flash the files.

To run Linux a Linux RFS (root file system) is required.  The following 'distros' are provided as options:


and the Linux RFS must be initially installed to an SD card using the Linux utilities below or by following these combined Windows and Android instructions:
  1. Download MiniTool's Partition Wizard from either http://www.partitionwizard.com/download.html or http://www.softpedia.com/progDownload/Partition-Wizard-Home-Edition-Download-133833.html
  2. Inset your SD card into you card reader in Windows.
  3. Format the SD card (as FAT32).
  4. Start MiniTool's Partition Wizard Home Edition and select "MiniTool Partition Wizard".
  5. Scroll down the top window as required to see the SD card disk and then select it by clicking on "Used: 0%".
  6. Click on the "Delete" icon at the top and then click "Apply" to delete the existing empty FAT32 partition.
  7. Now click on the "Create" icon selecting "Primary" for "Create As:" and "Ext4" as "File System:" and then "OK" followed by clicking on the "Apply" icon. This will create a usable partition on the SD card.
  8. Now insert the SD card into your device and boot into Android.
  9. It is best to update "vold.fstab" so that there is sufficient space to hold the uncompress RFS (e.g. around 2.5GB for the Ubuntu one) so open a terminal window and enter "su".
  10. Then enter "mount -o rw,remount /dev/block/mtdblock9 /system".
  11. Next enter "busybox vi /system/etc/vold.fstab" and update the block number from "9" to "10" on the line that mounts the "sdcard".
  12. Now open a browser and download one of the Linux RFS from the links above (alternatively download and unzip the Linux RFS in Windows and copy it to Android).
  13. In a terminal window rename the downloaded file as a file name ending in ".7z" e.g. "rfs.7z".
  14. Install ZArchiver from Google's Playstore.
  15. Use ZArchiver to unzip the "rfs.7z" file to create the raw image (e.g. 'linuxium-ubuntu1204-desktop-rfs.img').
  16. Then reboot and select “c” to go to the command line.
  17. Now enter the following commands to copy the image to the SD card:
    1. mke2fs /dev/mmcblk0p1 <enter>
    2. mount /dev/mmcblk0p1 /mnt/sdcard <enter>
    3. mount /dev/mtdblock9 /mnt/nand <enter>
    4. cd /mnt/nand/Download <enter>
    5. mount -o loop linuxium-ubuntu1204-desktop-rfs.img /mnt/misc <enter>
    6. cd /mnt/misc <enter>
    7. for i in * <enter>
    8. do <enter>
    9. echo copying $i <enter>
    10. cp -a $i /mnt/sdcard <enter>
    11. echo copied <enter>
    12. done <enter>
  18. You can then reboot by entering "reboot" and the Linux system will then be available.
Now insert the SD card and reboot your device.


Utilities - using Linux

Five Linux utilities can be downloaded as 'utilities.7z' (https://drive.google.com/file/d/0B99O3A0dDe67MFgzYjZ2Z3BMNzA) and need to be unzipped and run as 'sudo ./MAKE-{the rest of the utility name}'.

MAKE-LINUX-SDCARD

This will create a bootable Linux SD card and allows you to specify which Linux root file system to store on it.  First download the required Linux RFS and unzip it.  Then load an SD card to store the Linux RFS.  Run the utility by entering 'sudo ./MAKE-LINUX-SDCARD' and provide the full filename for the location of the unzipped RFS file and the full device name for the SD card disk.

MAKE-EMPTY-ANDROID-SDCARD
MAKE-EMPTY-LINUX-SDCARD
MAKE-EMPTY-MULTI-SDCARD


The Android one will create the partitions based on the Rikomagic parameter file. The Linux one will create a single partition the size of the SD card. The multi one is a kind of combo version. It will create the 'data' and 'cache' partitions for Android as per the parameter file and it will then create the first partition to the maximum size available meaning that it can be used for both Linux and for Android's 'system' partition.

MAKE-ANDROID-SDCARD (requires 'src.7z' to be downloaded to work - see below)

Finally this will create a bootable Android SD card as per the Rikomagic parameter file with the ROM's system image saved to it.


Compilation - requires Linux

You can use whatever Linux source you want and whatever Android ROM you like as long as you are prepared to recompile the software. If you want wifi other than the AP6210 chipset then you will have to recompile the kernel. Download 'src.7z' (https://drive.google.com/file/d/0B99O3A0dDe67ZnBnWWlIdUJQdEk) and unzip (by entering '7z x src.7z') and then unzip the files this creates in the directory 'src'.

You will also need a Linux source so from within 'src' use git (aptitude install git-core) to download one e.g. 'git clone https://github.com/linuxium/3188-SRC-AP6210 git-3188-SRC-AP6210'. Next edit the MAKE* files and change the 'DEVELOPMENT_DIR' variable to reflect the correct path. These scripts can be used to build specific components of the system and are self-explanatory. I've also included a total build script 'MAKE-BOOTLOADER.7z' (https://drive.google.com/file/d/0B99O3A0dDe67Z3JmQUpCUGJpMUE).

To unpack a ROM image first copy it to the directory 'images-rk3XXX_mod_tool/unpack' and from there run './rkunpack <ROM image>' followed by './unpack-boot'.


Caveat - required reading

Flashing software to a device can cause the device to become 'bricked'. Typically this is due to a specific cause e.g. poor quality USB cable, insufficient power source, manual interruption/intervention, incorrect flashing software etc.. There are several techniques to recover from this situation published on the internet. Whilst this software has been extensively tested on a new model MK802IV and a T428 without problem, your usage of it is at your own risk.