{"id":128,"date":"2008-09-03T21:48:55","date_gmt":"2008-09-04T02:48:55","guid":{"rendered":"https:\/\/lowtek.ca\/roo\/?p=128"},"modified":"2022-05-31T12:24:41","modified_gmt":"2022-05-31T16:24:41","slug":"installing-and-using-slimrio","status":"publish","type":"post","link":"https:\/\/lowtek.ca\/roo\/2008\/installing-and-using-slimrio\/","title":{"rendered":"Installing and Using SlimRIO"},"content":{"rendered":"<p>I&#8217;ve <a href=\"https:\/\/lowtek.ca\/roo\/?p=67\">previously talked<\/a> about the <a href=\"http:\/\/empeg.org.uk\/slimrio\/\">SlimRIO<\/a> project, but I finally got around to actually getting it properly setup and installed in the playroom downstairs.\u00a0 I figure I should give back to the community and write up a short How-To article.<\/p>\n<p><a href=\"https:\/\/lowtek.ca\/roo\/wp-content\/uploads\/2008\/09\/100_5678.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-131\" title=\"100_5678\" src=\"https:\/\/lowtek.ca\/roo\/wp-content\/uploads\/2008\/09\/100_5678.jpg\" alt=\"\" width=\"500\" height=\"167\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p>I run a Linux based music server, but SlimRIO will also work if you wanted to use Windows to serve up music.\u00a0 I will focus on Linux issues here, more specifically Ubuntu (Debian) configuration.\u00a0 There will also be some amount of hand waving that occurs, I&#8217;m going to assume you can figure out some of the details yourself.\u00a0 The SlimRIO website does cover <a href=\"https:\/\/web.archive.org\/web\/20120723091543\/http:\/\/empeg.org.uk\/slimrio\/linux.html\">Linux installation<\/a> and configuration.\u00a0 I&#8217;m actually using <a href=\"http:\/\/en.wikipedia.org\/wiki\/SlimServer\">SlimServer<\/a> still as I haven&#8217;t upgraded to <a href=\"http:\/\/www.slimdevices.com\/su_downloads.html\">SqueezeCenter<\/a> yet.<\/p>\n<p>The first hurdle you might stumble on is getting the DHCP server to offer up an IP address.\u00a0 This will vary depending on your setup, but in my case my DHCP server is handled by my <a href=\"http:\/\/en.wikipedia.org\/wiki\/Linksys_WRT54G_series#WRT54GL\">Linksys WRTGL<\/a> router running <a href=\"http:\/\/www.dd-wrt.com\">DD-WRT<\/a>.\u00a0 If you&#8217;ve got a compatible router, I strongly recommend considering using DD-WRT.\u00a0 Under the Adminstration-&gt;Services tab you can define a list of static leases that map MAC addresses to names and IPs.\u00a0 It&#8217;s really nice to talk to all of the devices on the home network by name &#8211; instead of trying to remember the IP address.\u00a0 [ok, so this probably wasn&#8217;t terribly helpful but there are lots of how-to documents on <a href=\"http:\/\/www.google.ca\/search?q=linux+dhcp+server\">Linux DHCP servers<\/a>]<\/p>\n<p>Initially just run the Python based <a href=\"http:\/\/en.wikipedia.org\/wiki\/Simple_Service_Discovery_Protocol\">SSDP<\/a> server.\u00a0 I found that on Linux the auto-detection of the host machines IP address didn&#8217;t work, so to be safe I recommend passing the numeric IP address (ie: 192.168.1.12) of your NFS file server.\u00a0 Later I&#8217;ll talk about using the C version and growing an \/etc\/init.d script for Debian based systems.<\/p>\n<p>The next tricky part will be getting an NFS server configured.\u00a0 This is where the name (or IP) address you&#8217;ve assigned to the RIO will matter.\u00a0 I ended up using <a href=\"http:\/\/www.wireshark.org\/\">WireShark<\/a> to sniff traffic to determine what was going wrong, it may be something you want to consider available to help diagnose problems.\u00a0 When the device boots it first gets an IP, the DHCP server tells the RIO what its hostname will be.\u00a0 The SSDP &#8220;response&#8221; tells it where the NFS server lives.\u00a0 The boot firmware then tries to mount via NFS the \/tftpboot\/&lt;rio hostname&gt; directory to get the rest of the firmware.\u00a0 Jeff Mock hosts the <a href=\"http:\/\/www.mock.com\/receiver\/server\/\">original investigation<\/a> into the RIO boot sequence.<\/p>\n<p>Assuming all things are configured correctly, it will just work.\u00a0 Of course you&#8217;ll have problems, but that&#8217;s where WireShark will be a life saver in pointing out what you did wrong.\u00a0 Another good place to look is the system logs on your Linux machine.<\/p>\n<p>Now let&#8217;s make it slick and build an init.d script to start the SSDP server.\u00a0 This was the first time I had created one of these, so my solution may be naive &#8211; and I know that I took the long road to the solution I ended up with.\u00a0 The <a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/\">Debian policy manual<\/a> covers init.d scripts in section 9.3, I initially found <a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/ch-opersys.html#s9.3.5\">9.3.5<\/a> that talked about the provided skeleton implementation.\u00a0 I then hacked this up to build my own <a href=\"https:\/\/lowtek.ca\/roo\/wp-content\/uploads\/2008\/09\/initd-ssdp.txt\">init.d script for SSDP<\/a>.\u00a0 The <a href=\"http:\/\/olympus.het.brown.edu\/cgi-bin\/man\/man2html?start-stop-daemon+8\">man page for the start-stop-daemon<\/a> was very helpful in doing this.<\/p>\n<p>Most of the implementation should be obvious as it is primarily directly from the skeleton.\u00a0 The only real work is in the start function:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #808080;\">#<br \/>\n#\u00a0\u00a0\u00a0 Function that starts the daemon\/service.<br \/>\n#<br \/>\nd_start() {<br \/>\nstart-stop-daemon &#8211;start &#8211;quiet &#8211;pidfile $PIDFILE \\<br \/>\n&#8211;exec $DAEMON &#8211;background &#8211;make-pidfile \\<br \/>\n&#8212; 192.168.1.12 \\<br \/>\n|| echo -n &#8221; already running&#8221;<br \/>\n}<\/span><\/p>\n<p>I&#8217;ve added the &#8211;background flag as the C version of SSDP is not a daemon and would never return control to the calling program.\u00a0 The &#8211;make-pidfile instructs the start-stop-daemon to manage the pidfile for us instead of assuming the ssdp program will do so.\u00a0 The final &#8212; followed by the IP address of the NFS server is an argument to be passed to the ssdp executable.\u00a0 This script was installed as \/etc\/init.d\/ssdp and now works as expected providing start, stop and restart.<\/p>\n<p>The ssdp program was compiled from the <a href=\"http:\/\/empeg.org.uk\/slimrio\/linux.html\">C source available from the SlimRIO site<\/a>. I installed it in \/usr\/local\/bin and used chown to assign it to the slimserver user and group, then chmod +s to run the program <a href=\"http:\/\/en.wikipedia.org\/wiki\/Setuid#setuid_on_executables\">setuid<\/a> as a nod towards security (this causes it to run as the slimserver user).<\/p>\n<p>Have the SSDP server automatically started at boot time is trivial.\u00a0 I originally found <a href=\"http:\/\/ubuntu.wordpress.com\/2005\/09\/07\/adding-a-startup-script-to-be-run-at-bootup\">an article<\/a> on how to do it in Ubuntu, but it <a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/ch-opersys.html#s9.3.3.1\">was also<\/a> in the Debian policy manual had I read it more carefully. (sometimes search engines make you stupid)<\/p>\n<p>The SlimRIO firmware emulates a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Squeezebox_(network_music_player)#SliMP3_.282001.29\">SliMP3<\/a> device which isn&#8217;t capable of some of the fancy (now standard) screen savers and visualizers, this isn&#8217;t a big deal for me.\u00a0 Also, in my setup it seemed that my MP3s were stored in a higher bitrate than it could easily handle without pauses. This is easily solved through a simple configuration in Slimserver under Player Settings-&gt;Audio &#8211; you can configure the bitrate limiting (default is no limit) which causes the music to be re-encoded on the fly, I found 128kbps to work fine.<\/p>\n<p>As always, I get a kick out of &#8220;hacking&#8221; consumer electronics.\u00a0 Its is also nice to take something that was gathering dust and put it to good use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve previously talked about the SlimRIO project, but I finally got around to actually getting it properly setup and installed in the playroom downstairs.\u00a0 I figure I should give back to the community and write up a short How-To article.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,11,12],"tags":[],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-computing","category-gadgets","category-how-to"],"_links":{"self":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":3,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":2050,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/128\/revisions\/2050"}],"wp:attachment":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}