I have just started taking interest in porting custom rom on an android device and it requires me to have a backup/dump of boot.img and recovery.img of my device. I have Sony Xperia E4 Dual (E2115).

Following are details about my device:

Kernel Build: 24.0.B.5.14
Processor: MT6582
Board: arima82_w_s_kk
Android Version: 4.4.4


Part_Name   Size    StartAddr   Type    MapTo
preloader    0x0000000000080000   0x0000000000000000   2   /dev/misc-sd
mbr          0x0000000000080000   0x0000000000000000   2   /dev/block/mmcblk0
ebr1         0x0000000000080000   0x0000000000080000   2   /dev/block/mmcblk0p1
pro_info     0x0000000000300000   0x0000000000100000   2   /dev/block/mmcblk0
nvram        0x0000000000500000   0x0000000000400000   2   /dev/block/mmcblk0
protect_f    0x0000000000a00000   0x0000000000900000   2   /dev/block/mmcblk0p2
protect_s    0x0000000000a00000   0x0000000001300000   2   /dev/block/mmcblk0p3
seccfg       0x0000000000020000   0x0000000001d00000   2   /dev/block/mmcblk0
uboot        0x0000000000080000   0x0000000001d20000   2   /dev/block/mmcblk0
ta           0x0000000000200000   0x0000000001da0000   2   /dev/block/mmcblk0
ltalabel     0x0000000001000000   0x0000000001fa0000   2   /dev/block/mmcblk0p4
fotakernel   0x0000000001400000   0x0000000002fa0000   2   /dev/block/mmcblk0
bootimg      0x0000000001400000   0x00000000043a0000   2   /dev/block/mmcblk0
sec_ro       0x0000000000600000   0x00000000057a0000   2   /dev/block/mmcblk0p5
misc         0x0000000000080000   0x0000000005da0000   2   /dev/block/mmcblk0
logo         0x0000000000300000   0x0000000005e20000   2   /dev/block/mmcblk0
ebr2         0x0000000000080000   0x0000000006120000   2   /dev/block/mmcblk0
expdb        0x0000000000080000   0x00000000061a0000   2   /dev/block/mmcblk0
tee1         0x0000000000080000   0x0000000006220000   2   /dev/block/mmcblk0
tee2         0x0000000000080000   0x00000000062a0000   2   /dev/block/mmcblk0
apps_log     0x0000000000800000   0x0000000006320000   2   /dev/block/mmcblk0p6
android      0x0000000083400000   0x0000000006b20000   2   /dev/block/mmcblk0p7
cache        0x000000000c800000   0x0000000089f20000   2   /dev/block/mmcblk0p8
usrdata      0x000000013a060000   0x0000000096720000   2   /dev/block/mmcblk0p9
bmtpool      0x0000000000000000   0xffffffffff3f00a8   2   /dev/block/mmcblk0
Part_Name:Partition name you should open;
Size:size of partition
StartAddr:Start Address of partition;
Type:Type of partition(MTD=1,EMMC=2)
MapTo:actual device you operate

As far as I know bootimg is what I am looking for. I converted the size and start address from hex to decimal and tried dumping it using:

dd if=/dev/block/mmcblk0 of=/sdcard/boot.img bs=4096 skip=17312 count=5210

But when I try to unpack it using unpackbootimg or other unpacking tools, I get an error stating that the boot.img is not a valid boot image. What am I missing here?

I have seen on the web that System images created using dd are not valid, but this is not the case with boot and recovery images and people have successfully dumped these partitions using this method. I am using Ubuntu and would love to know if there are other methods to achieve this.

  • Can you add the output of ls -l /dev/block/platform/*/by-name/? Apr 3 '16 at 18:22
  • @MatthewRead there is no such file or directory in my device. Apr 4 '16 at 5:00
  • Hmm maybe check if there is something similar -- find /dev -name "by-name" Apr 4 '16 at 8:23
  • echo $((0x0000000001400000/4096)) = 5120 not 5210 Mar 12 '17 at 22:35

Use this tool to pull from a PC
MTK Droid Tools Latest.zip

And for Android.. Use a backup tool like Flashify on PlayStore

Flashify PlayStore Link

and go to backups, Backup Kernel And Recovery..
Then navigate to internal storage > android > com.cgollner.flashify > files > backups And copy the files...

These files may be called boot.emmc.win and recovery.emmc.win,
These files need to be renamed to .img and they flash.. On my mtk this works...

  • I have tried MTK Droid tools from a Windows 7 virtual machine. It says " Unknown ROM structure, backup NOT possible!" Even Flashify failed in this case. :'( Apr 4 '16 at 9:05

Sony boot.img files are somehow different from what most programs, like unmkbootimg and variations of unpack-bootimg, expect them to be. I am still in the process of solving this gigantic riddle for myself. But I was able to repack boot.img from Sony format to a standard android boot.img format. Now unmkbootimg, for example, is able unmake it. Magisk is now also able to patch it to enable root.

To do that you're gonna need Android Image Kitchen

After you have it, assuming it's in the AIK-Linux folder, run sudo AIK-Linux/repackimg.sh --local <path to boot.img> on the file you got with dd. That will produce a new boot.img that can be used with unmkbootimg

Some background info

There is a certain problem with this. My phone(Sony Xperia L1) doesn't boot that. Even worse! It doesn't even boot the stock boot.img!

I have no root, so I could not use dd. I got kernel.elf(boot.img) from the firmware I downloaded with XperiFirm instead. But trying to boot it(without flashing) with fastboot doesn't work. It fails with an error: FAILED (remote: 'invalid kernel & ramdisk address: images overlap') Booting the image repacked with the Android Image Kitchen doesn't throw any errors. But my phone fails to boot it and just restarts.

P.S. I am well aware that this question is ancient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.