<?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>Energiequant &#187; Slug (NSLU2)</title>
	<atom:link href="http://www.energiequant.de/wordpress/articles/category/slug-nslu2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.energiequant.de/wordpress</link>
	<description></description>
	<lastBuildDate>Tue, 03 Aug 2010 21:40:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Broken</title>
		<link>http://www.energiequant.de/wordpress/articles/2008/11/25/broken/</link>
		<comments>http://www.energiequant.de/wordpress/articles/2008/11/25/broken/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 01:13:27 +0000</pubDate>
		<dc:creator>Energiequant</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Slug (NSLU2)]]></category>

		<guid isPermaLink="false">http://www.energiequant.de/wordpress/?p=136</guid>
		<description><![CDATA[In case anyone should be wondering why I didn&#8217;t continue my project to install Gentoo: Well&#8230; Unfortunately that slug is broken.
USB seems to be damaged in some way as it reports nothing but rubbish to the kernel and something causes bad noises to come from the beeper. Some forum threads pointed out that might be [...]]]></description>
			<content:encoded><![CDATA[<p>In case anyone should be wondering why I didn&#8217;t continue my project to install Gentoo: Well&#8230; Unfortunately that slug is broken.</p>
<p>USB seems to be damaged in some way as it reports nothing but rubbish to the kernel and something causes bad noises to come from the beeper. Some forum threads pointed out that might be caused by a bad power supply. However, after changing the AC adapter it doesn&#8217;t run any better in my case. Since I wasn&#8217;t able to flash the original firmware correctly (it was just too obvious that I manipulated that box) I decided to open it up and take a look at its PCB.</p>
<p>Unfortunately I can&#8217;t see any physical damages on that board so I must assume there&#8217;s some hidden defect somewhere. I doubt I can fix it, so I must consider that box to be broken after just 4 months. After all I read I must advice everyone <b>NOT</b> to buy a NSLU2 &#8211; except you are out for some soldering on the board. The hardware fails much too often from what I could find, be it for overheating, manufacturing or just design errors (like the fancy &#8220;feature&#8221; that you can power the box solely by an external USB hub). Sadly, if I cannot find the error or a workaround for it, I may not continue on this project since I am not willing to buy another box for full price that&#8217;s broken by design.</p>
<p>Either I buy one very very cheap at eBay or I will just let it die. Maybe someday I might be able to fix it &#8211; could be my studies might be of some help at some later point.</p>
<p>Anyway; this project was no complete loss of time. Much of the knowledge I gained can be helpful in getting Gentoo onto the <a href='http://www.openpandora.org/' target='_blank'>Pandora</a> when it finally arrives (which unfortunately may take another 3-4 months depending on LCD production since I assume I&#8217;m somewhere in the last third of the preorder queue).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.energiequant.de/wordpress/articles/2008/11/25/broken/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>msleep() vs. mdelay()</title>
		<link>http://www.energiequant.de/wordpress/articles/2008/10/02/msleep-vs-mdelay/</link>
		<comments>http://www.energiequant.de/wordpress/articles/2008/10/02/msleep-vs-mdelay/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 01:13:18 +0000</pubDate>
		<dc:creator>Energiequant</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Slug (NSLU2)]]></category>

		<guid isPermaLink="false">http://www.energiequant.de/wordpress/?p=135</guid>
		<description><![CDATA[Arrrrgh&#8230;. I finally got it&#8230;.
For months I have been trying to figure out why my cross-compiled kernel and rootfs won&#8217;t boot on the NSLU2 aka Slug. Since I didn&#8217;t want to solder pins for the serial I/O onto the board I tried a quite unique approach: Since the Slug has 4 LEDs that can be [...]]]></description>
			<content:encoded><![CDATA[<p>Arrrrgh&#8230;. I finally got it&#8230;.</p>
<p>For months I have been trying to figure out why my cross-compiled kernel and rootfs won&#8217;t boot on the NSLU2 aka Slug. Since I didn&#8217;t want to solder pins for the serial I/O onto the board I tried a quite unique approach: Since the Slug has 4 LEDs that can be easily controlled through GPIO, I could hook up at some function and send all output through the LEDs. Sure this would be slow (~1 character per second, maybe 1.5) but that would be enough to at least read kernel panic messages while retaining full warranty on the hardware.</p>
<p>Finding out how LEDs were controlled took me about 1,5 hours, hooking up and testing first things another hour. I hooked up before the call of init (disk 2 on), right after init (disk 1 on) and on kernel panics (both disk leds on). So what happened: It got init and then crashed with a panic after a few seconds. I figured out I could hook up at uart_console_write() or panic() and then read any output by blinking a byte in 4 steps (one byte on each disk LED, signal indication by setting power to green and &#8220;clock&#8221; indication through power amber). Well it started blinking for hours and hours and hours&#8230; But all I could decode was just infinite rubbish, no matter what I tried. Even a comparison i<sizeof(buf) would never get to an end, although buf has only a size of 1024 bytes (which i calculated should take at most 25 minutes to blink along).</p>
<p>Nothing worked - until now....</p>
<p>For some reason I chose msleep() over mdelay(). <b>That was the critical fault.</b></p>
<p><b>msleep()</b> seems to suspend the currently running task, so it is non-blocking regarding the whole system.</p>
<p><b>mdelay()</b> blocks the system (or at least the active CPU) if running single-threaded.</p>
<p>So why was that small change critical to my code? I don&#8217;t know exactly. But I know that panic() disables scheduling before any further action. So what happens if some code fragment used by panic() tries to relay on scheduling? Something seems to get corrupted very seriously, maybe some kind of heap or stack overflow happens. Maybe some process/scheduler data gets screwed up. I don&#8217;t know. But that seemingly tiny difference of blocking vs. non-blocking functions (what function does what isn&#8217;t always that clear if you&#8217;re new to Linux kernel programming) really makes a very big difference.</p>
<p>I finally recorded my kernel panic on dv tape and will decode it tomorrow using a simple tool I wrote. If it is finished I will make it available from this website.</p>
<p>Here&#8217;s a small excerpt from the ~20 minutes long message transmitting &#8220;BUG: sched[...]&#8221; (I did not decode more than that yet):</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/b_8b45-_8WM"></param><embed src="http://www.youtube.com/v/b_8b45-_8WM" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
<p><b>Edit:</b> I decoded all 20 minutes. What was readable (the decoder was a quick and dirty solution since yet) led me to &#8220;BUG: scheduling while atomic:&#8221; in kernel source and was simply caused by a remaining msleep in my LED function. I got rid of it and now got a clean message &#8220;Attempted to kill init!&#8221;. Now, that&#8217;s where the debugging begins&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.energiequant.de/wordpress/articles/2008/10/02/msleep-vs-mdelay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slug (Linksys NSLU2)</title>
		<link>http://www.energiequant.de/wordpress/articles/2008/07/13/slug-linksys-nslu2/</link>
		<comments>http://www.energiequant.de/wordpress/articles/2008/07/13/slug-linksys-nslu2/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 21:19:54 +0000</pubDate>
		<dc:creator>Energiequant</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Slug (NSLU2)]]></category>

		<guid isPermaLink="false">http://www.energiequant.de/wordpress/?p=133</guid>
		<description><![CDATA[After I read about a quite inexpensive (about 65 to 75€) embedded system on a forum two weeks ago, I needed to get one of these myself. The system has two USB host ports and an ethernet interface, 32MB SD-RAM, 8MB flash memory and a 266MHz ARM (Intel XScale) CPU (underclocked @133 MHz until mid [...]]]></description>
			<content:encoded><![CDATA[<p>After I read about a quite inexpensive (about 65 to 75€) embedded system on a forum two weeks ago, I needed to get one of these myself. The system has two USB host ports and an ethernet interface, 32MB SD-RAM, 8MB flash memory and a 266MHz ARM (Intel XScale) CPU (underclocked @133 MHz until mid 2006 production dates). It&#8217;s running Linux with a modified RedBoot bootloader. It&#8217;s originally intended to be a NAS server for USB hard drives but can be flashed with different Linux kernels and images. Unfortunately it&#8217;s already getting old (first released in 2004) and was reported to be discontinued so I had to decide to buy it now or never. I bought it:</p>
<p><!-- s9ymdb:91 --><img width="450" height="338" style="border: 0px; padding-left: 5px; padding-right: 5px;" src="/serendipity/uploads/080713_slug.jpg" alt="" /></p>
<p>If that device is completely new to you, the article on Wikipedia (<a href='http://en.wikipedia.org/wiki/NSLU2' target='_blank'>en</a>/<a href='http://de.wikipedia.org/wiki/NSLU2' target='_blank'>de</a>) may provide a good starting point for more information on what is possible. If you get interested in it, <a href='http://www.nslu2-linux.org/' target='_blank'>nslu2-linux.org</a> provides a great resource to answer almost all your questions.</p>
<p>My goal is to get Asterisk, DHCP, DNS, OpenVPN and maybe a small webserver to run on it. However I haven&#8217;t reached that yet. (Click the link below to read more.)<span id="more-133"></span>I initially booted the original system to verify everything is working. Since I don&#8217;t have any USB HDD and intended to attach a cheap 8GB USB flash drive I (surprisingly) couldn&#8217;t do anything with Linksys&#8217; firmware: It detects the stick but wouldn&#8217;t use it without a real hard drive attached to USB port 1 to install onto. With just 8 minutes uptime I decided to flash it right away.</p>
<p>I wanted to install Gentoo but installation on an embedded system is not that straight at all. Since there are some ready-to-use distros for the slug I flashed <a href='http://www.slug-firmware.net/' target='_target'>SlugOS/BE</a> onto it. As you may guess from the suffix, it&#8217;s a Big Endian version of that (Debian-based) distribution. The CPU could switch to Little Endian as well but since the unmodified RedBoot from the NSLU2 expects the system to be in BE mode it&#8217;s easier to set it up that way. It booted up with no problems and I could log in and start installing an outdated 2005.0 release of Gentoo using uclibc instead of glibc &#8211; unfortunately this is the latest (experimental) release of Gentoo for armeb (ARM Big Endian) using softfloat (to emulate the missing floating point unit) and uclibc (for saving memory).</p>
<p>I got quite far updating the base system but shortly before I could run a world update I experienced a severe blocker issue: uclibc is slowly updated and reported to be bugged in its latest revision, so Gentoo only supports the previous version. Unfortunately that version is reported to be unable to work with kernels/kernel headers >2.6.17 and caused a lot of bugs lately due to its age.</p>
<p>Now I had two options:</p>
<p>1. Forget about Gentoo and use one of the Debian based distros for the slug. However, SlugOS has been released before the critical kernel bugfix from February 2008, so it must be considered vulnerable to attacks if exposed to the Internet. Maybe I could update that system but I didn&#8217;t really want to be stuck with Debian.</p>
<p>2. Read into cross-compiling a complete system for embedded systems, manually applying kernel patches and transferring everything to the slug for trial-and-error testing until it finally boots and gives me a remote shell. Eventually this is the way I chose a week ago and that&#8217;s where the fun starts.</p>
<p>I just want to give a short introduction with this post. During the next weeks/months however, I will blog more and more articles about the issues I have with getting the system to run. So far I finally understood cross-compiling on Gentoo, got a basic system that could theoretically be chrooted into but since I compiled with a more recent version of glibc than SlugOS has been linked against, it won&#8217;t let me in yet. Today I prepared a &#8220;TinyGentoo&#8221; to (possibly) boot into, but it&#8217;s not ready yet. Next I will need to slim the boot system and try to build a kernel and transfer everything onto the slug for a first try to boot it blindly (without soldering the serial port connector onto the board).</p>
<p>Unfortunately I have two exams next monday so it&#8217;s unlikely I will get any further this week. I will keep this blog category updated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.energiequant.de/wordpress/articles/2008/07/13/slug-linksys-nslu2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
