This explains how to get FreeDOS working with TCP/IP and ssh.

The Problem

Sometimes, it is necessary to flash the BIOS, the IPMI card or to set the BIOS. For some motherboards it can be done in the running system, using, e.g., /dev/nvram . The trouble starts, if the NVRAM is bigger than 256 Byte and one has to fall back to DOS-tools, delivered by the vendor. This page explains, how a DOS image can be created. It describes the used tools and how does the DOS environment communicates with FAI.

Create a bootable dos image

  1. Go to http://www.freedos.org/ and download an installation-cd image and burn it onto a cd
  2. Install freedos on a box. We tried it on
    1. a Single-Dual Core Opteron 2218
      1. with a Supermicro H8SSL-i2 board
      2. and WD 1600YS SATA hd's
    2. a Single-Dual Core Xeon 3060
      1. with a Supermicro PDSML-LN2 board
      2. and WD 1600YS SATA hd's
    3. We have not been able to install freedos on a box with a Fujitsu Simens D2461-A2 board.
  3. Create a dos partition which starts from the first sector using the dos fdisk tool and format it with fat16. Make this image not to big, since it has to go with pxeboot over the net. We toke approximately 32M.
  4. install a basic dos environment with mbr writing tools (smbtmgrx) and other programs you consider to be useful.
  5. Reboot the box and go into the dos environment, start mbr writing tools.
  6. Reboot again using liveCD Linux system (Knoppix).
  7. Copy the first 63+N blocks of the hd into a file dd if=/dev/sda of=hd.img bs=512 count=63.
  8. Copy the the complete dos partition into another file dd if=/dev/sda1 of=dos.img bs=512.
  9. Combine the files dd if=dos.img of=hd.img bs=512 seek=63 and copy hd.img onto the tftp server.

Modify the Image

The idea is to mount the image to put different tools on there. Unfortunately, the image we just created has an MBR, which mount complains about. To find out at which block the partition starts, you can search for the ASCII-string "FRDOS4", which indicates the beginning of a dos partition. In our case the image starts after the fitst sector. One can mount the image by skipping it:

mount  -o loop,blocksize=512,offset=32256 boot.img /tmp/Dos_Mount

Copy the needed files into the mounted path.

Fill the dos partition with the tools and drivers you need. For us, this was basically:

A little Bash script does this automatically:

 #!/bin/bash
 
 input_dir="/root/Dos/IMAGE"
 old_image="boot.old_image"
 output="boot.img"
 base="/srv/tftp/fai/kernel/Dos_images"
 bs="512";
 offset="63";
 
 if ! [ -x "${base}/mount" ]; then
         mkdir ${base}/mount
 fi
 
 cd $base
 echo '* Making disk mountable ...'
 dd if=boot.old_image of=mountable bs=$bs skip=$offset &> /dev/null
 mount -o loop mountable mount
 rm -rf mount/*
 cp -a $input_dir/* $base/mount
 umount mount
 rm -rf mount
 
 cp $old_image $output
 echo '* Writing MBR ...'
 dd if=mountable of=$output bs=$bs seek=$offset &> /dev/null
 echo Done
 rm mountable

Booting the dos image

Assuming you use pxelinux, you can put this in the appropriate config file for the boot start:

 default fai-generated
 
 label fai-generated
 kernel kernel/memdisk
 append initrd=path/to/dos.img

After that, you should be able to boot into the dos image and see all the tools you have put there. Next, you need to load the appropriate network drivers.

tools

For the different tasks one has to collect the tools, which one gets either from the vendor or which are present on other DOS-disk-images.

The autoexec.bat is calling the payload.bat which can be modified to add other tools.

flashing the BIOS

The payload.bat calls the bios.bat which, basically, we took from the autoexec.bat of an ordinary DOS disk with flashes the BIOS.

flashing the IPMI card

The payload.bat calls the ipmi.bat which, basically, we took from the autoexec.bat of an ordinary DOS disk with flashes the IPMI cards.

Networking

Another important task was to enable ssh from within the dos environment. Although we ran into a couple of issues, we found that both Broadcom and Intel Pro 100/1000 had pretty good drivers available for dos. For the Intel card, we had to download the newest driver from the Intel page. The file you get there is a self-extracting archive, so we had to use wine to get the files out of there. After that, we put it in our image and added a start.bat to the directory:

 lsl.com 
 E1000odi.com 
 odipkt.com 0 96

DocumentationForm edit

Title How to get FreeDOS working with TCP/IP and ssh.
Description This page explains how to get FreeDOS working with TCP/IP and ssh.
Tags dos tcp/ip ssh
Category Admin
Topic revision: r4 - 10 Feb 2012, ArthurVarkentin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback