<?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>G33K @ Work &#187; open source</title>
	<atom:link href="http://www.geekatwork.de/tag/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekatwork.de</link>
	<description>Basteleien eines Geeks</description>
	<lastBuildDate>Mon, 12 Jul 2010 08:38:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Building and running your own Android</title>
		<link>http://www.geekatwork.de/2010/04/01/building-and-running-your-own-android/</link>
		<comments>http://www.geekatwork.de/2010/04/01/building-and-running-your-own-android/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 20:00:43 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[fastboot]]></category>
		<category><![CDATA[G2]]></category>
		<category><![CDATA[HTC]]></category>
		<category><![CDATA[Magic]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[SPL]]></category>

		<guid isPermaLink="false">http://www.geekatwork.de/?p=197</guid>
		<description><![CDATA[Almost a year ago I bought an HTC Magic (also known as  [...]]]></description>
			<content:encoded><![CDATA[<p>Almost a year ago I bought an HTC Magic (also known as the G2) phone as a replacement for my iPhone.<br />
I was quite happy with it since it had the newest Android 1.5 and there was also an update released by Google to get it to version 1.6.</p>
<p>Now, that there are much fancier phones out there, like the Nexus One and Motorola Milestone, there must be a reason for people to buy them. The consequence about that is that they are holding back any updates to Android 2.0 or 2.1 for older phones. At least that&#8217;s my impression.</p>
<p>I also ever wanted to build and run my own Android since it is open source. At least that&#8217;s what Google says.<br />
My first steps were quite disappointing since there was no device specific package for my G2 in the source tree. There was only one for the HTC Dream (G1).</p>
<p>Yesterday I wanted to give it another try and it was a success. I will post my steps here which are especially for the HTC Magic (or G2, HTC Sapphire, MyTouch 3G, Google IO &#8211; they are all the same) but it should be possible to do this with other phones as long as you have all the device specific blobs like the GSM Baseband layer or low level hardware drivers for your specific device.<br />
Also keep in mind that this won&#8217;t be a normal guide like &#8220;How can I root this phone?&#8221; I assume that you more or less know what you are doing. So don&#8217;t blame me when you brick your phone: Shit happens and I&#8217;m not going to fix it.<span id="more-197"></span></p>
<p>Also, be careful what phone you have. There are 2 versions of the HTC Magic. One is the PVT32A and the other is PVT32B.<br />
The A version has more RAM compared to B. The phone sold by HTC on their own is the A version. Almost all others are B versions. My phone is a B variant.<br />
Check <a href="http://wiki.xda-developers.com/index.php?pagename=HTC_Sapphire_Hacking#sec01" target="_blank">this site</a> for any further information.</p>
<h2>The SPL</h2>
<p>The SPL is the Secondary Program Loader. The Initial Program Loader, which runs before the SPL is responsible for the basic bootstrapping of the processor inside the phone. Most of the time it is located on some on-die ROM and loads the SPL from flash.</p>
<p>The SPL itself is responsible for all kinds of boot services like booting from flash or receiving and handling data from the USB port with the fastboot protocol, which can be used for several maintenance tasks.</p>
<p>Usually, if you buy an OEM phone, you will get a shipment bootloader. Development phones will have an engineering bootloader.<br />
The difference between those two is that with the shipment bootloader, you will not be able to write the flash directly from your computer over the fastboot protocol, which you definitely want if you compile/develop your own Android. So the first step is to install an engineering loader.<br />
You can get several SPLs <a href="http://forum.xda-developers.com/showthread.php?t=529019" target="_blank">here</a>. I installed the Crios  loader.<br />
Just put the zip file on your SD-Card, boot a <a href="http://www.cyanogenmod.com/downloads/recovery-image" target="_blank">modified recovery image</a> via fastboot and apply the zip file from your SD:</p>
<pre class="brush:plain">fastboot boot cm-recovery-1.4.img</pre>
<p>The fastboot utility is available <a href="http://developer.htc.com/adp.html#s2" target="_blank">here</a> or from your compiled Android in the out/host/&lt;platform&gt;/bin/ subdirectory.<br />
To get your phone into fastboot mode, turn it off and hold the &#8220;back&#8221;-key while turning it on.</p>
<p>After flashing the new SPL you will have the engineering bootloader with security turned off.</p>
<h2>Getting the Android sourcecode</h2>
<p>If you want to build your own Android you obviously need to get the sourcecode. I did all the work on a Gentoo Linux. I don&#8217;t know how to do it under Windows or Mac OS.</p>
<p>First I thought to take the CyanogenMod repositories but they won&#8217;t check out completely because there seems to be missing at least one repository on github.</p>
<p>To get the official Google tree, just follow <a href="http://source.android.com/download" target="_blank">this guide</a>.</p>
<p>Essentially you just install the required packages, get the repo client, do the repo init, repo sync and you should be done.</p>
<h2>Get the binary blobs</h2>
<p>For the Sapphire board package, you will need to get some binary blobs for the camera, WLAN, baseband and several other things.</p>
<p>You can download them on the <a title="http://developer.htc.com/google-io-device.html" href="http://" target="_blank">HTC page for the Google IO</a>. Just download the recovery image for Android 1.6 and put it into the root of your Android source tree.<br />
After that you need to change the directory to vendor/htc/sapphire-open and execute the unzip-files.sh which extracts the blobs from the downloaded zipfile and puts them into the appropriate places.</p>
<h2>Building it</h2>
<p>After you prepared your environment, get back to the root of the source tree and do a</p>
<pre class="brush:plain">source build/envsetup.sh
lunch</pre>
<p>to setup several environment variables and select the build target, which will be <em>aosp_sapphire_eu-userdebug</em> in our case.</p>
<p>After that you can just execute a</p>
<pre class="brush:plain">make -j3</pre>
<p>to start the build. You can adjust the number behind the -j parameter to your machine. If you have n cores, the number you normally use is n+1. This is not essential for a successful build, but if you have 2 or more cores, you should use them for the build.<br />
Now it&#8217;s time to ge some beautiful delicious black coffee or a cold bootle of <a href="http://www.club-mate.de" target="_blank">Club-Mate</a>, go for a walk or take a nap. This will take quite some time.</p>
<h2>Common errors during the build</h2>
<p>I ran into several erros while buildng. All of them were specific to my environment.</p>
<ul>
<li><em>no rule to make target `run-java-tool&#8217;</em> during build<br />
Solution: Just execute a <em>export PATH=$(java-config -O)/bin:$PATH</em> and the error you should be gone</li>
<li>Java 1.6 is installed.<br />
Solution: Do an <em>ACCEPT_LICENSE=&#8221;*&#8221; emerge =sun-jdk-1.5.0.22</em> and select the 1.5 JDK with eselect.</li>
<li>Building the emulator fails with something like <em>prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55:22: error: X11/Xlib.h: No such file or directory</em><br />
Solution: Do an <em>emerge libX11</em></li>
</ul>
<h2>Installing the built images on your phone</h2>
<p>After the build finished successful you will have everything in the <em>out</em> subdirectory.</p>
<p>Thanks to the engineering SPL, you can now install the built images using fastboot:</p>
<pre class="brush:plain">export ANDROID_PRODUCT_OUT="/path/to/android/root/out/target/product/sapphire-open"
fastboot flashall</pre>
<p>Be sure your phone is in fastboot mode.</p>
<p>After you flashed the images you should boot the recovery image, mentioned in the SPL section, again and wipe the userdata partition.<br />
This will cause a data loss. Anyway, you should have done a backup with nandroid in the modified recory image before messing around with your phone&#8217;s firmware <img src='http://www.geekatwork.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>The result</h2>

<a href='http://www.geekatwork.de/2010/04/01/building-and-running-your-own-android/about/' title='about'><img width="150" height="150" src="http://www.geekatwork.de/wp-content/uploads/about-150x150.png" class="attachment-thumbnail" alt="about" title="about" /></a>
<a href='http://www.geekatwork.de/2010/04/01/building-and-running-your-own-android/menu/' title='menu'><img width="150" height="150" src="http://www.geekatwork.de/wp-content/uploads/menu-150x150.png" class="attachment-thumbnail" alt="menu" title="menu" /></a>
<a href='http://www.geekatwork.de/2010/04/01/building-and-running-your-own-android/main/' title='main'><img width="150" height="150" src="http://www.geekatwork.de/wp-content/uploads/main-150x150.png" class="attachment-thumbnail" alt="main" title="main" /></a>

<h2>Next steps</h2>
<p>As you can see from the images above, all of the Google applications are missing. The next step would be to take them from an official Google image and put them on your phone. I think cyanogen already wrote a script for doing this for his builds. I haven&#8217;t checked this out yet.</p>
<p>Anyway, we have our very own Android 2.1 running.<br />
If you want to use it on a daily basis you should consider building a stable branch and using this instead of the master branch.</p>
<p>If you&#8217;ve got any questions or problems, just leave them in the comments and we will try to figure them out.</p>
<p><strong>Update:</strong> The cyanogenmod repositories do check out. I just used the wrong manifest repository.<br />
If you want to give it a try, just do a</p>
<pre class="brush:plain">repo init -u git://github.com/cyanogen/android.git -b eclair
repo sync</pre>
<p>instead of using the Google repository. <a href="http://wiki.cyanogenmod.com/index.php/Building_from_source" target="_blank">Have a look here</a> for more information.</p>
<p>General useful information, like adding your own target, creating keys for signing etc. can be found <a href="http://pdk.android.com/online-pdk/guide/build_new_device.html" target="_blank">here</a>.</p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://www.geekatwork.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekatwork.de/2010/04/01/building-and-running-your-own-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KiCAD FTW, EAGLE -&gt; fail!</title>
		<link>http://www.geekatwork.de/2009/01/29/kicad-ftw-eagle-fail/</link>
		<comments>http://www.geekatwork.de/2009/01/29/kicad-ftw-eagle-fail/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 15:16:50 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Elektronik]]></category>
		<category><![CDATA[The usual rants]]></category>
		<category><![CDATA[Eagle]]></category>
		<category><![CDATA[KiCAD]]></category>
		<category><![CDATA[Layout]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[PCB]]></category>
		<category><![CDATA[Schaltplan]]></category>

		<guid isPermaLink="false">http://galauner.de/wp/?p=19</guid>
		<description><![CDATA[Nachdem ich in den letzten Tagen einige Differenzen mit [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich in den letzten Tagen einige Differenzen mit EAGLE hatte, was die Legalität meiner Lizenz anging und dem daraus resultierenden Datenverlust, hab ich mich schlussendlich mal nach Alternativen umgesehen. Ich hab echt überlegt, ob ich die 125 Eier für die Non-Profit Version mal auf den Tisch leg, aber nach dem Scheiß können die mich mal. Ich hab jetzt eh was besseres. Bääh! <img src='http://www.geekatwork.de/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> <span id="more-19"></span></p>
<p>Also&#8230; Es geht um <a title="KiCAD" href="http://www.lis.inpg.fr/realise_au_lis/kicad/">KiCAD</a>. KiCAD ist eine Suite, mit der man Schaltpläne und Platinen Zeichnen und Layouten kann. Von irgendsonem Franzosen an irgendsonem &#8220;Laboratoire des bla&#8230;.&#8221; entwickelt. Im Prinzip wie EAGLE, nur mit dem kleinen aber feinen Unterschied, dass es komplett Open Source ist.</p>
<p>Die Bedienung ist etwas gewöhnungsbedürftig, aber verdammt schnell, wenn mans drauf hat. Es gibt einige verbesserungswürdige Punkte, aber die gibts immer. Mit einigen Buchstaben auf der Tastatur hat man sofort ein Bauteil unter Kontrolle. Nichtmal klicken muss man. Maus drüber, &#8220;m&#8221; drücken und Bauteil verschieben. Einmal klicken oder nochmal &#8220;m&#8221; drücken und fertig. Dasselbe gilt für &#8220;r&#8221; beim rotieren, &#8220;w&#8221; beim Wire verlegen usw.</p>
<p>Erste Ergebnisse nach 2 bis 3 Stunden Arbeit sieht man hier:<br />
<a rel="lightbox" href="http://www.geekatwork.de/wp-content/uploads/kicad-1024x819.png"><img class="alignnone size-medium wp-image-20" title="kicad" src="http://www.geekatwork.de/wp-content/uploads/kicad-300x240.png" alt="kicad" width="300" height="240" /></a></p>
<p>Eine geniale Anlaufstelle ist das <a title="Wiki" href="http://kicad.sourceforge.net/wiki/index.php">Wiki</a> mit seinem <a title="Schnelleinsteiger-Howto" href="http://kicad.sourceforge.net/wiki/index.php/DE:Mini_tutorial">Schnelleinsteiger-Howto</a>. Für Umsteiger von EAGLE gibts <a title="hier" href="http://library.oshec.org/">hier</a> noch eine Sammlung konvertierter Libraries. Eigene EAGLE Libraries kann man wohl auch relativ easy importieren. Weiteres gibts hier im <a title="FAQ" href="http://kicad.sourceforge.net/wiki/index.php/FAQ#How_do_I_import_libraries_from_other_PCB_programs.3F">FAQ</a>. Das ganze habe ich bisher aber noch nicht getestet.</p>
<p><em>Nachtrag:</em> Die ULPs für EAGLE gibts alle hier: <a title="Sourceforge" href="http://sourceforge.net/project/showfiles.php?group_id=123224&amp;package_id=134585">Sourceforge</a></p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.11';
var flattr_uid = 'G33KatWork';
var flattr_url = 'http://www.geekatwork.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'G33K @ Work';
var flattr_dsc = 'Basteleien eines Geeks';
</script>
<script src="http://api.flattr.com/button/load.js?v=0.2" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://www.geekatwork.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekatwork.de/2009/01/29/kicad-ftw-eagle-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple und der GCC</title>
		<link>http://www.geekatwork.de/2008/08/23/apple-und-der-gcc/</link>
		<comments>http://www.geekatwork.de/2008/08/23/apple-und-der-gcc/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 15:08:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[The usual rants]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[GCC]]></category>
		<category><![CDATA[LD]]></category>
		<category><![CDATA[Linker]]></category>
		<category><![CDATA[Linkerscript]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://galauner.de/wp/?p=34</guid>
		<description><![CDATA[Grmpf... Da freut man sich, dass Apple auf den supertol [...]]]></description>
			<content:encoded><![CDATA[<p>Grmpf&#8230; Da freut man sich, dass Apple auf den supertollen GCC und seine komplette Toolchain setzt und dann das:<span id="more-34"></span></p>
<pre class="brush:plain">[15:56:09][andy@geekbook:~/Desktop/oskrempel/kernel]
|-&gt; ld -T linker.ld loader.o kernel.o kernel.bin
ld: unknown option: -T
</pre>
<p>Wieso? Klar&#8230; Apple hat einiges am GCC verändern müssen, um ihn Mac OS-Komptabibel zu bekommen. Aber wieso bitte gibt es keinen Support für Linker Scripte?</p>
<p>Selbst Google hat dazu nicht viel ausgespuckt, ausser die Empfehlung sich einfach einen vollwertigen GCC zu installieren. MacPorts sei dank geht das ja relativ einfach. Dauert nur ewig. Mein MacBook ist jetzt schon gut 3 Stunden damit beschäftigt.</p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://www.geekatwork.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekatwork.de/2008/08/23/apple-und-der-gcc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
