<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Spice World! &#187; Linux</title>
	<atom:link href="http://www.cyberspice.org.uk/blog/category/geek/open-source/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberspice.org.uk/blog</link>
	<description>The life and times of a jet setting software engineer!</description>
	<lastBuildDate>Fri, 02 Dec 2011 14:52:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Upgrading your UK T-Mobile Google G1 (HTC Dream) to Android 2.x</title>
		<link>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 15:33:22 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Google G1]]></category>
		<category><![CDATA[HTC Dream]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=480</guid>
		<description><![CDATA[I&#8217;m currently developing a new project. Its a bluetooth enabled bracelet. I wanted to write an iPhone app to control it. However, much as I like my iPhone 4, Apple&#8217;s policy about locking the thing down sucks. So I then looked at writing an Android application for my G1. The problem with that is that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently developing a new project.  Its a bluetooth enabled bracelet.  I wanted to write an iPhone app to control it.  However, much as I like my iPhone 4, Apple&#8217;s policy about locking the thing down sucks.  So I then looked at writing an Android application for my G1.  The problem with that is that bluetooth support only arrived in Android 2.0 and T-Mobile/HTC ceased upgrades at 1.6 on the G1.  Since my G1 is two years old and out of contract I decided to be brave and upgrade it to Android 2.2.  Note the G1 is called the HTC Dream in many markets.</p>
<p><span id="more-480"></span><br />
<h2>Overview</h2>
<p>In order to install kind of new operating system I needed to have root access on the device.  This meant I had to <em>root</em> it.  Since Android 1.6 (Release R10) on the G1 doesn&#8217;t have any useful exploits I had to downgrade the OS to Release R7 first.  Once it is downgraded it you can use the rooting exploit in R7 to get root access and install a recovery image that will allow the installation of an updated radio software and the new operating system.</p>
<h2>Preliminaries</h2>
<p>Firstly read all of this blog post and all of the pages linked to from this blog post.  There is at least one point in this process where you can &#8220;brick your phone&#8221;.  I.e. you can put it in a state where by a regular user cannot make it usable.</p>
<p>Secondly you will be wiping your phone and replacing the software on it.  Back anything up you want to keep.  This includes purchased applications, data, contacts, whatever.</p>
<p>Make sure the phone is fully charged.  You don&#8217;t want it running out of power mid-flash!</p>
<p><span style="text-color: #ff0000;"><strong>Finally I provide no warranty express or implied.  You are doing this to your phone.  If it goes wrong its your fault!  You have been warned!</strong></span></p>
<h2>Downgrading and rooting</h2>
<p>Downgrading, rooting the phone, and installing a recovery image is described in the link below.  However since there are specific requirements for upgrading to Android 2.X I&#8217;ll explain each stage here.</p>
<p><a href="http://forum.xda-developers.com/showthread.php?t=442480">http://forum.xda-developers.com/showthread.php?t=442480</a></p>
<h3>Downgrading</h3>
<p>Before you do anything take note of the radio version string in the boot-loader.  Its the fourth line down.  You get the boot-loader screen up by holding down the camera button when powering on the phone.  With the original loader you should have multi-coloured bars with yellow text in the top left hand corner.  On my phone the radio version string read <em>&#8220;RADIO-2.22.19.26I&#8221;</em>.  Write down the string and store it somewhere safe.  You&#8217;ll need it later.</p>
<p>Now download the appropriate older image for your phone.  The links to the image downloads are on the page above however here&#8217;s the link for <a href="http://koushikdutta.blurryfox.com/G1/DREAMIMG-RC7.zip">RC7</a> for those with UK phones.  Download the image, unzip it, and save the <em>DREAMIMG.nbh</em> file in the root of your SD card.  While you&#8217;re at it also download <a href="http://www.androidspin.com/downloads.php?dir=amon_ra/RECOVERY/&#038;file=recovery-RA-dream-v1.5.2.img">recovery-RA-dream-v1.5.2.img</a> which is a recovery image and will be used later.  Save this in the root of your SD card also.</p>
<p>Turn off your phone, insert the SD card, and turn it back on again holding down the camera key as before.  It should now re-flash your phone.  There should be a progress bar.  When its all complete you can restart your phone normally (without the camera key held down).  This will result in some old school Android graphics and you wondering how anyone ever coped with that software.  Once the phone has booted find the phone details in settings and check the software build version number.  It should appear as something like <em>TC5-RC7 112931</em>.</p>
<p><center><br />
<table>
<tr>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075135008" title="View 'Initial bootloader' on Flickr.com"><img height="240" alt="Initial bootloader" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4113/5075135008_1492d33db5_m.jpg" width="162"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5074536617" title="View 'Installing an image from SD card' on Flickr.com"><img height="240" alt="Installing an image from SD card" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4012/5074536617_0f606f44e1_m.jpg" width="172"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075135512" title="View 'Software information screen' on Flickr.com"><img height="240" alt="Software information screen" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4111/5075135512_f439d0d7e8_m.jpg" width="168"/></a></td>
</tr>
</table>
<p></center></p>
<h3>Rooting the phone</h3>
<p>Now you have exploitable image installed it is time to root the phone.  This can be done using a back door.  Go to the home screen then type&#8230;</p>
<pre>
&lt;return&gt;
&lt;return&gt;
telnetd
&lt;return&gt;
</pre>
<p>&#8230;on the slide out keyboard.  This will look like a search in contacts for the name of <em>telnetd</em>.  In fact <em>telnetd</em> is the telnet daemon which allows you to connect to shell on the phone via telnet.  So now you need a telnet client.  Use the Android Market to download a telnet client.  Once installed you should be able to telnet to <em>localhost</em> and get a telnet prompt.</p>
<p>If all is well you have shell access as root (a &#8216;#&#8217; prompt).  Yay!</p>
<h3>Installing a recovery image</h3>
<p>Now we are going to install the recovery image we downloaded earlier. This will also give us permanent root access.  In the shell type&#8230;</p>
<pre>
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd sdcard
flash_image recovery recovery-RA-dream-v1.5.2.img
cat recovery-RA-dream-v1.5.2.img > /system/recovery.img
</pre>
<p>For those who are interested the lines do the following:</p>
<ol>
<li>Remounts the flash memory in read/write mode.  This allows you to save to the flash in the phone.</li>
<li>Navigate to the sdcard (which is mounted at /sdcard)</li>
<li>Flashes the recovery-RA-dream-v1.5.2.img image file in to the special recovery partition in the flash.</li>
<li>Copies the recovery-RA-dream-v1.5.2.img as /system/recovery.img (The Android busybox doesn&#8217;t have the copy command but cat with a pipe works just as well!).</li>
</ol>
<p>Once you&#8217;ve done this and have a prompt again you can reboot the phone.  This time if you hold down the home and power buttons when you power on the phone it will boot in to the recovery image.  You can use the short cuts or the track ball to select a menu item.</p>
<p>Now we are ready to install the new software.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5074537061" title="View 'Custom recovery image menu' on Flickr.com"><img height="240" style="display:block; margin-left:auto; margin-right:auto;" alt="Custom recovery image menu" border="0" src="http://farm5.static.flickr.com/4071/5074537061_048eed984f_m.jpg" width="166"/></a></p>
<h2>New radio software and DangerSPL</h2>
<p>Now we have to repartition the flash to give enough room for the new platform.  This is the scary bit.  As I said before&#8230;</p>
<p><span style="text-color: #ff0000;"><strong>Finally I provide no warranty express or implied.  You are doing this to your phone.  If it goes wrong its your fault!  You have been warned!</strong></span></p>
<p>Read this page thoroughly <a href="http://wiki.cyanogenmod.com/index.php?title=Dream:DangerSPL">http://wiki.cyanogenmod.com/index.php?title=Dream:DangerSPL</a>.  If you&#8217;ve gotten this far you fulfil the prerequisites to install Danger/SPL.  You now need to download the appropriate radio image, place it in the root of your SD card and flash it.  Remember that number we noted down from the boot-loader screen at the start (<em>&#8220;RADIO-2.22.19.26I&#8221;</em> or similar).  You will need it now.</p>
<p>Boot in to recovery by holding down the home and power buttons. Select <em>&#8220;Flash zip from sdcard&#8221;</em>.  Select <em>update.zip</em> (if that&#8217;s the name of the file) from the file menu.  The image should be flashed and will then reboot the phone.  Reboot the phone again.</p>
<p>Take out the SD card and boot back in to the boot loader.  It should now appear as below.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5074537429" title="View 'Updated Google G1 bootloader' on Flickr.com"><img height="240" style="display:block; margin-left:auto; margin-right:auto;" alt="Updated Google G1 bootloader" border="0" src="http://farm5.static.flickr.com/4043/5074537429_0bebc5256a_m.jpg" width="179"/></a></p>
<h2>Upgrading to FROYO and installing Google Apps</h2>
<p>All the hard work is now done.  You have a rooted phone with a nice recovery menu which allows you to flash anything that will fit.</p>
<p>To install the latest Android read this link: <a href="http://wiki.cyanogenmod.com/index.php?title=Dream:Installing_CyanogenMod_5%2B">http://wiki.cyanogenmod.com/index.php?title=Dream:Installing_CyanogenMod_5%2B</a>.</p>
<p>Clear out your SD card and download <a href="http://wiki.cyanogenmod.com/index.php?title=Latest_Version#DreamCM6">Froyo for the G1/Dream</a> and the <a href="http://wiki.cyanogenmod.com/index.php?title=Latest_Version#Google_Apps">Google <strong>Tiny</strong> Apps</a> (The G1 is a bit short on flash space so wont fit the all singing all dancing versions of the Google apps).  Boot in to recovery as before (home and power buttons) and again select <em>&#8220;Flash zip from sdcard&#8221;</em>.  Flash first Froyo and then the apps.</p>
<p>Finally reboot your phone.  You should now have Android 2.2 installed!</p>
<p><center><br />
<table>
<tr>
<td><a href="http://www.flickr.com/photos/39013214@N03/5074537651" title="View 'Cyanogen's Froyo (Android 2.2) booting' on Flickr.com"><img height="240" alt="Cyanogen's Froyo (Android 2.2) booting" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4068/5074537651_fd8dc6e0e7_m.jpg" width="179"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075136748" title="View 'Cyanogen's Froyo (Android 2.2) home screen.' on Flickr.com"><img height="240" alt="Cyanogen's Froyo (Android 2.2) home screen." border="0" style="display: inline;" src="http://farm5.static.flickr.com/4089/5075136748_9bb89e6b2c_m.jpg" width="179"/></a></td>
</tr>
</table>
<p></center></p>
<h2>Issues</h2>
<p>The only issue I had was an exception from the keyboard software the first time I used Froyo.  This can be solved using the <em>&#8220;Wipe&#8221;</em> menu in the recovery image.  I wiped data, cache and delvik cache (The latter generated an error I ignored) and then re-installed Froyo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T&#8217;info about Dash</title>
		<link>http://www.cyberspice.org.uk/blog/2009/12/24/tinfo-about-dash/</link>
		<comments>http://www.cyberspice.org.uk/blog/2009/12/24/tinfo-about-dash/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 12:45:15 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dash]]></category>
		<category><![CDATA[libncurses]]></category>
		<category><![CDATA[libtinfo]]></category>
		<category><![CDATA[sh]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=404</guid>
		<description><![CDATA[Once upon a time there was the Bourne command shell. sh as it is known is core at the heart of any UNIXy type operating system and others too. However for some it didn&#8217;t do enough so the Bourne Again shell, bash, was written and nearly every system ships with that. These shells are not [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time there was the Bourne command shell.  <strong>sh</strong> as it is known is core at the heart of any UNIXy type operating system and others too.  However for some it didn&#8217;t do enough so the Bourne Again shell, <strong>bash</strong>, was written and nearly every system ships with that.  These shells are not the same.  The have similar syntax but do not behave similarly.</p>
<p>There are other shells which have a completely different syntax and other scripting languages such as Perl and PHP so when writing a shell script you can indicate the correct interpreter using the <em>&#8216;hash bang bin bash&#8217;</em> comment to indicate you are using <strong>bash</strong>.  I.e.</p>
<pre>
#!/bin/bash
</pre>
<p>Some lazy programmers don&#8217;t indicate the exact shell they require and use </p>
<pre>
#!/bin/sh
</pre>
<p>to mean <strong>bash</strong> when it means <strong>sh</strong>.</p>
<p>Ubuntu, in their wisdom, have decided to go for <strong>dash</strong> as their shell.  It is an evolution of the Almquist shell and is smaller and lighter weight than <strong>bash</strong> however they install <strong>bash</strong> anyway.  <strong>dash</strong> and <strong>bash</strong> have the common subset of <strong>sh</strong> commands but are different.  So if you find you have a problem building or similar on Ubuntu it may be that the wrong shell is being used.  Ubuntu has a symlink as follows:</p>
<pre>
lrwxrwxrwx 1 root root       4 Mar 29  2009 sh -> dash
</pre>
<p>You may need to change this to point to dash as follows:</p>
<pre>
$ cd /bin
$ sudo rm sh
$ sudo ln -s bash sh
</pre>
<p>While we&#8217;re handling Ubuntu oddities building against NCurses, the terminal output library, can also be problematical.  A little while ago NCurses was split in to two libraries, <em>libncurses.so</em> and <em>libtinfo.so</em>.  Some badly written software will try and link explicitly with <em>libtinfo.so</em> directly rather than trying <em>libncurses.so</em> first.  Ubuntu does not split these two libraries but provides just the one <em>libncurses.so</em> library so if you have an issue with a missing <em>libtinfo.so</em> you will need to add symlinks in to your library directory as follows:</p>
<pre>
$ cd /usr/lib
$ ln -s libncurses.so.5 libtinfo.so.5
$ ln -s libtinfo.so.5 libtinfo.so
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2009/12/24/tinfo-about-dash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building PHP C extensions on Ubuntu 9.10</title>
		<link>http://www.cyberspice.org.uk/blog/2009/12/01/building-php-c-extensions-on-ubuntu-9-10/</link>
		<comments>http://www.cyberspice.org.uk/blog/2009/12/01/building-php-c-extensions-on-ubuntu-9-10/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 13:58:28 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PECL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=395</guid>
		<description><![CDATA[I have just taken over maintenance of the PECL Direct IO extension as it has been unmaintained for a while. Naturally the first thing I did before writing any new code was to check out the extension from SVN and try and build it. Building the source was fine but when I tried make test [...]]]></description>
			<content:encoded><![CDATA[<p>I have just taken over maintenance of the PECL Direct IO extension as it has been unmaintained for a while.  Naturally the first thing I did before writing any new code was to check out the extension from SVN and try and build it.  Building the source was fine but when I tried <em>make test</em> it failed producing output like the following:</p>
<pre>
PHP Warning:  PHP Startup: Unable to load dynamic library 'modules/gd.so' -
modules/gd.so: cannot open shared object file: No such file or
directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' -
modules/gd.so: cannot open shared object file: No such file or
directory in Unknown on line 0
</pre>
<p>The default PHP package on Ubuntu 9.10 is fairly minimalist.  Most extensions are provided as separate packages which include an INI file and a dynamic library.  The dynamic library is stored in:</p>
<pre>
/usr/lib/php5/20060613+lfs
</pre>
<p>And the INI file for each extension is in: </p>
<pre>
/etc/php5/conf.d.
</pre>
<p>The <em>make tests</em> rule in the generated Makefile in the extension you are compiling modifies the path that PHP searches for extensions by to point to the modules directory within the extension source.  So PHP, which is used to run the tests, cannot find the extensions.</p>
<p>I&#8217;ve found the easiest way (if slightly hacky) to fix the <em>make test</em> failure is just to copy the .so files from the PHP5 extension directory in to the modules directory within the extension source.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2009/12/01/building-php-c-extensions-on-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

