Difference between revisions of "BIOS Upgrade/X Series"

From ThinkWiki
Jump to: navigation, search
(Change geocites urls to oocities which has all relevant files available.)
Line 32: Line 32:
 
My first idea was 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 like that. To circumvent this problem I tried to create a RAM disk, copy the needed files to this RAM disk, and then use this RAM disk as some kind of virtual CD drive. However, there were some problems with this approach as reported below. For a description of this old approach see the section "Approach 2: Load an USB driver, create RAM disk and copy the files to the RAM disk" below. I developed a new approach to solve this problem and will describe it here.
 
My first idea was 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 like that. To circumvent this problem I tried to create a RAM disk, copy the needed files to this RAM disk, and then use this RAM disk as some kind of virtual CD drive. However, there were some problems with this approach as reported below. For a description of this old approach see the section "Approach 2: Load an USB driver, create RAM disk and copy the files to the RAM disk" below. I developed a new approach to solve this problem and will describe it here.
  
The idea is to create a new bootable ISO image that is large enough to hold the original ISO file. This can be done by switching from the virtual floppy drive used by Lenovo's update disk to a virtual hard disk drive (for details, see the El Torito standard). Instead of loading the CD drive driver provided by Lenovo we load the [[http://www.geocities.com/jadoxa/shsucdx/index.html SHSUCD drivers]]. This driver enables us to create a virtual CD drive from Lenovo's original ISO file.
+
The idea is to create a new bootable ISO image that is large enough to hold the original ISO file. This can be done by switching from the virtual floppy drive used by Lenovo's update disk to a virtual hard disk drive (for details, see the El Torito standard). Instead of loading the CD drive driver provided by Lenovo we load the [[http://www.oocities.com/jadoxa/shsucdx/index.html SHSUCD drivers]]. This driver enables us to create a virtual CD drive from Lenovo's original ISO file.
  
 
I wrote a script to automate this steps and create a new ISO file from Lenovo's ISO file. This new ISO file can directly be used to update the BIOS. My script takes four arguments:
 
I wrote a script to automate this steps and create a new ISO file from Lenovo's ISO file. This new ISO file can directly be used to update the BIOS. My script takes four arguments:
Line 42: Line 42:
 
</ol>
 
</ol>
  
