[GUIDE][HOW-TO]Extracting A 'boot.img' From An FTF

Search This thread

matt4321

Retired Senior Moderator - The Real Matt
Dec 20, 2011
4,000
6,240
30
Reading, UK
This is compatible with a wide variety of Xperia Devices

A guide bought to you by matt4321 and DaRk-L0rD​

Here I am going to show you how to get the boot.img (kernel) out of an FTF! This procedure is most useful for Locked Bootloaders as it means we can upgrade without the need for FlashTool!

This guide assumes that you have FlashTool installed on your PC

#############################​

Step 1:

You need a file extractor such as WinRar or 7zip.

Once this is done you want to open the whole FTF in the extractor. You will see a lot of .sin files!

The one we want is 'kernel.sin', not 'fotakernel.sin'.

Extract that file to somewhere appropriate on your computer, like the desktop!

2yvmck3.png


#############################​


Step 2:

Now you need to open FlashTool,

At the top you will see a tab that says 'Tools', click on that and select 'SIN Editor'. You will see a button that has 3 dots in the top right. This is the browse button, click on it and locate where your SIN file is.

One that is done, you need to click on 'Dump Data'.

This will dump the 'kernel.elf' to the same location of where your 'kernel.sin' is.

73gdx2.png



#############################​


Step 3:

The next part is simple,

All you need to do is rename your 'kernel.elf' to 'boot.img' and put it in a flashable zip, to make the flashable zip follow the instructions by @DaRk-L0rD in the 2nd post!

Keep in mind that the kernel should be 20mb.

v33zq0.jpg



#############################​


Step 4:

Enjoy! The kernel can be flashed via PhilZ for Locked Bootloaders and will work on both Locked and Unlocked bootloaders, since it is an official kernel it is signed by the Sony key so will be fine for Locked Bootloaders.
 
Last edited:

DaRk-L0rD

Senior Member
Sep 29, 2012
2,139
5,462
Isla Muerta
If you want to make a kernel's flashable zip

What you need:
1. winrar
2. Notepad++
3. The attachment: View attachment META-INF.rar
4. boot.img or kernel.elf


Procedure:

1. Extract the META-INF folder from the rar archive previously downloaded.

2. Open it and go META-INF -> google -> android and using Notepad++ edit the updater-script (right click on it and choose open with Notepad++).

3. Now you can see that the updater-script looks like this:

23lb993.png


4. The line package_extract_file("boot.img", "/dev/block/mmcblkXXX"); should be edited ONLY for 2 reasons.

  • In case you have a kernel.elf (custom kernels) instead of a boot.img
  • To edit the mmcblkXXX partition since it's different for each device

5. At the end of this post you will find a list of the /mmcblkXXX . For each device are different to choose wisely!!

In my case is the /mmcblk0p4, so will look like this:

28hoi8w.png


6. ui_print(""); , inside the " " you can add the text what you want. Remember that all the users will use this zip will be able to see what you wrote, so please be polite :p :p

For example:

ui_print("Installing the kernel");
ui_print("matt4321");
ui_print("DaRk-L0rD");
ui_print("");
package_extract_file("boot.img", "/dev/block/mmcblk0p4");
ui_print("Enjoy");
ui_print("Hit the thanks button");

----------------In case the kernel's format is kernel.elf, you can change the line and make it look like this: ----------------

package_extract_file("kernel.elf", "/dev/block/mmcblk0p4"); (as i said you before, the partition is my case is mmcblk0p4)


Also, make sure that you leave an empty line at the end of the commands (as you can see the line number 8 is empty).

6. Now select the META-INF folder and the boot.img or the kernel.elf file, right click on them and select Add to archive.

7. Make sure that the Archive format is ZIP and the Compression method is Store

8. Now your flashable zip is ready!

9. Enjoy



List of /mmcblkXXX

Each device has different partition for the kernel. Here is a list of those we found so far:

  • Xperia SP ---- /dev/block/mmcblk0p4
  • Xperia T---- /dev/block/mmcblk0p4
  • Xperia V---- /dev/block/mmcblk0p4
  • Xperia TX---- /dev/block/mmcblk0p4
  • Xperia Z1---- /dev/block/mmcblk0p14
  • Xperia E---- /dev/block/mmcblk0p3
  • Xperia Tipo---- /dev/block/mmcblk0p3
  • Xperia S---- /dev/block/mmcblk0p3
  • Xperia Ion---- /dev/block/mmcblk0p3

