Requirements
- rk3288 devices
- Android 4.4 (kitkat) rom based on official Rockchip SDK(kernel version 3.10.x)
- Linux system
Steps
- Connect your device to pc, boot your device into MaskRom Mode(CS918 PLUS as an example, hold reset and power button for about 5 seconds)
- Open terminal in the folder that you extract the archive. Backup some partitions in case you brick your device:
./rkflashtool r boot >boot_bak.img
./rkflashtool r kernel >kernel_bak.img
./rkflashtool r resource >resource_bak.img - Dump boot partition from device
./rkflashtool r boot >boot.img - Check the header of boot.img
od -c boot.img | head
There are two circumstances:
if the header of boot.img is “KRNL”, then boot.img is a signed ramdisk file. Unsign the file to get the ramdisk.
./rkunsign boot.img initramfs.cpio.gz
Or if the header of boot.img is “ANDROID!”, then boot.img is a signed android bootimg file. Extract ramdisk from boot.img.
./unmkbootimg boot.img
You will get three files: initramfs.cpio.gz(ramdisk), zImage(kernel), second.gz(resource).
For more info about rockchip boot sequence, visit here. - Now extract the ramdisk for modification:
gzip -d -c initramfs.cpio.gz >initramfs.cpio
mkdir ramdisk
cd ramdisk
../cpio -idv <../initramfs.cpio - Go to extracted ramdisk, open init.rk30board.rc with a text editor. Add two lines in post-fs section to load kernel modules at startup.
on post-fs
insmod /system/lib/modules/ump.ko
insmod /drmboot.ko
insmod /system/lib/modules/mali.ko
insmod /system/lib/modules/mali_kbase.ko
insmod /system/lib/modules/rk30_mirroring.ko
insmod /system/lib/modules/rk29-ipp.ko
## Add two lines here
insmod /system/lib/modules/ufsd.ko
insmod /system/lib/modules/exfat.ko
You may also want to add init.d support to ramdisk. Add these lines to the end of init.rc
service runparts /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
class main
oneshot - Now pack the ramdisk back. Go to the extracted ramdisk and run:
rm ../initramfs.cpio
find . | ../cpio -H newc -o > ../initramfs.cpio
cd ..
gzip -fn initramfs.cpio - Sign the ramdisk.
./rkcrc -k initramfs.cpio.gz boot_new.img - Flash the ramdisk into boot partition.
./rkflashtool w boot <boot_new.img
If your original boot.img is a android bootimg file, you will also need to flash kernel and resource.
./rkflashtool w kernel <zImage
./rkflashtool w resource <second.gz - Copy ufsd.ko, exfat.ko and vold into your flash drive/sdcard. Now do the rest jobs on the device side.
Connect your device to the display (if it is a tv stick) and boot into android.
Attach your flash drive/sdcard, open a file manager that supports root operations(like root explorer, ES explorer etc.).
copy ufsd.ko and exfat.ko into /system/lib/modules, set permissions to 0644.
backup /system/bin/vold to /system/bin/vold_bak, copy modified vold to /system/bin and set its permissions to 0755. - Done! Reboot now, your device should have kernel space ntfs/exfat support and automatically mount ntfs/exfat partition when attached.