LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-06-2010, 12:44 AM   #1
Ho0ligaN
LQ Newbie
 
Registered: Nov 2008
Posts: 9

Rep: Reputation: 0
How to obtain Image from zImage?


Hi,
I have obtained zImage from uImage by using this script http://buffalo.nas-central.org/wiki/...ract_an_uImage

Then I used the zlib library from www.zlib.net 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

Last edited by Ho0ligaN; 08-06-2010 at 12:46 AM.
 
Old 08-06-2010, 07:46 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
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
 
Old 08-06-2010, 08:25 AM   #3
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
http://openinkpot.org/wiki/Documentation/ZImageFormat

This has the info you need
 
1 members found this post helpful.
Old 08-09-2010, 04:43 AM   #4
Ho0ligaN
LQ Newbie
 
Registered: Nov 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Hey thanks for the link. I followed that method as follows

Code:
$ 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

Code:
$ 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
Code:
$ gunzip piggy.gz

gzip: piggy.gz: not in gzip format
any solutions?
 
Old 08-10-2010, 04:18 AM   #5
Ho0ligaN
LQ Newbie
 
Registered: Nov 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Bump!
 
Old 08-10-2010, 06:41 AM   #6
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Are you sure you wanted little-endian? ARM can be either.
 
Old 08-10-2010, 07:10 AM   #7
Ho0ligaN
LQ Newbie
 
Registered: Nov 2008
Posts: 9

Original Poster
Rep: Reputation: 0
I tried both, but to no avail

This is for android BTW, but I think it should work for all zImages?
 
Old 08-10-2010, 08:13 AM   #8
Ho0ligaN
LQ Newbie
 
Registered: Nov 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Code:
dd if=zImage of=piggy.gz bs=1 skip=14817
That did the trick!
 
Old 11-30-2010, 06:04 PM   #9
Jon Shemitz
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
armeb-linux-gnu-objdump.zz

openinkpot.org/wiki/Documentation/ZImageFormat 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.
 
Old 07-15-2017, 04:29 AM   #10
willem640
LQ Newbie
 
Registered: Jul 2017
Posts: 6

Rep: Reputation: Disabled
xz

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

edit:
i mean the built in file command with the magic files
 
Old 07-15-2017, 07:47 AM   #11
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
zImage is a compressed format of Linux kernel, not an actual image.
 
Old 07-15-2017, 08:30 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to build zImage pavan.manipal Red Hat 2 03-28-2009 01:35 AM
building zImage hoshangi Programming 10 07-19-2008 08:02 AM
Why 2 images - zImage / bzImage? topworld Linux - General 1 07-31-2006 01:42 AM
how to convert zImage to zImage.srec abirami Linux - Software 0 03-06-2005 11:35 PM
What is the different between vmlinux and zImage? alice95089 Linux - Software 1 02-21-2005 02:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration