Thursday, December 6, 2012

[Tutorial] Apple AirPlay on TomatoUSB Router

Hello and welcome to my first blog post.

In this blog posting, I'm going to show you how to setup Apple AirPlay on a router running TomatoUSB firmware. This will allow you to stream music from your iOS device or iTunes to speakers plugged into your router over your wireless network.

If you're not familiar with Apple AirPlay or TomatoUSB, here's a good introduction on AirPlay and a link to the TomatoUSB website. I would go as far as saying, don't buy a router unless it's supported by TomatoUSB.

First, lets talk about the router I'm using. It's a Belkin Share Max N300 Router (F7D3301/F7D7301). Here are some key things that makes this a great router in general and ideal for this project:

1) TomatoUSB Supported
2) 8MB Flash - allows you to run larger TomatoUSB builds (more features)
3) 2 USB 2.0 Ports
4) Gigabit Switch
5) The price I paid for it - $22 shipped

This router is very similar to the Asus RT-N16 (same chipset) minus the extra RAM, larger Flash and external antennas. The instructions below (not including the flashing instructions) will also work for the Asus RT-N16, Linksys E3000 and most modern router with USB Ports that is supported by TomatoUSB ('Yes' in either the K26 or K26RT-N columns and has USB ports).

Belkin Share Max N300 Router (F7D3301/F7D7301) Hardware Specs:

Broadcom BCM4716 Rev1
453 MHz CPU
8 MB Flash
64 MB RAM
2x USB 2.0
5 Ports Gigabit switch
WPS Button




I believe this particular model may have been discontinued. However, the following replacement models will also work, which I would highly recommend (same TomatoUSB flashing instructions) if you don't already have a router for this project:

Belkin Share Max N300 (F7D3301/F7D7301) - 2 USB, Gigabit
Belkin Share N300 (F7D7302) - 1 USB, No Gigabit 
Belkin Play N600 (F7D8302) -  Dual Band, 1 USB, No Gigabit 
*Belkin Play N600 HD (F7D8301) - Dual Band, 2 USB, Gigabit
*Belkin Wireless Play Max Router (F7D4301) - (Same as F7D8301) Dual Band, 2 USB, Gigabit
Belkin Wireless Play Router (F7D4302) - (Same as F7D8302) Dual Band, 1 USB, No Gigabit

*Recommended (Best model), typically $30-40.

Go by the model number and not the name. On the models with only 1 USB port, you'll need a USB hub because we need two USB ports - one for USB sound adapter or USB speakers and one for USB Flash drive or USB hard drive.

Requirements:
  1. TomatoUSB Supported Router (with at least one USB Port)
  2. USB Audio Adapter (USB DAC) - see below for some compatible ones
  3.  USB Flash Drive (>1GB) or USB Hard Drive. This tutorial will assume you're using a USB flash drive.
  4. Speakers - computer speakers, your home stereo system, iPod/iPhone dock with aux in.
Compatible/Recommended USB Sound Cards (Plug and Play)
Some additional USB DACs that I haven't tested personally, but should also work:
Outline of Steps:
  1. Install TomatoUSB
  2. Enable USB Support in Tomato
  3. Install Entware
  4. Install AirPlay (aka ShairPort) and other required packages
  5. Configure the router so that everything works after a reboot
  6. Enjoy some music

1) Install TomatoUSB

WARNING: you can brick your router if you flash the wrong firmware.

The flashing instructions below are specific to the Belkin routers I mentioned above. If you're using a different router, please use the appropriate tutorial/instructions for your particular model.

To install TomatoUSB, we first flash the router with DD-WRT and then from DD-WRT update to TomatoUSB.

  a) Download DD-WRT Firmware
  b) Download TomataUSB Firmware
  c) Enable Recovery Mode on Router
  d) Access the 'CFE miniWeb Server' Page and Update Router with DD-WRT
  e) From DD-WRT Flash to TomatoUSB



1a) Download DD-WRT Firmware for your particular model (.bin file):


Belkin Share N300 (F7D7302)
http://www.dd-wrt.com/dd-wrtv2/downloads/others/eko/V24-K26/svn18946/dd-wrt.v24-18946_NEWD-2_K2.6_mini_f7d7302.bin

Belkin Share Max N300 (F7D3301/F7D7301)
http://dl.dropbox.com/u/42238/BelkinN300/dd-wrt.v24-15396_NEWD-2_K2.6_mini_f7d3301.bin

Belkin Play N600 HD & Belkin Wireless Play Max (F7D4301/F7D8301)
http://www.dd-wrt.com/dd-wrtv2/downloads/others/eko/V24-K26/svn18946/dd-wrt.v24-18946_NEWD-2_K2.6_mini.bin

1b) Download TomatoUSB Firmware (.trx file)

For these Belkin Routers, I would recommend the latest Big-VPN version, or BT-VPN if you want BitTorrent Client built into the firmware. I'm going to be using build 108 of the Big-VPN in this tutorial.

Download it here - http://tomato.groov.pl/download/K26/build5x-108-EN/tomato-K26USB-1.28.RT-MIPSR2-108-Big-VPN.trx

1c) Enable Recovery Mode on Router

