<?xml version="1.0" encoding="iso-8859-1"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="html">Fon</title>
<link rel="alternate" type="text/html" href="http://www.tuxx-home.at"/>
<link rel="self" type="application/atom+xml" href="http://www.tuxx-home.at/archives/cat_18/index-atom.xml"/>
<updated>2007-11-11T10:31:57+01:00</updated>
<author>
<name>Alexander Griesser</name>
<uri>http://www.tuxx-home.at</uri>
</author>
<id>http://www.tuxx-home.at/</id>
<generator uri="http://nanoblogger.sourceforge.net" version="3.3 RC4">
NanoBlogger
</generator>

<entry>
<title type="html">HOWTO extract FON firmware archives (.fon)</title>
<author>
<name>Alexander Griesser</name>
</author>
<link rel="alternate" type="text/html" href="http://www.tuxx-home.at/archives/2007/10/10/T09_17_17/"/>
<id>http://www.tuxx-home.at/archives/2007/10/10/T09_17_17/</id>
<published>2007-10-10T09:17:17+01:00</published>
<updated>2007-10-10T09:17:17+01:00</updated>
<category term="Fon" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
Since yesterday I'm trying to extract <a class="external" href="http://www.fon.com">FON</a> firmware files (ending with .fon) to have a look at the internals
of these routers.<br />
Doing this isn't that easy, because it isn't documented anywhere (at least
I haven't found useful information about this), so I started at <a class="external" href="http://stefans.datenbruch.de/lafonera">Stefan's Fonera Hacking website</a> and found a script called <a class="file" href="http://stefans.datenbruch.de/lafonera/scripts/defon.sh">defon.sh</a> which does basically extract the embedded tar.gz archive out of the fon image file:<br />
<pre>
tuxx@vi-edv003:~/fonfw$ ./defon.sh fonera_0.7.1.5.fon &gt;fonera.tar.gz
Upgrade contains a new firmware
tuxx@vi-edv003:~/fonfw$
</pre>
After "defoning" the .fon file, you'll get a file called "fonera.tar.gz" which
can now easily be extracted:<br />
<pre>
tuxx@vi-edv003:~/fonfw$ tar xzf fonera.tar.gz
tuxx@vi-edv003:~/fonfw$ ls
defon.sh  fonera.tar.gz  fonera_0.7.1.5.fon  hotfix  rootfs.squashfs  upgrade
tuxx@vi-edv003:~/fonfw$
</pre>
As you can see, a file called <strong>"rootfs.squashfs"</strong> got extracted.
All my attempts to either `mount` it or `unsquashfs` it failed, but after a
lot of googling, I found <a class="external" href="http://www.neufbox4.org/wiki/index.php?title=Extraction_du_firmware">this site</a> which talks about different
ways of extracting specific squashfs files and the last mentioned method with the help of the <a class="external" href="http://www.bitsum.com/firmware_mod_kit.htm">Firmware Modification Kit</a> finally worked!<br />
At first, you'll have to download the firmware modkit archive and extract it:<br />
<pre>
tuxx@vi-edv003:~/fonfw$ wget -q http://download.berlios.de/firmwaremodkit/firmware_mod_tools_prebuilt.tar.gz
tuxx@vi-edv003:~/fonfw$ mkdir firmware_mod_tools
tuxx@vi-edv003:~/fonfw$ tar -x -C firmware_mod_tools -f firmware_mod_tools_prebuilt.tar.gz
tuxx@vi-edv003:~/fonfw$
</pre>
Now you can use the script "unsquashfs-lzma" for SquashFS v3.0 filesystems to
finally extract the archive:<br />
<pre>
tuxx@vi-edv003:~/fonfw$ firmware_mod_tools/src/squashfs-3.0/unsquashfs-lzma rootfs.squashfs
Reading a different endian SQUASHFS filesystem on rootfs.squashfs

created 330 files
created 53 directories
created 145 symlinks
created 0 devices
created 0 fifos
tuxx@vi-edv003:~/fonfw$
</pre>
The generated directory <strong>"squashfs-root"</strong> now contains the contents 
of the FON firmware:<br />
<pre>
tuxx@vi-edv003:~/fonfw$ ls squashfs-root/
bin  dev  etc  jffs  lib  mnt  proc  rom  sbin  sys  tmp  usr  var  www
tuxx@vi-edv003:~/fonfw$
</pre>
<br />
Happy hacking  <img src="http://www.tuxx-home.at/moods/smilies/wink.gif" alt=";)" />
</div>
</content>

</entry>

</feed>