Since we don't know all devices' partition, you should give us a hand.
Here is what you have to do:


Procedure:

via adb shell

ls -l /dev/block/platform/

then pick the top one (in my case is msm_sdcc.1), so

ls -l /dev/block/platform/msm_sdcc.1/by-name

Then which ever says 'kernel' is the one we want.
 
Last edited:

Rizal Lovins

Recognized Developer / Themer / Inactive RC
May 30, 2012
1,618
15,948
Bandung
LG V30
Could you give us a hand with the right/correct/total mate? :)
We tested all this in different Xperia devices and never had issues and that's why we made the tutorial.

Reiterating what DaRk-L0rD said, what can we change/how can we make it better?

Sent from my LT30p using Tapatalk

btw you can still use with this script :

Code:
package_extract_file("kernel.elf", "/dev/block/platform/msm_sdcc.1/by-name/Kernel");

Code:
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/Kernel");

you don't need to change compressed zip to store, normal is work :)
 
  • Like
Reactions: mrhnet and hussein1

ibanez7

Senior Member
Mar 30, 2012
1,232
6,228
Bandung
This guide is very simple and very interesting, especially for locked bootloader users, but with just "rename" it would not cause a very high risk? ...
sorry with my question (just want to make sure :D), because I know about kernel on Xperia devices that are quite complicated (unlike the Galaxy device)

btw, thank for the very simple guide, this is very useful, especially for my rom ;)
 

matt4321

Retired Senior Moderator - The Real Matt
Dec 20, 2011
4,000
6,240
30
Reading, UK
This guide is very simple and very interesting, especially for locked bootloader users, but with just "rename" it would not cause a very high risk? ...
sorry with my question (just want to make sure :D), because I know about kernel on Xperia devices that are quite complicated (unlike the Galaxy device)

btw, thank for the very simple guide, this is very useful, especially for my rom ;)

It's the method I have used for countless firmwares on the T, have done it for the V and TX as well. renaming it isn't totally necessary afaik, people are just more comfortable with the thought of a boot.img rather than a kernel.elf
 

osamaanjum

Member
Jan 22, 2014
28
7
Paris
New possibilities

Will this open up the possibility of upgrading android beyond 4.1.2 on locked bootloader on Xperia S and Ion?
 

kingvortex

Senior Member
Mar 25, 2010
5,042
3,967
Will this open up the possibility of upgrading android beyond 4.1.2 on locked bootloader on Xperia S and Ion?

I don't think so, as it's just a method of flashing a stock kernel via recovery instead of using Flashtool. It will not allow modified/custom kernels to run on a device with a locked bootloader.

Sent from my C6603 using Tapatalk
 
  • Like
Reactions: Webster101

matt4321

Retired Senior Moderator - The Real Matt
Dec 20, 2011
4,000
6,240
30
Reading, UK
Will this open up the possibility of upgrading android beyond 4.1.2 on locked bootloader on Xperia S and Ion?

It just allows locked bootloaders to flash a kernel via a locked bootloader recovery. It helps for people to update without the need for flashtool

Sent from my LT30p using Tapatalk
 

RochiWizz

Senior Member
Mar 7, 2009
116
23
no /dev/block/platform folder (xperia z)

where gonna help a bit by finding info fo SGP321 (xperia tablet z) but as title says I could not find the listed folder
Edit:
I found it but this is what I get

