Think Out of the Box with Vitha.Us ... Customising and Modding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bootloader software for RK3188 devices, dualboot Android and Linux

Go down

Bootloader software for RK3188 devices, dualboot Android and Linux Empty Bootloader software for RK3188 devices, dualboot Android and Linux

Post by vitha Wed Jan 21, 2015 2:17 pm

Bootloader software for RK3188 devices, dualboot Android and Linux IMG_4338
The power of a bootloader lies in giving you the choice in what happens after you power your device on.  Perhaps you want to boot Linux and not Android.  And you want Debian not Ubuntu.  Maybe you need quick access to Android as you just need to run one applications.  Or perhaps you want to test that new ROM before deciding whether to adopt it.

Hopefully what follows together with the software will help with some of these issues.

Two aspects I have focused on cover creating flexibility in booting both Linux and Android from either NAND or SD card together with a simple way to save and restore existing installs.

I've tried to make the code device independent and I've provided full source and instructions in the hope that many will find it easy to tailor to their specific hardware and needs.

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.

The basic configuration as supplied facilitates the backup of both Linux and Android together with a simple way to install Linux.  I've also provided five utilities: create an empty Linux or empty Android SD card, create an empty SD card for either Linux or Android and create an SD card with either Linux or Android installed on it.


Installation - requires Windows
--------------------------------------------

To install on the new model MK802IV (or similar device albeit loosing wifi functionality) 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.

This will load the Android ROM, Linux kernel and the bootloader software and allow you to boot Android.

To run Linux first download a Linux root file system e.g.

