Wednesday, May 16, 2012

OpenWrt on a Belkin Share Max N300 (F7D3301 or F7D7301)

Please see the update on thistopic at below link:


OpenWrt on a Belkin Share Max N300 (F7D3301 or F7D7301)

It was not a difficult job. Had to write a couple of patches to get it working. But a lot of work had been done by "George Kashperko" for Asus-RT-N16 . I took his patches, and applied some Belkin Specific patches.

The main modifications I made are:

1. Belkin trx headers: For some reason Belkin chose to use a custom header for trx. So modified the Makefiles to generate trx files with this custom header. Without this custom header Belkin CFE wont allow flashing the trx. And I preferred to not touch the CFE.

2. LZMA loader: Due to above modification, now I had to add some more code in the lzma decompressor and loader, to recognize the belkin headers. Without this the lzma loader will load, but wont boot, since it doest understand the new trx format.

3. Bridge setups. The virtual lan setup files needed some modification because of changes in port connections.

4. Diag and LED/GPIOs. Needed some modification to recognize the correct gpio pins and power/diag/usb leds.

Below are the exact steps to produce a trx file, which can be flashed via CFE.

1. Checkout openwrt (a specific version)
svn checkout --revision=30776 svn://

2.  Apply George's patches
    Download from here: 

    patch -p1 < 000-openwrt4716-TARGET_brcm4716-clone-brcm47xx.patch
    patch -p1 < 001-openwrt4716-TARGET_brcm4716.patch
    patch -p1 < 002-openwrt4716-TARGET_brcm4716-deps.patch

3. Apply my patch
   Download from here: 003-belkin-f7d3301.patch
   patch -p0 < 003-belkin-f7d3301.patch

4. make menuconfig
     select Target System -> Broadcom BCM94716
     select Target Profile -> Belkin PlayMax F7D4301

You will have the trx in the usual place after a successful compile.
Look for the file: bin/brcm4716/openwrt-brcm4716-f7d3301-squashfs.trx

For reference one trx I compiled is here : openwrt-brcm4716-f7d7301-squashfs.trx
This is for reference ONLY. Even though I can see many users finding this good enough, I suggest you compile your own trx, when you see your needs are different. If you flash the above trx, you will have telnet access at to your router.

You can install packages from openwrt trunk. But for that you have to addthe below lines to /etc/opkg.conf . Please dont install kernel modules from trunk snapshot, that may lead to kernel instability. But other packages should work without much issue. But as always, if something doesnt work from trunk snapshot, try compile that yourself using proper menuconfig.
arch all 100
arch brcm4716 200
arch brcm47xx 300

For details on opkg look here : opkg reference