shell@SGP321:/dev/block/platform/msm_sdcc.1 $ ls -l /dev/block/platform/msm_sdcc
.1/by-name
/platform/msm_sdcc.1/by-name <
lrwxrwxrwx root root 2014-06-08 20:48 B2B -> /dev/block/mmcblk0p26
lrwxrwxrwx root root 2014-06-08 20:48 FOTAKernel -> /dev/block/mmcblk0p23
lrwxrwxrwx root root 2014-06-08 20:48 LTALabel -> /dev/block/mmcblk0p16
lrwxrwxrwx root root 2014-06-08 20:48 TA -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 2014-06-08 20:48 aboot -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 2014-06-08 20:48 alt_aboot -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 2014-06-08 20:48 alt_rpm -> /dev/block/mmcblk0p15
lrwxrwxrwx root root 2014-06-08 20:48 alt_s1sbl2 -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 2014-06-08 20:48 alt_sbl1 -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 2014-06-08 20:48 alt_sbl2 -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 2014-06-08 20:48 alt_sbl3 -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 2014-06-08 20:48 alt_tz -> /dev/block/mmcblk0p13
lrwxrwxrwx root root 2014-06-08 20:48 apps_log -> /dev/block/mmcblk0p22
lrwxrwxrwx root root 2014-06-08 20:48 boot -> /dev/block/mmcblk0p17
lrwxrwxrwx root root 2014-06-08 20:48 cache -> /dev/block/mmcblk0p25
lrwxrwxrwx root root 2014-06-08 20:48 m9kefs1 -> /dev/block/mmcblk0p18
lrwxrwxrwx root root 2014-06-08 20:48 m9kefs2 -> /dev/block/mmcblk0p19
lrwxrwxrwx root root 2014-06-08 20:48 m9kefs3 -> /dev/block/mmcblk0p20
lrwxrwxrwx root root 2014-06-08 20:48 ramdump -> /dev/block/mmcblk0p21
lrwxrwxrwx root root 2014-06-08 20:48 rpm -> /dev/block/mmcblk0p14
lrwxrwxrwx root root 2014-06-08 20:48 s1sbl2 -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 2014-06-08 20:48 sbl1 -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 2014-06-08 20:48 sbl2 -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 2014-06-08 20:48 sbl3 -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 2014-06-08 20:48 system -> /dev/block/mmcblk0p24
lrwxrwxrwx root root 2014-06-08 20:48 tz -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 2014-06-08 20:48 userdata -> /dev/block/mmcblk0p27
 
Last edited:

Arrowblue

Senior Member
Jan 21, 2013
930
358
Antwerpen
OnePlus 8T
OnePlus 11
i extracted the kernel.sin from Sony xperia z 4.4.4 ftf and using flashtool to dum data and renamed .elf to Boot.img but its only 7.86 mb ??????? while trying to cook a rom with Android kitchen , Android kitchen gives me an error that android magic header not found at start of boot.img and then a warning Android header not found in boot.img ( Unsupported format ) any idea what is going on ?

---------- Post added at 06:38 AM ---------- Previous post was at 06:04 AM ----------

Fota kernel is the kernel that you mentioned in ?? if no than i do not see any kernel listed here in adb shell.

if yes then here you can it add in the op.
Sony Xperia Z (C6603)
FOTAKernel -> /dev/block/mmcb1k0p23

ls -l /dev/block/platform/
then pick the top one (in my case is msm_sdcc.1), so

Quote:
ls -l /dev/block/platform/msm_sdcc.1/by-name
Then which ever says 'kernel' is the one we want. ???
 

olokos

Recognized Developer
Oct 16, 2011
2,945
2,494
Warsaw
Epic guide man! You just saved some time for me with this guide!
facepalm-meme-face-813.jpg

That's me when I was searching for elf2img software on google and then I found your thread. xD
 
  • Like
Reactions: DaRk-L0rD

