Difference between revisions of "BIOS Upgrade/X Series"

From ThinkWiki
Jump to: navigation, search
(Moved X series instructions to a new page)
 
(Added TOC)
Line 1: Line 1:
 +
__TOC__
 +
 
X Series Thinkpads do not have an internal drive. If there is no Windows installed, the BIOS must be updated by booting from an USB drive or a drive that is integrated in the docking station. Since a while Lenovo provides BIOS updates in form of bootable CD images. Unfortunately, these images are intended to be used with the docking station's CD drive. If you do not own such a drive, things get complicated.
 
X Series Thinkpads do not have an internal drive. If there is no Windows installed, the BIOS must be updated by booting from an USB drive or a drive that is integrated in the docking station. Since a while Lenovo provides BIOS updates in form of bootable CD images. Unfortunately, these images are intended to be used with the docking station's CD drive. If you do not own such a drive, things get complicated.
  

Revision as of 16:19, 11 November 2007

X Series Thinkpads do not have an internal drive. If there is no Windows installed, the BIOS must be updated by booting from an USB drive or a drive that is integrated in the docking station. Since a while Lenovo provides BIOS updates in form of bootable CD images. Unfortunately, these images are intended to be used with the docking station's CD drive. If you do not own such a drive, things get complicated.

The problem is that current BIOS updates are quite large, about 3 MB in size. Booting from CDs typically works like booting from a 1.44 MB or 2.88 MB floppy disk. The floppy image is stored on the CD and is referenced in the CD's boot record. Because the BIOS update file are that large, they do not fit on such a floppy image. Thus, they must be stored on the CD outside the virtual floppy image. To access these files a driver for the CD drive has to be loaded. Since Lenovo's CD images are intended to be used with a docking station's CD drive, it is not possible to use them for BIOS updates by booting from an USB CD drive.

But there is hope. The CD images provided by Lenovo can be modified such that they contain drivers for USB CD drives. I tested the following with a Thinkpad X60s.

