nomis52.net
View Simon Newton's profile on LinkedIn

Host Setup

File System Setup

We need a couple of things working on the host machine to get things going. In order to keep things organised, create a new directory (in this case called wgt634U).

~$ mkdir wgt634U

Next, it will be useful later to be able to refer to this path without typing it out. In your .bashrc, add the following lines:

PROJ_ROOT=/home/simon/wgt634u/ export PROJ_ROOT

From now on I'll use $PROJ_ROOT.

I created the following directories under $PROJ_ROOT:

$ cd $PROJ_ROOT $ mkdir boot rootfs archives src $ ls archives boot rootfs src

This will do for now, we'll create some more as we move along.

TFTP Server Setup

TFTP is used to transfer a kernel to the router so that it can boot. You'll need a tftp server. I used atftpd. Under Debian you can apt-get it like so:

# apt-get install atftpd tftp

This should add the appropriate entry to your /etc/inetd.conf file. You'll need to edit the path though, mine looks like this:

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd --tftpd-timeout 300 --retry-timeout 5 /home/simon/wgt634u/boot

And restart inetd:

# /etc/init.d/inetd restart

Now to test it. Create a file in $PROJ_ROOT/boot and then try and retrieve it using tftp.

$ cd /tmp $ echo test > $PROJ_ROOT/boot/test $ tftp tftp> connect localhost tftp> get test Received 6 bytes in 0.0 seconds tftp> quit $ rm test

If you get a "File Not Found" check the permissions on the test file. Make sure as the user nobody you can access the file. If not you'll have to fix permissions.

NFS Server Setup

You'll need a NFS server to export the root filesystem. Under Debian an:

# apt-get install nfs-user-server

ought to do it. Next edit the /etc/exports file and add a line that looks like the following:

/home/simon/wgt634u/rootfs 192.168.0.0/255.255.0.0(rw,no_root_squash)

Restart the nfs server (as root)

# /etc/init.d/nfs-user-server restart

If possible check that it mounts from another machine on the network. You can do this with:

# mkdir /mnt/rootfs # mount 192.168.1.10:/home/simon/wgt634u/rootfs /mnt/rootfs

If the following suceeds with no errors it's looking good. Now umount the nfs share:

# unmount /mnt/rootfs

One issue I've been having is that the root filesystem needs to be owned by root (so that everything works on the target side). It would be a good idea to set up sudo so that you don't have to keep su'ing to root to run make install.

You need to be root for this bit. Under debian:

# apt-get install sudo

Then add the following line to /etc/sudoers .

simon ALL = NOPASSWD: /usr/bin/make

Replace simon with your username, you can leave "NOPASSWD:" out if you want to be prompted for your password each time you run sudo. I put it in so that I can script the install process.

Next: Build a toolchain