Top Liked Posts

  • There are no posts matching your filters.
  • 47
    This is compatible with a wide variety of Xperia Devices

    A guide bought to you by matt4321 and DaRk-L0rD​

    Here I am going to show you how to get the boot.img (kernel) out of an FTF! This procedure is most useful for Locked Bootloaders as it means we can upgrade without the need for FlashTool!

    This guide assumes that you have FlashTool installed on your PC

    #############################​

    Step 1:

    You need a file extractor such as WinRar or 7zip.

    Once this is done you want to open the whole FTF in the extractor. You will see a lot of .sin files!

    The one we want is 'kernel.sin', not 'fotakernel.sin'.

    Extract that file to somewhere appropriate on your computer, like the desktop!

    2yvmck3.png


    #############################​


    Step 2:

    Now you need to open FlashTool,

    At the top you will see a tab that says 'Tools', click on that and select 'SIN Editor'. You will see a button that has 3 dots in the top right. This is the browse button, click on it and locate where your SIN file is.

    One that is done, you need to click on 'Dump Data'.

    This will dump the 'kernel.elf' to the same location of where your 'kernel.sin' is.

    73gdx2.png



    #############################​


    Step 3:

    The next part is simple,

    All you need to do is rename your 'kernel.elf' to 'boot.img' and put it in a flashable zip, to make the flashable zip follow the instructions by @DaRk-L0rD in the 2nd post!

    Keep in mind that the kernel should be 20mb.

    v33zq0.jpg



    #############################​


    Step 4:

    Enjoy! The kernel can be flashed via PhilZ for Locked Bootloaders and will work on both Locked and Unlocked bootloaders, since it is an official kernel it is signed by the Sony key so will be fine for Locked Bootloaders.
    22
    If you want to make a kernel's flashable zip

    What you need:
    1. winrar
    2. Notepad++
    3. The attachment: View attachment META-INF.rar
    4. boot.img or kernel.elf


    Procedure:

    1. Extract the META-INF folder from the rar archive previously downloaded.

    2. Open it and go META-INF -> google -> android and using Notepad++ edit the updater-script (right click on it and choose open with Notepad++).

    3. Now you can see that the updater-script looks like this:

    23lb993.png


    4. The line package_extract_file("boot.img", "/dev/block/mmcblkXXX"); should be edited ONLY for 2 reasons.

    • In case you have a kernel.elf (custom kernels) instead of a boot.img
    • To edit the mmcblkXXX partition since it's different for each device

    5. At the end of this post you will find a list of the /mmcblkXXX . For each device are different to choose wisely!!

    In my case is the /mmcblk0p4, so will look like this:

    28hoi8w.png


    6. ui_print(""); , inside the " " you can add the text what you want. Remember that all the users will use this zip will be able to see what you wrote, so please be polite :p :p

    For example:

    ui_print("Installing the kernel");
    ui_print("matt4321");
    ui_print("DaRk-L0rD");
    ui_print("");
    package_extract_file("boot.img", "/dev/block/mmcblk0p4");
    ui_print("Enjoy");
    ui_print("Hit the thanks button");

    ----------------In case the kernel's format is kernel.elf, you can change the line and make it look like this: ----------------

    package_extract_file("kernel.elf", "/dev/block/mmcblk0p4"); (as i said you before, the partition is my case is mmcblk0p4)


    Also, make sure that you leave an empty line at the end of the commands (as you can see the line number 8 is empty).

    6. Now select the META-INF folder and the boot.img or the kernel.elf file, right click on them and select Add to archive.

    7. Make sure that the Archive format is ZIP and the Compression method is Store

    8. Now your flashable zip is ready!

    9. Enjoy



    List of /mmcblkXXX

    Each device has different partition for the kernel. Here is a list of those we found so far:

    • Xperia SP ---- /dev/block/mmcblk0p4
    • Xperia T---- /dev/block/mmcblk0p4
    • Xperia V---- /dev/block/mmcblk0p4
    • Xperia TX---- /dev/block/mmcblk0p4
    • Xperia Z1---- /dev/block/mmcblk0p14
    • Xperia E---- /dev/block/mmcblk0p3
    • Xperia Tipo---- /dev/block/mmcblk0p3
    • Xperia S---- /dev/block/mmcblk0p3
    • Xperia Ion---- /dev/block/mmcblk0p3

    Since we don't know all devices' partition, you should give us a hand.
    Here is what you have to do:


    Procedure:

    via adb shell

    ls -l /dev/block/platform/

    then pick the top one (in my case is msm_sdcc.1), so

    ls -l /dev/block/platform/msm_sdcc.1/by-name

    Then which ever says 'kernel' is the one we want.
    2
    Could you give us a hand with the right/correct/total mate? :)
    We tested all this in different Xperia devices and never had issues and that's why we made the tutorial.

    Reiterating what DaRk-L0rD said, what can we change/how can we make it better?

    Sent from my LT30p using Tapatalk

    btw you can still use with this script :

    Code:
    package_extract_file("kernel.elf", "/dev/block/platform/msm_sdcc.1/by-name/Kernel");

    Code:
    package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/Kernel");

    you don't need to change compressed zip to store, normal is work :)
    1
    On portal
    Congrats you 2:)
    1
    Took much of wrong/incorrect/partial info in this thread...