Have fun...


  1. Thank you for sharing the trx file. Will try it in the next week or so and will report back. I'll post the comments on the openwrt forum as there seems to be a bit more traffic there. Cheers!

  2. The trx file above works fine but it down't work well with the packages (opkg) because it is built using kernel 3.0 and the current packages use kernel 3.3. Packages that depend on the kernel will not install. I've modified the 003-belkin-f7d3301.patch to use the latest patch files from ASUS-RT-N16 that use kernel 3.3. However, I'm still having because of a kernel version mismatch:

    root@OpenWrt:~# opkg install kmod-usb-acm
    Installing kmod-usb-acm (3.3.7-1) to root...
    Multiple packages (kmod-usb-core and kmod-usb-core) providing same name marked HOLD or PREFER. Using latest.
    Collected errors:
    * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-usb-acm:
    * kernel (= 3.3.7-1-95a9161e0623c9eb4c0a4c6647be5a68) *
    * opkg_install_cmd: Cannot install package kmod-usb-acm.

    1. Jose,

      The kernel compile has to match the module compile (it is not just about the kernel version). There are kernel patches appied outside of "official" openwrt. So I wont suggest installing any kernel modules from snapshot. It is enforced specifically for a reason (a knowledgable user can work aroud it and install kernel modules from snapshot, but then I assume he know what he is getting into).

      My suggestion is to compile your own trx, and in this process change the menuconfig options to select the modules you want (kmod-usb-acm).

      Also please note that the trx provided is for "reference" just to show it boots and works for that compile. I will probably modify the article sometime to make it clear for new users, not to install kernel modules from another source on this trx.

  3. Hey I just flashed this to my belkin via CFE but cannot access the webgui. I can ping the gateway and even get a ip from DHCP. Any thoughts?

    1. Greg, as mentioned in the blog, you will have access to it via telnet. No Luci or Xwrt was included. You could install them using ipkg. But my main intension is to encourage more folks to compile openwrt, so that they can customize to have the packages they need, and see the extensive list of actually readily available for their use.

      If you are on windows, maybe look here to get started on openwrt compile environment:

    2. forgot to mention that "luci" and "xwrt" are two different options which provide web interface for openwrt. Infact I never use them though, since commandline is very powerful for openwrt.

  4. Thanks for the great post. I found some issue with the wireless network. which seems to be very unstable.

    also "wifi" command gives me some error

    root@OpenWrt:~# wifi
    wl0: Invalid argument
    wl0: Invalid argument

    any idea how to solve the problem?

    1. Jacob,

      I agree that the broadcom proprietry wl driver is not upto our expectations on 3.x kernels. Unfortunately I dont have any real solutions to offer on this driver. Maybe just watch the wl driver forums in openwrt.

      Regarding the error message, I think the issue is in enable_broadcom function. One of the wlc calls have either wrong arguments or is not in the right order. Try doing each of the wlc calls from that function one by one, to figure out the exact call.

      I was using a custom wlc call since I needed some specific settings, and dont remember encountering this specific issue.


  5. Manoj, would the TRX file work on a Belkin N600 HD as well? The N600 HD is a dual band 2.4GHz and 5GHz.

    Has anyone tried to install Luci with Manoj's TRX file? Any feedback/tips?

    1. Belkin has a habit of changing trx headers. I dont know whether N600 use the same trx header, if it doesnt it may just reject the N300 trx.

      Again I tend to think that by following exact modification steps I did for N300, you could make it work for N600 as well. Which means the patches could be similar but different.

      On the 5GHz band, I dont think we were able to get that band working on kernel 3x using broadcom drivers.

  6. Manoj, thanks for your post.
    Would your trx file work on Belkin Share N300 (F7D3302/F7D7302)? If not, how can I get the specific patch file for F7D3302? I haven't built my own trx before.

    1. I tested your trx file with F7D3302, and it didn't work.

    2. Chester,

      Was the trx rejected right away?
      or were you able to flash it and the boot didnt work?

      Please check my patches specifically the first 2 items I mentioned (trx header modification + lzma loader modification). I think you could atleast make the F7D3302 boot similar modifications.

      Obviously dont try anything if you dont have at least a way to do serial terminal debugging.


    3. Both our trx were rejected at the first time when I tried to flash it through cfe/dd-wrt upgrade webpage. Then I tried tftp a few times, still couldn't connect to the router. After that, I tried dd-wrt upgrade again and oddly it got flashed without rejection. It turned out the boot didn't work.
      Now I'm looking for serial debugging tools...
      I did some modification directly on your patch, replaced some numbers and strings in reference to some dd-wrt source code. Maybe I didn't do it right. Would you please have a look at my patch?

    4. Chester,

      I think what you are missing is the lzma loader patches.

      Sorry for being late on the reply. I did not notice your replies till today. If you are still working on this, one way to start debugging is to use the "initramfs" compile instead of the "squashfs" compile, and then use the vmlinux generated to do a CFE load and boot. This way you dont have to keep flashing new trx every time.

      Also it will avoid the "TRX MAGIC" check, and will get you started right away. Basically from CFE you can load the vmlinux image and execute it directly.

      Once you have that booting, check the boardtype/boardnum and TRX MAGIC etc by printf messages.

      I believe your issue is mostly due to the TRX MAGIC. There are two portions using this.

      1. The CFE itself, checks the TRX MAGIC to make sure your trx is valid, before flashing it. You could bypass this by using ddwrt flashing (but doing this without understanding why, you will face the next one).

      2. The loader.gz is part of the openwrt trx and this is the loader, which gets loaded in the beginning and then unlzmas the vmlinux from trx. Even this need to go throught the trx flashed image correctly and therefore needs the correct TRX MAGIC info. I dont see your patch doing anything to the loader.gz.


  7. hello everyone, does any of you know where the serial rx/tx pins are located for the F7D7301 version?

    1. J1 header (4 pins). 1-TX 2-RX 3-GND
      When I say TX I mean TX from router to USB/rs232-adapter.

      Please note that there could be some wierd encoding on the RX, which means you may not be able to type commands in the serial terminal.

      The work around is, send the commands via http.
      For example check the router reboot link from CFE home page.
      You could send any command to cfe via http.

  8. FYI - new Beta of OpenWRT 12.09 is available. Manoj, any chance you could provide a TRX file so that we can help debug the Beta? TIA.

    1. I was not planning on updating the trx, when I initially put this blog. But sure I will upload a newer one soon. (My original intension was to enable more folks compile and customize their own versions).

      Infact I take the compiled kernel directly now and does usb boot for the updates (no more flashing the firmware). I will probably publish this method in another blog, so it will be less risky for the folks who update often. (the idea is you dont touch the flash/mtd for any updates, all updates are done in a usb drive).

    2. Another vote for this...:)

    3. I just published updated patches and also a new trx. As always, try to compile yourself for your own custom needs.

      I will probably close comments on this post. So that I can consolidate comments on the new updated post.

  9. Hello, I wanted to say thank you for sharing the firmware (you sent it to me on slickdeals) and instructions for building openwrt for this router.

    I'm new to openwrt, but thanks to you and the wonderful openwrt community, I'm currently building (make in progress) my first openwrt firmware.


    Wish me luck. I'm trying to get Apple AirPrint (CUPS) and Airplay (ShairPort) working on this thing.

    1. Status update...

      Was able to build it successfully if I didn't add the extra modules I want - usb storage, usb audio, shairport

      Guess I'll wait for the patch for AA.

      Here's the error if it helps:

      make[5]: Entering directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/tests'
      gcc -DHAVE_CONFIG_H -I. -I../libopkg -O2 -I/home/grayman4hire/OpenWRT/32786/staging_dir/host/include -Wall -g -O3 -I../libopkg -O2 -I/home/grayman4hire/OpenWRT/32786/staging_dir/host/include -MT libopkg_test.o -MD -MP -MF .deps/libopkg_test.Tpo -c -o libopkg_test.o libopkg_test.c
      mv -f .deps/libopkg_test.Tpo .deps/libopkg_test.Po
      /bin/bash ../libtool --tag=CC --mode=link gcc -Wall -g -O3 -I../libopkg -O2 -I/home/grayman4hire/OpenWRT/32786/staging_dir/host/include -static -L/home/grayman4hire/OpenWRT/32786/staging_dir/host/lib -o libopkg_test libopkg_test.o ../libopkg/libopkg.a ../libbb/libbb.a
      OpenWrt-libtool: link: gcc -Wall -g -O3 -I../libopkg -O2 -I/home/grayman4hire/OpenWRT/32786/staging_dir/host/include -o libopkg_test libopkg_test.o -L/home/grayman4hire/OpenWRT/32786/staging_dir/host/lib ../libopkg/libopkg.a ../libbb/libbb.a
      make[5]: Leaving directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/tests'
      Making all in utils
      make[5]: Entering directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/utils'
      make[5]: Nothing to be done for `all'.
      make[5]: Leaving directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/utils'
      Making all in man
      make[5]: Entering directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/man'
      make[5]: Nothing to be done for `all'.
      make[5]: Leaving directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/man'
      make[5]: Entering directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618'
      make[5]: Nothing to be done for `all-am'.
      make[5]: Leaving directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618'
      make[4]: Leaving directory `/home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618'
      install -m0755 /home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/src/opkg-cl /home/grayman4hire/OpenWRT/32786/staging_dir/host/bin/opkg
      touch /home/grayman4hire/OpenWRT/32786/build_dir/host/opkg-618/.built
      make[3]: Leaving directory `/home/grayman4hire/OpenWRT/32786/package/opkg'
      make[2]: Leaving directory `/home/grayman4hire/OpenWRT/32786'
      make[1]: *** [/home/grayman4hire/OpenWRT/32786/staging_dir/target-mips_r2_uClibc-] Error 2
      make[1]: Leaving directory `/home/grayman4hire/OpenWRT/32786'
      make: *** [world] Error 2

  10. Hi All,

    Closing comments here. Please post your comments and suggestions on the new update published at the link below:

    RoundAbouts: Update : OpenWrt on a Belkin Share Max N300 (F7D3301 or F7D7301)