The idea is to take Lenovo's ISO CD image and modify it such that a USB CD drive can be used instead the CD drive in the docking station. Unfortunately, simply replacing the drivers is not enough. While doing the BIOS update, the USB ports seem to get disabled or something. Therefore, before starting the update process the CD contents have to be copied to a RAM disk. I will describe the procedure step by step.

  1. Download the ISO image style BIOS update from Lenovo's website. This file will be refered to as /tmp/bios-lenovo.iso.
  2. Extract the floppy image from this ISO image. You can use the following shell script for this task (or an alternative one from [1]). Simply save this code into the file /tmp/extractbootimage.sh, set the x-flag (chmod +x /tmp/extractbootimage.sh) and call it using the command /tmp/extractbootimage.sh /tmp/bios-lenovo.iso /tmp/bios-lenovo.img. The floppy image contained in the ISO image will then be saved to /tmp/bios-lenovo.img. Here is the code of the shell script:
    #!/bin/bash
    
    # This script extracts the floopy boot image from bootable ISO images
    #
    # Written by Joachim Selke (mail@joachim-selke.de), 2007-04-07
    
    ISOFILE=$1
    IMAGEFILE=$2
    
    if [ ! -r $ISOFILE ]; then
            echo $ISOFILE: file does not exist or is not readable
            exit 1
    fi
    
    if [ -z $IMAGEFILE ]; then
            echo Error: no image file specified
            exit 1
    fi
    
    ISOFILESIZE=`stat -c %s $ISOFILE`
    
    # collect El Torito data
    # see http://www.phoenix.com/NR/rdonlyres/98D3219C-9CC9-4DF5-B496-A286D893E36A/0/specscdrom.pdf for reference
    
    BOOTCATALOGPOINTERBYTE=$((17 * 0x800 + 0x47))
    
    if [ $ISOFILESIZE -lt $(($BOOTCATALOGPOINTERBYTE + 4)) ]; then
            echo ISO file is too short, possibly damaged
            exit 1
    fi
    
    # absolute pointer to first sector of boot catalog:
    BOOTCATALOG=`od -A n -t x4 -N 4 -j $BOOTCATALOGPOINTERBYTE $ISOFILE | tr -d [:blank:]`
    
    BOOTCATALOGBYTE=$((0x$BOOTCATALOG * 0x800))
    
    echo Boot catalog starts at byte $BOOTCATALOGBYTE
    
    if [ $ISOFILESIZE -lt $(($BOOTCATALOGBYTE + 32 + 2)) ]; then
            echo ISO file is too short, possibly damaged
            exit 1
    fi
    
    # media type of boot image
    # only floppy disk images are supported by this script
    BOOTMEDIATYPE=`od -A n -t x1 -N 1 -j $(($BOOTCATALOGBYTE + 32 + 1)) $ISOFILE | tr -d [:blank:]`
    
    if [ $BOOTMEDIATYPE -eq 1 ]; then
            echo Boot media type is 1.2M floppy disk
            IMAGEBLOCKS=$((1200 / 2))
    elif [ $BOOTMEDIATYPE -eq 2 ]; then
            echo Boot media type is 1.44M floppy disk
            IMAGEBLOCKS=$((1440 / 2))
    elif [ $BOOTMEDIATYPE -eq 3 ]; then
            echo Boot media type is 2.88M floppy disk
            IMAGEBLOCKS=$((2880 / 2))
    else
            echo Boot media type is $((0x$BOOTMEDIATYPE)). This type is not supported yet.
            exit 1
    fi
    
    # absolute pointer to start of boot image
    BOOTIMAGE=`od -A n -t x4 -N 4 -j $(($BOOTCATALOGBYTE + 32 + 8)) $ISOFILE | tr -d [:blank:]`
    
    BOOTIMAGEBYTE=$((0x$BOOTIMAGE * 0x800))
    
    echo Boot image starts at byte $BOOTIMAGEBYTE
    
    if [ $ISOFILESIZE -lt $((0x$BOOTIMAGE * 0x800 + $IMAGEBLOCKS * 0x800)) ]; then
            echo ISO file is too short, possibly damaged
            exit 1
    fi
    
    echo Extracting boot image ...
    
    dd if=$ISOFILE of=$IMAGEFILE bs=2K count=$IMAGEBLOCKS skip=$((0x$BOOTIMAGE))
    
    echo Finished
    
  3. Mount the floppy image as root using the loop device:
    # mkdir /tmp/bios-lenovo.img-mnt
    # mount -o loop /tmp/bios-lenovo.img /tmp/bios-lenovo.img-mnt
    The image is now mounted as /tmp/bios-lenovo.img-mnt.
  4. Download needed drivers. First download some USB drivers from Panasonic Japan. Save the file to /tmp/f2h_usb.exe This file is a self-extracting EXE file, that can be executed under Linux using Wine:
    $ wine /tmp/f2h_usb.exe
    You will be asked where to save the extracted files. Choose /tmp. A new directory /tmp/F2h containing the needed drivers will be created. Additionally, you will need drivers for the RAM disk mentioned. Download them from the ReSizeable RAMDisk project. Unzip them to /tmp/srdisk.
  5. Let's modify the floppy image:
    $ cp /tmp/F2h/Usbaspi.sys /tmp/bios-lenovo.img-mnt/
    $ cp /tmp/F2h/USBCD.SYS /tmp/bios-lenovo.img-mnt/
    $ cp /tmp/F2h/RAMFD.SYS /tmp/bios-lenovo.img-mnt/
    $ cp /tmp/srdisk/srdxms.sys /tmp/bios-lenovo.img-mnt/
    $ cp /tmp/srdisk/srdisk.exe /tmp/bios-lenovo.img-mnt/
    Now add the following lines to /tmp/bios-lenovo.img-mnt/config.sys replacing the line DEVICE = A:\IBMTPCD.SYS /R /C:
    DEVICE = A:\SRDXMS.SYS
    DEVICE = A:\RAMFD.SYS
    DEVICE = A:\USBASPI.SYS /V
    DEVICE = A:\USBCD.SYS /D:TPCD001
    

    Finally, edit the file /tmp/bios-lenovo.img-mnt/autoexec.bat replacing the last line (saying COMMAND.COM) by the following:

    A:\SRDISK 10000
    COPY *.* D:
    D:
    COMMAND.COM
    

    Maybe the RAM disk gets a drive letter different from D: on your system. In this case, you have to change the above lines accordingly.

  6. Unmount the floppy image (as root):
    # umount /tmp/bios-lenovo.img-mnt
  7. Copy the content of the original CD image to a new directory and create a new ISO file:
    # mkdir /tmp/bios-lenovo.iso-mnt
    # mount -o loop /tmp/bios-lenovo.iso /tmp/bios-lenovo.iso-mnt
    $ mkdir /tmp/bios-new.iso-mnt
    $ cp /tmp/bios-lenovo.iso-mnt/* /tmp/bios-new.iso-mnt
    $ cp /tmp/bios-lenovo.img /tmp/bios-new.iso-mnt/boot.img
    # umount /tmp/bios-lenovo.iso-mnt
    $ mkisofs -relaxed-filenames -b boot.img -o /tmp/bios-new.iso /tmp/bios-new.iso-mnt/
  8. The file /tmp/bios-new.iso is the modified ISO file. Just burn it to CD and use this CD for updating your BIOS (boot from it using your USB drive). Please give some comments here if it worked for you.

Alternative method using a USB stick

Note: none of the above methods worked on my X60s. This method worked for me, however. PhilipPaeps 16:41, 24 August 2007 (UTC)

This method was surprisingly painless once I convinced my ThinkPad X60s to boot DOS from a USB stick. I used VMWare and some mystical tool to get DOS on the stick. If you can find another way to get a bootable DOS stick, please update this section!

  • Tell VMWare to create a virtual floppy image for you and format it under Microsoft Windows and tell it to create a system disk. You can do this by clicking into "My Computer", then right-clicking on the "Floppy" icon and selecting "Format". In the box that pops up, you need to check the box that says "Create an MS-DOS startup disk" and then click "Start".
  • In a command prompt again: C:\DriveKey\HPUSBF.EXE E: -Q -B:A:\, replacing the E: with the "drive letter" associated with your USB stick (you can find this letter in "My Computer" under "Removable Storage"). WARNING: this wipes anything on the USB stick. You will end up with a USB stick which appears empty at this point, but there is DOS on it somewhere.
  • Now mount the BIOS update ISO image from Lenovo as a virtual CDROM using VMWare again and copy the files from it to the USB stick: copy D:\*.* E:\.

At this point, you may want to fiddle with the splash image, as described elsewhere on ThinkWiki.

  • Reboot and press F12, tell the BIOS to boot from your USB stick.
  • cd flash ; updtflsh.exe

Think happy thoughts. The ThinkPad will beep quite ominously (and loudly!) a couple of times. Do not let this worry you too much. After about three minutes, the program will ask you to press enter to restart and hopefully all will be well.

Comments

  • I have followed your excellent instructions. The CD booted, the update program ran but stopped working and responding while updating. Luckily the BIOS was not destroyed. Since destroying the BIOS is a very high risk, I am going to recover the original Windows on an old HD and will run the update exe update program from there.
  • I followed these clear instructions, and like the comment above I ended up with a CD that booted but the update program stopped working and responding. An ALT-CTRL-DELETE rebooted my x60s, and it works so the BIOS must not have been damaged. I was trying to upgrade from version 2.08 to 2.11, I wonder if these instructions are somehow particular to certain versions? Latch 01:22, 14 June 2007 (UTC)
  • After following the above instructions, the program also stopped working while updating the BIOS. But after changing the drive letter from D: to C: (see code below), it everything worked fine. However, I had some trouble figuring out, which letter to choose over D: at first, as the BIOS Upgrade program started right away.
    A:\SRDISK 10000
    COPY *.* C:
    C:
    COMMAND.COM
    

    Mtx, 1 August 2007, Thinkpad X61s

  • Flashing the bios (2.12) works for me on a X60s (using drive c). Using the DVD-R on an USB-Hub did not work.
    Ra 00:15, 21 August 2007 (UTC)

Alternative method to the above "alternative method"

This is based on the above "Alternative Method" and works on my X60.

1. Download the BIOS Update iso image and the USB Stick Formatter.

2. Now get access to Windows -- be it in an emulator, or a colleague's PC. Steps 3, 4, 5 needs Windows to complete.

3. Install the HP USB Stick Formatter.

4. Go to the directory where you installed the tool: e.g. C:\DriveKey and extract HPUSBF.EXE to HPUSBF\ (using WinRAR).

5. Run the HPUSBFW utility, selecting the location of system files as C:\DriveKey\HPUSBF, and format the USB stick.

6. Extract the iso image to the USB stick, for example to K:\7buj22us (K: being the USB stick).

7. On the target computer, boot with the USB stick and issue the commands "cd 7buj22us" then "command.com"

This brings up the BIOS flash interface and you can update your BIOS from here.