FORUMS
Remove All Ads from XDA

[TOOL] imgRePackerRK (RockChip's firmware images unpacker/packer)

338 posts
Thanks Meter: 234
 
By RedScorpioXDA, Senior Member on 30th April 2013, 05:01 AM
Post Reply Email Thread
24th September 2019, 08:14 PM |#331  
Junior Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by RedScorpioXDA

http://ge.tt/9ZbfbCy2

Works great! thanks a ton!
25th September 2019, 09:21 AM |#332  
OP Senior Member
Thanks Meter: 234
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

It's sha1 for the header "id" checksum, but I've seen some weird variant images which were sha256 as well on Huawei.

https://github.com/osm0sis/mkbootimg

Thanks so much.
Note that this algorithm (SHA1) does not match RockChip in V. 0. For it you need to add
Code:
  SHA_update(&ctx, &hdr->tags_addr, sizeof(hdr->tags_addr));
  SHA_update(&ctx, &hdr->page_size, sizeof(hdr->page_size));
  SHA_update(&ctx, &hdr->header_version, sizeof(hdr->header_version));
  SHA_update(&ctx, &hdr->os_version, sizeof(hdr->os_version));
  SHA_update(&ctx, &hdr->name, sizeof(hdr->name));
  SHA_update(&ctx, &hdr->cmdline, sizeof(hdr->cmdline));
The Following User Says Thank You to RedScorpioXDA For This Useful Post: [ View ] Gift RedScorpioXDA Ad-Free
27th September 2019, 08:45 AM |#333  
OP Senior Member
Thanks Meter: 234
 
Donate to Me
More
New test version http://ge.tt/4XBA1Ky2
5th October 2019, 07:37 PM |#334  
Senior Member
Thanks Meter: 249
 
Donate to Me
More
Hi

I tried to unpack the image for a95x r3 rk3318 but it seems that the system.img cannot be extracted:


imgRePackerRK.exe /2nd /rkcrc A95XR3-RK3328.img
Code:
--- Firmware unpacking ---

        2-nd layer file unpacking
        sparse image format detected
        "C:\Users\Aco\Desktop\Rockchip\imgRePackerRKa\A95XR3-RK3328.img.dump\Image\system.img" (sparse image) unpacking
        Processed blocks        = 524288
        Stored CRC32            = 0x00000000
        Calculated CRC32        = 0x9b59d6b0
        Stored and calculated CRC32 are not equal
        Probably CRC32 don't used
        Configuration file"C:\Users\Aco\Desktop\Rockchip\imgRePackerRKa\A95XR3-RK3328.img.dump\Image\system.img.cfg"
        created
        Unpacked image format: ext4 image (16)

                Ext3/Ext4 file properties:

                Size:                   2147483648
                Label:                  "/"
                Blocks count:           524288
                Reserved blocks count:  0
                Free blocks count:      60086
                Block size:             4096
                Blocks per group:       32768
                Inodes count:           131072
                Free inodes count:      127648
                Inode size:             256
                Inodes per group:       8192
                Reserved GDT blocks:    127
        "C:\Users\Aco\Desktop\Rockchip\imgRePackerRKa\A95XR3-RK3328.img.dump\Image\system.img"  unpacked
or did I do something wrong?
7th October 2019, 08:51 AM |#335  
OP Senior Member
Thanks Meter: 234
 
Donate to Me
More
Quote:
Originally Posted by acocalypso

<...>
sparse image format detected
<...>
Unpacked image format: ext4 image (16)
<...>

all unpacked (sparse -> ext4)
6th November 2019, 09:50 AM |#336  
Member
Thanks Meter: 8
 
More
How does one repack the ramdisk for boot.img using this? I'm getting an error "Can't unpack file", but the boot.img.dump file seems to have contents. Here's the result from
Code:
imgrepackerrk boot.img
Code:

        imgrepackerrk (version 1.07h_test linux)
        Rockchip firmware batch/update images unpacker/packer

        (c) RedScorpio, Moscow, 2013-2019
            [email protected]

        Detected OS:
        Ubuntu 16.04.6 LTS \n \l
        DISTRIB_ID=Ubuntu
        DISTRIB_RELEASE=16.04
        DISTRIB_CODENAME=xenial
        DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
        NAME="Ubuntu"
        VERSION="16.04.6 LTS (Xenial Xerus)"
        ID=ubuntu
        ID_LIKE=debian
        PRETTY_NAME="Ubuntu 16.04.6 LTS"
        VERSION_ID="16.04"
        HOME_URL="http://www.ubuntu.com/"
        SUPPORT_URL="http://help.ubuntu.com/"
        BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
        VERSION_CODENAME=xenial
        UBUNTU_CODENAME=xenial
        ==========================[ START ]==========================

        --- Firmware unpacking ---

        2-nd layer file unpacking
        Android boot image format detected
        "boot.img" (Android boot image) unpacking
        Image properties:
                Type    Android boot image ("ANDROID!")
                Version  = 0 (0x00000000)
                OSversion = 8.0.0/2017.10
                KernelSize = 0x012c0808
                RamdiskSize = 0x0023258c
                SecondFSize = 0x0006da00
        Kernel (boot.img.dump/kernel)   extracted
        Ramdisk (boot.img.dump/ramdisk) extracted
                "boot.img.dump/ramdisk" (gzip/cpio) unpacking
        Can't unpack file
        Second file (boot.img.dump/second)      extracted
                "boot.img.dump/second" (Rockchip resources image file) unpacking
        Image properties:
                Type: Rockchip resources image file (RSCE)
                RSCE image version      = 0 (0x0000)
                RSCE file table version = 0x0000
                Image header size       = 0x01 (512)
                File table offset       = 0x01 (512)
                File table record size  = 0x01 (512)
                File count  = 2
                "rk-kernel.dtb"         extracted (format: unknown)
                "logo.bmp"  extracted (format: bitmap image file)
                BasePath is empty
                Configuration file"boot.img.dump/second.cfg"    created
                "boot.img.dump/second"  unpacked

        Configuration file"boot.img.cfg"        created
        "boot.img"     unpacked
7th November 2019, 07:52 AM |#337  
OP Senior Member
Thanks Meter: 234
 
Donate to Me
More
Quote:
Originally Posted by Aaaron16

How does one repack the ramdisk for boot.img using this?

Linux version of imimgrepackerrk uses the built-in OS capabilities to decompress gzip/cpio files. So look for reasons on your computer.
15th November 2019, 05:38 AM |#338  
Junior Member
Thanks Meter: 0
 
More
Hi, thanks for this tool.

I am trying to unpack, modify and repack boot.img for an RK3368 device. I tested this tool by un and repacking with no modifications, but can't boot the result image, after flashing it with rkflashtool. I tried both 1.06 and 1.07h test but no luck. Any ideas what's wrong?

boot.img

Logs from unpack:
Code:
        Rockchip firmware batch/update images unpacker/packer

        (c) RedScorpio, Moscow, 2013-2019
            [email protected]

        Detected OS:
        Arch Linux \r (\l)
        LSB_VERSION=1.4
        DISTRIB_ID=Arch
        DISTRIB_RELEASE=rolling
        DISTRIB_DESCRIPTION="Arch Linux"
        NAME="Arch Linux"
        PRETTY_NAME="Arch Linux"
        ID=arch
        BUILD_ID=rolling
        ANSI_COLOR="0;36"
        HOME_URL="https://www.archlinux.org/"
        DOCUMENTATION_URL="https://wiki.archlinux.org/"
        SUPPORT_URL="https://bbs.archlinux.org/"
        BUG_REPORT_URL="https://bugs.archlinux.org/"
        LOGO=archlinux
        Ini-file created
        ==========================[ START ]==========================

        --- Firmware unpacking ---

        2-nd layer file unpacking
        Android boot image format detected
        "boot.img" (Android boot image) unpacking
        Image properties:
                Type            Android boot image ("ANDROID!")
                Version         = 0 (0x00000000)
                OSversion       = -
                KernelSize      = 0x01299ca8
                RamdiskSize     = 0x00159bc0
                SecondFSize     = 0x00067c00
        Kernel (boot.img.dump/kernel)   extracted
        Ramdisk (boot.img.dump/ramdisk) extracted
                "boot.img.dump/ramdisk" (gzip/cpio) unpacking
                Configuration file"boot.img.dump/ramdisk.cfg"   created
                "boot.img.dump/ramdisk" unpacked

        Second file (boot.img.dump/second)      extracted
                "boot.img.dump/second" (Rockchip resources image file) unpacking
        Image properties:
                Type: Rockchip resources image file (RSCE)
                RSCE image version      = 0 (0x0000)
                RSCE file table version = 0x0000
                Image header size       = 0x01 (512)
                File table offset       = 0x01 (512)
                File table record size  = 0x01 (512)
                File count              = 3
                "rk-kernel.dtb"         extracted (format: unknown)
                "logo.bmp"              extracted (format: bitmap image file)
                "logo_kernel.bmp"               extracted (format: bitmap image file)
                BasePath is empty
                Configuration file"boot.img.dump/second.cfg"    created
                "boot.img.dump/second"  unpacked

        Configuration file"boot.img.cfg"        created
        "boot.img"      unpacked
Logs from repack:
Code:
        Rockchip firmware batch/update images unpacker/packer

        (c) RedScorpio, Moscow, 2013-2019
            [email protected]

        Detected OS:
        Arch Linux \r (\l)
        LSB_VERSION=1.4
        DISTRIB_ID=Arch
        DISTRIB_RELEASE=rolling
        DISTRIB_DESCRIPTION="Arch Linux"
        NAME="Arch Linux"
        PRETTY_NAME="Arch Linux"
        ID=arch
        BUILD_ID=rolling
        ANSI_COLOR="0;36"
        HOME_URL="https://www.archlinux.org/"
        DOCUMENTATION_URL="https://wiki.archlinux.org/"
        SUPPORT_URL="https://bbs.archlinux.org/"
        BUG_REPORT_URL="https://bugs.archlinux.org/"
        LOGO=archlinux
        ==========================[ START ]==========================

        --- Firmware creating ---

        2-nd layer file packing
        Configuration file (boot.img.cfg) found
        "boot.img" (Android boot image) packing
        Kernel (boot.img.dump/kernel)   found
                Configuration file (boot.img.dump/ramdisk.cfg) found
                "boot.img.dump/ramdisk" (gzip/cpio) packing
6155 blocks
                "boot.img.dump/ramdisk" packed
        Ramdisk (boot.img.dump/ramdisk) found
                Configuration file (boot.img.dump/second.cfg) found
                "boot.img.dump/second.dump/rk-kernel.dtb" (232916)      found
                "boot.img.dump/second.dump/logo.bmp" (170326)   found
                "boot.img.dump/second.dump/logo_kernel.bmp" (19160)     found

        Image properties:
                Type: Rockchip resources image file (RSCE)
                RSCE image version      = 0 (0x0000)
                RSCE file table version = 0x0000
                Image header size       = 0x01 (512)
                File table offset       = 0x01 (512)
                File table record size  = 0x01 (512)
                File count              = 3
                "rk-kernel.dtb"         injected (format: unknown)
                "logo.bmp"              injected (format: bitmap image file)
                "logo_kernel.bmp"               injected (format: bitmap image file)
        Second file (boot.img.dump/second)      found
        Kernel (boot.img.dump/kernel)   injected
        Ramdisk (boot.img.dump/ramdisk) injected
        Second file (boot.img.dump/second)      injected
        SHA check summ injected
        Image properties:
                Type            Android boot image ("ANDROID!")
                Version         = 0 (0x00000000)
                OSversion       = -
                KernelSize      = 0x01299ca8
                RamdiskSize     = 0x0015b604
                SecondFSize     = 0x00067c00
18th November 2019, 09:40 AM |#339  
OP Senior Member
Thanks Meter: 234
 
Donate to Me
More
Quote:
Originally Posted by d788873

<...>
I tested this tool by un and repacking with no modifications, but can't boot the result image, after flashing it with rkflashtool. I tried both 1.06 and 1.07h test but no luck. Any ideas what's wrong?
<...>

I downloaded the ro6hc5.img and did a control repacking. The only difference with simple repacking is the length change (apparently you just copied the entire partition, so the file is longer)

Quote:
Originally Posted by d788873

<...> modify and repack <...> Any ideas what's wrong?

I think - this is the cause of the problem
Post Reply Subscribe to Thread

Tags
rockchip unpacker

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes