Share, , Google Plus, Pinterest,

Print

Posted in:

Android – How To Unpack Rikomagic Firmware

Probably most of you out there already heard about Rikomagic, the Android based mini PC devices. Well i’ve been working with these Android devices for a while now and decided to share some of my knowledge about it with you all.

This post is about Unpacking and Re-Packing Rikomagic Official Firmware.

Why would you Unpack Rikomagic Firmware?

I am working on a project that includes administering Rikomagic Android devices. As a System Engineer assigned to keep my hands on the Android operating system, and of course i had to make some changes to the official Android Rikomagic Firmwares.

To do this, we need to unpack the initial .img file downloaded from official Rikomagic Firmware downloads site.

The following guide provides information about  Unpaking and Re-Packing Rikomagic Firmwares on:

  • Linux machines
  • Windows machines
Android - How To Unpack Rikomagic Firmware
Android – How To Unpack Rikomagic Firmware

Download Software to Unpack Rikomagic Firmware

First we need to download the Unpack Rikomagic Firmware Software which is called “imgRePackerRK”.

Click HERE to download the “imgRePackerRK” 1.04 version which supports Windows and Linux or jump to XDA Developers forum and see if a newer version exists.

After downloading the “imgRePackerRK” unzip it to the desired directory.

There are 5 files in the archive:

[geekpeek@localhost imgRePackerRK_104]$ ll
total 300
-rw-rw-r-- 1 geekpeek geekpeek  74456 Feb 17  2014 imgrepackerrk
-rw-rw-r-- 1 geekpeek geekpeek 106496 Feb 17  2014 imgRePackerRK.exe
-rw-rw-r-- 1 geekpeek geekpeek    131 Nov 28 12:59 imgrepackerrk.ini
-rw-rw-r-- 1 geekpeek geekpeek   5743 Feb 17  2014 ReadMe.txt
-rw-rw-r-- 1 geekpeek geekpeek 107520 May 13  2013 zlib1.dll

imgrepackerrk – Unpacking and re-packing script. Use this file if you are running Linux, make sure you make it executable before running it.

imgRePackerRK.exe -Unpacking and re-packing script. Use this file if you are running Windows.

Unpack Rikomagic Firmware