Both shsucdrd.exe and shsucdx.com can be downloaded from [http://www.geocities.com/jadoxa/shsucdx/index.html].
+
Both shsucdrd.exe and shsucdx.com can be downloaded from [http://www.oocities.com/jadoxa/shsucdx/index.html].
  
 
To sum up, an example call of the script would be <tt>convertlenovo.sh /home/selke/Desktop/7buj23uc.iso /home/selke/Desktop/out.iso /home/selke/Desktop/shsucdrd.exe /home/selke/Desktop/shsucdx.com</tt>
 
To sum up, an example call of the script would be <tt>convertlenovo.sh /home/selke/Desktop/7buj23uc.iso /home/selke/Desktop/out.iso /home/selke/Desktop/shsucdrd.exe /home/selke/Desktop/shsucdx.com</tt>

Revision as of 16:25, 23 September 2010

X Series Thinkpads do not have internal optical or floppy drives. 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. In recent times Lenovo provides BIOS updates in form of bootable CD images. Unfortunately, in most cases 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 files are that large, they do not fit on such a floppy image. To resolve it, you have to either use a large harddisk image for your bootimage (e.g. in X200, X200 Tablet and X301), or store these update files on the CD outside the virtual floppy image. For the former case, see BIOS update without optical disk. This page concerns with the later case.

To access the BIOS update files on the CD outside the bootimage, 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.

Another problem is that older X Series (like the X32) don't have bootable iso images at all. They have only two options: 1. update from Windows, 2. update using a diskette updater, which requires you to have a real floppy disk drive.

But there is hope. This page describes some approaches to solve the problems above.

Here is a brief overview of each approach:

Approach 1: Use larger boot image and create virtual CD drive

The CD images provided by Lenovo can be modified such that a BIOS update is possible -- without loading any drivers. I (Joachim Selke) successfully updated my Thinkpad X60s using the following method.

My first idea was 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 like that. To circumvent this problem I tried to create a RAM disk, copy the needed files to this RAM disk, and then use this RAM disk as some kind of virtual CD drive. However, there were some problems with this approach as reported below. For a description of this old approach see the section "Approach 2: Load an USB driver, create RAM disk and copy the files to the RAM disk" below. I developed a new approach to solve this problem and will describe it here.

The idea is to create a new bootable ISO image that is large enough to hold the original ISO file. This can be done by switching from the virtual floppy drive used by Lenovo's update disk to a virtual hard disk drive (for details, see the El Torito standard). Instead of loading the CD drive driver provided by Lenovo we load the [SHSUCD drivers]. This driver enables us to create a virtual CD drive from Lenovo's original ISO file.

I wrote a script to automate this steps and create a new ISO file from Lenovo's ISO file. This new ISO file can directly be used to update the BIOS. My script takes four arguments:

  1. the filename of Lenovo's original ISO file (e.g. /home/selke/Desktop/7buj23uc.iso)
  2. the filename of the new ISO file to be created (e.g. /home/selke/Desktop/out.iso)
  3. the location of shsucdrd.exe (e.g. /home/selke/Desktop/shsucdrd.exe
  4. the location of shsucdx.com (e.g. /home/selke/Desktop/shsucdx.com

Both shsucdrd.exe and shsucdx.com can be downloaded from [1].

To sum up, an example call of the script would be convertlenovo.sh /home/selke/Desktop/7buj23uc.iso /home/selke/Desktop/out.iso /home/selke/Desktop/shsucdrd.exe /home/selke/Desktop/shsucdx.com

Note that you need recent versions of the following tools:

  • mkdosfs (for Fedora users: contained in the package dosfstools)
  • mkisofs

The script runs perfectly on my Fedora 11 system (it should also run without problems on Fedora 7, 8, 9, 10 and other popular distributions). If there are problems, please tell me (Joachim Selke).

Further note that the script at some point requires you to enter the root password since it must mount a disk image. As far as I know, this cannot be done without root privileges.

What does the script do? I will give a short overview:

  1. Extract the boot floppy image from Lenovo's bootable ISO file.
  2. Create a new boot hard disk image and copy both the boot sector and the files from Lenovo's boot floppy image to the new image.
  3. Copy Lenovo's ISO image to the new hard disk image.
  4. Also copy the SHSUCD drivers to the hard disk and change autoexec.bat and config.sys accordingly. When booting this hard disk image a new virtual CD drive will be created by SHSUCD. This virtual CD drive will have Lenovo's original ISO disc "inserted."
  5. Create a new ISO file that only consists of the boot image given by the bootable hard disk image just created.

Some additional notes:

  • Currently, the script is not able to handle spaces in file names properly. Thus, the file names and directory path names used when calling the script should not contain spaces.
  • The file name of the original ISO file (7buj23uc.iso in the example above) must follow the DOS 8.3 file name conventions; otherwise SHSUCD will not be able to load the ISO image.

Here is the complete script (save it as convertlenovo.sh):

#!/bin/bash

# Written by Joachim Selke (mail@joachim-selke.de), 2007-12-28

# Known bugs:
# - spaces in file names make trouble at the moment (so try to avoid spaces),
#   I will fix that later
# - some users seem to have problems with some of the sed statements,
#   I currently have no idea what is wrong there ... (please report those bugs)

CDIMAGE=$1       # location of Lenovo's CD image
NEWCDIMAGE=$2    # filename of ISO file to create
SHSUCDRD_EXE=$3  # location of shsucdrd.exe
SHSUCDX_COM=$4   # location of shsucdx.com

MB_HDD=50  # HDD image size in megabyte (base 1000)

TMPDIR=`mktemp -d`
ISODIR=`mktemp -d`

HDDIMG=$ISODIR/hdd.img  # filename of HDD image to create
FLOPPYIMG=$TMPDIR/floppy.img # filename of floppy image to create

##############################################################################

# This script extracts the floopy boot image from bootable ISO images
#
# Written by Joachim Selke (mail@joachim-selke.de), 2007-04-07

ISOFILE=$CDIMAGE
IMAGEFILE=$FLOPPYIMG

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

##############################################################################

NO_HEA=16    # heads
NO_SECT=63   # sectors per cylinder/track
B_SECT=512   # bytes per sector

B_CYL=$(($NO_HEA * $NO_SECT * $B_SECT))  # bytes per cylinder/track

NO_CYL=$(($MB_HDD * 1000 * 1000 / $B_CYL))  # cylinders/tracks per head

echo -n -e "Cylinders: $NO_CYL\nHeads: $NO_HEA\nSectors per track: $NO_SECT\nBytes per sector: $B_SECT\n"

echo Creating empty image ...
dd if=/dev/zero of=$HDDIMG bs=$B_CYL count=$NO_CYL >/dev/null 2>&1

echo Creating partition structure ...
echo -n -e "o\n n\n p\n 1\n \n \n t\n 6\n a\n 1\n w\n" | /sbin/fdisk -b $B_SECT -C $NO_CYL -H $NO_HEA -S $NO_SECT $HDDIMG >/dev/null 2>&1

echo Writing master boot record ...
echo -n -e "\
\xFA\xB8\x00\x10\x8E\xD0\xBC\x00\xB0\xB8\x00\x00\x8E\xD8\x8E\xC0\
\xFB\xBE\x00\x7C\xBF\x00\x06\xB9\x00\x02\xF3\xA4\xEA\x21\x06\x00\
\x00\xBE\xBE\x07\x38\x04\x75\x0B\x83\xC6\x10\x81\xFE\xFE\x07\x75\
\xF3\xEB\x16\xB4\x02\xB0\x01\xBB\x00\x7C\xB2\x80\x8A\x74\x01\x8B\
\x4C\x02\xCD\x13\xEA\x00\x7C\x00\x00\xEB\xFE\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x52\xF9\x06\x00\x00\x00\
" | dd of=$HDDIMG bs=1 conv=notrunc >/dev/null 2>&1

echo Creating primary partition ...
# extract partition, create FAT16 filesystem and copy back
PARTFILE=${HDDIMG}-PARTITION
SECT_PARTTABLE=$NO_SECT
B_PARTTABLE=$(($SECT_PARTTABLE * $B_SECT))
dd if=$HDDIMG of=$PARTFILE bs=$B_SECT skip=$SECT_PARTTABLE >/dev/null 2>&1
/sbin/mkdosfs -F 16 -h $NO_SECT $PARTFILE
# Correct physical drive number (set to 0x00, should be 0x80)
echo -n -e "\x80" | dd of=$PARTFILE bs=1 seek=36 conv=notrunc >/dev/null 2>&1
# Correct sectors per track (set to 0x0020, should be $NO_SECT)
NO_SECT_HEX1=$(echo "ibase=10; obase=16; $(($NO_SECT / 256))" | bc)
NO_SECT_HEX2=$(echo "ibase=10; obase=16; $(($NO_SECT % 256))" | bc)
NO_SECT_HEX=$(echo -n -e "\\x$NO_SECT_HEX2\\x$NO_SECT_HEX1")
echo -n -e $NO_SECT_HEX | dd of=$PARTFILE bs=1 seek=24 conv=notrunc >/dev/null 2>&1
dd if=$PARTFILE of=$HDDIMG bs=$B_SECT seek=$SECT_PARTTABLE >/dev/null 2>&1
rm -f $PARTFILE

# transfer floppy boot sector code
B_BOOTSECPARAM=62                            # length of parameter block in boot sector
B_BOOTSECCODE=$(($B_SECT - B_BOOTSECPARAM))  # length of code block in boot sector
echo Copying boot sector ...
dd if=$FLOPPYIMG of=$HDDIMG bs=1 count=$B_BOOTSECCODE skip=$B_BOOTSECPARAM seek=$(($B_PARTTABLE + $B_BOOTSECPARAM)) conv=notrunc >/dev/null 2>&1

echo Copying DOS files ...
CDIMAGE_BASENAME=$(basename $CDIMAGE)
HDDDIR=$TMPDIR/hdd
FLOPPYDIR=$TMPDIR/floppy
su --command="\
  mkdir $HDDDIR;\
  mkdir $FLOPPYDIR;\
  mount -oloop $FLOPPYIMG $FLOPPYDIR;\
  mount -t msdos -oloop,offset=$(($SECT_PARTTABLE * $B_SECT)) $HDDIMG $HDDDIR;\
  cp --preserve $FLOPPYDIR/ibmbio.com $HDDDIR;\
  cp --preserve $FLOPPYDIR/ibmdos.com $HDDDIR;\
  cp --preserve -u $FLOPPYDIR/* $HDDDIR;\
  cp --preserve=timestamps $CDIMAGE $HDDDIR;\
  cp --preserve=timestamps $SHSUCDRD_EXE $HDDDIR;\
  cp --preserve=timestamps $SHSUCDX_COM $HDDDIR;\
  cat $FLOPPYDIR/config.sys | \
    sed -e 's/A:\\\/C:\\\/' | \
    grep -v IBMTPCD.SYS >$HDDDIR/config.sys;\
  cat $FLOPPYDIR/autoexec.bat | \
    sed -e 's/LOADHIGH MSCDEX.EXE \/D:TPCD001/shsucdrd.exe \/f:$CDIMAGE_BASENAME\r\nshsucdx.com \/d:SHSU-CDR,R/' >$HDDDIR/autoexec.bat;\
  umount $FLOPPYDIR;\
  umount $HDDDIR;\
  rm -rf $FLOPPYDIR;\
  rm -rf $HDDDIR"

echo Creating ISO image ...
mkisofs -input-charset default -hard-disk-boot -b $(basename $HDDIMG) -hide boot.cat -hide $(basename $HDDIMG) -o $NEWCDIMAGE $ISODIR

rm -rf $TMPDIR
rm -rf $ISODIR

echo Completed!

If you have any questions, feel free to ask. :-)

BTW: It would be much simpler if I simply could put the new ISO images for download somewhere. But I guess for legal reasons this will not be possible.

Comments on Approach 1

  • Reported to work on:
    • ThinkPad X60s (1702-55G) with Plextor PX-608CU USB DVD recorder
    • ThinkPad X60 (1702-55G) with Plextor PX-608CU USB DVD recorder, upgraded BIOS from version 2.14 to 2.16
    • ThinkPad X60 (1706-GMG) with Plextor PX-608CU USB DVD recorder, upgraded BIOS from version 2.03 to 2.14
    • ThinkPad X61s (7666-36G) with Freecom FS-50 USB DVD recorder, upgraded BIOS from version 1.10 to 2.07
    • ThinkPad X300 (6476-CTO) with Nu SBW-242US USB DVD recorder, upgraded BIOS from 1.05 to 1.08
    • Thinkpad X60s (1704-44U) with Lite-On DX-20A3H, upgraded BIOS from 2.17 to 2.18
    • ThinkPad X61s (7666-36G) with Samsung SE-S224 USB DVD recorder, upgraded BIOS from version 2.07 to 2.20

Approach 2: Load an USB driver, create RAM disk and copy the files to the RAM disk

I ( Joachim Selke) successfully updated my Thinkpad X60s using the following method.

My first idea was 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 like that. To circumvent this problem I tried to create a RAM disk, copy the needed files to this RAM disk, and then use this RAM disk as some kind of virtual CD drive. However, there were some problems with this approach as reported below.

  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 [2]). 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.


Comments on Approach 2

  • 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)
  • Flashing BIOS 2.14 works for me on a X60s (using drive c). 25-02-2008

Approach 3: 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.

Approach 4: 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 a new directory HPUSBF\ (using WinRAR, 7zip or similar).

5. Run the HPUSBFW.EXE utility, selecting the location of system files as C:\DriveKey\HPUSBF, and let it 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.

Comments on Approach 4

  • I (Martin Aulbach) followed these clear instructions and updated my X61t (from BIOS v1.08 to v1.10) without any problems and with a nice graphic splash screen. It is not necessary to let Windows format the USB stick as a MS-DOS startup disk, as outlined in Approach 3. The HP format tool will take care of this (in Step 5) and the USB stick will boot sucessfully at startup (correct boot order provided).
  • This update to BIOS 2.14 worked on a brand-new X61s, 2008-06-27. (adsmith)
  • This update to BIOS 2.19 worked on a X61 (76754KU), 2009-01-21. (leonardokroeger)

Approach 5: Free Alternative method to the above "alternative method"

This is functionally equivalent to the above two "alternative methods", yet does not depend on MS Windows or any other proprietary software. It updates the BIOS through a bootable USB stick, and depends upon the FreeDOS, SYSLINUX, and AdvanceMAME projects. A detailed description is provided at [3]. This method currently isn't redommended by the author "due to troubles reported by users (August 9th, 2008)".

Approach 6: Using a USB stick to upgrade BIOS on older X Series Thinkpads

This method has been successfully applied for upgrading an X32 Thinkpad. The previous BIOS version was 3.00d, and it was upgraded to 3.02 . Below are the steps:

1. Download the new BIOS and EC Diskette-type upgrades.

2. Make a DOS-bootable USB stick. See the section above for instructions on how to do this.

3. Copy the upgrade programs to the USB stick.

4. Make two zero-files (using dd), each with the size of a floppy disk.

5. Boot up the USB stick using QEMU, with the USB stick as hda, and the two floppy disk images as A: and B: .

6. Run the BIOS upgrade program, and select the first diskette as its destination. This will not actually upgrade the BIOS; it will only fill up the disk image.

7. Run the EC upgrade program, with the second diskette as target. Again, this will only fill up the disk image, not upgrade the EC.

8. Make two directories, C:\1 and C:\2 .

9. Copy the contents of the first diskette to C:\1 and the second diskette to C:\2 .

10. Exit QEMU, use the USB stick to boot the Thinkpad which BIOS we are going to upgrade.

11. cd into C:\1 and run command.com inside it. This will bring up the BIOS update interface, so update the BIOS.

12. After updating the BIOS, the machine will turn off by itself. Now boot again, with the same USB stick.

13. cd into C:\2 and run command.com inside it. This will bring up the EC update interface. Update the EC and wait for the machine to shut down completely.

14. Remove the USB stick. Now boot into the machine and go into BIOS setup. Right now you should see the new BIOS and EC version. If not, then something is wrong; make sure you have followed the above steps properly. Please also discuss this.

Approach 7: Use syslinux to boot floppy images which are part of the CD ISO files. Done with a X31 to upgrade the EC to version 1.08 and the BIOS to 3.02.

1. Download the CD ISO files of the embedded controller and the BIOS.

2. loop mount these files, check for files like 1quj08us.img (EC) and 1quj19us.img (BIOS) and copy them to /boot/

3. Install the syslinux package and boot the two images with the help of the memdisk feature ( grub: kernel /boot/memdisk initrd /boot/{ec|bios}.img)

Approach 8 : Use HP USB Format Utility and Win98Boot files to Create Bootable USB Stick

I have an X60s - and needed to upgrade BIOS from 1.09 (2006) to 2.18 (2009) to enable Intel virtualisation feature.

1. There is an HP utility tool floating around the net called HP USB Boot Utility. This can create a bootable USB stick using boot/system files you have.

e.g. See : http://blogs.oreilly.com/digitalmedia/2004/10/utility-to-make-usb-flash-driv.html

2. Get some DOS (or similar) boot files - I found something called "win98boot.zip" e.g.

http://www.bay-wolf.com/utility/usbkey/win98boot.zip

3. Extract the ISO BIOS image (e.g. WinRAR will do this)

4. Run the HP tool, select the USB device, I used FAT32, create a DOS bootable disk and point at the win98boot folder - then "Start". NOTE - this formats the USB stick!

5. Once complete (you could test it boots at this point), copy the extracted BIOS files to the stick e.g. inside new folder "bios"

6. Plug in to laptop and boot from stick. This takes ~2 mins and may (loudly) beep twice.

Once complete, I restarted and reset the BIOS, restarted, set the BIOS up and now all seems well.


Approach 8: Updating via "IBM Predesktop area", suitable for model X (not have CDROM and floppy)

It's so difficult to update BIOS and ECP without cdrom, floppy disk. Don't know the reason why I couldn't update BIOS and ECP(1QHJ08US and 1QUJ19US) for my IBM Thinkpad X31.Hmm, may be cause of the dividing partition on my hard disk, that is:

Primary: ext3, ext3, ntfs
Extended: Ntsf, fat32
Bootloader: GRUB

No problem, you can use this way to do it:

  • First, config in BIOS

In Security part:

  1. Remove all password of Supervisor and Power on password
  2. Set Access IBM Predesktop Area to Normal
  3. Choose Enable "Flash BIOS updating by End User" in BIOS update Option.

In Config part:

  1. Choose Enable for Network flash over Lan
  • Second, download the newest version of BIOS update and ECP update

Running: The program extract all files to the folder. There is a .img file (1QUJ19US.IMG, 1QUJ08US.IMG) in each folder. Copy the imformation content in that img file and paste it to one FAT partition(using winimage or TotalCmd to extract)


as seen All files in 1QUJ19US.IMG is extracted to D:\BIOS

695,764  $018E000.FL1
163      0691.HSH
2,049    0691.PAT
163      0694.HSH
2,049    0694.PAT
163      0695.HSH
2,049    0695.PAT
2,049    06D0.PAT
163      06D1.HSH
2,049    06D1.PAT
163      06D2.HSH
2,049    06D2.PAT
163      06D6.HSH
2,049    06D6.PAT
2,049    06D8.PAT
697      CHKBMP.EXE
8,128    COMMAND.COM
26       CONFIG.SYS
24,860   FLASH2.EXE
26       LCREFLSH.BAT
170      LOGO.BAT
330      LOGO.SCR
111,925  PHLASH16.EXE
91,648   PREPARE.EXE
45       PROD.DAT
22,252   QKFLASH.EXE
9,923    README.TXT
4,260    TPCHKS.EXE
39,666   UPDTFLSH.EXE
6,958    UPDTMN.EXE
12,501   USERINT.EXE
15,254   UTILINFO.EXE

And all files in 1QUJ08US.IMG are: D:\ECP

315,404 $018E000.FL2
8,000   COMMAND.COM
36      CONFIG.SYS
16,910  ECFLASH2.EXE
45      PROD.DAT
17,812  QKFLASH.EXE
990     README.TXT
4,260   TPCHKS.EXE
89,738  UPDTEC.EXE
31,134  UPDTFLSH.EXE
12,501  USERINT.EXE
15,226  UTILINFO.EXE
  • Okie, now plug AC Adapter, charge full battery to your laptop and continue third step:
    • Flash BIOS first,

1. Power On, press blue button on keyboard: Access IBM

2. On "Utilities", double click " Diagnostic disk"

3. Your laptop will start PC-DOS, wait when this message appear:

Please insert the first floppy diskette and
Press any key to continue

4. Press Ctrl + Break, you will see :

Terminate batch job (Y/N) ?

5. Okie, press Y, you will get DOS prompt like D:\

NOTE!
D:\ is my RAMDISK, C:\ is my disk format as FAT.!

6. Enter to c:\BIOS

c:
cd c:\BIOS

7. Run FLASH2.EXE /u $018E000.FL1

8. Wait flash progress compelete and reboot.

    • Flash ECP

Follow above instruction from step 1 to 5

6. Enter to c:\ECP

c:
cd c:\ECP

7. run UPDTFLSH.EXE $018E000.FL2

8. Follow UPDTFLSH's instructions

9. Wait flash complete and auto turn off computer.

I done it on my IBM Thinkpad X31.

Enjoy,

Tested by nm.

Approach 10: Booting the Lenovo ISO image using Grub and SysLinux

I ran this on my X100e L625 (Dual-Core) 3508-5EG.

Basically, you download the iso of the cd for bios upgrade from Lenovo and let grub + syslinux emulate a cd-rom drive for you, running the software on the iso.

It's nice and feels safe, since either the iso boots from grub or it doesn't, but if it does, you are running the full OS and update software stack as provided and tested by Lenovo. If it doesn't your bios will not be affected and you will not have bricked your laptop.

  • Download the latest bios upgrade from Lenovo website. I used version 1.25 (6xuj08uc.iso)
  • Get your hands on memdisk of syslinux. I had to compile a recent version, because my memdisk version that came with Ubuntu did not work correctly.
  • To compile a recent version of syslinux (I used 3.86):
  • Copy the memdisk file of syslinux to /boot/memdisk
  • Update the grub config file: add the code snippet below to the end of the file /boot/grub/grub.cfg. (on Ubuntu, add it to the file /etc/grub.d/40_custom instead, and do a $ sudo update-grub afterwards).
menuentry "Thinkpad x100e BIOS Upgrade to 1.25" {
       set root='(hd0,1)' # This line should match the other menuentries in your grub.cfg
       linux16 /boot/memdisk iso
       initrd16 /boot/6xuj08uc.iso # Make sure this is the correct filename (a different version will have a different filename)
}
  • Now reboot, press and hold shift right after the Thinkpad logo disappears and you should see an option in the grub boot menu to boot the bios upgrade cd.
  • Select that option and press enter, the Lenovo bios update software should boot, and you'll get a text-menu interface.
    • If you just see text on a black background and your Thinkpad no longer responds, your booting failed. At this point you are not updating the bios, so you can safely reboot using the power on/off button, recheck your config and find out what you did wrong.
  • If it does boot, follow the directions carefully:
    • Make absolutely sure you have power attached and a well loaded battery just in case
    • The process takes around a minute
    • When it asks to remove the cd and press enter to reboot, just press enter.
    • You should then reboot having and updated bios.