[Upgrading, Modifying and Unlocking] debugasm:
Possible inconsistency in repack same image ...

First of all thanks RedScorpioXDA for your magnificent tool ... :good:

I'm trying to do experiments on RockChip's firmware images for Minix NEO x7. During some tests I ran into a problem a little strange. In my first test I have used "imgRePackerRK Vers. 104" for manipulating my image. With this tool after unpack and pack the same firmware, during send image with "RKBatchTool" the sysfile it is never sent. You can clearly see why the upload takes only a few seconds instead of one minute or more, cause of the file system of almost 1 Gbyte. I imagine then that there is some problem on the image although perfectly loaded by the software "RKBatchTool".

Yesterday I downloaded the new software "imgRePackerRK Vers. 105", Using this software the problem has disappeared. Now upload it occurs completely successfully.

Then I asked myself why and I did this little test:

Downloaded files dx05_nand_ubuntu_1.1.1.7z

With "imgRePackerRK Vers. 105" I have unpack with this command "imgRePackerRK.exe /log dx05_nand_ubuntu_1.1.1.img"

imgRepackerRK (v. 1.05 windows)
(c) RedScorpio, Moscow, 2013-2015

Command parameters: "/log" "dx05_nand_ubuntu_1.1.1.img"

Run parameters:
log = 1
debug = 0
quiet = 0
mono = 0
md5 = 0
rkcrc = 0
rkaf = 0
skip = 0
2nd = 0
cid = 0
symb = 0
memsize = 134217728
basecfgpath = ""
loadername = ""

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

--- Firmware unpacking ---

"RKFW" image file detected

Batch image header from "dx05_nand_ubuntu_1.1.1.img" was read
Image properties:
Type	RockChip batch image (RKFW)
Version	1.1.0
Date	2013.09.05
Time	16:39:56
ChipID	0x00000070
Code(?)	0x01050000

-- boot.img processing --

-- update.img processing --
Update data header from "dx05_nand_ubuntu_1.1.1.img" was read
Image properties:
Type	RockChip update image (RKAF)
Id	"007"
Model	"rk30sdk"
Manufacturer	"RK30SDK"
Version	1.1.0

- Files extracting -
Image files count = 9

package-file (package-file)	extracted (format: unknown)
bootloader (RK3188Loader(L)_V1.20.bin)	extracted (format: RockChip bootloader image)
PARM file (parameter) found
parameter (parameter)	extracted (format: RockChip PARM signed file)
"dx05_nand_ubuntu_1.1.1.img.dump\parameter"	extracted
misc (../images/misc.img)	extracted (format: unknown)
KRNL file (images\kernel.img) found
kernel (../images/kernel.img)	extracted (format: RockChip KRNL signed file)
"dx05_nand_ubuntu_1.1.1.img.dump\images\kernel.img"	extracted
KRNL file (images\boot.img) found
boot (../images/boot.img)	extracted (format: RockChip KRNL signed file)
"dx05_nand_ubuntu_1.1.1.img.dump\images\boot.img"	extracted
linux (../images/ubuntu.img)	extracted (format: ext4 image)
update-script (update-script)	extracted (format: unknown)
recover-script (recover-script)	extracted (format: unknown)

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

Configuration file for RKAndroidTool v.1.xx (8-bit) created
Configuration file for RKAndroidTool v.2.xx (16-bit) created

- md5 summ checking -
MD5 summ (dx05_nand_ubuntu_1.1.1.img.dump\image.md5)	saved
Stored MD5	= "65a22c5e0d90718188b977737e3bc24b"
Calculated MD5	= "65a22c5e0d90718188b977737e3bc24b"

- image.cfg creating -
image.cfg created

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

Now I pack without any change with this command "imgRePackerRK.exe /log dx05_nand_ubuntu_1.1.1.img.dump"

imgRepackerRK (v. 1.05 windows)
(c) RedScorpio, Moscow, 2013-2015

Command parameters: "/log" "dx05_nand_ubuntu_1.1.1.img.dump"

Run parameters:
log = 1
debug = 0
quiet = 0
mono = 0
md5 = 0
rkcrc = 0
rkaf = 0
skip = 0
2nd = 0
cid = 0
symb = 0
memsize = 134217728
basecfgpath = ""
loadername = ""

==========================[ 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)_V1.20.bin)	checked
parameter (parameter)	checked (file size = 0x000001ba, partition size = 0x00400000)
misc (../images/misc.img)	checked (file size = 0x0000c000, partition size = 0x00400000)
kernel (../images/kernel.img)	checked (file size = 0x0024c77c, partition size = 0x01000000)
boot (../images/boot.img)	checked (file size = 0x001409cd, partition size = 0x01000000)
linux (../images/ubuntu.img)	checked (file size = 0x0c9ad000, partition size = 0xfffffc00)
update-script (update-script)	checked
recover-script (recover-script)	checked