Shortcut:
1) Unplug the router. Hold down the reset button while plugging in the router. Let go of the reset button.

If the shortcut doesn't work, try the long way.

Long way (aka 30-30-30 reset):
1) While the router is powered on press the reset button for 30 secs (do not let up on the reset button)
2) Keeping the reset button pressed, unplug the power (do not let up on the reset button)
3) Plug the power back in and wait for another 30 seconds (do not let up on the reset button)
4) You can now let up on the reset button

On the Belkin Play N600 HD (F7D4301/F7D8301) model, try holding down the WPS button for 10 seconds while powering on the router.

Also try the WPS instead of the reset button for the 30/30/30 reset, if you need to clear the NVRAM or having issues trying to get into the CFW Menu.

1d) Access the 'CFE miniWeb Server' Page and Update Router with DD-WRT firmware

5) Plug your desktop/laptop into port 1, 2, 3 or 4 and set your IP Address to 192.168.2.8 with a gateway of 192.168.2.1
6) Point your IE browser/Chrome (Do not use Firefox) to http://192.168.2.1 and CFE menu will be available. If you're having issues connecting to the CFE menu, try setting your computer to 192.168.1.8 and point your browser at http://192.168.1.1
7) Browse and Upload the dd-wrt .bin firmware file

This is how the CFE Menu looks like:






1e) From DD-WRT flash to TomatoUSB

8) Set network settings back to DHCP. It will take about 5 minutes to load DD-WRT. After about 5 minutes open a new tab on your browser and connect to http://192.168.1.1
9) When logging into DD-WRT for the first time, it will prompt you to set a password. Set the password to something very simple like 'password'. (Only used temporary).
10) Navigate to the firmware upload screen, Administration->Upgrade Firmware, and then load the TomatoUSB .trx firmware file (tomato-K26USB-1.28.RT-MIPSR2-108-Big-VPN.trx). Make sure to select the "Reset to Default Settings" after flashing.
11) Connect to TomatoUSB @ http://192.168.1.1. Use admin/admin as username/password.

At this point you should have TomatoUSB running on your router.

2) Enable USB Support in Tomato

Connect to your TomatoUSB router (http://192.168.1.1). Log in with root/admin as the username/password and go to USB and NAS-> USB Support (http://192.168.1.1/nas-usb.asp).

Make sure the following are checked, then click [SAVE]:.
Core USB Support
USB 2.0 Support
USB 1.1 Support OHCI
USB Storage Support
Automount (we'll use this later)




3) Install Entware (a package manager that allows you to install additional software on your router)


Plug in your USB flash drive and USB Audio Adapter or USB Speakers. Note that your USB flash drive will be completely wiped.

SSH (Putty) into your router. Use the default username and password of root/admin.

From here on, most of the work will be done via the console. Don't be afraid, you can cut/paste most of the commands. Note that the router needs to be connected to the internet because we will be downloading additional software.

#Partition your usb flash drive
umount /dev/sda1 
fdisk /dev/sda

# Type in the following commands:


# p # list current partitions

# o # to delete all partitions

# n # new partition

# p # primary partition

# 1 (one) # first partition

# <enter> # default start block

# <enter> # default end block #use the whole flash drive

# w # write new partition to disk

  
#umount /dev/sda1 incase it was automounted
umount /dev/sda1

#format newly created partition
#label disk as 'optware' case sensitive
mke2fs -j -L optware /dev/sda1


#mount the new disk partition
mount /dev/sda1 /opt


#Make sure /opt is properly mounted on a reboot.
echo "LABEL=optware /opt ext3 defaults 1 1" >> /etc/fstab

nvram setfile2nvram /etc/fstab 

nvram commit

#Install entware
cd /opt
#all one line
wget -O - http://entware.wl500g.info/binaries/entware/installer/entware_install.sh | sh

4) Install ShairPort (aka AirPlay) and other required packages


#download and install shairport
cd /tmp
wget http://dl.dropbox.com/u/42238/entware/shairport_0.05-20121002-1_entware.ipk
opkg install shairport_0.05-20121002-1_entware.ipk

#install dbus, avahi (aka bonjour), 
opkg install dbus avahi-daemon avahi-utils

#download extra kernel modules
cd /tmp
wget http://tomato.groov.pl/download/K26/build5x-108-EN/extras-mips2.tar.gz
mkdir /opt/extras
cd /opt/extras
tar xvzf /tmp/extras-mips2.tar.gz
#load sound modules
insmod /opt/extras/soundcore
insmod /opt/extras/snd
insmod /opt/extras/snd-hwdep
insmod /opt/extras/snd-page-alloc
insmod /opt/extras/snd-timer
insmod /opt/extras/snd-pcm
insmod /opt/extras/snd-seq-device
insmod /opt/extras/snd-seq
insmod /opt/extras/snd-rawmidi
insmod /opt/extras/snd-seq-midi-event
insmod /opt/extras/snd-seq-midi
insmod /opt/extras/snd-mixer-oss
insmod /opt/extras/snd-pcm-oss
insmod /opt/extras/snd-usb-lib
insmod /opt/extras/snd-usb-audio
insmod /opt/extras/input-core
insmod /opt/extras/hid
insmod /opt/extras/usbhid


