Linux Remote-Boot mini-HOWTO: Configuring Remote-Boot Workstations with Red-Hat Linux, DOS, Windows 3.1 and Windows 95: TCP/IP Bootprom Related Utilities

prev-9102654 next-4497395 toc-1670458

This section gives some informations on the use of the utilities we wrote for use with the TCP/IP Bootprom.

4.1 MENUEDIT

This is a program running under DOS, for editing menu scripts usable with the TCP/IP Bootprom. It is very basic, but is still much more comfortable to use than the menu scripts themselves. You can get online-help by depressing the F1 key. If you want to enhance it (for instancing adding cut-and-paste), I would be happy to publish your new version.

Pascal source code is available here.

4.2 BPHDBOOT

This boot image will load the hard-disk master boot record and jump into it.

This boot image is particularly convenient to use when configuring an operating system that wants you to reboot before it finalizes its configuration. It can also be used on computers for which you do not want to impose a hard-disk cleanup at any time but you still want to be able to do it whenever needed.

Assembler source code is available here.

4.3 BPCLEAN

This boot image rewrite the hard-disk master boot record, including the hard-disk partition table. Moreover, it can quick-format a DOS (FAT16) data partition (but cannot make it bootable). For copyright reasons, we had to program our own master boot record and FAT16 boot sector. They should behave more or less like the standard implementation, except that some messages have been adapted for the context of remote-boot computers. In order to have this program work, you might need to disable the BIOS master boot record protection (which is anyway not any more necessary since it will be refreshed at each boot).

This program downloads the partition table description file with the same basename as itself and the .tab extension. This file can contains empty lines, comments beginning with a sharp but should never exceed 512 characters.

The first four non-blank non-commented lines should contain the discription for the four hard disk partitions. The fifth non-blank non-commented line should contain the name of the next boot image to load.

Partition description lines are made of several space- or tab-separated fields, and must be in one of the following three forms:


type  boot?  1st-cyl  1st-head  1st-sect  last-cyl  last-head  last-sect
type  boot?  1st-cyl  1st-head  1st-sect  relative-size
type  boot?  relative-size
  • In the first form, the file give the precise geometry of the partition.
  • In the second form, the first sector position is given but the end of the partition is automatically calculated on the basis of the requested partition size.
  • In the third form, the first sector is automatically deduced from the end of the previous partition and the end of the partition is automatically calculated on the basis of the requested partition size. This form is totally independant of the hard-disk geometry.

Every number is assumed to be in decimal form, except when prefixed with a dollard, in which case it is assumed to be an hexadecimal number.

  • The type of a partition is 4 for DOS partitions under 32Mb, and 6 for DOS partitions from 32Mb to 500Mb. Many other values can be found using Linux fdisk help for instance.
  • The boot? field should be Y for the boot partition and N for all other partitions. This flag is used by the master boot record.
  • The 1st-cyl, 1st-head and 1st-sect are the absolute coordinates of the first sector of the partition. Do not forget that while cylinders and heads are numbered starting from 0, sectors are numbered starting from 1.
  • The last-cyl, last-head and last-sect are the absolute coordinates of the last sector of the partition. Partition usually end on a cylinder boundary.
  • The relative-size of a partition takes can be expressed in the following ways:
    • + 10 Mb which means that the partition should be at least 10 Mb (ie. 2048 sectors) big;
    • - 100 Mb which means that the partition should leave at least 100 Mb (ie. 20480 sectors) free for the next partitions;
    • + 30 % which means that the partition should occupy at least 30 percent of the space available at this point;
    • - 70 % which means that the partition shouls leave at least 70 percent of the space available at this point for the next partitions.

    Partitions defined by their relative size always end on a cylinder boundary, and unless the first sector position is precised, start after a head boundary. To our knowledge, this is conform to the standard usage.

Whenever a label is appended at the end of a partition description line, the corresponding partition is formatted as a DOS FAT16 partition, whatever its type. This is compatible both with partition types 4 and 6, and is particularely usefull for cleaning a DOS partition on a student computer for instance. Such quick-format only takes some tenths of a second.

By default, bpclean is compiled with support for LBA (no more than 1024 cylinders, and up to 256 heads). Some strange BIOSes and some strange OSes prefer the so-called NORMAL mode (up to 4096 cylinders, but no more than 64 heads); if you need it, comment the LBA definition in the source code and recompile it.

Assembler source code is available here.

4.4 MRZIP, MRUNZIP and BPUNZIP

MrZip is a DOS program that can build a compressed raw image of a DOS FAT16 partition. It first analyses the disk usage in order to process only used data bytes, and then uses a very fast (but not very efficient) statistical compression algorithm to compress the data. Windows 95 long filenames are supported, and files with the .SWP extension are not saved. Several magic numbers are included between the various parts of the archive, and a checksum is computed on the original data. The checksum is stored as the low-order word of the volume serial number in the archive, while the high-order word is simply incremented. If you zero the serial number of your hard-disk before building the compressed image, you can then use this number to track the number of updates to your image.

