Netxfer


This script has been updated - if you have a problem with the new version, you can try the old version: netxfer-old.sh


This script is used for downloading flash image files to the Evo T20, instead of using the standard netxfer software under windows. It also acts as a PXE server if you give it suitable command-line arguments - netxfer and PXE are almost identical, just different ports and filenames. The servers are not run as daemons - they're killed on script exit - this is usually most useful to me because I'm just testing things temporarily.

It works for me (well, it did last time I checked), but I'm happy to hear of problems and will try to fix them if practical.

Don't forget to punch a hole through your firewall if you're running one on the interface that is supposed to serve the files! (T20 uses TCP port 10067 for dhcp, and UDP port 10069 for tftp. Look at the script for port numbers for other modes)

Under Debian Lenny, the dhcp server I have used is called dhcp3-server and the tftp server is tftpd-hpa (at install time, if it asks you whether inetd should start tftpd, say "no" - the script here will start and stop it as required).

Whilst the image download is one file, the T20 fetches it in 2 parts. The first part is small - when it is done, the T20 pauses to do a few things (setup? erase flash? program bios chip?). After that, the rest of the file is downloaded. The default settings of some tftp servers have too short a timeout for the slow old T20 - the transfer fails when the T20 pauses for too long. The solution is just to have a longer timeout! The pause is longer for devices with more memory - maybe a minute for a 256M T20.

Note that if you have a particularly old tftp server, it may be limited to 32M transfers (512 byte blocks and 16bit block count). This is no good for us - you need a better tftp server (I use tftp-hpa).

The dhcp3 server that I use may not be available on SuSE. Apparently, there's a package called "ISC DHCP Server" which works if you create a symlink from /usr/sbin/dhcpd3 that points to /usr/sbin/dhcpd (or you could edit the script)(the server package is dhcp-server-3.0.5-9.i586.rpm in directory ftp://ftp.suse.com/pub/suse/update/10.2/rpm/i586/ although there may be a newer version by the time you read this). Thanks to Philip Loewen for this info.


PXE Serving

Running the script with command-line options of -p or -a gets you PXE mode, on either standard ports (67-69) or alternate ports (69,1067-1068). To use alternate mode, you need a client compiled to use those ports - it's one of the options for http://www.etherboot.org or http://rom-o-matic.net

This is my /tftpboot dir structure:

$ tree -p /tftpboot
/tftpboot
|-- [-r-xr--r--]  linux24
|-- [-rw-r--r--]  minirt24.gz
|-- [-rw-r--r--]  pxelinux.0
`-- [drwxr-xr-x]  pxelinux.cfg
    `-- [-rw-r--r--]  default

It is essential that these files and directories be readable by "other" (directories also need to be executable by "other"). Without this, the PXE client won't be able to read the files, and that would be silly.

You can get pxelinux.0 from http://syslinux.zytor.com/pxe.php (along with more info about PXE in general)

This is the content of /tftpboot/pxelinux.cfg/default

prompt 0
label linux
  kernel linux24
  append ramdisk_size=100000 init=/etc/init host=DEvoSL frominitrd nopcmcia noswap initrd=minirt24.gz

The script:

The script is my own construction, but the config options mostly came from assorted websites, with some hints from Markku Mähönen and Bartek Szurgot too.
Malte Stretz provided a patch to cope with dhcpd dropping privileges, and to trap ctrl-c cleanly. I plan to tidy things up a bit, but I haven't had time for that yet - the script seems to work well as it is.

Contact me if you have any problems!

I have unimaginatively called the script netxfer.sh