#Lets do a quick test to verify that sound is working
#WARNING, may be loud
opkg install madplay
wget -O - http://ca.ah.fm:9000 | madplay -

#Got sound? Good. Lets continue.
#Control+C to break and stop music
#required to start avahi-daemon
echo "nogroup:x:2:" >> /tmp/etc/group
echo "nogroup:x:2:2:avahi daemon:/opt/sbin/avahi-daemon:/bin/false" >> /tmp/etc/passwd

#delete orphan pid files in case they exist
#rm /opt/var/run/dbus/pid
rm /opt/var/run/dbus.pid
rm /opt/var/run/avahi-daemon/pid


#start dbus first before avahi
/opt/etc/init.d/S20dbus start


#start avahi-daemon
avahi-daemon -D

#starts shairport 
shairport -a "Living Room" -b 282 -d


#Test playing some music from your 
#iOS device or iTunes via AirPlay

#to stop shairport, avahi and dbus
killall shairport
avahi-daemon -k
/opt/etc/init.d/S20dbus stop

5) Configure the router so that everything works after a reboot:


Go to USB and NAS -> USB Support (http://192.168.1.1/nas-usb.asp).



In the "Run after mounting" section add the following:

#load sound modules
insmod /opt/extras/soundcore
insmod /opt/extras/snd
insmod /opt/extras/snd-hwdep
insmod /opt/extras/snd-page-alloc
insmod /opt/extras/snd-timer
insmod /opt/extras/snd-pcm
insmod /opt/extras/snd-seq-device
insmod /opt/extras/snd-seq
insmod /opt/extras/snd-rawmidi
insmod /opt/extras/snd-seq-midi-event
insmod /opt/extras/snd-seq-midi
insmod /opt/extras/snd-mixer-oss
insmod /opt/extras/snd-pcm-oss
insmod /opt/extras/snd-usb-lib
insmod /opt/extras/snd-usb-audio
insmod /opt/extras/input-core
insmod /opt/extras/hid
insmod /opt/extras/usbhid

#required to start avahi-daemon
echo "nogroup:x:2:" >> /tmp/etc/group
echo "nogroup:x:2:2:avahi daemon:/opt/sbin/avahi-daemon:/bin/false" >> /tmp/etc/passwd

#delete orphan pid files in case they exist
#rm /opt/var/run/dbus/pid
rm /opt/var/run/dbus.pid
rm /opt/var/run/avahi-daemon/pid

#start dbus first before avahi
/opt/etc/init.d/S20dbus start


#start avahi-daemon
avahi-daemon -D


#start shairport 
shairport -a "Living Room" -b 282 -d

In the "Run before unmounting" section add the following:

#run before umount
killall shairport
avahi-daemon -k
/opt/etc/init.d/S20dbus stop

6) Enjoy some music 

On your iOS Device or iTunes, play some music and look for the AirPlay icon.




You should now see "Living Room" as one of your AirPlay options


 


You're done!

Addendum - Adjusting the Volume

#install alsa-utils

opkg install alsa-utils


#link the correct sound device

mkdir /dev/snd

ln -s /dev/controlC0 /dev/snd/controlC0


#required for amixer

echo "audio:x:3:" >> /tmp/etc/group


#Check the mixer name. "PCM" in my case
#Could be "Speaker"
amixer
#Simple mixer control 'PCM',0
# Capabilities: pvolume pswitch pswitch-joined penum
# Playback channels: Front Left - Front Right
# Limits: Playback 0 - 128
# Mono:
# Front Left: Playback 128 [100%] [0.00dB] [on]
# Front Right: Playback 128 [100%] [0.00dB] [on]
#adjust volume to 70% or whatever is appropriate
#as low as 7% for earbuds/headphones
amixer set PCM 70%
#Simple mixer control 'PCM',0
# Capabilities: pvolume pswitch pswitch-joined penum
# Playback channels: Front Left - Front Right
# Limits: Playback 0 - 128
# Mono:
# Front Left: Playback 90 [70%] [-38.00dB] [on]
# Front Right: Playback 90 [70%] [-38.00dB] [on]
#To make the volume stick after a reboot

#Add the two commands to the run after mounting section


mkdir /dev/snd

ln -s /dev/controlC0 /dev/snd/controlC0


echo "audio:x:3:" >> /tmp/etc/group

amixer set PCM 70%


-------------------------

My personal awesome sounding DIY AirPlay setup for around $100 consist of the following:

- LP-2020A+ Lepai Tripath Class Amplifier ($20 - Highly Recommended)
- Pioneer SP-BS21-LR Bookshelf (discontinued - Here are some alternatives)

Special thanks to the Entware developers/maintainers. Entware is a replacement of optware. Please check them out - http://code.google.com/p/wl500g-repo/wiki/Goal.

Please leave some feedback in the comments and let me know if you run into any issues. Questions welcomed.

[Update 3/6/2013] Just got AirPrint working on TomatoUSB also. Check out the tutorial below. Sorry, at this time, AirPlay and AirPrint are not compatible with each other. The AirPrint solution uses, Optware which isn't compatible with Entware. Hopefully we'll resolve it soon.