Ubuntu (https://docs.google.com/file/d/0B99O3A0dDe67RTFZbHg3ZWE3LXc)
Lubuntu (https://docs.google.com/file/d/0B99O3A0dDe67RWRTbGxDbndlSDQ)
Xubuntu (https://docs.google.com/file/d/0B99O3A0dDe67WWp1dEFJZC1hTWs)
Debian (https://docs.google.com/file/d/0B99O3A0dDe67aHVJT0FCbGw2V1k)

and install to an SD card.

To install a LINUX RFS to SD card in Windows first:
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.

Now insert the SD card into your device and boot into Android and:
1.  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:
a.  Open a browser and enter "su".
b.  Then enter "mount -o rw,remount /dev/block/mtdblock9 /system".
c.  Next enter "busybox vi /system/etc/vold.fstab" and update the block number from "9" to "10" on the line that mounts the "sdcard".
2.  Then we need to get a LInux RFS by:
a.  Open a browser and download one of the Linux RFS from the links above.
b.  In a terminal window rename the downloaded file as a file name ending in ".7z" e.g. "rfs.7z".
c.  Install ZArchiver from Google's Playstore.
d.  Use ZArchiver to unzip the "rfs.7z" file to create the raw image (e.g. linuxium-ubuntu1204-desktop-rfs.img).
Alternatively download and unzip the Linux RFS in Windows and copy it to Android.
3.  Then reboot and select “c” to go to the command line.
4.  Now enter the following commands to copy the image to the SD card:
mke2fs /dev/mmcblk0p1 <enter>
mount /dev/mmcblk0p1 /mnt/sdcard <enter>
mount /dev/mtdblock9 /mnt/nand <enter>
cd /mnt/nand/Download <enter>
mount -o loop linuxium-ubuntu1204-desktop-rfs.img /mnt/misc <enter>
cd /mnt/misc <enter>
for i in * <enter>
do <enter>
echo copying $i  <enter>
cp -a $i /mnt/sdcard <enter>
echo copied <enter>
done <enter>
5. You can then reboot by entering "reboot" and the Linux system will then be available.

Alternatively from within a Linux VM or using a LiveCD see https://plus.google.com/109451178006683865932/posts/bn6cQQzH42e for SD card installation instructions or use the utility below and insert the SD card and reboot your device.


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'.


Utilities - require Linux
--------------------------------

Five Linux utilities can be downloaded as 'utilities.7z' (https://drive.google.com/file/d/0B99O3A0dDe67MFgzYjZ2Z3BMNzA).  After unzipping, the first three will format an SD card suitable for use with the software.

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-LINUX-SDCARD

This will create a bootable Linux SD card and allows you to specify which Linux root file system to store on it.

MAKE-ANDROID-SDCARD (requires 'src.7z' to down downloaded)

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


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.



Pre-Requisites
---------------------


For Windows download and install 'RKBatchTool' (see these excellent instructions http://wiki.radxa.com/Rock/flash_the...Install_driver) or for Linux download and install 'upgrade_tool' (see https://plus.google.com/109451178006...ts/ZVic25M5cdT).


Download a Linux root file system e.g.


Ubuntu (https://docs.google.com/file/d/0B99O...TFZbHg3ZWE3LXc)
Lubuntu (https://docs.google.com/file/d/0B99O...WRTbGxDbndlSDQ)
Xubuntu (https://docs.google.com/file/d/0B99O...Wp1dEFJZC1hTWs)
Debian (https://docs.google.com/file/d/0B99O...HVJT0FCbGw2V1k)


and install to an SD card (unzip and then for Windows use 'Win32 Disk Imager' or for Linux use 'dd').




Installation
----------------


Connect your 3188 device in bootloader mode (check with your seller/manufacture's site for specific information on your device although typically it means connecting a USB cable to your PC and pressing the reset button on your device while you connect the other end of the cable to the micro USB OTG port on your device).


Download and unzip the update image appropriate to your device:


Radxa Rock - https://drive.google.com/file/d/0B99...TZkc1RsSlJETzQ
Minix Neo X7 - https://drive.google.com/file/d/0B99...UpSRzlqRGhXWmc
Rikomagic MK802IV (latest model) - https://drive.google.com/file/d/0B99...jVLSHlhQXVnX0k


Flash your device using 'RKBatchTool' for Windows or 'upgrade_tool' for Linux (see the instructions above).


Now insert the SD card and boot your device. Select the required boot option from the on-screen menu. Note the first Android boot is very slow as it is setting up the system ready for use. Be patient, even after you think that nothing is happening, as it will boot!


To add the Linux modules to the Linux RFS simply:


1. Download the relevant modules and unzip the file:
Radxa Rock - https://drive.google.com/file/d/0B99...UpoVlUyQmplSkU
Minix Neo X7 - https://drive.google.com/file/d/0B99...E5LRG9Ua2RIcDA
Rikomagic MK802IV (latest model) - https://drive.google.com/file/d/0B99...jFXMmJId2l5TkE
2. As root enter 'cd /lib/modules' and then 'cpio -ivdum < <unzipped_modules_file>'
3. Reboot




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 the specific devices without problem, your usage of it is at your own risk.
vitha
vitha
Senior Member
Senior Member

Posts : 373
Join date : 2012-10-28

Back to top Go down

Bootloader software for RK3188 devices, dualboot Android and Linux Empty Re: Bootloader software for RK3188 devices, dualboot Android and Linux

Post by vitha Wed Jan 21, 2015 2:19 pm



For other devices here are some additional untested kernels (as I don't have the devices) that may be of interest:

8188EU wifi (e.g. old model MK802IV):
https://drive.google.com/file/d/0B99O3A0dDe67QkdyeTc1N1lTTnc

AP6330 wifi (e.g. T428):
https://drive.google.com/file/d/0B99O3A0dDe67NV9GSGdWOUkyVEU

Flash the binaries described above except use one of the above as the 'kernel.img'
vitha
vitha
Senior Member
Senior Member

Posts : 373
Join date : 2012-10-28

Back to top Go down

Bootloader software for RK3188 devices, dualboot Android and Linux Empty Re: Bootloader software for RK3188 devices, dualboot Android and Linux

Post by vitha Wed Jan 21, 2015 2:20 pm

Win32 Disk Imager writes the image to the SD card without creating a partition so unfortunately the paths would have to be updated. Therefore I suggest this approach:

In Windows:
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 in to 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 useable partition on the SD card.

In Android:
1. Make sure you have updated "vold.fstab" as above so that you have sufficient space in your Android environment to hold the uncompress RFS (e.g. around 2.5GB for the Ubuntu one).
2. Either download and unzip the Linux RFS in Windows and copy it to Android or
a. Open a browser and download one of the Linux RFS
b. In a terminal window rename the file as a file name ending in ".7z" e.g. "rfs.7z"
c. Install ZArchiver from Google's Playstore
d. Use ZArchiver to unzip the "rfs.7z" file to create the raw image (e.g. linuxium-ubuntu1204-desktop-rfs.img)
3. Then reboot and select “c” to go to the command line.
4. Now enter the following commands to copy the image to the SD card:
mke2fs /dev/mmcblk0p1
mount /dev/mmcblk0p1 /mnt/sdcard
mount /dev/mtdblock9 /mnt/nand
cd /mnt/nand/Download
mount -o loop linuxium-ubuntu1204-desktop-rfs.img /mnt/misc
cd /mnt/misc
for i in *
do
echo copying $i
cp -a $i /mnt/sdcard
echo copied
done
5. You can then reboot by entering "reboot" and the Linux system should then be available.

There will undoubtedly be other approaches hopefully others will contribute. You will see that I've used "cp -a" to copy each directory. This gives you good visibility of what is happening. An alternative would be to "dd" the image to the SD card which is simpler but I've found much slower.
vitha
vitha
Senior Member
Senior Member

Posts : 373
Join date : 2012-10-28

Back to top Go down

Bootloader software for RK3188 devices, dualboot Android and Linux Empty Re: Bootloader software for RK3188 devices, dualboot Android and Linux

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum