MR3020 is a nice box, which includes the following internals:
CPU: Atheros AR7240@400MHz
RAM: 32MiB
Flash: 4MiB
Lan: 1x100Mbit
WiFi: 802.11 b/g/n 150Mbps
SoC: Atheros AR9330 rev 1
USB: 1×2.0 (* notes below)
Serial: yes
JTAG: no
SoC: Atheros AR9330 rev 1
Power: 5V via mini-USB
OS: OpenWRT support
Very similar to TL-WR703N
That’s a quite powerful tiny box and it costs only 20-40$. That price makes MR3020 a very interesting one in terms of experimentation. I’ve decided to convert it into AirPlay receiver to push music stream wirelessly over the house.
My network config is something like this:
WIFI<——– dhcp client>MR3020<static 192.168.1.1/24 ——–>LAN (for administration reasons)
–>USB sound card–>audio cable etc
Since zeroconf works on broadcast basis we don’t need to know MR3020 address in WIFI network – it will be discovered and communicate automatically. So it’ll act as a usual DHCP client.
Here is the algo of such process and notes about pitfalls.
* Learn a bit about OpenWRT: http://openwrt.org/
* Read about router at OpenWRT site: http://wiki.openwrt.org/toh/tp-link/tl-mr3020
* Install a stock OpenWRT build into your device
* Set up a build environment. I’ve used Ubuntu 12.10 x64 running in VirtualBox
Here’s a good manual: http://wiki.openwrt.org/doc/howto/buildroot.exigence
First of all you have to set up prerequisites depending on your build system.
* Download openwrt itself:
mkdir ~/openwrt
cd ~/openwrt
svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk
* Download and patch shairport package
copy feeds.conf.default to feeds.conf
add new source to the end: src-git jlars git://github.com/jlars/packages.git;master
checkout feeds:
./scripts/feeds update
./scripts/feeds install -a
* Patch shairport package:
cd feeds/jlars
wget -O – ftp://ftp.custom-openwrt-builds.info/patches/shairport_deps_trunk.diff | patch -p1
cd ~/openwrt/trunk
* Configure our build
select our target:
make menuconfig
select Target System->Atheros AR7xxx/AR9xxx
select Target Profile->TP-Link TL-MR3020
quit and fill the defaults:
make defconfig
enter menuconfig again check the following list of packages. MR3020 has only 4Mb flash, so system should contain only required packages (packages should be built into system – ‘y’ key to choose):
base-files
busybox
dropbear
hotplug2
mtd
swconfig
uci
kmod-leds-gpio
kmod-ledtrig-default-on
kmod-ledtrig-netdev
kmod-ledtrig-timer
kmod-ledtrig-usbdev
kmod-gpio-button-hotplug
kmod-wdt-ath79
kmod-sound-core
– all sound drivers
kmod-usb-audio
kmod-usb-ohci
kmod-usb2
kmod-ath9k
wpad-mini
shairport
uboot-envtools
* Try to build it
make -j 3 V=99
* Check if build was successful: check binary image at
bin/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin
(
if you have weird errors while building sstrip tool – try to fix it’s makefile:
change this: $(HOSTCC) $(HOST_CFLAGS) -I../include -include endian.h $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/sstrip src/sstrip.c
into this: $(HOSTCC) $(HOST_CFLAGS) $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/sstrip src/sstrip.c
)
* Patch shairport on IPv6/iPv4 bug:
go into build_dir/target-mips_r2_uClibc-0.9.33.2/shairport-0.05/ and edit socketlib.c.
at line #162 comment out AF_INET6 option:
// tFamily = AF_INET6;
build and install fixed version:
make package/shairport/compile
make package/shairport/install
make
* Now we need to edit configuration files so our build can start serving AirPlay right after installation.
FS root is located at: build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx
We need to edit 3 things:
– lan configuration
– wifi configuration
– shairport autostart
* Edit lib/functions/uci-defaults.sh
Locate things like this:
set network.lan=’interface’
set network.lan.ifname=’$ifname’
set network.lan.type=’bridge’
set network.lan.proto=’static’
set network.lan.ipaddr=’192.168.1.1′
set network.lan.netmask=’255.255.255.0′
and change them into this:
set network.lan=’interface’
set network.lan.ifname=’$ifname’
# set network.lan.type=’bridge’
set network.lan.proto=’static’
set network.lan.ipaddr=’192.168.1.1′
set network.lan.netmask=’255.255.255.0′
set network.wan=’interface’
set network.wan.proto=’dhcp’
option type mac80211
option channel ${channel}
option hwmode 11${mode_11n}${mode_band}
$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1
config wifi-iface
option device radio$devidx
option network wan
option mode sta
option ssid YOUR_SSID
option encryption YOUR_ENCRYPTION
option key YOUR_PASSWORD
* Build the final image:
make target/install
* Find any lightweight http-server like Mangoose and share the system image located at bin/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin
(better rename it into something like image.bin)
* Telnet into running MR3020 via cable at 192.168.1.1(it will root login without password) and install fresh image:
cd /tmp
wget http://192.168.1.2:8080/image.bin
mtd write image.bin firmware
reboot
After rebooting WiFi LED should be blinking and new AirPlay receiver named MR3020 will be available in your wireless network.
Pitfall note! MR3020 has USB2.0 _only_ port. That means that it will not work well with USB1.0/1.1 devices. There’s a pretty simple workaround – plug your sound card via USB2.0 hub. Here are details about this bug: https://forum.openwrt.org/viewtopic.php?id=39956
Personally I’m using Creative USB Sound Blaster Play! (USB 1.1) and it works well with USB hub.
That’s all for now.
Thanks, i build it for the TL-WR703N router, and it works good. The TRUNK version has some problem with usb soundcard, and the AA version is perfect.
would it be possible to have a copy of the final image you built? please send me an email with it attached at clone987@gmail.com if its okay.
Thank you for the great writeup. I had to make a few minor tweaks to build it for my TL-WR703N, compile without multi-core support, and use the Attitude Adjustment build of OpenWRT due to having the newer bootloader version. Current OpenWRT trunk disables the LAN interface on devices with this bootloader.
http://wiki.openwrt.org/toh/tp-link/tl-wr703n#warnings.gotchas
Hi!
Could you share the binary ipk for the patched shairport? I also have an MR3020. Thanks!
Hi Edu!
Sorry, I don't have ipk since it's a quite heavy mechanism for such tiny machine as MR3020.
However, it is very easy to upload any binary directly into running system, for example using wget.
I can send you a binary executable file for shairport if you wish.
Hi,
I have been looking for options for a media server, can you share the shairport binary?
Thanks
Hi,
Here's the shairport binary itself: https://dl.dropboxusercontent.com/u/17093148/shairport
Mike.
Hi, not to worry, I have managed to build it.
Ps, the link to patch the shairplay no long works, but can replace with the following,
wget -O – https://github.com/sancome/patches/raw/master/shairport_deps_trunk.diff –no-check-certificate | patch -p1
Thanks
Hi, I see there are some package preselect in addition to what is listed above. Am I suppose to unselect all the packages except the one listed above to make it fit in the 4Mb flash? I am afraid some of them is required and my blink my router.
also i cannot locate wpad-mini and hotplug2 packages in the latest trunk r37793.
Thanks.
Hi Barry,
For my setup those packages were sufficient and everything was ok. Anyway – you can reset to factory defaults if anything goes wrong, it's pretty easy.
the trunk now have shairport package but it doesn't work. I replaced with the binary you posted above and it work very perfectly. thanks so much.
the structure might have changed, I cannot get your feed to show up in menuconfig. i can see all the downloaded files under the /feeds directory. the package show up under multimedia is from the trunk and that one wont work.
Glad you found it useful. Personally I think that there's no need to fix what ain't broken 🙂
Hey, would anybody out there feel enough pity for me to post a link to the final binary? Save me a day or two building it for myself.
Pretty please? With a cherry on top? (Note, I am obviously not above begging.)
Hi Dan!
Look better, there's a link above =)
Ok, I must be blind, dense or both. I see a link to the shairport binary and a couple to articles about related articles but not to the complete openwrt image with shairport. What am I missing?
My bad! Though you've meant a shairport binary, not whole system image.
Please try this one: http://db.tt/VYXEqYjv
This comment has been removed by the author.
Hmmm… I uploaded the new firmware image and it said it had updated the firmware ok and then rebooted. Now when I cycle the power, the blue light flashes once and that's it. I do see link lights on the ethernet hub it's plugged into but no sign of it in the wifi menu on my laptop or iPhone.
One thing, I don't have my USB audio adapter yet. Will it fail to boot correctly without it?
(Oh, and thanks so much for posting the binary for me!)
You should connect via telnet and configure your wireless network using vi.
(or if your home network is 192.168.1.0 then you can try it without wifi)
The box itself should work normally without peripherals.
Ok, first off.. Thanks so much for all your help. I really appreciate it. That said…
I've been able to talk to it via telnet if I hold down the reset button for about 10s while it is boots up. With it connected to my system via ethernet cable, I can then telnet to it at 192.168.1.1.
In that state, I don't see it in any of my iOS devices as an AirPlay device nor do I see any wifi SSIDs from it.
If I boot it w/o holding in the reset button, the blue light flashes once, then about 5s later the green led on the usb audio device lights up and then a few seconds later the blue light comes on solid.
I did get a copy of the boot log and can post it here for you if that's of any help.
Hi Dan! Please write me a private message, so I can try to help you.
Hi Michael,
could you share the ipk file for the shairport ?
Regards
Ari
Hi Ary,
Sorry, I haven't built an ipk package.
Mike.
i'm having trouble installing this on my wr703n can you email me? kasarap@gmail.com
Michael:
Thanks for all your work on this and publishing you firmware. I downloaded you complete firmware and flashed it to my wr703n without issue. Now however, I can't communicate with it. What is the IP address you have in your firmware? I tried the usual 192.168.1.1 and 192.168.1.100 with no luck. I also tried to arp -a it but no response from it.
Also, do I need to telnet to it through the wired out serial port?
Thanks again.
I'm sorry about this situation.
If everything was ok, your device should be available via 192.168.1.1 on Lan port and WiFi interface will grab network configuration from your DHCP service. You can try to boot in failsafe mode to look what is going on.
BTW, I've placed a disclaimer about such model at the top of this post.
Thanks Michael. Can you point me to your latest firmware version so I can download and try again. I have had good luck with other 3020 software on the 703.
I've got connection to the serial port thru my rs232 adaptor now and I can see all to console output. Just need to figure out why I can't ping it at 192.168.1.1.
Appreciate your responding on this. I don't expect you to trouble shoot it. This is my leearning experience with this little guy.
Cheers.
Glenn.
Michael did you manage to help Dan? I think i had the same problem. I
upgraded your final firmware to my 3020 v1 and now i dont see it on my
network. Dont see any new wifi and throught lan i cannot ping
192.168.1.1 its like the router is not doing nothing. On fail safe
mode i can connect with Telnet on 192.168.1.1. What can i do? Is there
anything i need to configure after flashing your firmware? The litle
switch had to be on what position? 3G Whisp or AP? Thanks Michael for
You help.
Perfect!! It works!! Thanks a lot Michael!!
This comment has been removed by the author.
I left only required packages and can't make factory.bin or sysupgrade.bin. Build was without errors. Please help.
This comment has been removed by the author.
Hello! You can throw built image? Pasha_0512@mail.ru Thanks
Hello guys, could you someone tell me how long boots up your package? From power on to see AirPlay on device. Thanx
Hey Mike, is it possible to do this on a Windows based machine?
Hi Dan and Michael, I am having the same issue. My MR3020 is not showing up at all on my computer. I do not see it boot up correctly, all I see right now is the reset led and power LED on after flashing the firmware in the suggested post above.
Im having the same issue right now.