<?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>Мой веб-журнал</title>
	<atom:link href="http://blog.johnford.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.johnford.info</link>
	<description>John Ford</description>
	<lastBuildDate>Fri, 05 Mar 2010 17:34:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Figuring out which files are touched while installing software</title>
		<link>http://blog.johnford.info/figuring-out-which-files-are-touched-while-installing-software/</link>
		<comments>http://blog.johnford.info/figuring-out-which-files-are-touched-while-installing-software/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 17:34:07 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=223</guid>
		<description><![CDATA[We are working on getting our infrastructure up to speed for Maemo 5 and Maemo 5 QT builds.  A critical part of Maemo5 building is the scratchbox.  This is a toolkit that Nokia uses to make development on for their linux based phones easier.  We have enough linux build slaves in production [...]]]></description>
			<content:encoded><![CDATA[<p>We are working on getting our infrastructure up to speed for Maemo 5 and Maemo 5 QT builds.  A critical part of Maemo5 building is the scratchbox.  This is a toolkit that Nokia uses to make development on for their linux based phones easier.  We have enough linux build slaves in production that it is impractical to deploy scratchbox by hand on each machine.  Scratchbox also does internet package downloads which means that we could get different packages each time we try to install the scratchbox.  We already have a fairly old version of scratchbox which is set up with the Chinook sdk that we have used for doing our Maemo builds thus far.  Originally I was under the impression that we were going to need to have 2 totally seperate scratchbox installations but thanks to Doug T. for showing me how to upgrade our existing scratchbox 4 installation to scratchbox 5.  </p>
<p>My concern with this upgrade, however, was that files outside the <code>/builds/scratchbox</code> directory were going to be touched.  I wanted to be thorough so I did an experiment.  I ran <code>find -mount -type f -exec openssl md5 '{}' \; | tee -a /file-list ; find -mount -type f -exec openssl md5 '{}' \; | tee -a /file-list</code> before and after the scratchbox upgrade.  The <code>-mount</code> and two different runs at our two mountpoints was to ensure that we didn&#8217;t hash things like the <code>/dev, /proc, /sys</code> filesystem.  My original intent was to do <code>diff file-list1 file-list2</code> but that resulted in showing me every single file that changed.  I only wanted to know the files that changed outside of my scratchbox root directory of <code>/builds/scratchbox</code>.  My diff was polluted by 77,000 files that resided in the scratcbox root.  I figured that the best option at the time was to hack up a quick python script:</p>
<pre>
#!/usr/bin/python
#This file is a quick script to process the output of
# find / -mount -type f -exec openssl md5 '{}' \; | tee -a
import sys, os.path, re

if not len(sys.argv) == 3:
    print "purple monkey dishwasher"
    exit(1)
filename_a = sys.argv[1]
filename_b = sys.argv[2]
if not os.path.exists(filename_a) or not os.path.exists(filename_b):
    print "insert change into meter and press green button"
    exit(1)
data={}
pattern = re.compile("^MD5\((?P<file>.*)\)= (?P<hash>.*)$")
#Get the data from A
f = open(filename_a, 'r')
for i in f.readlines():
    m = pattern.search(i)
    data[m.group('file')] = m.group('hash')
f.close()
f = open(filename_b, 'r')
sbfile = re.compile("^/builds/scratchbox") #pattern describing files to ignore
#Figure out diff to B
f = open(filename_b, 'r')
for i in f.readlines():
    m = pattern.search(i)
    if not data.has_key(m.group('file')):
        if not sbfile.search(m.group('file')):
            print 'new file - ', m.group('file')
    else:
         if not sbfile.search(m.group('file')):
             if not data[m.group('file')] == m.group('hash'):
                 print 'updated file - ', m.group('file')
</pre>
<p>This is code I have written to scratch my own itch.  I am posting this as it might be useful to someone else.  if you wanted to ignore a different directory you&#8217;d change <code>sbfile = re.compile("^/builds/scratchbox")</code> to be a pattern describing your path to ignore.  If you wanted to find all things that changed over your whole partition you would remove sbfile and all sbfile checks to have a final bit of code like</p>
<pre>
#Figure out diff to B
f = open(filename_b, 'r')
for i in f.readlines():
    m = pattern.search(i)
    if not data.has_key(m.group('file')):
        print 'new file - ', m.group('file')
    else:
         if not data[m.group('file')] == m.group('hash'):
             print 'updated file - ', m.group('file')
</pre>
<p>In the end, I found that the scratchbox upgrade that I did only changed my bash_history and added some tarballs to /tmp.  I am very glad that this is the case as it really simplifies our deployment of the new scratchbox!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/figuring-out-which-files-are-touched-while-installing-software/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>What is wrong with AT&amp;T&#8217;s Flash Ads?</title>
		<link>http://blog.johnford.info/what-is-wrong-with-atts-flash-ads/</link>
		<comments>http://blog.johnford.info/what-is-wrong-with-atts-flash-ads/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 23:56:38 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=203</guid>
		<description><![CDATA[Over the last couple days I noticed my Firefox getting painfully slow.  The weird part was that the rest of my system was responsive.  When I opened Activity Monitor it showed 100% CPU usage for Firefox.  I decided to do some investigating.  I used the &#8216;Sample Process&#8217; feature in Activity Monitor.  [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last couple days I noticed my Firefox getting painfully slow.  The weird part was that the rest of my system was responsive.  When I opened Activity Monitor it showed 100% CPU usage for Firefox.  I decided to do some investigating.  I used the &#8216;Sample Process&#8217; feature in Activity Monitor.   After setting the display to &#8216;Percent of Parent&#8217; I noticed that there was a lot of &#8216;Flash_EnforceLocalSecurity&#8217; messages which lead me to believe that Flash was the culprit.<br />
<img class="size-full wp-image-209" title="Sampling Firefox" src="http://blog.johnford.info/wp-content/uploads/2009/11/Screen-shot-2009-11-24-at-3.01.37-PM.png" alt="Screen shot 2009-11-24 at 3.01.37 PM" width="768" height="489" /><br />
I went through my tabs, and sure enough I had lots of Flash open.  This pattern kept repeating itself.  I&#8217;d notice Firefox getting sluggish, close flash web pages and see Firefox performing properly and CPU usage levels back to normal.  I found it strange that I could play Hulu and Youtube videos fine.  I even went to <a href="http://www.bannerserver.com/">www.bannerserver.com</a> and found that while Firefox was never using 100% of my CPU.  This was baffling me until I figured out what the problem was.  This issue only happens when AT&amp;T Uverse flash ads show up.</p>
<p><img class="size-full wp-image-206" title="Example Ad" src="http://blog.johnford.info/wp-content/uploads/2009/11/Screen-shot-2009-11-24-at-2.31.55-PM.png" alt="Screen shot 2009-11-24 at 2.31.55 PM" width="735" height="97" /><br />
Not everyone cares to find the root cause of a problem like this.  It is also only sporadically reproducible, going to the same website might show different ads each time.  I would bet that a lot of people would look at this and say &#8220;Firefox is slow&#8221;, especially because the ads are there on many different pages.  These ads are also not the primary reason someone goes to the page (I&#8217;d hope) which means that it is difficult to associate the flash ad with the purpose of their tab if they do try to figure out what the problem is.  Having plug-ins in a separate process (Electrolysis) seems like a great idea.  I hope that, like Safari on Mac, it shows up as a totally separate process which helps avoid people blaming Firefox for poor performance.</p>
<p><img class="size-full wp-image-208" title="Activity Monitor showing Flash Player" src="http://blog.johnford.info/wp-content/uploads/2009/11/Screen-shot-2009-11-24-at-2.48.29-PM.png" alt="Screen shot 2009-11-24 at 2.48.29 PM" width="744" height="558" /><br />
The most annoying part of this whole situation is that I&#8217;d love to be a Uverse subscriber.  It is bad enough that they aren&#8217;t offering it in my area, but to make my browser slower is a slap in the face!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/what-is-wrong-with-atts-flash-ads/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Mac OS X Screensaver Hang</title>
		<link>http://blog.johnford.info/mac-os-x-screensaver-hang/</link>
		<comments>http://blog.johnford.info/mac-os-x-screensaver-hang/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 07:03:54 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=198</guid>
		<description><![CDATA[I was trying to get into my personal Macbook a couple minutes ago but the screen was black and I had a spinning beach ball.  I couldn&#8217;t remember if I had anything important open so I didn&#8217;t want to force a reboot.  I hadn&#8217;t used the computer for a couple hours so I [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to get into my personal Macbook a couple minutes ago but the screen was black and I had a spinning beach ball.  I couldn&#8217;t remember if I had anything important open so I didn&#8217;t want to force a reboot.  I hadn&#8217;t used the computer for a couple hours so I guessed that the screen saver had hung or VLC froze in full screen.  I logged into my Macbook through ssh and ran <code>ps -e</code>.  VLC wasn&#8217;t there, so I looked for screen-saver-y things and found <code> 5827 ??         0:00.22 /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine</code>.  I ended up killing it with <code>sudo killall ScreenSaverEngine</code> which immediately brought me back to my desktop.  I am guessing I won&#8217;t have a screensaver back until I reboot.  Hope this helps!  Oh, and make sure that you already have SSH enabled (Remote Login in the Sharing preference pane) and know the IP/Domain of your laptop.  I used <code>johns-macbook.local</code> which the OS set up for me automatically.  My guess is that it is some sort of bonjour/zeroconf to dns bridge.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/mac-os-x-screensaver-hang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unittests on PPC and Non-SSE2 Machines</title>
		<link>http://blog.johnford.info/unittests-on-ppc-and-non-sse2-machines/</link>
		<comments>http://blog.johnford.info/unittests-on-ppc-and-non-sse2-machines/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 22:46:55 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=189</guid>
		<description><![CDATA[During the lead up to the Firefox 3.5 release, there was a request to have older machines running unit tests.  Our solution for the 3.5 release was to burn Ted cycles.  This is unfortunate because Ted could have otherwise done much more useful things.  For the Firefox 3.6 release, we automated this [...]]]></description>
			<content:encoded><![CDATA[<p>During the lead up to the Firefox 3.5 release, there was a request to have older machines running unit tests.  Our solution for the 3.5 release was to burn Ted cycles.  This is unfortunate because Ted could have otherwise done much more useful things.  For the Firefox 3.6 release, we automated this testing.  The reason for running these tests is that our JavaScript interpreter spits out native machine code .  The problem is that there are still machines capable of running Firefox but do not have all of the latest instruction sets(MMX, 3DNow, SSE2, SSE3, ad infinitum).  Specifically, there was a concern over the inclusion of the SSE2 instructions when running on non-SSE2 capable hardware.  This is especially important for those people who are still running an older machine exclusively for browsing.  It is very important that we don&#8217;t unknowingly introduce a requirement for SSE2.  We also need to test our claimed compatibility with older Macintosh machines based on the PowerPC core.  To fix this situation, I have created the geriatric master.  This master is in charge of our fleet of aging fleet of Pentium 3s and PowerPC G4s.  It reports to the <a href="http://tinderbox.mozilla.org/showbuilds.cgi?tree=GeriatricMachines">GeriatricMasters</a> tinderbox.  I currently am monitoring the Mozilla 1.9.2 and Mozilla Central nightly builds.</p>
<div id="attachment_190" class="wp-caption aligncenter" style="width: 591px"><a href="http://blog.johnford.info/wp-content/uploads/2009/11/Picture-5.png"><img src="http://blog.johnford.info/wp-content/uploads/2009/11/Picture-5.png" alt="These are the first two succesful runs" title="Sample runs" width="581" height="404" class="size-full wp-image-190" /></a><p class="wp-caption-text">These are the first two succesful runs</p></div>
<p>We are running some old machines saved from the Landings to Castro move.  The P3s are around a decade old and the G4 Mac Mini and Dual G4 PowerMacs are about 4-5 years old.  We also aren&#8217;t running matched hardware which is going to make detective work on failures difficult.  I have found some machines to replace our mixture of P3s that do not even have SSE.  They are based on the AMD Geode LX800 processor.  These machines are what the OLPC XO have as a <a href="http://wiki.laptop.org/go/Hardware_specification">cpu</a>.  Because they are based on an ancient CPU core (Cyrix 5&#215;86, technically a 486), they even lack SSE.  That makes them the perfect for our testing.  The model that I am looking at is the <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813130103">MSI Fuzzy</a>.  I don&#8217;t really understand their naming, but this machine would fit our needs perfectly.  It has a fast (for the category) processor and slots for 1gb of ram.  Most importantly, it allows us to have as many identical machines as we need.  The Mac Mini is easier to standardize on because it was fairly popular at the time and there are only one or two minor variations of the PowerPC Mini.</p>
<p>Before we go rushing out and buying a bunch of new machines for this testing, we need to know how long there will be demand for this kind of testing.  I would estimate that it would cost about $500 per Geode machine, and that we might be able to get nightly coverage on two to three branches on linux and windows with four machines. </p>
<p>Also of note is that because we are running on such old hardware, we are getting JavaScript timeouts.  I don&#8217;t really know how to manually set the preference that ignores these timeout warnings, but it is causing a lot of the jobs to be killed off because they aren&#8217;t responsive.  I&#8217;d love to know if you know how I can disable this in an easy to automate way.  I was thinking that I could launch and kill Firefox to create a profile, modify the profile&#8217;s preference file then launch it again for the real tests.  I don&#8217;t know which preference file I would need to do this on though.<br />
<a href="http://blog.johnford.info/wp-content/uploads/2009/11/slow-script.png"><img src="http://blog.johnford.info/wp-content/uploads/2009/11/slow-script.png" alt="slow-script" title="slow-script" width="643" height="264" class="aligncenter size-full wp-image-192" /></a></p>
<p>This is where I&#8217;d like to ask people who are working on the JavaScript JIT to let me know how long we need to do this testing and whether this current coverage (mozilla192 and mozilla-central) is enough.  A comment on this post, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=463262">bug 463262</a> or ping me on #build (jhford).  </p>
<p>As a side note, this configuration makes it possible for us to run unit tests on second tier support machines and operating systems.  If there is any community interest, I can look making it possible for anyone to connect their machine to this buildbot master if they have an obscure machine with spare cycles.  This would require you to be able to dedicate the box for this testing, us to already produce builds that run on that architecture.</p>
<p>If anyone wants, I can get some photos of the machines on Monday.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/unittests-on-ppc-and-non-sse2-machines/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Reimplementing a subset of DD in Python</title>
		<link>http://blog.johnford.info/reimplementing-a-subset-of-dd-in-python/</link>
		<comments>http://blog.johnford.info/reimplementing-a-subset-of-dd-in-python/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 22:02:56 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=183</guid>
		<description><![CDATA[Through my work on imaging our Nokia test farm, I have developed 3 approaches to imaging the n810.  The first is to set up an N810 then generate our own firmware image as a JFFS2 filesystem.  This approach gives us an N810 that is essentially factory-stock.  We found that we were still having devices fall [...]]]></description>
			<content:encoded><![CDATA[<p>Through my work on imaging our Nokia test farm, I have developed 3 approaches to imaging the n810.  The first is to set up an N810 then generate our own firmware image as a JFFS2 filesystem.  This approach gives us an N810 that is essentially factory-stock.  We found that we were still having devices fall over on a regular basis with this approach.  The next approach I tried was to put the full Maemo operating system on an SD card and boot from it.  This resulted in significantly improved reliability at a minor cost in test suite run time.  The actual imaging process is far less human involved than the older approach.  All that is required is that somebody is there to change blank sd cards and execute the command again.  This process used <a href="http://en.wikipedia.org/wiki/Rsync">rsync</a> (<code>sudo rsync -a moz-ref-v2/. /mount/point/.</code>) to copy the files from a directory on the imaging machine onto the SD card.  As a part of the imaging process, the hostname is set as are a couple other bits of information.  It took me the better part of 3 days to image all 40 sd cards using this approach.</p>
<p>The third approach that we are going to move forward with uses the imaging process of the second approach to create a &#8216;master&#8217; image.  This image has all the information already set up, including text files specifying which image revision the device is running on.  Once this is done, we use <a href="http://en.wikipedia.org/wiki/Dd_%28Unix%29">dd</a> to dump an image of the entire sd card onto the PC&#8217;s hard disk (<code>dd if=/dev/sdb of=moz-ref-v1.dump bs=100M</code>).  When this is complete, we have a 3.7GB file which contains the entire contents of the master card image.  We can then write this file directly to another sd card to get an identical copy of the master (<code>dd if=moz-ref-v1.dump bs=100M</code>).  The problem is that this doesn&#8217;t scale too well.  We are aiming to be able to write to 14 cards at the same time.  I have investigated using <code>tee</code>(<code>dd if=moz-ref-v1.dump bs=100M | tee /dev/sdb /dev/sdc /dev/sdd &gt; /dev/null</code>) but found that it wouldn&#8217;t write to raw devices.  Another option would be to use a for loop and start a bunch of dd processes in the background.  While this would have worked, we would be using a really high amount of hard disk throughput, scaling linearly.  Instead, I decided to write a limited subset implementation of dd in Python.  I used the optparse library to implement the command line interface and standard Python I/O for the cloning process.  After timing a few runs, I found that my python script was about 98% as fast as the canonical implementation.  I only measured wall time as that is the only thing of value for this situation.</p>
<p>A further optimization that I would like to do is the ability to store the image files in a compressed format and decompress them on the fly.  Because the dump files contain every single bit that the filesystem tracks it ends up being the same size as the SD card itself.  In our case, we have a 4GB filesystem even though only about a gig of that is used.  The most simple way to get around this is to compress the image files.  Rather than worrying about manually decompressing the file before feeding it into the duplication program, I am going to implement decompression in the duplicator program.  I found that Python has a really nice <a href="http://docs.python.org/library/bz2.html">BZip2</a> module in the standard library.  This is module provides a full file interface for a BZip2 compressed file.  Before I decided to implement this, I wanted to check that the module is able to decompress files on the fly.  I started by generating a file with random data (<code>dd if=/dev/random of=random bs=1024 count=1024</code>) which I then computed a sha1 has for (<code>openssl sha1 &lt; random &gt; random.sha1</code>).  At this I opened an interactive Python interpreter and ran the commands:</p>
<pre>&gt;&gt;&gt; import bz2
&gt;&gt;&gt; in = bz2.BZ2File('random.bz2')
&gt;&gt;&gt; out = open('random', 'w+')
&gt;&gt;&gt; while True:
...  buffer = f.read(1024)
...  if buffer is '':
...   break
...  o.write(buffer)
...</pre>
<p>Once this had completed, I exited the python interpreter and compared my sha1 hashes:</p>
<pre>jhford$ cat random.sha1
dc34e2d6308786e5e5857f7b0b1126097060df6c
jhford$ openssl sha1 &lt; random
dc34e2d6308786e5e5857f7b0b1126097060df6c</pre>
<p>This tells me that I can safely use the BZ2File class for implementing compressed sd card images.  My current implementation strategy is to have files that have a &#8216;.bz2&#8242; extension automatically treated as either a file that is compressed (input) or should be compressed (output).</p>
<p>I am continually impressed by how comprehensive the Python standard library is.  It seems that every time I write something in Python, there is a built in module to do anything that isn&#8217;t specific to the problem at hand!</p>
<p>The code for my duplicator implementation is being developed at <a href="http://hg.johnford.info/multi-dd">http://hg.johnford.info/multi-dd</a> and the imaging scripts for the mobile work lives in the build repository at <a href="http://hg.mozilla.org/build/tools">http://hg.mozilla.org/build/tools</a> in the directory <code>buildfarm/mobile</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/reimplementing-a-subset-of-dd-in-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WinCE Try Builds</title>
		<link>http://blog.johnford.info/wince-try-builds/</link>
		<comments>http://blog.johnford.info/wince-try-builds/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 04:37:04 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=180</guid>
		<description><![CDATA[I know my last post about Try Server work was enabling Maemo and WinCE builds but we later realized that those were actually Windows Mobile.  While based on Windows CE, Windows Mobile is a distinct product.  Thanks to Nick&#8217;s work I was able to get Try builds up and running a lot quicker. [...]]]></description>
			<content:encoded><![CDATA[<p>I know my last post about Try Server work was enabling Maemo and WinCE builds but we later realized that those were actually Windows Mobile.  While based on Windows CE, Windows Mobile is a distinct product.  Thanks to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=485109">Nick&#8217;s work</a> I was able to get Try builds up and running a lot quicker.  Because this is a straight Firefox build, I was able to use the standard try server build factories.  I have asked some of the mobile team developers to verify the builds manually before I mark the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=514332">bug</a> as resolved fixed.  One issue that I have noticed is that the Tinderbox build logs aren&#8217;t being scraped properly.  An example is that</p>
<pre>TinderboxPrint: jford@mozilla.com
TinderboxPrint: 1252624187
Comments: No description given</pre>
<p>is not showing up in the waterfall column.  I have seen this with other builders, so I am going to assume that it isn&#8217;t specific to my code.</p>
<p>This now means that when you submit your code to the Try Server a WinCE build will kick off.  I hope that this helps the WinCE team!  If you notice anything strange going on, please don&#8217;t hesitate to contact me.  I am always on irc.mozilla.org in #build as jhford.</p>
<p><a href="http://blog.johnford.info/wp-content/uploads/2009/09/Screen-shot-2009-09-10-at-9.24.45-PM.png"><img class="aligncenter size-full wp-image-181" title="Successful builds!" src="http://blog.johnford.info/wp-content/uploads/2009/09/Screen-shot-2009-09-10-at-9.24.45-PM.png" alt="Successful builds!" width="481" height="179" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/wince-try-builds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>14 More Nokias</title>
		<link>http://blog.johnford.info/14-more-nokias/</link>
		<comments>http://blog.johnford.info/14-more-nokias/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 01:16:05 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=167</guid>
		<description><![CDATA[We have gotten the remainder of our order of 20 Nokia N810s.  This brings our total pool of devices up to 40!  I have gotten them fully set up and they are running in staging.  If everything looks good tomorrow, I will move them over to production.
I have also moved them all to the conference [...]]]></description>
			<content:encoded><![CDATA[<p>We have gotten the remainder of our order of 20 Nokia N810s.  This brings our total pool of devices up to 40!  I have gotten them fully set up and they are running in staging.  If everything looks good tomorrow, I will move them over to production.</p>

<a href='http://blog.johnford.info/14-more-nokias/img_1023/' title='IMG_1023'><img width="150" height="112" src="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1023.png" class="attachment-thumbnail" alt="" title="IMG_1023" /></a>
<a href='http://blog.johnford.info/14-more-nokias/img_1025/' title='IMG_1025'><img width="150" height="112" src="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1025.png" class="attachment-thumbnail" alt="" title="IMG_1025" /></a>

<p>I have also moved them all to the conference table in FAIL to see if this improves our connection reliability.  This will really help us to keep posting reliable and timely numbers.  I still have 3 units running in staging which are using a MicroSD card for their entire os and data drive.  If this works out well, we will hopefully improve our end to end times on builds and make it even easier to reimage a malfunctioning device.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/14-more-nokias/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Credit Card Fraud</title>
		<link>http://blog.johnford.info/credit-card-fraud/</link>
		<comments>http://blog.johnford.info/credit-card-fraud/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 06:09:12 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=164</guid>
		<description><![CDATA[I checked my Visa account tonight and found out that my bill was $2100 more than it is supposed to be.  Turns out that someone though it&#8217;d be fun to order a $1500 Vacation from something that looks like a front and $600 from Rogers Wireless.  I have spoken to RBC and Rogers Wireless and [...]]]></description>
			<content:encoded><![CDATA[<p>I checked my Visa account tonight and found out that my bill was $2100 more than it is supposed to be.  Turns out that someone though it&#8217;d be fun to order a $1500 Vacation from something that looks like a front and $600 from Rogers Wireless.  I have spoken to RBC and Rogers Wireless and explained the situation.  RBC is reversing the charges and conducting an investigation.  Rogers Wireless is launching a fraud investigation.</p>
<p>I also did an Equifax and Trans Union credit check tonight.  The Equifax one comes up clean as does the majority of the Trans Union one.  Unfortunately, the Trans Union report shows that Rogers has done a credit check on me.  This negatively impacts my credit rating and is the last thing I need right now.  I called the non-emergency number of the Police to report the fraud and was greeted by an apparent wall.  I wasn&#8217;t speaking to an officer though.  This person informed me that even though I live in Toronto normally, and that BOTH charges on my card show as Toronto, ON it isn&#8217;t a matter for Toronto Police unless I am physically in Toronto.  Nice to see my tax dollars hard at work!  This numpty suggested that I visit the local police here to give a report.  I don&#8217;t understand this.  Why on earth would a Mountain View police officer be the one to deal with a crime committed against a Canadian, in Canada with Canadian companies.  I doubt that it would even make its way up to Toronto.</p>
<p>This couldn&#8217;t have come at a worse time.  I wonder if the false credit check will be removed from my credit history as I absolutely didn&#8217;t request it, the $600 charge or the $1503 charge!  As I sit here, I wonder what I can do regarding this situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/credit-card-fraud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Six Nokia N810s up in 1 hour</title>
		<link>http://blog.johnford.info/six-nokia-n810s-up-in-1-hour/</link>
		<comments>http://blog.johnford.info/six-nokia-n810s-up-in-1-hour/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:34:51 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=157</guid>
		<description><![CDATA[Today John O&#8217;Duinn found some new N810s around the office.  While they weren&#8217;t destined for us, we worked a trade (Thanks Nick!) for some of the devices we have arriving soon.
The imaging process that I described in an earlier post requires some time to bake in a staging environment because it requires some fairly significant [...]]]></description>
			<content:encoded><![CDATA[<p>Today John O&#8217;Duinn found some new N810s around the office.  While they weren&#8217;t destined for us, we worked a trade (Thanks Nick!) for some of the devices we have arriving soon.</p>
<div id="attachment_162" class="wp-caption aligncenter" style="width: 490px"><a href="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1013.png"><img class="size-full wp-image-162" title="IMG_1013" src="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1013.png" alt="The new devices still in their boxes" width="480" height="640" /></a><p class="wp-caption-text">The new devices still in their boxes</p></div>
<p>The imaging process that I described in an <a href="http://blog.johnford.info/imaging-nokias-n810/" target="_blank">earlier post </a>requires some time to bake in a staging environment because it requires some fairly significant changes in how the device acts.  In the interim I have generated an image for flashing the N810s that still uses the internal raw flash memory.  To do this we set up a reference device exactly as needed.  After this I generated a new filesystem image (<code>sudo gainroot; mount -t jffs2 /dev/mtdblock4 /opt; mount /dev/mmcblk1p1 /floppy; cd /floppy; mkfs.jffs2 -r /opt -o moz-ref-image-v1.jffs2 -e 128 -l -n</code>).  Once this was done I transfered the files to my desktop pc and wrote an automation script that flashes the devices.  This puts the root filesytem onto the device.  For the pagesets used by talos we need to use the internal controlled flash card. For this I have written a script which takes the device files for each plugged in maemo and rsync&#8217;s the contents of the drive.  Using a helper script I have made this work on 6 devices at once.</p>
<div id="attachment_159" class="wp-caption aligncenter" style="width: 650px"><a href="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1019.png"><img class="size-full wp-image-159" title="IMG_1019" src="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1019.png" alt="Data being transfered to the new N810s" width="640" height="480" /></a><p class="wp-caption-text">Data being transfered to the new N810s</p></div>
<p>It took a less than one hour to get all the machines from unopened shipping box to running in our staging environment.  If everything looks good, I will move these six new devices over to production tomorrow.  This is a significant improvement over the multiple hour per device process of setting up a device we used before.  This process scales very well.  It takes 90 seconds to flash each device with a root file system and is done in serial.  Setting up the page set file system took 6 minutes for 6 devices and is done in parallel.</p>
<div id="attachment_160" class="wp-caption aligncenter" style="width: 650px"><a href="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1022.png"><img class="size-full wp-image-160" title="Staging" src="http://blog.johnford.info/wp-content/uploads/2009/08/IMG_1022.png" alt="In Staging" width="640" height="480" /></a><p class="wp-caption-text">In Staging</p></div>
<p>I am eagerly awaiting the arrival of 14 more N810s some time this or next week.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/six-nokia-n810s-up-in-1-hour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Imaging Nokia&#8217;s N810</title>
		<link>http://blog.johnford.info/imaging-nokias-n810/</link>
		<comments>http://blog.johnford.info/imaging-nokias-n810/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 01:30:53 +0000</pubDate>
		<dc:creator>John Ford</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.johnford.info/?p=147</guid>
		<description><![CDATA[In order to scale our mobile testing infrastructure we need to be able to get devices up and running in production as soon as possible and be able to repair software issues as quickly as possible.  The N810 runs Maemo and due to its similarities to desktop Linux it is the only mobile platform we [...]]]></description>
			<content:encoded><![CDATA[<p>In order to scale our mobile testing infrastructure we need to be able to get devices up and running in production as soon as possible and be able to repair software issues as quickly as possible.  The N810 runs Maemo and due to its similarities to desktop Linux it is the only mobile platform we are able to run unit and performance tests yet.  Up until now, we have had to set up the devices by hand each time.  As well, when a device&#8217;s software stopped working right it needed to be erased, reflashed and reset manually.  This reseting process occurs multiple times a week and ends up taking a while to get the device back into production.  The work required, while uninteresting, is full of detail that may not be accurately expressed on the N810&#8217;s miniature keyboard.  The ability to image the N810 gives us a multi-faceted win in that we are able to get new devices up quicker, fix broken devices quicker and ensure all devices are set up consistently.</p>
<h3>Anatomy of the N810</h3>
<p>The Nokia N810 has internal raw flash memory (/dev/mtd*), internal controlled flash (/dev/mmcblk0) and a MiniSD card slot (/dev/mmcblk1).  The raw flash memory and controlled flash memory <a title="UBIFS Documents" href="http://www.linux-mtd.infradead.org/doc/ubifs.html#L_raw_vs_ftl" target="_blank">differ significantly</a> in their operation and as a result use two totally different file-systems.  On a normal N810 there are 5 partitions:</p>
<ul>
<li>Bootloader &#8211; raw file</li>
<li>Kernel image &#8211; raw file</li>
<li>Initialization filesystem &#8211; JFFS2 filesystem</li>
<li>Root filesystem &#8211; JFFS2 filesystem</li>
<li>Data partition on internal controlled 2GB flash memory &#8211; FAT filesystem</li>
</ul>
<p>My first approach was to generate a custom filesystem image of the <a title="Root filesystem information" href="http://www.linfo.org/root_filesystem.html" target="_blank">root filesystem</a>.  I accomplished this by mounting the root filesystem to an existing unused folder (<code>mount -t jffs2 /dev/mtdblock4 /opt</code>).  I could have created a new folder, but this would mean that this new mountpoint folder would also be present in the image.  Once mounted I used the JFFS2 filesytem creator to create a filesystem image(<code>/home/user/initfs_flasher/mkfs.jffs2 -r /opt -o /media/mmc2/rootfs-moz-v1.jffs2 -e 128 -l -n</code>).  This <a href="http://linux.die.net/man/1/mkfs.jffs2" target="_blank">command</a> creates a filesystem image (i.e. not written out to a device file as you would with mkfs.ext3) with a root directory of /opt.  The other parameters specify the erase block size, the <a href="http://en.wikipedia.org/wiki/Endianness">byte-sex</a> and not to have cleanmarkers.  This will write the file to the removable flash card which can then be inserted into a PC and flashed to the device using the Nokia&#8217;s <a href="http://www.hopelesscase.com/linuxnotes/flasher-3.0-static" target="_blank">flashing program</a> (<code>su; ./flasher-3.0 --rootfs rootfs-moz-v1.jffs2 --flash</code>).</p>
<h3>Shortcomings</h3>
<p>This approached worked really well but it could not automate setting the device up to go straight into production.  Someone would need to manually change the hostname, change the buildbot.tac file and change the buildbot information page.  This got me to thinking that I could copy the files onto my PC, modify them, generate the filesystem image locally then flash the device.  I started by setting up <a href="https://wiki.mozilla.org/ReferencePlatforms/Test/Maemo#fix_apt-get">rsync</a> and <a href="https://wiki.mozilla.org/ReferencePlatforms/Test/Maemo#sshd" target="_blank">openssh</a>.  I mounted the root filesystem as before and ran rsync on my PC (<code>su; mkdir rootfs; rsync -a root@10.0.0.1/. rootfs/.</code>) and got a snack (note the critical -a flag on rsync).  When I had gotten back I had all the files and created the filesystem (<code>su; yum install mtd-utils; mkfs.jffs2 -r rootfs -o rootfs-moz-v2.jffs2 -e 128 -l -n</code>) then flashed this onto the device (<code>su -; ./flasher-3.0 --rootfs</code>).  This is where the wheels began to fall off.  The device booted and it appeared to be working great.</p>
<p>I was testing the devices when I noticed that the shutdown prompt wasn&#8217;t themed properly.  When you press the power button on an N810, a menu comes up asking if you want to lock the device, suspend it or turn it off.  The first issue with this approach was that this menu wasn&#8217;t themed using the proper <a href="http://live.gnome.org/Hildon">hildon</a> buttons and instead was using the default GTK<a href="http://developer.gnome.org/doc/GGAD/figures/gtkbutton.png"> button theme</a>.  This was not in itself an issue but signalled that there was corruption happening somewhere.  We decided to run this image in our staging environment and unfortunately my concerns were realized when a lot of the tests were failing.</p>
<h3>Improved Process</h3>
<p>While investigating our options I came across a couple pages about <a href="http://wiki.maemo.org/Booting_from_a_flash_card" target="_blank">booting from a flash card</a> and <a href="http://wiki.maemo.org/Advanced_booting" target="_blank">advanced boot</a> configurations on the maemo wiki.  My initial attempt followed the booting from a flash card page&#8217;s instructions.  This yeilded a working system but made the flashing process very complicated requiring work to be done on the PC and on the device.  This would not really solve any problem and as a result I did some further thinking.  It turns out that Nokia had the foresight to allow booting from an SD card in the stock firmware.  Now on my second approach, I used the flashing program to set the device that has the root filesystem (<code>su; ./flasher-3.0 --set-root-device mmc</code>) to one of the controlled flash cards.  Important to note is that there is no place to choose between the internal memory and the memory card.  At boot the N810 will scan the first partition on both devices looking for a specific file.  When it finds that file it selects that device as the boot device.</p>
<p>To get the fully configured root filesystem onto the SD card, I remounted the raw flash root partition as in my first approach and rsync&#8217;d it to my PC as in my modified first approach.  My first strategy for duplicating the SD card was to copy the files to the reference SD card then use <code>dd</code> to dump the contents of the card(<code>dd if=/dev/sdc of=dump.sd bs=100M</code>) to a file then write them to another card(<code>dd if=dump.sd of=/dev/sdc bs=100M</code>).  This strategy has the disadvantage of needing to write out a lot of blank space which takes a long time.  It also doesn&#8217;t shrink or grow the partition or filesystem which means that you need to use the exact same size or larger card.</p>
<h3>Final Implementation</h3>
<p>I decided to write a less naïve implementation.  The result was a <a href="http://hg.johnford.info/mobile-imaging/file/bddc94600243/jhford-scripts/moz-image.sh" target="_self">script</a> that creates a blank filesystem on an SD card on my PC, copies the files over, modifies the files as needed then ejects the SD card.  This card can then be put into a device that has had its root device set correctly.  I wrote a <a href="http://hg.johnford.info/mobile-imaging/file/bddc94600243/jhford-scripts/moz-prep.sh" target="_blank">script</a> to do all device setup correctly.  In this script I reflash the bootloader and kernel for safety and put the device into Research and Development mode to enable root access on device.  I also flash an empty root filesystem to the raw flash partition to ensure it isn&#8217;t used.  Using different types of flash could affect performance test results.</p>
<p>Something rather annoying is that the N810&#8217;s device file naming convention is for controlled flash devices is <a href="https://bugs.maemo.org/show_bug.cgi?id=2747" target="_blank">broken</a>.  This means that while the MiniSD card should be <code>/dev/mmcblk1</code> when booted from the raw flash <code>/dev/mtdblock4</code> it is <code>/dev/mmcblk0</code> when booted from MiniSD card itself.  Because I had copied the entire root filesystem to the internal card while testing things, the only way I was able to confirm that I was booted from the memory card was to remove the card while the system was operating.  Thankfully, this caused a major system crash and proved that I was running off the MiniSD card.</p>
<h3>Hidden Benefits</h3>
<p>As a side effect of running the device with all the files on the same MiniSD card the internal 2GB controlled flash card is now unused.  This can now be used for lots of swap storage.  To do this you need to create a file that is the size of the swap you need (<code>dd if=/dev/zero of=${MOUNTPOINT}/.swap bs=1024 count=262144</code>) then turn it into swap space (<code>mkswap ${MOUNTPOINT}/.swap</code>).  This can either be done on device or on a PC with the device plugged into it.</p>
<h3>Next Steps</h3>
<p>I still haven&#8217;t tested the SD card images in staging yet.  I also need to work with Aki to move files from the old mount points of /media/mmc1 and /media/mmc2 which are no longer correct or used.  I also need to move the imaging machine somewhere other than my desk and check the code into Mozilla&#8217;s mercurial repository.</p>
<h3>Useful Links</h3>
<ul>
<li>http://wiki.maemo.org/Modifying_the_root_image</li>
<li>http://wiki.maemo.org/Booting_from_a_flash_card</li>
<li>http://wiki.maemo.org/Advanced_booting</li>
<li>http://fanoush.wz.cz/maemo/index.html#initfs</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.johnford.info/imaging-nokias-n810/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