Since MrZip uses direct disk access, it recommended that you flush any disk write cache before you run it. Windows 95 seems to handle direct disk access consistently.

MrUnzip is a DOS program that can expand a compressed disk image to the hard-disk, using direct disk access. Do not use it in conjunction with any cache program, as it is already sufficiently afflicting for the DOS itself… Anyway, it can be very helpfull if you you want to fix a boot image that cannot boot anymore for instance.

BpUnzip is a boot image that manage compressed hard disk images. Roughly, it will boot from the hard disk image with the same base name, with the extension .imz.

It first read the partition table and look for

  • the first DOS partition, where the disk image should be restored
  • the last cylinder allocated for a partition, after which the compressed hard disk images will be stored.

It then read the first sector of the first unused cylinder and see if there is already an image table. If it is not the case, or if the image table contains some inconsistency, or if both shift keys are depressed (a special general-cleaning signal), the image table is cleared.

If the image table does not already contains the requested image, it is loaded using TFTP and added to the image table. If there is not enough space after previously loaded images for the new one, old images are discarded. If the image was already present in the image table, the most recent image boot sector (including the checksum) is loaded by TFTP and compared against the available image. If they are not exactly the same, the compressed image is reloaded.

The image is then uncompressed, all magic numbers are verified, and the checksum is computed on the decompressed data. If the decompression fails, or if the checksum does not match the value included in the most recent boot sector, the image is assumed to be corrupted and is reloaded. Otherwise, the program gives the control to the boot sector, and the operating system is started.

If bpunzip was loaded with a .P extension (for instance as win95.P), it is assumed that the TFTP server has an extended interface on port 59 (in addition to the regular interface on port 69). BpUnzip will then use it for loading the image using bigger packets, typically 1408 bytes instead of 512 bytes per packet (this convention for using triggering the use of big packets is very similar to that used by the TCP/IP Bootprom).

Similarly, if bpunzip was loaded with a .G extension (for instance as win95.GP), it will first download a GIF file with the same basename (for instance win95.gif) and display it on the screen during the whole operation. The program works only in 800×600, 256 color mode (although the GIF file can be smaller and use less colors). If your video adapter is not VESA compatible, this feature is not available to you. Note than the last 16 colors of the palette are used to display the progress bar banner. Either do not use them, or expect them to be incorrect. By the way, if you don’t like our progress bar banner, feel free to change it (in GIFDATA.ASM), but please leave our names visible somewhere.

The target partition does not have to be exactly of the same size as the original one; it just have to be big enough to hold the clusters from the beginning of the partition to the last used cluster. If the destination partition is smaller than the original partition, the FAT will be shrinked accordingly (but not the cluster size). If the the destination partition is bigger than the original partition, the FAT will be expanded as much as possible. However, if the destination partition is much bigger than the original, it is likely that 65518 clusters will not be enough to cover all space (since the cluster size cannot be adapted). In this case, bpunzip will issue a warning telling that some space is lost.

By default, bpunzip is compiled with support for LBA (no more than 1024 cylinders, and up to 256 heads). Some strange BIOSes and some strange OSes prefer the so-called NORMAL mode (up to 4096 cylinders, but no more than 64 heads); if you need it, comment the LBA definition in the source code and recompile it.

Assembler source code is available here.

You might encounter problems with Solaris 2.5 TFTP server when dealing with images bigger than 16 Megabytes. This is because it cannot handle more than 32768 packets per file. This is a known bug, for which SUN currently provides no fix. We suggest using the more efficient extended TFTP server (also provided for other OS on your TCP/IP Bootprom utility disk).

4.5 NOBREAK

Nobreak.sys is a very small (about 350 bytes only) driver that you include at the beginning of your config.sys. Its goal is to secure the boot process, until the user is logged in. DOS provides a setting for this (namely BREAK=OFF), but it is not drastic enough, and has almost no effect in the autoexec.bat. Our driver works by modifying the scan-code of the key pressed when a break is requested, directly at the BIOS level. This way, no program at all can receive a break until break is enabled again.

The driver must be loaded from the config.sys (or using the devlod program from Undocumented DOS). Afterwards, break can be enabled by sending Yes to the NOBRK pseudo-device, and disabled again by sending No (in fact, only the first character, Y or N is significant).

As this driver relies on the BIOS, it does only work for DOS and Windows 3.1. Windows 95 has its own low-level keyboard handling routines.

Assembler source code is available here.

prev-9102654 next-4497395 toc-1670458

READ  More 2 Cent Tips & Tricks LG #37