Archive for April, 2010

Updating system firmware on an IBM Thinkpad T43 using pxeboot

Friday, April 30th, 2010

Recently I got my hands on an IBM Thinkpad T43 without disk drive and cdrom (perfectly OK machine thrown out, apparently for no reason). I decided to update the firmware to the newest version before considering buying replacement parts for it.

So how do you update the firmware on an IBM Thinkpad without floppy or cdrom? You netboot it ofcourse. Needless to say these instructions might also work for other models. And finally: If you break your Thinkpad following these instructions I have no liability and you get to thank yourself and keep both parts!

With the standard disclaimer out of the way, lets start.

First I went to the excelent site thinkwiki.org where I located the latest bios. I then downloaded bios version 1.29 from Lenovo (Notice that two versions of the T43 exists and they are incompatible!)

I turned my attention to my linux server (ubuntu) and configured the dhcpd, tftpd and inetd to allow me to netboot using pxe. First off I installed the four needed utilities.

sudo apt-get install openbsd-inetd tftpd-hpa  dhcp3-server cabextract

When PXE booting a computer, it broadcasts for a lease from a DHCP server on the net. I configured my dhcpd server with the following besides the normal dhcpd options.

sudo vi /etc/dhcp3/dhcpd.conf
...
...
       host t43 {
                hardware ethernet 00:11:25:d6:ef:4b;
                fixed-address 192.168.1.35;
                filename "pxelinux.0";
      }
...
...

You ofcourse have to change the hardware ethernet to the mac address of your Thinkpads ethernetcard. I saved the file and restarted dhcpd with

/etc/init.d/dhcp3-server restart

Next I configured inetd:

vi /etc/inetd.conf
tftp  dgram  udp  wait  root  /usr/sbin/in.tftpd -v -v -v -s /usr/lib/syslinux

Saved and restarted inetd

sudo /etc/init.d/openbsd-inetd

I then configured pxe with a config file that pxelinux.0 expects (your mac address will vary ofcourse) .

mkdir -p /usr/lib/syslinux/pxelinux.cfg
vi /usr/lib/syslinux/pxelinux.cfg/01-00-11-25-d6-ef-4b
DEFAULT t43firmware
LABEL t43firmware
        kernel memdisk
        append vga=normal initrd=flash/t43/70UJ29US.IMG --
PROMPT 1
TIMEOUT 0

Almost there. Next up, get the flash image ready

mkdir -p /usr/lib/syslinux/flash/t43
cd /usr/lib/syslinux/pxelinux.cfg
wget http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/70uj29us.exe

That got you an windows cabinetfile. Extract the firmware from that

cabextract -F 70UJ29US.IMG 70uj29us.exe
Extracting cabinet: 70uj29us.exe
  extracting 70UJ29US.IMG
All done, no errors.

I then powered up the T43. It booted over PXE

I pressed return and the flash program started:

I accepted the (many) warnings and disclaimers….. and

…. nothing happened! It just hung. I thought I had fried my newly aquired Thinkpad. I powered it off and on again just to see that it still worked, and that I was on the same BIOS level. Hmm, now what? It nearly worked, but still no cigar. I decided to take it one level further, doing it all by hand:

Mount the image file by hand using the loop driver:

sudo mkdir /floppy
sudo mkdir /floppy1
sudo mount -o loop /usr/lib/syslinux/flash/t43/70UJ29US.IMG /floppy

Get a standalone freedos boot image (called balder) from the nice guys at freedos.org:

cd /usr/lib/syslinux/flash/t43/
wget http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/\\
     unofficial/balder/balder10.img
sudo mount -o loop /usr/lib/syslinux/flash/t43/balder10.img /floppy1

Remove a lot of files from balder10.img and copy files over from the IBM flash disk.

sudo rm /floppy1/{display.exe,edit.exe,dosfsck.exe,zip.exe,unzip.exe,\\
                  defrag.exe,fdisk.exe,chkdsk.exe,cwsdpmi.exe,keyboard.sys,\\
                  format.exe,subst.exe,edit.hlp,country.sys,keybrd2.sys,\\
                  diskcopy.exe,edlin.exe,replace.exe,fdiskpt.ini,debug.com,\\
                  mode.com,shrdrv86.exe,xcopy.exe,move.exe,keyb.exe,tree.com,\\
                  fdisk.ini,diskcomp.com,ctmouse.exe,more.exe,shsucdx.com}
sudo cp /floppy/{\$0199000.fl1,06d*,chkbmp.exe,flash2.exe,lcreflsh.bat,logo.bat,\\
                 logo.scr,phlash16.exe,prepare.exe,prod.da*,qkflash.exe,\\
                 readme.txt,tpchks.exe,updtflsh.exe,updtmn.exe,userint.exe,\\
                 utilinfo.exe} /floppy1

# rename the flash file
sudo mv \$0199000.fl1 flash.img

# unmount floppy
sudo umount /floppy1/

Edit the pxe config file (your mac address will vary ofcourse) to use the balder/freedos image file instead of the Lenovo flash disk.

vi /usr/lib/syslinux/pxelinux.cfg/01-00-11-25-d6-ef-4b
DEFAULT t43firmware
LABEL t43firmware
        kernel memdisk
        append vga=normal initrd=flash/t43/balder10.img --
PROMPT 1
TIMEOUT 0

Reboot the T43 machine. Boot over PXE, single step (F8) the freedos start. Make sure you do NOT use EMS or HIMEM. After a brief period of time you should find yourself in an dos prompt, where you run

A:\phlash16.exe flash.img

The system should flash nicely and you should be all done within a minute:

Not for the faint of hearted, but I never promised that ;-)

Firewall in an ZynOS based xDSL router (ie. zyxel P660R-D1)

Tuesday, April 13th, 2010

I recently got xDSL from one of the major danish ISPs. I was very satisfied until I discovered that port 80 was closed. I looked high and low for a solution. Eventually I gave up and contacted the support, which confirmed my suspicion: the router had an firewall which blocked port 80.

The solution is actually quite straight forward:

wan node index 1
wan node filter incoming tcpip 256 256 256 256
wan node filter outgoing tcpip 256 256 256 256
wan node save

And now my blog is accessible for the outside world again.