I've been intending to improve upon the Icecast on the NSLU2 install for awhile. Even though it works, it's a pain to deal with if it's in an environment where you need to power down or cycle the power periodically.
In any case, Brian M., who's also attempting to build a similar set up, asked a few questions which prompted me to attempt the build. I'm not promising anything (there are a number of issues ahead) but I'll post my notes here. Determining the proper way to do this is a progressively slower process so it may take some time.
Contents |
Note: I'm building this on the SlugOS/BE 4.8 beta, which has kernel version 2.6.21.7. Your mileage may vary.
First off, I tried for the obvious stuff. I went here and tried installing slugos-native. It wasn't much of a surprise that the package doesn't exist on the repository. I'll have to try to wing it. From that page, I know I'll need gcc and libc6-dev so run
ipkg install gcc ipkg install libc6-dev ipkg install automake ipkg install glibc ipkg install glibc-gconv ipkg install glibc-utils ipkg install sed ipkg install bison ipkg install make ipkg install binutils
Note that some of these commands install a lot of other stuff (dependencies). I'm not sure if absolutely all of them are required; a couple I added just to be safe.
Do a long list on gcc
ls -l /usr/bin/gcc
If it exists and is a symlink directly to armeb-linux-gcc, delete it. If it's a binary, just rename it to something like "old_gcc". Create a file called gcc, containing the following:
/usr/bin/armeb-linux-gcc -mthumb-interwork $*
Make it executable with
chmod 555 /usr/bin/gcc
If it isn't already installed, install tar via:
ipkg install tar
First, more libraries to install
ipkg install libodd ipkg install libogg-dev ipkg install libvorbis ipkg install libvorbis-dev
Now to grab the Icecast code... First create a work folder and cd into it.
root@LKG7F9788:~$ mkdir work root@LKG7F9788:~$ cd work root@LKG7F9788:~/work$
Next, wget the packages from the Icecast site.
wget http://downloads.xiph.org/releases/icecast/icecast-2.3.1.tar.gz wget http://downloads.us.xiph.org/releases/libshout/libshout-2.2.2.tar.gz
Untar the libshout tarball via "tar xvfz libshout-2.2.2.tar.gz" and cd into its directory. Run the following:
./configure
It'll take a few seconds to get started (remember this isn't a 4GHz quad-core we're working with). You may have to do a bit of troubleshooting if something is missing. The system may appear to hang on the following but it's just a long calculation. Let it run!
checking the maximum length of command line arguments...
You can tell that the NSLU2 is doing something by looking at the "Ready/Status" led (the top one). It should be green and blinking. Next, you need to edit the libtool file in the libshout directory. Find the line that looks like
AR="ar"
and change it to
AR="/usr/armeb-linux/bin/ar"
You need to do this because there is a version of "ar" built into busybox and it's extremely limited. By installing binutils (I think), you also get the version located in the /usr/armeb-linux/bin directory.
Now run "make", then "make install"
libxslt is one of the pre-reqs for Icecast. Since there's no .pkg for it, we'll have to build it.
First, install the following packages
ipkg install g++ ipkg install g++-symlinks
I recommend using g++ vice cpp because cpp spits up an error during "./configure". Something about failing a sanity check.
cd back to the top of your work folder. Get the source code via:
wget ftp://xmlsoft.org/libxml2/libxslt-cvs-snapshot.tar.gz
untar that tarball and cd into the resulting directory. Run "./configure".
Next, you need to edit the libtool file in the libxslt directory. Find the line that looks like
AR="ar"
and change it to
AR="/usr/armeb-linux/bin/ar"
Yeah, just like you did with libshout. Again, you need to do this because there is a version of "ar" built into busybox and it's extremely limited. By installing binutils (I think), you also get the version located in the /usr/armeb-linux/bin directory.
Now run "make". Note: this is another one of those that takes a really long time to compile. Go get a cup of coffee. When you're done with the coffee, run "make install".
First, more packages to install (I recommend reading the Icecast README file!!)
ipkg install curl ipkg install libxml2 ipkg install libxml2-dev ipkg install libcurl-dev
Again, please note that the above does install other dependencies.
cd back to the top of your work folder, untar the Icecast tarball, and cd into the resulting folder.
root@LKG7F9788:~/work$ tar xvfz icecast-2.3.1.tar.gz root@LKG7F9788:~/work$ cd icecast-2.3.1/
Run "./configure". Consider another cup of coffee. "./configure" should be done by the time you get back to your computer.
Do the libtool trick again (changing the AR setting).
Run "make". Consider driving up to the corner store for pastries ("make" takes awhile). If you're watching it, you'll probably see a lot of
warning: pointer targets in passing argument 1 of 'xmlStrdup' differ in signedness
Run "make install".
Edit /usr/local/etc/icecast.xml - uncomment (remove the "<--!" and "-->" lines above and below "changeowner" sections. - change the loglevel value from 4 to 1 - you may want to change the path for logging also (look for logdir)
Start Icecast via the following and then point a browser at http://your_NSLU2_IP:8000
icecast -c /usr/local/etc/icecast.xml
You'll want to change the admin password but for now, test the interface by clicking on "Administration" and logging in. The default username is "admin" and the default password is "hackme".
cd back to the top of your work folder and grab the source code via:
http://www.musicpd.org/uploads/files/mpd-0.13.1.tar.gz
untar the tarball and cd into the resulting directory:
root@LKG7F9788:~/work$ tar xvfz mpd-0.13.1.tar.gz root@LKG7F9788:~/work$ cd mpd-0.13.1/
Be sure to read the INSTALL file. If all you're going to do is stream to an Icecast server, you already have libshout, libogg, and libvorbis installed and won't need libao or libalsa. It may be a good idea to add libmad, libid3tag, and libsamplerate though.
ipkg install libmad0 ipkg install libmad-dev ipkg install libsamplerate0 ipkg install libsamplerate0-dev ipkg install libid3tag0 ipkg install libid3tag-dev
Run "./configure". Again, it will appear to hang on
checking the maximum length of command line arguments...
Let it run. It should end with a screen that looks like
########### MPD CONFIGURATION ############ Playback Support: libao support .................disabled OSS support ...................enabled ALSA support ..................disabled JACK support ..................disabled OS X support ..................disabled PulseAudio support ............disabled Media MVP support .............disabled Shout streaming support .......enabled File Format Support: ID3 tag support ...............enabled mp3 support ...................enabled Ogg Vorbis support ............enabled using tremor.................no FLAC support ..................disabled OggFLAC support ...............disabled Wave file support .............disabled MP4/AAC support ...............disabled Musepack (MPC) support ........disabled MOD support ...................disabled Other features: libsamplerate support .........disabled Zeroconf support ..............disabled ########################################## You are now ready to compile MPD Type "make" to compile MPD
Again, edit the libtool file and change the AR line. Run "make" and "make install".
Before you leave the mpd build directory, run the following:
cp doc/modconf.example /etc/mpd.conf
Then edit /etc/mpd.conf to suit your use.
Both MPD and Icecast work on the NSLU2. However, running both of the on the same NSLU2 is quite noticeable. MPD as a file server requires a certain amount of processing power. I've notice that it behaves much nicer as an end-point (see my notes on using it as a network interface for a stereo). Icecast by itself generates around .03 system load. MPD alone generates .5+. Both on the same box, streaming a local file causes .8-.9+, which causes the audio to stutter. My recommendation is that you run MPD either on a more powerful system or on a dedicated NSLU2.
If you didn't install binutils, you probably get the following error when you try to run "./configure"
checking for C compiler default output file name... configure: error: C compiler cannot create executables
If the system appears to hang on the following, it's not really hung. Let it run! It's just doing a lot of work on a very slow system. (see "Building libshout" above)
checking the maximum length of command line arguments...
If you get the following error, you didn't edit libtool before running make. Go back to "Building libshout" or "Building libxslt" (above).
ar cru .libs/libiceavl.a .libs/libiceavl_la-avl.o
ar: invalid option -- u
BusyBox v1.2.1 (2007.12.25-11:17+0000) multi-call binary
Usage: ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES
Extract or list FILES from an ar archive.
Options:
-o preserve original dates
-p extract to stdout
-t list
-x extract
-v verbosely list files processed
make: *** [libiceavl.la] Error 1
When you're running "./configure" in the libxslt directory, if "./configure" complains about /lib/cpp failing a sanity check, run the following
ipkg remove cpp ipkg remove cpp-symlinks ipkg install g++ ipkg install g++-symlinks
If you're cross-compiling and get the following error (at least in Fedora), you need to install the gcc-c++ package:
checking how to run the C++ preprocessor... /lib/cpp configure: error: C++ preprocessor "/lib/cpp" fails sanity check
<comments>Building_Icecast_and_MPD_on_the_NSLU2</comments>