-- Injecting into "dx05_nand_ubuntu_1.1.1.img" --
- Image header (RKFW) injecting -
Image properties:
Type	RockChip batch image (RKFW)
Version	1.1.0
Date	2013.09.05
Time	16:39:56
ChipID	0x00000070
Code(?)	0x01050000

Image header injected

- boot.img injecting -
boot.img (RK3188Loader(L)_V1.20.bin)	injected

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

update.img header injected

- Files injecting -
Image files count = 9

package-file (unknown)	injected
bootloader (RockChip bootloader image)	injected
"dx05_nand_ubuntu_1.1.1.img.dump\parameter.parm"	signed
parameter (RockChip PARM signed file)	injected
misc (unknown)	injected
"dx05_nand_ubuntu_1.1.1.img.dump\images\kernel.img.krnl"	signed
kernel (RockChip KRNL signed file)	injected
"dx05_nand_ubuntu_1.1.1.img.dump\images\boot.img.krnl"	signed
boot (RockChip KRNL signed file)	injected
linux (ext4 image)	injected
update-script (unknown)	injected
recover-script (unknown)	injected

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

- MD5 check summ injecting -
MD5	= "9716e45512b2374a3a0de65df4949974"
MD5 check summ injected

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

As you can see the image is different, is well known thanks to the MD5 signature

Original MD5 (unpak) = "65a22c5e0d90718188b977737e3bc24b"
Nuovo MD5 (pack) = "9716e45512b2374a3a0de65df4949974"

Performing a search of the differences in RAW mode are observed :

Original file :

0002FD20 2E 2E 2F 69 6D 61 67 65 73 2F 75 62 75 6E 74 75 ../images/ubuntu
0002FD30 2E 69 6D 67 00 00 00 00 00 00 00 00 00 00 00 00 .img............
0002FD40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD50 00 00 00 00 00 00 00 00 00 00 00 00[COLOR="Red"] 00 00 00 00[/COLOR] ................
0002FD60 00 B0 3C 00 00 40 11 00 00 D0 9A 0C 00 D0 9A 0C ..<..@..........
0002FD70 75 70 64 61 74 65 2D 73 63 72 69 70 74 00 00 00 update-script...
0002FD80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Repacked file :

0002FD20 2E 2E 2F 69 6D 61 67 65 73 2F 75 62 75 6E 74 75 ../images/ubuntu
0002FD30 2E 69 6D 67 00 00 00 00 00 00 00 00 00 00 00 00 .img............
0002FD40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD50 00 00 00 00 00 00 00 00 00 00 00 00 [COLOR="Red"]FE FF FF FF[/COLOR] ................
0002FD60 00 B0 3C 00 00 40 11 00 00 D0 9A 0C 00 D0 9A 0C ..<..@..........
0002FD70 75 70 64 61 74 65 2D 73 63 72 69 70 74 00 00 00 update-script...
0002FD80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

At address 0x0002FD5C...0x0002FD5F there are differences.

Naturally, even in the bottom of the file there are differences, which concern

inserting check MD5:

Original file:

0CDA89C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0CDA89D0 00 00 00 00 52 9D 5F 46 36 35 61 32 32 63 35 65 ....R._F65a22c5e
0CDA89E0 30 64 39 30 37 31 38 31 38 38 62 39 37 37 37 33 0d90718188b97773
0CDA89F0 37 65 33 62 63 32 34 62 7e3bc24b

Repacked file :

0CDA89C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0CDA89D0 00 00 00 00 1B 8D 75 F7 39 37 31 36 65 34 35 35 ......u.9716e455
0CDA89E0 31 32 62 32 33 37 34 61 33 61 30 64 65 36 35 64 12b2374a3a0de65d
0CDA89F0 66 34 39 34 39 39 37 34 f4949974

What interests us most is that the "payload" of the image is right.

With the software version "imgRePackerRK Vers. 104" you get something

different and this does not work at all:

Original file :

0002FD30 2E 69 6D 67 00 00 00 00 00 00 00 00 00 00 00 00 .img............
0002FD40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD60 00 B0 3C 00 [COLOR="Red"]00 40 11 00[/COLOR] 00 D0 9A 0C 00 D0 9A 0C ..<..@..........
0002FD70 75 70 64 61 74 65 2D 73 63 72 69 70 74 00 00 00 update-script...
0002FD80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD90 75 70 64 61 74 65 2D 73 63 72 69 70 74 00 00 00 update-script...

Repacked file :

0002FD30 2E 69 6D 67 00 00 00 00 00 00 00 00 00 00 00 00 .img............
0002FD40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD60 00 B0 3C 00 [COLOR="Red"]FF FF FF FF[/COLOR] 00 D0 9A 0C 00 D0 9A 0C ..<.............
0002FD70 75 70 64 61 74 65 2D 73 63 72 69 70 74 00 00 00 update-script...
0002FD80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0002FD90 75 70 64 61 74 65 2D 73 63 72 69 70 74 00 00 00 update-script...

At address 0x0002FD614...0x0002FD67 there are differences.

My question: the difference in the image (excluding MD5) is normal? Is there a BUG?

Thanks very much

debugasm