Lost Password? No account yet? Sign up! Why bother?
  • Narrow screen resolution
  • Wide screen resolution
  • Auto width resolution
  • Increase font size
  • Decrease font size
  • Default font size

SmallNetBuilder - Small Network Help

  
Home arrow NAS arrow NAS How To arrow How To: Hacking the Linksys NSLU2 - Part 2 - Adding NFS
How To: Hacking the Linksys NSLU2 - Part 2 - Adding NFS Print E-mail
Jim Buzbee   
August 10, 2004

Modifying and Building the Portmapper

Now we can move on to bigger and better things. It may seem a big step to go from "Hello World" to NFS, but it's not too bad. First we need to install and setup the Linux source tree in order to access the required include files. The source tree can be found in the snapgear tar file included on the CD distributed with the NSLU2.

First untar the snapgear tar file in your build area. Since we are not going to be building the kernel, we'll take a shortcut setting up for an ARM architecture. Create and execute the following script from within the snapgear/linux-2.4.x directory :

#!/bin/bash rm -f include/asm rm -f include/asm-arm/proc rm -f include/asm-arm/arch ( cd include; ln -s asm-arm asm ) ( cd include/asm-arm; ln -s proc-armv proc ) ( cd include/asm-arm; ln -s arch-ixp425 arch )

Now we should be set up for more complex builds. NFS is based on a Remote Procedure Call architecture. In order for RPC to function, it needs a helper daemon called the portmapper. I found portmapper source code here, and source for an NFS server here. After untarring the source trees you should end up with portmap_4 directory, a snapgear directory and a nfs-server-2.2beta47 directory along with the original gpl_code_2.03 directory.

Next let's build the portmapper. I had to make a few changes to the Makefile to simplify the build. First, I commented out the line : HOSTS_ACCESS= -DHOSTS_ACCESS, to reduce an external library dependence. Everywhere I saw a reference to libwrap.a I also commented it out for the same reason. For a more secure server, these can be put back, but additional libraries will be needed.

I then modified the CFLAGS line to point to my snapgear linux source tree :

CFLAGS = $(COPT) -O $(NSARCHS) $(SETPGRP) -I /home/jbuzbee/snapgear/linux-2.4.x/include/

Finally, in the top of the makefile, I added the following line in order to invoke the cross compiler:

CC=/home/jbuzbee/gpl_code_2.03/usr/local/openrg/armsaeb/bin/armv4b-hardhat-linux-gcc

In addition to the makefile changes, I needed to make a small source change. In the file portmap.c, there's a perror function defined that overrides the standard perror. I changed the argument definition from const char to __const char so as to match the stdio.h definition in our cross compilation tree.

Now, all that is required is a "make". This produces a number of warnings, but the build should run to completion. Next strip the binary to save memory for our little box:

# armv4b-hardhat-linux-strip portmap



Tags: BYOD, Hacking, How To, Linksys, NAS, NSLU2,

Related Articles:

How To:Hacking the Linksys NSLU2 - Part 3 - Adding an iTunes server
How To: Hacking the Linksys NSLU2 - Part 4- Customizing the Flash
How To: Hacking the Linksys NSLU2 - Part 5- Moving to Unslung
Hacking the Linksys NSLU2 Part VI - Installing a Media Server
How To: Hacking the Linksys NSLU2 - Part 1
 

Most Read

 
 

Over At The Forums

Are Cat6 and Cat5e not perfectly compatible?
So, I was rearranging some of my network today (notably moving my router to a different room) and I noticed something very odd. When I...

Captive portal for security
I've read about this in the previous Bed & Breakfast thread. Our company wants to get wireless going on one of the floors. There is only personal...

D-Link DNS-323 Mysteries
Hello folks. I'm having issues with my Nas and looking for some thoughts. 1. The 323 gets recognised by Vista as a network device but...

Gigabit Network Help!
I have a gigabit NAS (D-link 323) that I have connected to a D-Link DGS-1005D gigabit switch. I then have my desktop connected to...

Synology DS-209+ review up!!
Looks real good. Now Netgear needs to play catchup and dump that old Infrant CPU for something more modern and powerful!! http://www.trustedreviews.com/networ...ion-DS-209-/p1

Slideshows

NETGEAR ReadyNAS Pro Western Digital ShareSpace QNAP TS-509 Pro D-Link DNS-343 4-Bay Network Storage Enclosure Thecus N3200 RAID 5 NAS D-Link DIR-628 RangeBooster N Dual Band Router More

Win This!

Enter to Win!

You could win a Trendnet TEW-633GR Wireless N Gigabit Router and two TEW-621PC 300Mbps Wireless N-Draft PC Cards

Learn How!

 

Ldr:0.00178289413452, Rct:0.0060019493103, Sky:0.00774002075195, Tlink:0.0883529186249, TopPG:0.088427066803, GQV:0.0885670185089 seconds to load.