Or in other words: shairport on MR3020 using OpenWRT!
First, if you want to do it yourself and brick anything using this guide, don't make me responsible: THIS COMES WITH ABSOLUTELY NO WARRANTY! (However after the first few OpenWRT builds I made, some of them didn't let me connect to the MR3020 and now I know, there are some possible methods to resurrect it, e.g. OpenWRT failsafe mode and serial communication with the bootloader.)
It took about 3 days and some code research to get it working, and here it is:
Installation: You can download the firmware image here (Factory, Sysupgrade) and install it using the web interface of the MR3020. Be sure to use the factory image on MR3020 with original firmware, and sysupgrade only on MR3020 which already has OpenWRT on it, otherwise it may brick. Then, after reboot, you need to connect to it using telnet, because the LuCI webinterface is broken in this build...
Then, set the new root password:
Now you need to setup wireless etc. As there is no webinterface, you need to login via ssh and then use the uci command, e.g.:
ssh firstname.lastname@example.org uci show wireless uci set wireless.radio0.country=DE uci set wireless.radio0.channel=6 uci set wireless.radio0.txpower=0 uci set wireless.@wifi-iface.ssid=AirPlay uci set wireless.@wifi-iface.encryption=psk2+ccmp uci set wireless.@wifi-iface.key=secretWPAPassphrase uci set wireless.@wifi-iface.network=lan uci set dhcp.lan.dhcp_option="3 6" uci commit wifi
YOU HAVE TO CHANGE THE VALUES PRESENTED ABOVE! Checkout the OpenWRT manual for help.
Now it's time to test the setup. Use one of your iDevices to connect to the router wirelessly. If that works, you are one big step further. So, let's try out shairport itself and start it using the ssh connection:
shairport -a AirPlayer -v2
You can replace "AirPlayer" with the name you like to see on your iDevice as the AirPlay speakers. If shairport didn't quit with an error message, you should be able to use your iDevice as an AirPlay client by now. Just post a comment of your shairport error message, if you got one and I'll try to help you.
To make shairport starting after system boot, we need to edit the
/etc/rc.local file, as there is no init-script for shairport at the moment. I used vi to put the command into the file, but you can also just use echo or cat for that:
cat <<EOF >/etc/rc.local shairport -a AirPlayer -q -d exit 0 EOF
-q tells shairport to be quiet and
-d to daemonize.
Now you're done and can reboot the device or just unplug it and put it anywhere you want to have a streaming box.
Thanks goes to:
I've just found out how you can tell the dhcp server (dnsmasq) to not pass any gateway or dns entries. This simplifies the method of using both interfaces (3G and WiFi) of an iPhone at the same time, so you can stream music and check emails or surf through the internet. All you have to do (if you already have an MR3020 modified like above) is:
uci set wireless.@wifi-iface.network=lan` uci set dhcp.lan.dhcp_option="3 6"` uci commit
reboot -for pull the USB plug and you're done I've already updated the instructions above to cover these news. Thanks for the hint goes to the people in this forum thread: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=316277
UPDATE 2 [2014-02-04]:
Some users (Maciek and Evgen below in the comments) and I have the problem, that shairport seems to stutter after 3-5 minutes of playback.
Today I had some free time to experiment and tried out a buffer size of 148 (which should be exactly one packet transferred from my iPhone 4 to shairport). To try this out, all you need to do is, append the "-b 148" option to your shairport command (in /etc/rc.local, if you want to set that for every boot). With the buffer size set to 148 I have 10 to 20 minutes without stuttering.
This is not a solution, just a temporary 'fix'. I have to compile the current master branch of the new 1.0 version of shairport for OpenWrt, but it will take some time to port... Not sure, when this will be done.