[Tutorial] Apple AirPrint on TomatoUSB Router

[Update 4/9/2013] Please check out my PogoPlug Tutorial below. A PogoPlug running Arch Linux ARM is the perfect companion to your TomatoUSB Router. I highly recommend that you run AirPlay/AirPrint on the PogoPlug versus your TomatoUSB router.

[Tutorial] - PogoPlug E02 with Arch Linux ARM - NAS (Samba4), AirPlay, AirPrint, Google CloudPrint

81 comments :

  1. After a while I get like 4-5 "living room"s to choose from my AirPlay options.

    Also there is like a 5sec delay before pressing play in itunes and actually hearing music.

    Linksys 610N v2 (E3000) Tomato by Shibby 105.

    ReplyDelete
    Replies
    1. Venice, the only reason I can think of why you are seeing more than one "living room" AirPlay speaker option is because shairport some how got restarted. Try rebooting your router to see if it clears up the problem.

      The delay is normal due to buffering.

      Delete
  2. Hi - I posted in the openwrt forum but maybe here's better? Just trying to work out how to set the system volume as it's too high at the moment! Thanks

    ReplyDelete
    Replies
    1. Hi Andrew,

      Thanks for letting me know about the volume. I'm looking into a solution. Typically you would run 'amixer' or 'alsamixer' to control the volume which is part of the 'alsa-utils' package. However, entware doesn't have that package yet. I've opened an issue on the entware project page requesting the 'alsa-utils' package. I'm also attempting to build it myself. I'll keep you updated on any progress.

      If any reader can help with the build or can offer another solution/suggestions it would be appreciated. Thanks

      Delete
  3. Thank you, Qui Hong. Before your how-to the Shairport was a "black box" for me.

    Recently I've added a afpfs-ng package that helps to mount Time Capsule or other AFP shares right on router.

    ReplyDelete
    Replies
    1. Hi Alexander,

      This tutorial wouldn't be possible without you. Thank you so much for working on entware and building the shairport package.

      I find it amazing that here I am in SF, CA and you're in Smolensk, Russia, across the globe, and we're working together!

      Delete
  4. Thanks for the guide! Got the usb soundcard to play the techno stream on my headphones, but the shairport function doesnt work. My iphone sees "living room" tries to play there, fails and then pauses the music. Dmesg didnt have any related output, any ideas?

    ReplyDelete
    Replies
    1. @hhhhh,

      One quick thing to try:

      opkg remove shairport
      opkg install shairport

      For a short period of time a few days back, there was a newer version of shairport available on in the entware repo that required additional arguments to start up properly. That package has seen been reverted.

      Another thing to try is to manually start shairport and enable verbose logging to see if there's any obvious errors.

      "shairport -a "Living Room" -b 282 -v"

      Delete
  5. i failed to mention i am using the toastman build:
    tomato-K26USB-1.28.7500.4MIPSR2Toastman-RT-VPN.trx
    with matching extras sourced from shibby:
    http://tomato.groov.pl/download/K26/build5x-075V-ML/extras-mips2.tar.gz

    any chance either of these factors would cause shairport not to function? I have shairport4win on two of my comps and it works great!

    ReplyDelete
  6. Awesome tutorial. Easy to follow. Finally got my diy airplay setup running! Props to you dude! Would it be possible to have a custom tomato build with shairport integrated though so we dont have to connect a flahsdrive?

    ReplyDelete
    Replies
    1. @clone987,

      Thanks for the positive feedback. There is zero chances of a custom firmware with shairport integrated. :) I highly doubt it would fit on a 8MB flash.

      Care to share details on your diy airplay setup?

      Qui

      Delete
  7. Hello!

    I'm trying to install Tomato with AirPlay on my Belkin PlayMax N600HD router. Everything going fine till "opkg install shairport". Every install attempt finishes with "* wfopen: /usr/sbin/shairport: Read-only file system" error. I understand that there is a problem with chmod(?), but I don't know how to fit it. Any ideas what to do?
    (ofc when I try to start shairport, there is no such file - "-sh: shairport: not found")

    ReplyDelete
    Replies
    1. There might be a problem with the shairport package in the official entware repo. I've updated the tutorial to point to a known working version of shairport. Can you please give it a try and report back? Thanks

      Delete
    2. Everything working now.
      Thanks a lot!

      Delete
    3. One more question: is delay 8-9 sec normal? Shouldn't be like 2-3 sec?

      Delete
  8. I also had the same problem as KaM and the update to the tutorial fixed that. But there is an md5 error on the libao now. So I used the original @http://wl500g-repo.googlecode.com/svn/ipkg/openwrt/

    So I can get it working via ssh, but when I add the lines to the mount/unmount and reboot the router it never starts again? Any ideas there?

    ReplyDelete
    Replies
    1. Alright.. I figured that out. For the nvram line I had to change it to just
      "nvram setfile2nvram /etc/fstab"

      dropped the "nvram commit" off the end

      I'm running toastman...not sure if that's the issue with that?

      I also used the "tomato-F7D3302-1.28.7501.3MIPSR2Toastman-RT-Mini.bin" for the initial flash because the DD-WRT file you posted above wasn't working on my router.

      Delete
    2. Hey Doug,

      Thanks for pointing that out the run on command. Sometimes when I edit the tutorial, the editor sometimes doesn't behave properly.

      It should be two separate command:
      nvram setfile2nvram /etc/fstab
      nvram commit

      Which router model are you using again? I'll update the tutorial appropriately. Thanks

      Let's chat on testing the sound and newer version of shairport on the tomatousb.org forum.

      Delete
    3. As said.. kind of new to this, so wasn't aware it should be two lines. It seems to be working fine with out the nvram commit?

      I'm using the Belkin Share N300 F7D7302

      Delete
  9. Please post a link to the thread on tomatousb.org, where the Airplay is discussed.

    ReplyDelete
    Replies
    1. I've updated the tutorial with instructions for adjusting the volume and a link to a newer version of ShairPort if you're interested in testing it.

      Delete
  10. will you please make airplay available via ipkg?

    ReplyDelete
    Replies
    1. I'm working on it. Compiled already but not working properly and/or not tested. Once it's working I'll post a updated tutorial.

      Delete
  11. everything went fine until #load sound modules part. i got
    "insmod: can't insert '/opt/extras/soundcore.ko': unknown symbol in module, or unknown parameter"
    any idea?

    ReplyDelete
    Replies
    1. Did you use the same firmware as the tutorial? If not you need to find the extra modules compiled for your firmware to make it work.

      I had the same issue and I was able to get it to work after finding the correct extras.MIPS2 modules

      Delete
    2. no, i use dualwan firmware(1.28.0542 MIPSR2 K26 USB 8M). do you know how to find the correct extras.MIPS2 modules?

      Delete
    3. I would really like to know that too please

      Delete
  12. hi Qui Hong

    I was able to get it to work when I followed your tutorial (although i am using an Asus RT-N16, different firmware and extras module)
    but after reboot I had some issues:

    1. the USB drive did not mount to /opt on reboot. fixed this after i added to the "run after mount":

    #mount the new disk partition
    mount /dev/sda1 /opt

    2. The Shairport process is running, but there is not airplay device

    I went back to trace the steps and I am getting a failed message when starting the "S20dbus" dbus-daemon.


    Any idea on how to fix this?

    ReplyDelete
    Replies
    1. Hi Andy,

      1) This section should have taken care of mount /opt on reboot via fstab. Since you did this on an existing setup using a different firmware, I'm assuming your flash drive was not label as "optware" which is what is expected.

      #Make sure /opt is properly mounted on a reboot.
      echo "LABEL=optware /opt ext2 defaults 1 1" >> /etc/fstab
      nvram setfile2nvram /etc/fstab
      nvram commit

      2) Do you have this section in the run after mounting section?

      #delete orphan pid files in case they exist
      rm /opt/var/run/dbus/pid
      rm /opt/var/run/avahi-daemon/pid

      Delete
    2. Yes, I have them, but dbus still fails to start after rebooting. Until than everything works as described in this how-to. After umount /opt - reformat the "optware" partition - reinstalling opkg, dbus and avahi everything goes ok again.

      Nice job though...

      my setup:
      -wl500g+2Gb usb pen drive+usb sound card
      -/opt mounts correctly
      -my extra modules are in post-mount script
      -/tmp/etc/group and passwd files modified on flash

      Delete
    3. I had the same problems with /opt and dbus.
      I had to add
      rm /opt/var/run/dbus.pid

      Delete
    4. True that!!!!!


      "rm /opt/var/run/dbus.pid" instead of "rm /opt/var/run/dbus/pid". Now I'm up and running! Thanks a lot!

      Ed

      Delete
    5. On the other hand for avahi-daemon the above mentioned "rm /opt/var/run/avahi-daemon/pid" is the right choice. So the right way is the following:

      rm /opt/var/run/dbus.pid
      m /opt/var/run/avahi-daemon/pid

      Delete
    6. Thanks for letting me know. Might be dependent on the dbus package used. I'll update the tutorial to delete both files (in case either one exists).

      Delete
    7. I went ahead and updated the location of the dbus pid file in the tutorial. Looks like the dbus package in entware was updated and the pid file location changed.

      Thanks for letting me know!

      Delete
  13. Is there a way to do the set up on a Mac? I got through step 2, but it looks like Putty is only for Windows. Thanks.

    ReplyDelete
  14. Qui:
    Thanks for putting this tutorial together.
    Everything works until I tried to start Avahi.

    avahi-daemon -D
    Timeout reached while wating for return value
    Could not receive return value from daemon process.

    Any ideas?

    ReplyDelete
    Replies
    1. run it without the -D to see what the issue is.

      Delete
    2. Failed to create runtime directory /opt/var/run/avahi-daemon/

      When I launch avahi-daemon, it creates avahi-daemon folder, but will not create the pid. I tried setting directory permissions to the entire /opt/var/run to 777 and it still doesn't make a difference.

      Delete
    3. Are you starting from scratch using the Shibby's firmware and following my instruction exactly?

      Delete
  15. Need Help: I think my router may now be bricked. Following the procedure above, on WinXP , I:

    1. Started with a new Belkin F7D7301 v1.

    2. Successfully flashed DD-WRT using current newest firmware:
    dd-wrt.v24-21061_NEWD-2_K2.6_mini_f7d7301.bin

    3. Using DD-WRT, flashed newest current TomatoUSB .trx firmware (112, Big-VPN), with "Reset to Default Settings after flashing" set.
    http://tomato.groov.pl/download/K26/build5x-112-EN/tomato-K26USB-1.28.RT-MIPSR2-112-Big-VPN.trx

    I waited a long time, and the flash seemed successful. But I cannot connect to the router. I tried many variations:

    A. Unplugging and re-plugging the router power (with PC connected with DHCP):
    After 5 seconds, network status briefly indicates "acquiring network address".
    After 13 seconds, status indicates "network cable unplugged"
    After 17 seconds, router indicator light turns orange, then quickly green and stays green.
    However, computer continues to indicate "Network cable unplugged". Disconnecting and reconnecting ethernet cable does not change anything.

    B. I repeated this power-cycle procedure with static IPs. Network status briefly flashes "connected" twice during the router boot, but quickly turns to "network cable unplugged" after about 17 seconds as above. Indicator light remains green.
    192.168.1.8/255.255.255.0/192.168.1.1
    192.168.2.8/255.255.255.0/192.168.2.1

    C. 30-30-30 reset
    Upon plugging in power during the final 30 interval, even with reset still being held, computer indicates "acquiring network address".
    After about a minute, status changes to "limited or no connectivity" with an IP address of 169.254.120.104. Indicator light on router stays off and continues to stay off.

    Unplugging and replugging ethernet cable yields same limited or no connectivity IP address result. Router indicator light remains off.

    Is the router bricked? Did I flash a wrong version of Tomato? Can I get the router out of this situation? Is there a forum where I might get more help? Thanks!

    ReplyDelete
    Replies
    1. Doesn't sound like your router is bricked since the router indicator light is green. Try the 30-30-30 reset again and make sure you set a static ip address for your computer.

      Delete
    2. With some help from another forum, I eventually solved the problem. The problem was that the NVRAM was not being cleared after flashing Tomato. I performed a 30/30/30 reset, but using the WPS button, not the reset button. This may have cleared the NVRAM. I'm not sure.
      I was then able to access the CFE page from the recovery mode: (holding the reset button for ten seconds while plugging in the power, setting static IP and connecting to 192.168.1.1, then selecting Erase NVRAM from the CFE miniWeb server, and rebooting).

      I started the flashing over from scratch, being sure to manually erase the NVRAM using the CFE page after the DD-WRT flash and after the Tomato flash. This went smoothly.

      So I would suggest adding a step 10.5 in section 1e) to manually erase the NVRAM using the CFE after flashing Tomato.

      Also, it should be noted that the 30/30/30 reset using the RESET button does NOT erase the NVRAM. I'm not sure what it does, nor what a 30/30/30 using the WPS button exactly does.

      Delete
    3. Thanks for following up and posting your solution. I really appreciate that.

      I just noticed you didn't use the DD-WRT firmware I provided - dd-wrt.v24-15396_NEWD-2_K2.6_mini_f7d3301.bin. Instead you used a newer version.

      Maybe there's a bug in the newer version of DD-WRT where it ignores the "Reset to Default Settings after flashing" checkbox, which should clear the NVRAM.

      Not sure if you have time, but if you do, can you start from scratch and use the dd-wrt firmware I provided? I flashed numerous F7D7301 models with the exact instructions I posted with no issues.

      I'll definitely mention trying to 30/30/30 reset using the WPS button versus the RESET button. Thank you again.

      Delete
  16. What is the speed you guys get when connected a HDD to the USB port and read/write from a PC? Assuming that the PC and the router are gigabyte connected.

    ReplyDelete
    Replies
    1. When using an Ext3 drive, expect 4-7Mbytes per second. Slightly less if using NTFS.

      You can tune SAMBA to get slightly faster performance (7-9MByte with ext3):
      Add "use sendfile = no" in the "Samba Custom Configuration" box under "USB and NAS"->"File Sharing" screen.

      Delete
  17. I followed the instructions and everything worked great. However, after I rebooted the router "Living Room" was no longer available on my apple devices. Is there any way to determine what function isn't starting? Thanks.

    ReplyDelete
    Replies
    1. Double check section "5) Configure the router so that everything works after a reboot" and verify you have everything configured correctly.

      Delete
  18. I tried to do this again and it appears the links for entware are out of date. If you have the time would you please update the tutorial. Thank you.

    ReplyDelete
    Replies
    1. Can you be more specific as to what link is out of date?

      Delete
    2. This link didn't work http://wl500g-repo.googlecode.com/svn/ipkg/entware_install.sh

      I think it has moved here https://github.com/Entware/entware

      Thanks.

      Delete
    3. I've made the update. Try again and please let me know. Thanks

      Delete
    4. I was able to go through the tutorial by using this command to install entware:

      wget http://wl500g-repo.googlecode.com/svn/ipkg/entware_install.sh

      It appears that the link is still not updated in this tutorial, although you have that updated link in your Site to Site VPN tutorial.

      Delete
    5. Thanks for letting me know. I thought, I updated it, but I guess not. It's correct now (I hope).

      Delete
  19. Hi Qui Hong, first of all thanks and congrats for this article!

    I want to ask if I could do this over the router Linksys E3000 because it has just one USB port.

    I've already replaced the firmware by DD-WRT.

    Thanks!

    ReplyDelete
    Replies
    1. Active USB hub is the simplest way ...

      Delete
  20. Hey there,

    when trying to install Shairport I get this error:

    root@unknown:/tmp# opkg install shairport_0.05-20121002-1_entware.ipk
    Installing shairport (0.05-20121002-1) to root...
    Collected errors:
    * satisfy_dependencies_for: Cannot satisfy the following dependencies for shairport:
    * libao * libopenssl * perlbase-io *
    * opkg_install_cmd: Cannot install package shairport.

    The router is running TomatoUSB K26 VPN MIPSR1. I'll be trying to manually get the packages mentioned by the installer now but I have a feeling that I've made a fundamental mistake somewhere.
    Another question: while formatting the flash drive you write:

    mke2fs -j -L optware /dev/sda1
    [..]
    echo "LABEL=optware /opt ext2..."

    According to my understanding 'mke2fs -j' creates an ext3 partition then why are you mounting it as ext2? Is there a trick that's escaping me there?

    Thanks, and awesome post by the way. I'm really looking forward to making this work.

    cheers

    ReplyDelete
    Replies
    1. Ok, so now it works. Here's what I did:

      -downloaded the latest entware from "wget -O - http://entware.wl500g.info/binaries/entware/installer/entware_install.sh | sh" instead of the one given here
      -downloaded the firmware from the specified link (I previously downloaded it from the official site, big mistake when I wanted to install the sound modules... I know I know my bad)

      After this everyhing went smoothly and I want to thank you for having written this tutorial. Without this I would probably be way in the dark.

      My question about the ext2/3 discrepancy still stands though. And also I've noticed a significant decrease in sound quality compared to the cable. Is that normal? Should I try to buy a better USB adapter?

      cheers

      Delete
    2. Good catch regarding the ext2 versus ext3. Here is my explanation on the discrepancy... always format with journaling (for ext3) for flexibility. When mounting use ext2 or ext3 depending on if you're using a USB flash drive or USB hard drive. The argument is that journaling will cause the USB flash drive to wear out faster. At any rate, I just updated the echo statement to be ext3 as I think the journaling is worth the extra wear on the USB flash drive.

      Thanks for the updated entware install script. I thought I updated it previously but I guess not.

      Delete
    3. I have another question: currently shairplay is running on a client router that I want to connect through WAN. I added a firewall rule to accept incoming TCP on port 5002 and iTunes seems to be able to connect but no sound is coming through. Are there other ports I should be opening?

      Delete
  21. I followed your instructions and downloaded the same files, but it may seem that I bricked my F7D4301. It all went well till the end of 1E, where I opened 192.168.1.1 and repeatedly entered admin/admin, but that combination didn't work, and all of a sudden, the green light in modem disappeared, and no light would show on. I tried a 30-30-30 using WPS and reset buttons, and tried pressing WPS for 10 seconds upon start, but to no avail. Also, there is no light coming from the ethernet plug in my pc. When I insert a USB stick in one port, its light turn on for a split second then disappears, while the other makes the USB light constantly on.

    Any recommendations?

    ReplyDelete
    Replies
    1. Sorry to hear you're having issues with your setup. I don't understand how it's possible to "all of a sudden" brick your router while entering the login credentials. My only suggestion would be to try to reset it somehow.

      Delete
    2. Can you please confirm that you actually used the files I provided in this tutorial versus files you got from somewhere else? You stated you use the "same files", however the link to the DD-WRT firmware from the F7D4301/8301 returns a 404 so I'm a little confused.

      Delete
    3. Yes, that is confusing, but do you have any advise on how to reset it?

      That link is no longer available, but their FTP still has it: ftp://ftp.dd-wrt.com/others/eko/V24-K26/svn18946

      Delete
    4. Whatever I know about resetting the router has been documented in this blog post. My only recommendation is to keep trying. The Belkin routers uses a CFE menu which makes it very difficult to brick (even with a bad flash).

      The FTP link you provided didn't work. I want to know exactly what DD-WRT bin file you used and where you got it because I've seen this issue reported before (not being about to login with admin/admin after flashing to TomatoUSB) when using other versions of DD-WRT bin file. It's like there is a bug in the firmware where it ignores the "Reset to Default Settings" in step 1e, 10.

      Delete
    5. Here's the direct link: ftp://ftp.dd-wrt.com/others/eko/V24-K26/svn18946/dd-wrt.v24-18946_NEWD-2_K2.6_mini.bin
      same filename...

      Delete
    6. Strange, the link you provided still doesn't work.

      Anyways, that a look at this thread - http://www.dd-wrt.com/phpBB2/viewtopic.php?t=78042&postdays=0&postorder=asc&start=345 (@lolekthegreat posting). Sounds like what I suspected, the NVRAM not being properly cleared when flashing from DD-WRT to Tomato either because the "Reset to Default Setting" wasn't checked (you did check it right?) or it wasn't honored (a bug maybe). Sounds like you might have to recover via serial or jtag.

      Delete
    7. Another thread with some good info - http://slickdeals.net/f/6534628-belkin-play-max-dual-band-router-f7d4301-dd-wrt-tomato-compatible-18-99-fs-amazon?v=1&page=3

      You should be able to reset the NVRAM somehow or get back into the CFE menu to reflash.

      Delete
    8. Thanks for the help. I am certain that I selected to clear NVRAM when uploading dd-wrt, but if I recall correctly, I didn't wait enough after that. I only waited till I was able to access the admin page in dd-wrt, and then immediately uploaded tomato file. Could this be the issue where there wasn't ample time for modem to clear nvram? I just assumed that as long that I can access the admin page, then upgrade of dd-wrt is done.

      Delete
    9. You won't believe it, but I simply left the router powered on for 24 hours, and then did a 30/30/30 reset, and now it's running Tomato! Thanks.

      Delete
    10. @Hani, that's awesome news. Hopefully it will help some future readers.

      Delete
  22. Qui,

    I am having problems loading the last 3 modules, it says they are incompatible.

    I already have Shibby's latest firmware on my Linksys E4200 router (tomato-E4200USB-NVRAM60K-1.28.RT-N5x-MIPSR2-121-AIO.bin), so I downloaded the extras from that location to ensure the builds are compatible: http://tomato.groov.pl/download/K26RT-N/build5x-121-EN/extras.mips2.tar.gz, but I get the following errors when loading the last 3 modules:
    root@Tomato:/tmp# insmod /opt/extras/input-core
    insmod: can't insert '/opt/extras/input-core.ko': invalid module format
    root@Tomato:/tmp# insmod /opt/extras/hid
    insmod: can't insert '/opt/extras/hid.ko': invalid module format
    root@Tomato:/tmp# insmod /opt/extras/usbhid
    insmod: can't insert '/opt/extras/usbhid.ko': invalid module format

    Can you advise on how to fix?

    Regards,

    Sean

    ReplyDelete
    Replies
    1. try a different firmware (VPN versus AIO) or older version. google the error. better yet, stick to the tested version documented in the tutorial. please report back if you figure a workaround. thanks

      Delete
    2. I tried a couple of different versions, but without success, so before I downgrade my router back to 108, can you give me an idea of the audio output quality? Can you get the full audio spectrum up to 20KHz, or is it more like PC quality with some slight chopping or distortion?
      Thanks

      Delete
  23. There seems to be some other new problems with this tutorial with some of the updates to Entware and shairport.

    I was able to follow the tutorial through to the installation of shairport, but the current version of wget doesn't support https protocol and it appears that dropbox has updated this link so that it requires https protocol to access it. It comes back with the following error:

    wget http://dl.dropbox.com/u/42238/entware/shairport_0.05-201
    21002-1_entware.ipk
    Connecting to dl.dropbox.com (23.21.78.151:80)
    Connecting to dl.dropboxusercontent.com (54.235.206.42:80)
    wget: not an http or ftp url: https://dl.dropboxusercontent.com/u/42238/entware/shairport_0.05-20121002-1_entware.ipk

    Despite this error, I was able to install a newer, updated version of shairport through a simple command in opkg.

    This is the install command I used:
    opkg install shairport
    Downloading http://entware.wl500g.info/binaries/entware/shairport_2014-08-22_entware.ipk. (Notice that the version I was able to install with the opkg command is newer that the version in the tutorial.)

    I then returned to your tutorial and was able to get everything to work (including the madplay test), but when I finally ran shairport, I got the following error:

    shairport -a "Living Room" -b 282 -d
    Starting Shairport -dirty
    Listening for connections.
    1710
    root@unknown:/opt/extras# ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
    ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
    ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
    FATAL: Alsa initialization failed: unable to open pcm device: No such file or directory

    Shutting down...

    Is this error occurring because I'm running a newer, updated version of shairport that cannot use the usb audio drivers that worked for the older version of shairport?

    ReplyDelete
  24. I can't comment on the issue with the shairport version provided by opkg. My recommendation would be to run a "opkg install wget" to get the version of wget that supports https.

    ReplyDelete
    Replies
    1. I wasn't able to figure out how to download https with an updated version of wget, but I was able to get the file downloaded with another command - curl. I think to get everything in your tutorial working again you'd need to add these lines:

      #after installing entware, install curl
      cd /opt
      opkg install curl

      #download and install shairport
      cd /tmp
      curl -k -L -o shairport_0.05-20121002-1_entware.ipk https://dl.dropbox.com/u/42238/entware/shairport_0.05-20121002-1_entware.ipk?dl=1
      opkg install shairport_0.05-20121002-1_entware.ipk

      Any chance you'd be interested in figuring out how to get the most recent update of shairport (2014-08-22) working with this setup? I'm really hoping the latency issue with this setup could be resolved (or at least a bit better) with the update.

      Delete
    2. Thanks for the detail info. I'll probably move the shairport package to a non https URL in the near future to simplify things, but for now, I'm sure you're info will help others.

      Sorry, this is not something I'm working on any longer. Any update will not reduce the latency.

      Delete