For the following example we will download the latest MK802IV (MK802IV Android 4.4 software(140526) from Rikomagic official download site and unzip it.

Unpack Rikomagic Firmware On Linux

Since we are on Linux, we will be using Linux console for the following steps.

After unzipping “MK802 IV_4.4_AP_0526.zip” file a new folder was created called “MK802 IV_4.4_AP_0526” and another folder with the same name “MK802 IV_4.4_AP_0526” in it.

Move into that folder so we see the following three files:

[geekpeek@localhost MK802 IV_4.4_AP_0526]$ ll
total 527752
-rwxr-xr-x 1 geekpeek geekpeek 537516504 May 26  2014 4.4_MK802IV_AP6210_20140526.img
-rwxr-xr-x 1 geekpeek geekpeek    582175 Apr 21  2014 BatchTool V1.7.zip
-rwxr-xr-x 1 geekpeek geekpeek   2307584 Feb 25  2014 how to recovery,update IIIS and IV.doc

The firmware file is called “4.4_MK802IV_AP6210_20140526.img” and this is the one we will be unpacking.

While we’re in the directory where firmware file resides we need to call the “imgrepackerrk” command and point it to the firmware file.

Please note that “imgrepackerrk” must be executable!

[geekpeek@localhost MK802 IV_4.4_AP_0526]$ ~/VMShare/imgRePackerRK_104/imgrepackerrk 4.4_MK802IV_AP6210_20140526.img 

	imgRePackerRK (version 1.04 linux)
	Rockchip firmware batch image unpacker/packer

	(c) RedScorpio, Moscow, 2013-2014
	    RedScorpio@land.ru

	==========================[ START ]==========================
	
	--- Firmware unpacking ---
	
	"RKFW" image file detected
	
	Image properties:
		Type		RockChip batch image (RKFW)
		Version		4.4.2
		Date		2014.05.26
		Time		11:17:00
		ChipID		0x00000070
		Code(?)		0x01060000
	
	-- boot.img processing --
	
	-- update.img processing --
	Image properties:
		Type		RockChip update image (RKAF)
		Id		"007"
		Model		"rk3188"
		Manufacturer	"RK30SDK"
		Version		4.4.2
	
	- Files extracting -
	Image files count = 11
	
	package-file (package-file)		extracted (format: unknown)
	bootloader (RK3188Loader(L)_V2.13.bin)		extracted (format: RockChip bootloader image)
	parameter (parameter)		extracted (format: RockChip PARM signed file)
	misc (Image/misc.img)		extracted (format: unknown)
	kernel (Image/kernel.img)		extracted (format: RockChip KRNL signed file)
	boot (Image/boot.img)		extracted (format: Android boot image)
	recovery (Image/recovery.img)		extracted (format: Android boot image)
	system (Image/system.img)		extracted (format: ext4 image)
	backup (SELF)	skipped
	update-script (update-script)		extracted (format: unknown)
	recover-script (recover-script)		extracted (format: unknown)
	
	- rkCRC summ of update.img checking -
	Stored rkCRC		= 0xed3470cc
	Calculated rkCRC	= 0xed3470cc
	
	- md5 summ checking -
	MD5 summ (4.4_MK802IV_AP6210_20140526.img.dump/image.md5)		saved
	Stored MD5		= "f282c36b99d8f253d59408210e42e525"
	Calculated MD5		= "f282c36b99d8f253d59408210e42e525"
	
	- image.cfg creating -
	image.cfg created
	
	==========================[ STOP  ]==========================

Voila, we have successfully Unpacked Rikomagic Firmware!

If we take a look on the filesystem we can see the new directory called “4.4_MK802IV_AP6210_20140526.img.dump” which holds all of the files we need!

[geekpeek@localhost MK802 IV_4.4_AP_0526]$ ll 4.4_MK802IV_AP6210_20140526.img.dump
total 228
drwxrwxr-x 2 geekpeek geekpeek   4096 Nov 28 13:27 Image
-rw-rw-r-- 1 geekpeek geekpeek    325 Nov 28 13:27 image.cfg
-rw-rw-r-- 1 geekpeek geekpeek     32 Nov 28 13:27 image.md5
-rw-rw-r-- 1 geekpeek geekpeek    594 Nov 28 13:27 package-file
-rw-rw-r-- 1 geekpeek geekpeek    633 Nov 28 13:27 parameter
-rw-rw-r-- 1 geekpeek geekpeek    266 Nov 28 13:27 recover-script
-rw-rw-r-- 1 geekpeek geekpeek 201038 Nov 28 13:27 RK3188Loader(L)_V2.13.bin
-rw-rw-r-- 1 geekpeek geekpeek    933 Nov 28 13:27 update-script
[geekpeek@localhost MK802 IV_4.4_AP_0526]$ ll 4.4_MK802IV_AP6210_20140526.img.dump/Image/
total 524512
-rw-rw-r-- 1 geekpeek geekpeek  10338304 Nov 28 13:27 boot.img
-rw-rw-r-- 1 geekpeek geekpeek   9179172 Nov 28 13:27 kernel.img
-rw-rw-r-- 1 geekpeek geekpeek     49152 Nov 28 13:27 misc.img
-rw-rw-r-- 1 geekpeek geekpeek  13385728 Nov 28 13:27 recovery.img
-rw-rw-r-- 1 geekpeek geekpeek 504139776 Nov 28 13:27 system.img

Unpack Rikomagic Firmware On Windows

I like working from console in Windows too, so i am using great software called MobaXterm to come a bit closer to Linux console on Windows.

The process is the pretty much the same as on Linux so i will be copy/pasting most of this stuff.

After unzipping “MK802 IV_4.4_AP_0526.zip” file a new folder was created called “MK802 IV_4.4_AP_0526” and in that folder another folder with the same name “MK802 IV_4.4_AP_0526”.

Move to the folder so we see the following three files:

[GeekUser.GeekPeek] ➤ ll
total 263876
-rw-r--r--    1 GeekUser GeekPeek 537516504 May 26  2014 4.4_MK802IV_AP6210_20140526.img
-rw-r--r--    1 GeekUser GeekPeek    582175 Apr 21  2014 BatchTool V1.7.zip
-rw-r--r--    1 GeekUser GeekPeek   2307584 Feb 25  2014 how to recovery,update IIIS and IV.doc

Again, the firmware file is called “4.4_MK802IV_AP6210_20140526.img” and this is the one we will be unpacking.

While we’re in the directory where firmware file resides we need to call the “imgRePackerRK.exe” command and point it to the firmware file.

[GeekUser.GeekPeek] ➤ ~/MyDocuments/imgRePackerRK_104/imgRePackerRK.exe 4.4_MK802IV_AP6210_20140526.img

        imgRePackerRK (version 1.04 windows)
        Rockchip firmware batch image unpacker/packer

        (c) RedScorpio, Moscow, 2013-2014
            RedScorpio@land.ru

        ==========================[ START ]==========================

        --- Firmware unpacking ---

        "RKFW" image file detected

        Image properties:
                Type            RockChip batch image (RKFW)
                Version         4.4.2
                Date            2014.05.26
                Time            11:17:00
                ChipID          0x00000070
                Code(?)         0x01060000

        -- boot.img processing --

        -- update.img processing --
        Image properties:
                Type            RockChip update image (RKAF)
                Id              "007"
                Model           "rk3188"
                Manufacturer    "RK30SDK"
                Version         4.4.2

        - Files extracting -
        Image files count = 11

        package-file (package-file)             extracted (format: unknown)
        bootloader (RK3188Loader(L)_V2.13.bin)          extracted (format: RockChip bootloader image)
        parameter (parameter)           extracted (format: RockChip PARM signed file)
        misc (Image/misc.img)           extracted (format: unknown)
        kernel (Image/kernel.img)               extracted (format: RockChip KRNL signed file)
        boot (Image/boot.img)           extracted (format: Android boot image)
        recovery (Image/recovery.img)           extracted (format: Android boot image)
        system (Image/system.img)               extracted (format: ext4 image)
        backup (SELF)   skipped
        update-script (update-script)           extracted (format: unknown)
        recover-script (recover-script)         extracted (format: unknown)

        - rkCRC summ of update.img checking -
        Stored rkCRC            = 0xed3470cc
        Calculated rkCRC        = 0xed3470cc

        - md5 summ checking -
        MD5 summ (4.4_MK802IV_AP6210_20140526.img.dumpimage.md5)               saved
        Stored MD5              = "f282c36b99d8f253d59408210e42e525"
        Calculated MD5          = "f282c36b99d8f253d59408210e42e525"

        - image.cfg creating -
        image.cfg created

        ==========================[ STOP  ]==========================

Voila, we successfully Unpacked Rikomagic Firmware even on Windows 🙂

Re-Pack Rikomagic Firmware

When re-packing Rikomagic Firmware the process is the same as with unpacking, we just need to be pointing to the .dump directory.

Again re-packing is possible on a Linux or Windows machine.

Re-Pack Rikomagic Firmware On Linux

After making the desired changes to Rikomagic Firmware files we need to pack it all together again to get an .img file which we can use with BatchTool to flash the Rikomagic device.

Let’s move to the folder where .dump directory called “4.4_MK802IV_AP6210_20140526.img.dump” from previous unpacking step exists.

[geekpeek@localhost MK802 IV_4.4_AP_0526]$ ll
total 527756
-rwxr-xr-x 1 geekpeek geekpeek 537516504 May 26  2014 4.4_MK802IV_AP6210_20140526.img
drwxrwxr-x 3 geekpeek geekpeek      4096 Nov 28 13:39 4.4_MK802IV_AP6210_20140526.img.dump
-rwxr-xr-x 1 geekpeek geekpeek    582175 Apr 21  2014 BatchTool V1.7.zip
-rwxr-xr-x 1 geekpeek geekpeek   2307584 Feb 25  2014 how to recovery,update IIIS and IV.doc

If you want, you can rename the existing “4.4_MK802IV_AP6210_20140526.img” to your liking since re-packing Rikomagic Firmware will create a new .img file and this one will be renamed to .bak.

The next step is to call the “imgrepackerrk” command and point it to the “4.4_MK802IV_AP6210_20140526.img.dump” directory.

PLEASE DISCARD the last “/” when pointing to the .dump directory!

[geekpeek@localhost MK802 IV_4.4_AP_0526]$ ~/Download/imgRePackerRK_104/imgrepackerrk 4.4_MK802IV_AP6210_20140526.img.dump

	imgRePackerRK (version 1.04 linux)
	Rockchip firmware batch image unpacker/packer

	(c) RedScorpio, Moscow, 2013-2014
	    RedScorpio@land.ru

	==========================[ START ]==========================
	
	--- Firmware creating ---
	
	- "package-file" configuration file reading -
	"package-file" was read
	
	- "parameter" configuration file reading -
	"parameter" was read
	
	- "image.cfg"  configuration file reading -
	image.cfg was read
	
	- Files checking -
	package-file (package-file)		checked
	bootloader (RK3188Loader(L)_V2.13.bin)		checked
	parameter (parameter)		checked
	misc (Image/misc.img)		checked
	kernel (Image/kernel.img)		checked
	boot (Image/boot.img)		checked
	recovery (Image/recovery.img)		checked
	system (Image/system.img)		checked
	backup (SELF)	skipped
	update-script (update-script)		checked
	recover-script (recover-script)		checked
	
	-- Injecting into "4.4_MK802IV_AP6210_20140526.img" --
	- Image header (RKFW) injecting -
	Image properties:
		Type		RockChip batch image (RKFW)
		Version		4.4.2
		Date		2014.05.26
		Time		11:17:00
		ChipID		0x00000070
		Code(?)		0x01060000
	
	Image header injected
	
	- boot.img injecting -
	boot.img (RK3188Loader(L)_V2.13.bin)		injected
		
	- update.img header (RKAF) injecting -
	Image properties:
		Type		RockChip update image (RKAF)
		Id		"007"
		Model		"rk3188"
		Manufacturer	"RK30SDK"
		Version		4.4.2
	
	update.img header injected
	
	- Files injecting -
	Image files count = 11
	
	package-file (unknown)		injected
	bootloader (RockChip bootloader image)		injected
	parameter (RockChip PARM signed file)		injected
	misc (unknown)		injected
	kernel (RockChip KRNL signed file)		injected
	boot (Android boot image)		injected
	recovery (Android boot image)		injected
	system (ext4 image)		injected
	backup			skipped
	update-script (unknown)		injected
	recover-script (unknown)		injected
	
	- rkCRC check summ of update.img injecting -
		rkCRC	= 0x80fba42e
	rkCRC check summ injected
	
	- MD5 check summ injecting -
		MD5	= "13bb3a7d7a22c98aa7cf8212495e7d6a"
	MD5 check summ injected
	
	==========================[ STOP  ]==========================

… and a new Rokchip Firmware file was created!

Now you can use this .img file with BatchTool to flash your Rikomagic device.

Re-Pack Rikomagic Firmware On Windows

Again i am using MobaXterm console to re-pack Rikomagic Firmware image.

Move to the folder where .dump directory called “4.4_MK802IV_AP6210_20140526.img.dump” from previous unpacking step exists and call the “imgRePackerRK.exe” command to point it to the .dump file.

[GeekUser.GeekPeek] ➤ ~/MyDocuments/imgRePackerRK_104/imgRePackerRK.exe 4.4_MK802IV_AP6210_20140526.img.dump

        imgRePackerRK (version 1.04 windows)
        Rockchip firmware batch image unpacker/packer

        (c) RedScorpio, Moscow, 2013-2014
            RedScorpio@land.ru

        ==========================[ START ]==========================

        --- Firmware creating ---

        - "package-file" configuration file reading -
        "package-file" was read

        - "parameter" configuration file reading -
        "parameter" was read

        - "image.cfg"  configuration file reading -
        image.cfg was read

        - Files checking -
        package-file (package-file)             checked
        bootloader (RK3188Loader(L)_V2.13.bin)          checked
        parameter (parameter)           checked
        misc (Image/misc.img)           checked
        kernel (Image/kernel.img)               checked
        boot (Image/boot.img)           checked
        recovery (Image/recovery.img)           checked
        system (Image/system.img)               checked
        backup (SELF)   skipped
        update-script (update-script)           checked
        recover-script (recover-script)         checked

        -- Injecting into "4.4_MK802IV_AP6210_20140526.img" --
        - Image header (RKFW) injecting -
        Image properties:
                Type            RockChip batch image (RKFW)
                Version         4.4.2
                Date            2014.05.26
                Time            11:17:00
                ChipID          0x00000070
                Code(?)         0x01060000

        Image header injected

        - boot.img injecting -
        boot.img (RK3188Loader(L)_V2.13.bin)            injected

        - update.img header (RKAF) injecting -
        Image properties:
                Type            RockChip update image (RKAF)
                Id              "007"
                Model           "rk3188"
                Manufacturer    "RK30SDK"
                Version         4.4.2

        update.img header injected

        - Files injecting -
        Image files count = 11

        package-file (unknown)          injected
        bootloader (RockChip bootloader image)          injected
        parameter (RockChip PARM signed file)           injected
        misc (unknown)          injected
        kernel (RockChip KRNL signed file)              injected
        boot (Android boot image)               injected
        recovery (Android boot image)           injected
        system (ext4 image)             injected
        backup                  skipped
        update-script (unknown)         injected
        recover-script (unknown)                injected

        - rkCRC check summ of update.img injecting -
                rkCRC   = 0x80fba42e
        rkCRC check summ injected

        - MD5 check summ injecting -
                MD5     = "13bb3a7d7a22c98aa7cf8212495e7d6a"
        MD5 check summ injected

        ==========================[ STOP  ]==========================

This is the end of my post on Unpack Rikomagic Firmware.

In the next few posts, i will write how to start customizing official Rikomagic Firmware so stay tuned if you want to learn something new!