{"id":82,"date":"2010-08-24T19:54:42","date_gmt":"2010-08-24T23:54:42","guid":{"rendered":"http:\/\/hackspot.net\/iSpotBlog\/?p=82"},"modified":"2010-08-27T18:00:10","modified_gmt":"2010-08-27T22:00:10","slug":"ispot-firmware-download-image-file-format","status":"publish","type":"post","link":"http:\/\/hackspot.net\/iSpotBlog\/?p=82","title":{"rendered":"iSpot firmware download image file format"},"content":{"rendered":"<p>I&#8217;ve analyzed the structure of the &#8220;.bin&#8221; files used for firmware updates on the iSpot, and will document\/update my findings below.<\/p>\n<p>Here is a hex-dump of the beginning of a firmware update &#8220;.bin&#8221; file (this is from &#8220;iSpot_Software_080510.bin&#8221;):<\/p>\n<pre>00000000  49 4d 57 2d 43 36 31 35  57 00 00 00 00 00 00 00  |IMW-C615W.......|\r\n00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\r\n00000020  04 03 02 01 01 09 09 04  fa 06 00 00 07 00 00 00  |................|\r\n00000030  00 04 00 00 ec 96 11 00  c6 3d 6c 04 ad 30 9f 57  |.........=l..0.W|\r\n00000040  eb 68 2f c1 f3 9f da 48  ec 9a 11 00 00 00 52 00  |.h\/....H......R.|\r\n00000050  33 dd ab bd 0f da 5d 02  f2 db c1 5e 35 bb 61 7e  |3.....]....^5.a~|\r\n00000060  ec 9a 63 00 72 73 16 00  d9 ed ae eb 3d 90 b8 87  |..c.rs......=...|\r\n00000070  9d 7e 10 93 a8 2d 52 4f  00 00 00 00 00 00 00 00  |.~...-RO........|\r\n00000080  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\r\n00000090  31 2e 31 2e 31 00 00 00  00 00 00 00 00 00 00 00  |1.1.1...........|\r\n000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\r\n000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|\r\n000000c0  00 00 00 00 ff ff ff ff  ff ff ff ff ff ff ff ff  |................|<\/pre>\n<p>Here is a description of the data at specific offsets:<\/p>\n<p><strong>0000-001e :<\/strong> Text description of image file (&#8220;name&#8221;)<\/p>\n<p><strong>001f-001f :<\/strong> I believe this is just a NULL terminator for the above string<\/p>\n<p><strong>0020-0023 :<\/strong> Used by the flash_program application to determine byte order (big- vs little- endian) of the file.\u00a0 Should always be &#8220;04 03 02 01&#8221;.<\/p>\n<p><strong>0024-0027 :<\/strong> Version number (&#8220;vpos&#8221;):\u00a0(&#8220;01 09 09 04&#8221; in this build: corresponds to &#8220;v1994&#8221;)<\/p>\n<p><strong>0028-002b :<\/strong> SVN version number (&#8220;svn&#8221;): same as value stored in this image&#8217;s &#8220;\/etc\/version.svn&#8221;, stored as a little-endian 32-bit value<\/p>\n<p><strong>002c-002c :<\/strong> Bitmask describing which &#8216;sub-files&#8217; are contained in the .bin (&#8220;bintype&#8221;).<\/p>\n<p style=\"padding-left: 30px;\">If bit 0 is set (bitmask 0x01), then the image contains a <em>KERNEL<\/em>.<\/p>\n<p style=\"padding-left: 30px;\">If bit 1 is set (bitmask 0x02), then the image contains a jffs2 root filesystem (<em>ROOTFS<\/em>).<\/p>\n<p style=\"padding-left: 30px;\">If bit 2 is set (bitmask 0x04), then the image contains a WiFi firmware image (<em>WIFI<\/em>).<\/p>\n<p style=\"padding-left: 30px;\">If bit 3 is set (bitmask 0x08), then the image contains an unknown 4th sub-file image (UNDEF).<\/p>\n<p><strong>002d-002f : <\/strong>Unknown\/undefined<\/p>\n<p><em>KERNEL info:<\/em><\/p>\n<p><strong>0030-0033 :<\/strong> Offset into .bin file to start of kernel image (if &#8220;bintype&#8221;\u00a0<em>KERNEL<\/em> bit is set) (little-endian 32-bit)<\/p>\n<p><strong>0034-0037 :<\/strong> Size of\u00a0kernel image (if &#8220;bintype&#8221;\u00a0<em>KERNEL<\/em> bit is set)\u00a0(little-endian 32-bit)<\/p>\n<p><strong>0038-0047 :<\/strong> MD5 hash of kernel image (if &#8220;bintype&#8221;\u00a0<em>KERNEL<\/em> bit is set)<\/p>\n<p><em>ROOTFS info:<\/em><\/p>\n<p><strong>0048-004b :<\/strong> Offset into .bin file to start of\u00a0jffs2 root filesystem\u00a0image (if &#8220;bintype&#8221;\u00a0<em>ROOTFS<\/em> bit is set)\u00a0(little-endian 32-bit)<\/p>\n<p><strong>004c-004f :<\/strong> Size of jffs2 root filesystem\u00a0image (if &#8220;bintype&#8221;\u00a0<em>ROOTFS<\/em> bit is set)\u00a0(little-endian 32-bit)<\/p>\n<p><strong>0050-005f :<\/strong> MD5 hash of\u00a0jffs2 root filesystem image (if &#8220;bintype&#8221;\u00a0<em>ROOTFS<\/em> bit is set)<\/p>\n<p><em>WIFI info:<\/em><\/p>\n<p><strong>0060-0063 :<\/strong> Offset into .bin file to start of\u00a0WiFi firmware\u00a0image (if &#8220;bintype&#8221;\u00a0<em>WIFI<\/em> bit is set)\u00a0(little-endian 32-bit)<\/p>\n<p><strong>0064-0067 :<\/strong> Size of\u00a0WiFi firmware image (if &#8220;bintype&#8221;\u00a0<em>WIFI<\/em> bit is set)\u00a0(little-endian 32-bit)<\/p>\n<p><strong>0068-0077 :<\/strong> MD5 hash of\u00a0WiFi firmware image (if &#8220;bintype&#8221;\u00a0<em>WIFI<\/em> bit is set)<\/p>\n<p><em>UNDEF info:<\/em><\/p>\n<p><strong>0078-008f :<\/strong> Appears to be room for fourth &#8216;sub-file&#8217; info<\/p>\n<p><strong>0090-???? :<\/strong> If &#8220;bintype&#8221; WIFI bit is set, then the ASCII (NULL terminated)\u00a0version string\u00a0for the WiFi image is stored here (max length unknown).<\/p>\n<p><strong>????-00c3 :<\/strong> Unknown (currently NULL bytes)<\/p>\n<p>Looking at the specific file header show in the hex-dump above, you can see that the &#8220;svn&#8221; version number is 0x000006fa (&#8220;1786&#8221; decimal).<\/p>\n<p>The &#8220;.bin&#8221; file contains a kernel image, a jffs2 root filesystem image, and a WiFi firmware image (because &#8220;bintype&#8221; is &#8220;07&#8221;, so all three file type bits are set).<\/p>\n<p style=\"padding-left: 30px;\">The KERNEL image starts at offset 0x00000400\u00a0into the &#8220;.bin&#8221; file, and is 0x1196ec bytes long.<\/p>\n<p style=\"padding-left: 30px;\">The ROOTFS image starts at offset 0x119aec\u00a0into the &#8220;.bin&#8221; file, and is 0x00520000 bytes long.<\/p>\n<p style=\"padding-left: 30px;\">The WIFI image starts at offset 0x00639aec into the &#8220;.bin&#8221; file, and is 0x00167372 bytes long.<\/p>\n<p>\u00a0<\/p>\n<h3>Sub-file image format<\/h3>\n<p>The KERNEL image is a standard compressed kernel image (with a &#8216;header applet&#8217; which decompresses the kernel payload\u00a0and jumps to it). It is for an ARM architecture CPU.<\/p>\n<p>The ROOTFS image is a JFFS2 filesystem image. This was likely created either directly using &#8220;mkfs.jffs2&#8221;, or by dumping the contents of the flash chip\u00a0partition after the JFFS2 image was created there.<\/p>\n<p>The WIFI image is a standard compressed kernel image <em>with an embedded init ramdisk<\/em> (&#8220;initrd&#8221;). This kernel is for a MIPS architecture CPU.<\/p>\n<h3>Manipulating firmware update image<\/h3>\n<p>I plan on releasing some utilities for unpacking\/repacking the contents of a firmware update image.\u00a0 Once finished, a link will be provided here.<\/p>\n<p><em><strong>EDIT<\/strong><\/em>: The firmware manipulation utility has been released. See this article : &#8220;<a href=\"http:\/\/hackspot.net\/iSpotBlog\/?p=177\">Release of \u2018fwtool\u2019 \u2013 firmware image manipulation tool<\/a>&#8220;.<\/p>\n<p><em>Disclaimer: information on this site is for educational purposes only, and intended to help iSpot owners experiment with their own devices. I do not condone any hacking for illegal purposes, such as stealing service, etc.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve analyzed the structure of the &#8220;.bin&#8221; files used for firmware updates on the iSpot, and will document\/update my findings below. Here is a hex-dump of the beginning of a firmware update &#8220;.bin&#8221; file (this is from &#8220;iSpot_Software_080510.bin&#8221;): 00000000 49 &hellip; <a href=\"http:\/\/hackspot.net\/iSpotBlog\/?p=82\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=82"}],"version-history":[{"count":34,"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":191,"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=\/wp\/v2\/posts\/82\/revisions\/191"}],"wp:attachment":[{"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hackspot.net\/iSpotBlog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}