Post Reply

[HOW TO] Extract kernel image from the Samsung Galaxy S5 VZW firmware

OP roman.blachman

26th May 2014, 08:55 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: Nov 2013
If you interested in extracting the kernel image from the Samsung Galaxy S5 ROM, you should follow the following steps.
This is was tested with the G900VVRU1ANCG_G900VVZW1ANCG_VZW stock ROM firmware.
  1. The first is extracting the files from the ROM firmware file, this is explained in many places and won't be covered here.
  2. Extract the boot.img to some directory, using the Android unpackbootimg utility:
    Code:
    unpackbootimg -i boot.img -o boot/
  3. After extracting the boot.img file you will usually end up with the following file list:
    Code:
    boot.img-base
    boot.img-cmdline
    boot.img-pagesize
    boot.img-ramdisk.gz <- this includes the root (/) files, like init*.rc and SELinux policy files
    boot.img-zImage <- compressed image of the Android Linux kernel
  4. Next step will be extracting the compressed kernel image from the zImage file. The Android kernel is a self-extracting compressed file, while different devices use different compression methods. While looking at the file contents using hex editor, you can see the decompression code at the beginning, and then at some point the compressed data begins. The compressed image begins where you find the LZO magic header.

    Code:
    static const unsigned char lzop_magic[9] = {
    	0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
    };
    Save the data from the LZO magic header to the end of the file with the zImage.kernel file name.
  5. This firmware and kernel are using LZO compression, and there is an easy to use utility called lzop that is used for the decompression of the file. Just run the following command to decompress the kernel from the zImage.kernel file:

    Code:
    lzop -d -c zImage.kernel > zImage.kernel.decompressed

And now you have the decompressed kernel for the device ready for exploration, which is also attached to this post.

Note:
Attached Files
File Type: 7z zImage.kernel.decompressed.7z - [Click for QR Code] (5.22 MB, 48 views)
27th May 2014, 12:51 AM   |  #2  
lcmazza's Avatar
Senior Member
Thanks Meter: 32
 
158 posts
Join Date:Joined: Dec 2011
But it does trip KNOX after flashing, doesn't it?


Quote:
Originally Posted by roman.blachman

If you interested in extracting the kernel image from the Samsung Galaxy S5 ROM, you should follow the following steps.
This is was tested with the G900VVRU1ANCG_G900VVZW1ANCG_VZW stock ROM firmware.

  1. The first is extracting the files from the ROM firmware file, this is explained in many places and won't be covered here.
  2. Extract the boot.img to some directory, using the Android unpackbootimg utility:
    Code:
    unpackbootimg -i boot.img -o boot/
  3. After extracting the boot.img file you will usually end up with the following file list:
    Code:
    boot.img-base
    boot.img-cmdline
    boot.img-pagesize
    boot.img-ramdisk.gz <- this includes the root (/) files, like init*.rc and SELinux policy files
    boot.img-zImage <- compressed image of the Android Linux kernel
  4. Next step will be extracting the compressed kernel image from the zImage file. The Android kernel is a self-extracting compressed file, while different devices use different compression methods. While looking at the file contents using hex editor, you can see the decompression code at the beginning, and then at some point the compressed data begins. The compressed image begins where you find the LZO magic header.

    Code:
    static const unsigned char lzop_magic[9] = {
    	0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
    };
    Save the data from the LZO magic header to the end of the file with the zImage.kernel file name.
  5. This firmware and kernel are using LZO compression, and there is an easy to use utility called lzop that is used for the decompression of the file. Just run the following command to decompress the kernel from the zImage.kernel file:

    Code:
    lzop -d -c zImage.kernel > zImage.kernel.decompressed

And now you have the decompressed kernel for the device ready for exploration, which is also attached to this post.

Note:

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy S 5 General by ThreadRank