-   Programming (
-   -   How to obtain Image from zImage? (

Ho0ligaN 08-06-2010 01:44 AM

How to obtain Image from zImage?
I have obtained zImage from uImage by using this script

Then I used the zlib library from and the accompanying zpipe.c file to uncompress zImage but I am getting this error

zpipe: invalid or incomplete deflate data

Am I on the right path? My aim is to obtain completely uncompressed Image.

EDIT: The kernel is 2.6.29

estabroo 08-06-2010 08:46 AM

zimage is a self extracting gzip compressed image, you might be able to decompress it by finding the starting offset of the data in the file

estabroo 08-06-2010 09:25 AM

This has the info you need

Ho0ligaN 08-09-2010 05:43 AM

Hey thanks for the link. I followed that method as follows


$ arm-linux-objdump -EL -b binary -D -m armv5t zImage | grep 8b1f
    39e0:        088b1f00        stmeq        fp, {r8, r9, sl, fp, ip}
  11a60:        c8b1f58e        ldmgt        r1!, {r1, r2, r3, r7, r8, sl, ip, sp, lr, pc}

Then obtained piggy.gz


$ dd if=zImage of=piggy.gz bs=1 skip=14816
Now, when I try gunzipping piggy.gz it still says its not in gunzip format

$ gunzip piggy.gz

gzip: piggy.gz: not in gzip format

any solutions?

Ho0ligaN 08-10-2010 05:18 AM


estabroo 08-10-2010 07:41 AM

Are you sure you wanted little-endian? ARM can be either.

Ho0ligaN 08-10-2010 08:10 AM

I tried both, but to no avail :(

This is for android BTW, but I think it should work for all zImages?

Ho0ligaN 08-10-2010 09:13 AM


dd if=zImage of=piggy.gz bs=1 skip=14817
That did the trick!

Jon Shemitz 11-30-2010 07:04 PM

armeb-linux-gnu-objdump.zz refers to armeb-linux-gnu-objdump.zz. I don't have that executable, so I just used
hexdump zImage |grep -E "8b ?1f"
and it worked just fine.

willem640 07-15-2017 05:29 AM

your piggy can also be in xz format. have you tried executing file?

i mean the built in file command with the magic files

NevemTeve 07-15-2017 08:47 AM

zImage is a compressed format of Linux kernel, not an actual image.

jefro 07-15-2017 09:30 PM

Hello and welcome to LQ, willem640.

We usually try to avoid posting to very old threads. They tend to have out of date information. If you can advance some old threads then OK otherwise we have many current questions that need assistance. :)

All times are GMT -5. The time now is 09:47 PM.