DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-10-20 06:47:19

puterboy
Member
Registered: 2008-09-18
Posts: 306

How to convert uImage to zImage?

I've seen a lot about how to convert a zImage to a uImage but how do you do the opposite -- convert a uImage to a zImage?

Offline

 

#2 2008-10-24 15:54:05

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: How to convert uImage to zImage?

Is this possible?
I have been googling all over and have not seen any reference to this direction.

Offline

 

#3 2011-01-18 05:10:16

IcyK
Member
From: The Netherlands
Registered: 2011-01-17
Posts: 10

Re: How to convert uImage to zImage?

puterboy, have you figured it out yet?
I'm curious, too ...

Thanx!

Offline

 

#4 2011-01-18 07:31:18

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: How to convert uImage to zImage?

yeah it's pretty simple
dd if=uImage bs=64 skip=1 of=zImage
or directly from the NAND:
dd if=/dev/mtdblock2 of=zImage bs=64 skip=1

Offline

 

#5 2011-01-19 19:46:16

puterboy
Member
Registered: 2008-09-18
Posts: 306

Re: How to convert uImage to zImage?

Actually, /dev/mtdblock2 is in general bigger than zImage (although the above will still generally work)
If you want to extract just the uImage or zImage directly from /dev/mtdblock2 without any trailing garbage, try the following (though it will be much slower)

For the uImage
uImageSrc=/dev/mtd2; dd if=$uImageSrc of=zImage-$(uname -r) bs=1 count=$((64 + $(dd if=$uImageSrc ibs=4 skip=27 count=1 2>/dev/null |  hexdump -v -e '1/4 "%02d"')))

For the zImage either trim the first 64 bytes using as above: dd if=uImage of=zImage bs=64 skip=1

or directly try:
uImageSrc=/dev/mtd2; dd if=$uImageSrc of=zImage-$(uname -r) bs=1 skip=64 count=$(dd if=$uImageSrc ibs=4 skip=27 count=1 2>/dev/null |  hexdump -v -e '1/4 "%02d"')

Note the operation is relatively slow since we use bs=1 since there is no guarantee that the uImage or the zImage are divisible by any standard block size factor

Note this works by reading the size of the zImage (and hence uImage) from bytes 28-31 of the zImage.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB