Tuesday, 7 June 2016

Adding Lenovo Maintenance Utilities (IBM DOS-based) to E2B

Some Lenovo (ex-IBM) maintenance utilities make an IBM-DOS bootable USB flash drive.

These USB flash drives are formatted with a FAT12 volume which boots to IBM DR-DOS via IBMBIO.com. Typically, they are in floppy diskette format (i.e. no partition table).

Under grub4dos, it is possible to boot from a FAT12 drive using:
chainloader --pcdos /ibmbio.com
However, if you convert the Lenovo USB flash drive to a FAT32 .imgPTN file and try to boot from it using E2B, you will find that it does not boot. The reason for this is that, unfortunately, IBM DR-DOS does not seem to boot from a FAT32 volume.

The IBM DOS boot chain is:

IBMBIO.COM -> IBMDOS.COM -> COMMAND.COM

We can fix this by using FreeDOS boot files in the .imgPTN partition image or by making an image .IMA file...



Method 1 - Use only FreeDOS (.imgPTN)

This method is the easiest to implement and assumes you already have a bootable IBM DOS-based USB flash drive with the DOS utilities on it.

1.1 Download RMPrepUSB and find the FREEDOS_USB_BOOT folder (e.g. run RMPrepUSB and press F3).

1.2 Now copy these two files from the FREEDOS_USB_BOOT folder to the root of your IBM USB flash drive:
  • \KERNEL.SYS
  • \COMFREE.COM

1.3 Drag-and-drop the Lenovo USB drive's letter\icon in Windows Explorer onto the MPI_FAT32 Desktop shortcut (you need to install the MPI Tool Kit first), and make a xxxx.imgPTN file.

The boot chain is now:

KERNEL.SYS -> COMFREE.COM -> COMMAND.COM

Method 2 - Use FreeDOS+IBM DOS (.imgPTN)

This method is will boot to IBM DOS by using the FreeDOS kernel and is more compatible as it will be running IBM DR-DOS instead of FreeDOS. It assumes you already have a bootable IBM DOS-based USB flash drive with the DOS utilities on it.

2.1 Download RMPrepUSB and find the FREEDOS_USB_BOOT folder (e.g. run RMPrepUSB and press F3).

2.2 Now copy the KERNEL.SYS file from the FREEDOS_USB_BOOT folder to the root of your IBM USB flash drive:

  • \KERNEL.SYS

2.3 Rename IBMDOS.COM to COMFREE.COM

2.4 Drag-and-drop the IBM USB drive letter\icon in Windows Explorer onto the MPI_FAT32 Desktop shortcut (you need to install the MPI Tool Kit first), and make a xxxx.imgPTN file.

The boot chain is now:

KERNEL.SYS -> IBMDOS.COM (renamed) -> COMMAND.COM





Method 3 - Make a .IMA image file

The Lenovo utility actually made a floppy disk volume on the USB flash drive.
So, we can make a .IMA floppy disk image file from the USB drive.

1. Find the size of the volume by using Windows Explorer:

In my case it was 31.8MB

2. Run RMPrepUSB - Drive -> File and answer the prompts (select the Lenovo drive):
  • Output Filename - e.g. C:\temp\Lenovo.ima
  • Start - 0
  • End - e.g. 32MB  (change as required)
  • File Start - 0
3. When the Lenovo.ima file has been made, copy it to your E2B USB drive (e.g. \_ISO\UTILITIES or \_ISO\DOS).

Note: if you change the file extension to .imarw then it will be writable and any changes made will be permanent (i.e. like booting from a rd/wr disk).

Compress the .IMA image (optional)

The Lenovo.ima file was 32MB in size (in my case), however we can compress this to just 389KB as follows:

1. Load the Lenovo.ima file into WinImage and select Image - Defragment current image. Then click File - Save to re-save the image. This removes any random data in the unused sectors inside the image so that we can achieve better compression.

2. Drag-and-drop the Lenovo.ima file onto the \_ISO\docs\E2B Utilities\LZMA\LZMA_Encode.cmd file to compress the file.


The xxxx.ima.orig backup file can be deleted, if one was made by the script.

Note: The .ima file does not actually need to be contiguous, but E2B may complain if it is not contiguous!