Belkin N1 Vision Custom Firmware

If you want to build your own custom firmware for the Belkin N1 router this guide will explain how to do it for the F5D8232-4 v2. The others should be similar. I will explain this using the Debian distro. The reason for this is the cross compiling tools used by belkin are Debian only executables. You can create your own cross-compiling tools for Cygwin, Ubuntu, Suse, etc if you prefer them over Debian (or you happen to have a box setup) and then use this guide to assist you through the rest of the process.

Cygwin is not recommended as it is very slow and you will spend many minutes twiddling your thumb while it compiles.

Step 1: Planning

Determine how you are going to install linux. Do you have an unused box at home? Or do you plan to run it on a virtual machine?

Windows 7 comes with Microsoft Virtual PC. It does its job very well, but it cannot run 64bit hosts. For that I recommend Oracle VirtualBox [virtualbox.org].

I won’t go through the steps of setting up a virtual machine. Both hypervisors are easy to use, and very user-friendly.

Step 2: The Platform

Acquire the latest debian build from any of the mirrors (big download, 18.7 GB):

64bit:

http://mirrors.usc.edu/pub/linux/distributions/debian-cd/current/amd64/iso-dvd/
http://cdimage.debian.org/debian-cd/5.0.5/amd64/iso-dvd/
http://mirror.yellowfiber.net/debian-cd/5.0.5/amd64/iso-dvd/
http://debian.mirror.iweb.ca/debian-cd/5.0.5/amd64/iso-dvd/

32bit:

http://mirrors.usc.edu/pub/linux/distributions/debian-cd/current/i386/iso-dvd/
http://cdimage.debian.org/debian-cd/5.0.5/i386/iso-dvd/
http://mirror.yellowfiber.net/debian-cd/5.0.5/i386/iso-dvd/
http://debian.mirror.iweb.ca/debian-cd/5.0.5/i386/iso-dvd/

Installation is rather straightforward. Mount/burn ISO. Boot from CD. Install Debian.

Step 3: Getting the stuff

I didn’t initially plan to include this section, but I have for those who aren’t familiar with all the tools.

On your linux box, head over to the Belkin opensource webpage and grab the tarball relevant to your hardware. Mine for example is the F5D8232-4 2xxx.

Once the tarball is downloaded, open up a terminal:

$ mkdir belkinsrc
$ cd belkinsrc
$ tar -xf [download_location]/[tarball]

[download_location] is wherever you downloaded that tarball, and [tarball] is the filename. This will extract all the contents to the belkinsrc directory.

Step 4: Getting the Necessary

Most linux distros these days have the apt package manager, and from that you should be able to retrieve all the binaries we will need for this task. For this project to compile, here are the dependencies needed:

  • gcc
  • g++
  • make
  • glibc
  • flex
  • bison
  • gettext
  • texinfo
  • lzip
  • sed

Some of these may have already been installed by default. You need sudo rights to perform these tasks. Open up a Debian root terminal, or append sudo to every command you type (or if you get permission errors).

There might be others, but those are the ones I wrote down. To get a package:

$ apt-get install [name_of_package]

or

$ sudo apt-get install [name_of_package]

For example, to get flex:

$ apt-get install flex

Sometimes, different distros have different version numbers or names for packages. If apt-get returns “couldn’t find package”, try the following

$ aptitude search gcc

This will look for all gcc packages available to the package manager. Look for the simplest name on that list that contains what you are looking for, possibly appended with a version number.

Once you have successfully acquired all the necessary packages, you may move on to the next step. If you get stuck, simply reread this section until things start to make sense. Hopefully you won’t be stuck forever :)

Note: With debian you will be asked to insert various DVDs. If you are running a VM, just mount the relevant ISO and hit enter to continue.

Step 5: Compile

Before we attempt to fix anything, let’s run it once through. Simply execute the buildGPL.sh under release_GPL/:

$ cd release_GPL
$./buildGPL.sh

It will run for a few minutes, when it should eventually halt at some errors. Those we look at in the next step.

Step 6: Fix Broken Code

I found few things missing in the package I downloaded. Below are fixes only for the F5D8232v2-2.00.03_GPL.tar.gz tarball.

F5D8232v2-2.00.03_GPL.tar.gz

Fix 1:

Type the following in a terminal:

$ pico release_GPL/buildGPL.sh

Where you see the following lines (lines 34 and 35):

make oldconfig
make

Add the line below them:

cd ../..

Save and exit (Ctrl-X).

Fix 2: lzmp.cpp
$ pico release_GPL/tools/lzma-4.32.0beta5/src/lzma/lzmp.cpp

Scroll until you hit the #include statements. In any empty line, type the following:

#include <stdlib.h>

Save and exit (Ctrl-X).

Fix 3: toolchain_build_mipsel
$ pico release_GPL/tools/buildroot/toolchain_build_mipsel/
  binutils-2.16.91.0.7-build/Makefile

Scroll down to line 255 (Ctrl-C to check which line you are on). Change that line to say:

MAKEINFO = makeinfo

Save and exit (Ctrl-X).

There is a better way to do this, but for now this fix will suffice.

Step 7: Verify it Works

Check the path release_GPL/firmware/images. If the date on the .img file is today’s date (ls -al), then you have successfully compiled the source code. If not, you need to review the output for error messages and attempt to diagnose them. The .img file is the one you can safely upload to your router to replace your existing firmware.

Step 8: Start Customizing

… where to begin. It really depends what you hope to achieve. If the router is giving problems, you can try modifying various config options in the many directories. Or you can try upgrading some of the libraries used. Or you can build a better gui for the router. Anything is possible really, if you have the patience.

Most of the goodies are under the firmware/ directory and rootfs. That’s probably a good starting point :)

Before asking questions I highly recommend you attempt to fix any issues you encounter on your own. Its a great learning experience, and who knows? Maybe you’ll discover a gold mine ;)

Have fun.

http://schoolcomputing.wikia.com/wiki/Student_Information_Systems#Free_and_Open_Source_SIS

1 Comment

  1. Mario Lobo said,

    February 14, 2011 at 1:26 pm

    Hi Ahmad;

    I successfully compiled and uploaded an unchanged firmware for my Belkin N1 Vison router by following your instructions ! It is up and running fine.

    IThe first thing I’d like to do is to add Telnetd or sshd to it. It seems to me it should go under release_GPL/firmware/apps but I am not sure.

    Could you give me some steps or hints on how I can add it? I think I know what to do about the make files but I have no idea on how to make it start up at boot. I can’t find any init.d folder where linux starts up its daemons.

    Thank for the great howto.

    Best wishes,

    Mario Lobo

Post a Comment