<?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>Hardwarebug &#187; Hardware</title>
	<atom:link href="http://hardwarebug.org/category/hardware/feed/" rel="self" type="application/rss+xml" />
	<link>http://hardwarebug.org</link>
	<description>Everything is broken</description>
	<lastBuildDate>Tue, 17 Aug 2010 14:47:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Hacking the Popcorn Hour C-200</title>
		<link>http://hardwarebug.org/2010/05/03/hacking-the-popcorn-hour-c-200/</link>
		<comments>http://hardwarebug.org/2010/05/03/hacking-the-popcorn-hour-c-200/#comments</comments>
		<pubDate>Mon, 03 May 2010 03:14:34 +0000</pubDate>
		<dc:creator>Mans</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[MIPS]]></category>

		<guid isPermaLink="false">http://hardwarebug.org/?p=479</guid>
		<description><![CDATA[Update: A new firmware version has been released since the publication of this article. I do not know if the procedure described below will work with the new version. The Popcorn Hour C-200 is a Linux-based media player with impressive specifications. At its heart is a Sigma Designs SMP8643 system on chip with a 667MHz [...]]]></description>
			<content:encoded><![CDATA[<p><b>Update:</b> A new firmware version has been released since the publication of this article. I do not know if the procedure described below will work with the new version.</p>
<p>The <a href="http://www.popcornhour.com/onlinestore/index.php?pluginoption=productspec&#038;item_id=12">Popcorn Hour C-200</a> is a Linux-based media player with impressive specifications.  At its heart is a <a href="http://www.sigmadesigns.com/">Sigma Designs</a> <a href="http://www.sigmadesigns.com/products.php?id=35">SMP8643</a> system on chip with a 667MHz <a href="http://mips.com/products/cores/32-64-bit-cores/mips32-74k/">MIPS 74Kf</a> as main CPU, several co-processors, and 512MB of DRAM attached.  Gigabit Ethernet, SATA, and USB provide connectivity with the world around it.  With a modest $299 on the price tag, the temptation to repurpose the unit as a low-power server or cheap development board is hard to resist.  This article shows how such a conversion can be achieved.<br />
<span id="more-479"></span></p>
<h1>Kernel</h1>
<p>The PCH runs a patched Linux 2.6.22.19 kernel.  A <a href="http://www.networkedmediatank.com/download/firmware/nmt/gpl/linux-2.6.22.19.tar.bz2">source tarball</a> is available from the manufacturer. This contains the sources with Sigma support patches, <a href="http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.22/2.6.22-ck1/">Con Kolivas&#8217; patch set</a> (scheduler tweaks), and assorted unrelated changes. Properly split patches are unfortunately not available.  I have created a reduced patch against vanilla 2.6.22.19 with only Sigma-specific changes, available <a href="http://hardwarebug.org/files/pch_hack/Sigma-Tango2-3-patches.patch.bz2">here</a>.</p>
<p>The installed kernel has a number of features disabled, notably PTY support and oprofile.  We will use <a href="http://linux.die.net/man/8/kexec">kexec</a> to load a more friendly one.</p>
<p>As might be expected, the PCH kernel does not have kexec support enabled.  It does however, by virtue of using closed-source components, support module loading.  This lets us turn kexec into a module and load it.  A patch for this is available <a href="http://hardwarebug.org/files/pch_hack/kexec-as-module-for-PCH-C-200.patch">here</a>.  To build the module, apply the patch to the PCH sources and build using <a href="http://hardwarebug.org/files/pch_hack/kexec_module_config">this configuration</a>.  This will produce two modules, <code>kexec.ko</code> and <code>mips_kexec.ko</code>.  No other products of this build will be needed.</p>
<p>The replacement kernel can be built from the PCH sources or, if one prefers, from vanilla 2.6.22.19 with the Sigma-only <a href="http://hardwarebug.org/files/pch_hack/Sigma-Tango2-3-patches.patch.bz2">patch</a>.  For the latter case, <a href="http://hardwarebug.org/files/pch_hack/kernel_config">this config</a> provides a minimal starting point suitable for NFS-root.</p>
<p>When configuring the kernel, make sure <code>CONFIG_TANGOX_IGNORE_CMDLINE</code> is enabled.  Otherwise the command line will be overridden by a useless one stored in flash.  A good command line can be set with <code>CONFIG_CMDLINE</code> (under &#8220;Kernel hacking&#8221; in <code>menuconfig</code>) or passed from kexec.</p>
<h1>Taking control</h1>
<p>In order to load our kexec module, we must first gain root privileges on the PCH, and here a few features of the system are working to our advantage:</p>
<ol>
<li>The PCH allows mounting any NFS export to access media files stored there.</li>
<li>There is an HTTP server running.  As root.</li>
<li>This HTTP server can be readily instructed to fetch files from an NFS mount.</li>
<li>Files with a name ending in .cgi are executed.  As root.</li>
</ol>
<p>All we need do to profit from this is place the kexec modules, the kexec userspace tools, and a simple script on an NFS export.  Once this is done, and the mount point configured on the PCH, a simple HTTP request will send the old kernel screaming to /dev/null, our shiny new kernel taking its place.</p>
<h1>The rootfs</h1>
<p>A kernel is mostly useless without a root filesystem containing tools and applications.  A number of tools for cross-compiling a full system exist, each with its strengths and weaknesses.  The only thing to look out for is the version of kernel headers used (usually a linux-headers package).  As we will be running an old kernel, chances are the default version is too recent.  Other than this, everything should be by the book.</p>
<h1>Assembling the parts</h1>
<p>Having gathered all the pieces, it is now time to assemble the hack.  The following steps are suitable for an NFS-root system.  Adaptation to a disk-based system is left as an exercise.</p>
<ol>
<li>Build a rootfs for MIPS 74Kf little endian.  Make sure kernel headers used are no more recent than 2.6.22.x.  Include a recent version of the kexec userspace tools.</li>
<li>Fetch and unpack the PCH <a href="http://www.networkedmediatank.com/download/firmware/nmt/gpl/linux-2.6.22.19.tar.bz2">kernel sources</a>.</li>
<li>Apply the modular kexec <a href="http://hardwarebug.org/files/pch_hack/kexec-as-module-for-PCH-C-200.patch">patch</a>.</li>
<li>Using <a href="http://hardwarebug.org/files/pch_hack/kexec_module_config">this config</a>, build the modules and install them as usual to the rootfs.  The version string must be 2.6.22.19-19-4.</li>
<li>From either the same kernel sources or plain 2.6.22.19 with Sigma <a href="http://hardwarebug.org/files/pch_hack/Sigma-Tango2-3-patches.patch.bz2">patches</a>, build a <code>vmlinux</code> and (optionally) modules using <a href="http://hardwarebug.org/files/pch_hack/kernel_config">this</a> config. Modify the compiled-in command line to point to the correct rootfs. Set the version string to something other than in the previous step.
<li>Copy <code>vmlinux</code> to any directory in the rootfs.</li>
<li>Copy <a href="http://hardwarebug.org/files/pch_hack/kexec.sh"><code>kexec.sh</code></a> and <a href="http://hardwarebug.org/files/pch_hack/kexec.cgi"><code>kexec.cgi</code></a> to the same directory as <code>vmlinux</code>.</li>
<li>Export the rootfs over NFS with full read/write permissions for the PCH.</li>
<li>Power on the PCH, and update to latest firmware.</li>
<li>Configure an NFS mount of the rootfs.</li>
<li>Navigate to the rootfs in the PCH UI.  A directory listing of <code>bin</code>, <code>dev</code>, etc. should be displayed.</li>
<li>On the host system, run the <code>kexec.sh</code> script with the target hostname or IP address as argument.</li>
<li>If all goes well, the new kernel will boot and mount the rootfs.</li>
</ol>
<h1>Serial console</h1>
<p>A serial console is indispensable for solving boot problems.  The PCH board has two UART connectors.  We will use the one labeled UART0. The pinout is as follows (not standard PC pinout).</p>
<pre>
        +-----------+
       2| * * * * * |10
       1| * * * * * |9
        \-----------+
          J7 UART0
    /---------------------/ board edge
</pre>
<table>
<tr style="text-align: left">
<th>Pin</th>
<th>Function</th>
</tr>
<tr>
<td>1</td>
<td>+5V</td>
</tr>
<tr>
<td>5</td>
<td>Rx</td>
</tr>
<tr>
<td>6</td>
<td>Tx</td>
</tr>
<tr>
<td>10</td>
<td>GND</td>
</tr>
</table>
<p>The signals are 3.3V so a converter, e.g. MAX202, is required for connecting this to a PC serial port.  The default port settings are 115200 bps 8n1.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardwarebug.org/2010/05/03/hacking-the-popcorn-hour-c-200/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>New toy: Gdium netbook</title>
		<link>http://hardwarebug.org/2009/02/06/new-toy-gdium-netbook/</link>
		<comments>http://hardwarebug.org/2009/02/06/new-toy-gdium-netbook/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 03:33:19 +0000</pubDate>
		<dc:creator>Mans</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[MIPS]]></category>

		<guid isPermaLink="false">http://hardwarebug.org/?p=115</guid>
		<description><![CDATA[A new toy arrived to my house today in the shape of a Gdium Liberty 1000 netbook. Based on a Loongson 2F CPU clocked at 900 MHz, the unit sports 512 MB of RAM, a 1024&#215;600 LCD, and the usual array of external ports. Curiously absent is any form of internal mass-storage device. Operating system, [...]]]></description>
			<content:encoded><![CDATA[<p>A new toy arrived to my house today in the shape of a <a href="http://www.gdium.com/en/product/liberty1000">Gdium Liberty 1000</a> netbook. Based on a <a href="http://www.linux-mips.org/wiki/Loongson">Loongson 2F</a> CPU clocked at 900 MHz, the unit sports 512 MB of RAM, a 1024&#215;600 LCD, and the usual array of external ports. Curiously absent is any form of internal mass-storage device. Operating system, applications, and data are stored on a 16GB USB-attached flash device with a dedicated port.</p>
<p>The operating system is a customised version of Mandriva Linux. Its GNOME GUI somewhat overpowers the small machine, rendering the user experience less than stellar. A less bloated user interface would likely have allowed for smoother, albeit less visually rich, operation.</p>
<p>The selection of applications directly accessible through the main menu system is more or less what is expected for this class of machine: a graphical file manager, web browser, email client, word processor, and some simple utilities and games.</p>
<p>The less visible applications present a more interesting collection. Certain packages appear to have been installed with little consideration for utility. For instance, including GDB but not GCC strikes me as odd, as does the presence of Hylafax on a machine with no modem.</p>
<p>On the multimedia side the Gdium certainly earns points for trying. Both VLC and Totem are installed, as are a number of xine plugins; the main xine application is however missing. Despite all the players available, video playback is performance is disappointing. Even a modest standard-definition MPEG2 video is enough to bring the player to its knees.</p>
<p>FFmpeg is there too, of course. The version found here reports itself as SVN-r11599 though it is undoubtedly patched to some degree, as is customary with distribution builds. Whatever may have been patched, I am pleased to see that nothing appears to have been disabled. A cursory review of the format list shows all the major formats are there, both encoders and decoders.</p>
<p>For a quick speed test, I ran a simple benchmark of FFmpeg on a selection of formats, and compared the results to the <a href="http://beagleboard.org/">Beagle board</a> at 600 MHz. In most tests the Gdium performance is within 10% of the Beagle board, faster for H.264 video and slower for MPEG2. This is unsurprising since FFmpeg has extensive SIMD optimisations for the Cortex-A8 ARM processor on the Beagle board. With floating-point-intensive audio codecs, the Gdium is 2-3 times faster than the Beagle, consistent with the limited floating-point unit of the Cortex-A8.</p>
<p>The Loongson CPU has SIMD capabilities, so compiler/assembler permitting, it should be possible to boost the multimedia performance considerably.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardwarebug.org/2009/02/06/new-toy-gdium-netbook/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
