<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://buffalo.nas-central.org/w/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>How to Extract an uImage - Revision history</title>
		<link>http://buffalo.nas-central.org/w/index.php?title=How_to_Extract_an_uImage&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.1</generator>
		<lastBuildDate>Mon, 20 May 2013 08:29:58 GMT</lastBuildDate>
		<item>
			<title>Maddes:&amp;#32;Correct link to image.h include</title>
			<link>http://buffalo.nas-central.org/w/index.php?title=How_to_Extract_an_uImage&amp;diff=31437&amp;oldid=prev</link>
			<description>&lt;p&gt;Correct link to image.h include&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:36, 25 September 2011&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Extract an uImage ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Extract an uImage ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;According to the [http://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;u-boot.cvs&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;sourceforge&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;net&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;viewvc/u&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;boot&lt;/del&gt;/u-boot&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;/&lt;/del&gt;include/image.h&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;?view=markup &lt;/del&gt;U-Boot header definition] an uImage begins with the hex byte sequence 27 05 19 56 and the header is 64 bytes long.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;According to the [http://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;git&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;denx&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;de&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cgi&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bin&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;gitweb.cgi?p=&lt;/ins&gt;u-boot&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.git;a=blob;f=&lt;/ins&gt;include/image.h U-Boot header definition] an uImage begins with the hex byte sequence 27 05 19 56 and the header is 64 bytes long.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The data is directly following the header and could be in compressed form (gzip or bzip2), but this is untypical for embedded devices.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The data is directly following the header and could be in compressed form (gzip or bzip2), but this is untypical for embedded devices.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# check for uImage magic word&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# check for uImage magic word&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# http://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;u-boot.cvs&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;sourceforge&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;net&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;viewvc/u&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;boot&lt;/del&gt;/u-boot&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;/&lt;/del&gt;include/image.h&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;?view=markup&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# http://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;git&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;denx&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;de&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cgi&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bin&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;gitweb.cgi?p=&lt;/ins&gt;u-boot&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.git;a=blob;f=&lt;/ins&gt;include/image.h&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;echo 'Checking for uImage magic word...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;echo 'Checking for uImage magic word...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;MAGIC=`dd if=&amp;quot;${UIMAGE}&amp;quot; ibs=4 count=1 | hexdump -v -e '1/1 &amp;quot;%02X&amp;quot;'`&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;MAGIC=`dd if=&amp;quot;${UIMAGE}&amp;quot; ibs=4 count=1 | hexdump -v -e '1/1 &amp;quot;%02X&amp;quot;'`&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2013-05-20 08:29:58 --&gt;
&lt;/table&gt;</description>
			<pubDate>Sun, 25 Sep 2011 21:36:37 GMT</pubDate>			<dc:creator>Maddes</dc:creator>			<comments>http://buffalo.nas-central.org/wiki/Talk:How_to_Extract_an_uImage</comments>		</item>
		<item>
			<title>Pohl8574:&amp;#32;/* extract_uImage.sh */</title>
			<link>http://buffalo.nas-central.org/w/index.php?title=How_to_Extract_an_uImage&amp;diff=30059&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;extract_uImage.sh&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:59, 20 October 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Extracting mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Extracting mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		dd if=&amp;quot;${DATAFILE}&amp;quot; of=&amp;quot;uImage.mach-type&amp;quot; ibs=8 count=1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		dd if=&amp;quot;${DATAFILE}&amp;quot; of=&amp;quot;uImage.mach-type&amp;quot; ibs=8 count=1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ARCH=$(hexdump -v -e '1/1 &amp;quot;%02X &amp;quot;' uImage.mach-type); echo &amp;quot;The &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;arch&lt;/del&gt;-type is: $ARCH&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ARCH=$(hexdump -v -e '1/1 &amp;quot;%02X &amp;quot;' uImage.mach-type); echo &amp;quot;The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;mach&lt;/ins&gt;-type is: $ARCH&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Stripping mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Stripping mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		TMPFILE='uImage.tmp'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		TMPFILE='uImage.tmp'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2013-05-13 21:24:06 --&gt;
&lt;!-- diff cache key nascentral_wiki-mwiki_:diff:version:1.11a:oldid:30058:newid:30059 --&gt;
&lt;/table&gt;</description>
			<pubDate>Wed, 20 Oct 2010 14:59:36 GMT</pubDate>			<dc:creator>Pohl8574</dc:creator>			<comments>http://buffalo.nas-central.org/wiki/Talk:How_to_Extract_an_uImage</comments>		</item>
		<item>
			<title>Pohl8574:&amp;#32;/* extract_uImage.sh */</title>
			<link>http://buffalo.nas-central.org/w/index.php?title=How_to_Extract_an_uImage&amp;diff=30058&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;extract_uImage.sh&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:52, 20 October 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Extracting mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Extracting mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		dd if=&amp;quot;${DATAFILE}&amp;quot; of=&amp;quot;uImage.mach-type&amp;quot; ibs=8 count=1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		dd if=&amp;quot;${DATAFILE}&amp;quot; of=&amp;quot;uImage.mach-type&amp;quot; ibs=8 count=1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ARCH=$(hexdump -v -e '1/1 &amp;quot;%02X &amp;quot;' uImage.mach-type); echo &amp;quot;The arch-type is: $ARCH&amp;quot;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Stripping mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		echo 'Stripping mach-type header...'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		TMPFILE='uImage.tmp'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;		TMPFILE='uImage.tmp'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2013-05-19 11:42:25 --&gt;
&lt;!-- diff cache key nascentral_wiki-mwiki_:diff:version:1.11a:oldid:29790:newid:30058 --&gt;
&lt;/table&gt;</description>
			<pubDate>Wed, 20 Oct 2010 14:52:18 GMT</pubDate>			<dc:creator>Pohl8574</dc:creator>			<comments>http://buffalo.nas-central.org/wiki/Talk:How_to_Extract_an_uImage</comments>		</item>
		<item>
			<title>Maddes:&amp;#32;Initial post</title>
			<link>http://buffalo.nas-central.org/w/index.php?title=How_to_Extract_an_uImage&amp;diff=29790&amp;oldid=prev</link>
			<description>&lt;p&gt;Initial post&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Template:Articles|LSPro|LSLive|LS-WSGL/R1|Howto|Development|Software}}&lt;br /&gt;
&lt;br /&gt;
== About ==&lt;br /&gt;
This article provides a Linux script which extracts the data of an uImage, so it can be re-used for other compatible devices.&lt;br /&gt;
A script is used instead of separate instructions, so that it can be re-used easily for several different uImages.&lt;br /&gt;
&lt;br /&gt;
== Extract an uImage ==&lt;br /&gt;
According to the [http://u-boot.cvs.sourceforge.net/viewvc/u-boot/u-boot/include/image.h?view=markup U-Boot header definition] an uImage begins with the hex byte sequence 27 05 19 56 and the header is 64 bytes long.&lt;br /&gt;
&lt;br /&gt;
The data is directly following the header and could be in compressed form (gzip or bzip2), but this is untypical for embedded devices.&lt;br /&gt;
It is normally a zImage (=compressed Linux kernel plus decompressor for low memory).&lt;br /&gt;
To get the data only the uImage header has to be removed.&lt;br /&gt;
&lt;br /&gt;
For ARM devices an additional 8-byte header with the machine type is in front of a zImage.&lt;br /&gt;
In this case the additional 8 bytes have to be removed too.&lt;br /&gt;
&lt;br /&gt;
=== extract_uImage.sh ===&lt;br /&gt;
The script also tries to determine if the data is a zImage, otherwise it assumes an Image.&lt;br /&gt;
The script is also available [http://ftp.maddes.net/u-boot/ here], but most not be up-to-date all the time.&lt;br /&gt;
&amp;lt;pre&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Copyright (C) 2010 Matthias Buecher (http://www.maddes.net/)&lt;br /&gt;
#&lt;br /&gt;
# This program is free software; you can redistribute it and/or modify&lt;br /&gt;
# it under the terms of the GNU General Public License as published by&lt;br /&gt;
# the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
# (at your option) any later version.&lt;br /&gt;
# http://www.gnu.org/licenses/gpl-2.0.txt&lt;br /&gt;
#&lt;br /&gt;
# This program is distributed in the hope that it will be useful,&lt;br /&gt;
# but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
# GNU General Public License for more details.&lt;br /&gt;
#&lt;br /&gt;
# You should have received a copy of the GNU General Public License&lt;br /&gt;
# along with this program; if not, write to the Free Software&lt;br /&gt;
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
UIMAGE=$1&lt;br /&gt;
&lt;br /&gt;
# check for uImage magic word&lt;br /&gt;
# http://u-boot.cvs.sourceforge.net/viewvc/u-boot/u-boot/include/image.h?view=markup&lt;br /&gt;
echo 'Checking for uImage magic word...'&lt;br /&gt;
MAGIC=`dd if=&amp;quot;${UIMAGE}&amp;quot; ibs=4 count=1 | hexdump -v -e '1/1 &amp;quot;%02X&amp;quot;'`&lt;br /&gt;
[ '27051956' != &amp;quot;${MAGIC}&amp;quot; ]  &amp;amp;&amp;amp; { echo 'Not an uImage.' ; exit 1 ; }&lt;br /&gt;
&lt;br /&gt;
# extract data from uImage&lt;br /&gt;
echo 'uImage recognized.'&lt;br /&gt;
echo 'Extracting data...'&lt;br /&gt;
DATAFILE='uImage.data'&lt;br /&gt;
dd if=&amp;quot;${UIMAGE}&amp;quot; of=&amp;quot;${DATAFILE}&amp;quot; ibs=64 skip=1&lt;br /&gt;
&lt;br /&gt;
# check for ARM mach type ( xx 1C A0 E3 xx 10 81 E3 )&lt;br /&gt;
# http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e600&lt;br /&gt;
echo 'Checking for ARM mach-type...'&lt;br /&gt;
MAGIC=`dd if=&amp;quot;${DATAFILE}&amp;quot; ibs=1 skip=1 count=3 | hexdump -v -e '1/1 &amp;quot;%02X&amp;quot;'`&lt;br /&gt;
[ '1CA0E3' = &amp;quot;${MAGIC}&amp;quot; ] &amp;amp;&amp;amp; {&lt;br /&gt;
	MAGIC=`dd if=&amp;quot;${DATAFILE}&amp;quot; ibs=1 skip=5 count=3 | hexdump -v -e '1/1 &amp;quot;%02X&amp;quot;'`&lt;br /&gt;
	[ '1081E3' = &amp;quot;${MAGIC}&amp;quot; ] &amp;amp;&amp;amp; {&lt;br /&gt;
		echo 'ARM mach-type header recognized.'&lt;br /&gt;
		echo 'Extracting mach-type header...'&lt;br /&gt;
		dd if=&amp;quot;${DATAFILE}&amp;quot; of=&amp;quot;uImage.mach-type&amp;quot; ibs=8 count=1&lt;br /&gt;
		echo 'Stripping mach-type header...'&lt;br /&gt;
		TMPFILE='uImage.tmp'&lt;br /&gt;
		dd if=&amp;quot;${DATAFILE}&amp;quot; of=&amp;quot;${TMPFILE}&amp;quot; ibs=8 skip=1&lt;br /&gt;
		rm -f &amp;quot;${DATAFILE}&amp;quot;&lt;br /&gt;
		mv &amp;quot;${TMPFILE}&amp;quot; &amp;quot;${DATAFILE}&amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# check for zImage, otherwise assume Image&lt;br /&gt;
# http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#d0e309&lt;br /&gt;
TMPFILE='Image'&lt;br /&gt;
echo 'Checking for zImage...'&lt;br /&gt;
MAGIC=`dd if=&amp;quot;${DATAFILE}&amp;quot; ibs=4 skip=9 count=1 | hexdump -v -e '1/1 &amp;quot;%02X&amp;quot;'`&lt;br /&gt;
[ '18286F01' = &amp;quot;${MAGIC}&amp;quot; ] &amp;amp;&amp;amp; {&lt;br /&gt;
	START=`dd if=&amp;quot;${DATAFILE}&amp;quot; ibs=4 skip=10 count=1 | hexdump -v -e '1/4 &amp;quot;%08X&amp;quot;'`&lt;br /&gt;
	END=`dd if=&amp;quot;${DATAFILE}&amp;quot; ibs=4 skip=11 count=1 | hexdump -v -e '1/4 &amp;quot;%08X&amp;quot;'`&lt;br /&gt;
#&lt;br /&gt;
	SIZE=$(( 0x${END} - 0x${START} ))&lt;br /&gt;
#&lt;br /&gt;
	echo &amp;quot;zImage recognized with start 0x${START}, end 0x${END} and size ${SIZE}.&amp;quot;&lt;br /&gt;
	TMPFILE='zImage'&lt;br /&gt;
}&lt;br /&gt;
mv &amp;quot;${DATAFILE}&amp;quot; &amp;quot;${TMPFILE}&amp;quot; &lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;gt;&amp;gt;&amp;gt; ${UIMAGE} extracted to ${TMPFILE}&amp;quot;&amp;lt;/pre&amp;gt;&lt;/div&gt;</description>
			<pubDate>Fri, 23 Apr 2010 23:06:19 GMT</pubDate>			<dc:creator>Maddes</dc:creator>			<comments>http://buffalo.nas-central.org/wiki/Talk:How_to_Extract_an_uImage</comments>		</item>
	</channel>
</rss>