DosBoot

From FAIWiki
Jump to: navigation, search

Contents

Abstract

If one gets hardware it might be necessary to flash firmware or to set the CMOS or NVRAM. Many vendors offer only DOS tools to perform these tasks - often incorporated in floppy images. This page describes how to setup up a generic DOS image containing all these tools and establish an automatic procedure for the installation.

Problem

If no user interaction is required one can boot floppy images using pxeboot. This has some drawbacks:

  • sometimes one needs more the one floopy image, since one image provides not enough space for all tools and settings
  • the pxe-server does not know whether a floppy image successfully went through

The second point is crucial, since it is not clear when the FAI installation can be started. One certainly wants to finish the firmware upgrade first.

Solution

The first point can be solved by generating a sufficiently large DOS image and populate it with all tools and firmware images. For the second issue one needs to install a TCP/IP stack for DOS together with ssh2dos. This allows a remote access onto the FAI server. This provides the possibility to change the pxe-config using, e.g., fai-chboot. You configure the BIOS of one machine and do the setup automatically on all other machines.

Recipe

Create a bootable dos image

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

Modify the image

Mount the image and to put the desired tools onto there. Unfortunately, the image we just created has an MBR, which mount complains about. The dos partition starts on block 64. If you want to find out at which block the partition starts search for the ASCII-string "FRDOS4", which indicates the beginning of a DOS partition. The easiest way to mount the DOS partition is mount -o loop,blocksize=512,offset=32256 hd.img /mnt/dos Copy the needed files into the mounted path.

Software and tools

Fill the DOS partition with the tools and drivers you need. We used:

Boot the dos image

Install the package 'syslinux-common'. Edit pxelinux configuration file for a node /srv/tftp/fai/pxelinux.cfg/HEXIPADDRESS':

default dos-boot
label dos-boot
kernel kernel/memdisk
append initrd=path/to/hd.img

Initial setup

  • Configure the BIOS on your sample machine according to you needs (you must not forget to enable netboot)
  • You should be able to boot into the dos image and see all the tools you placed there.
  • You need to load the appropriate network drivers. See the WATT-32 manuals.
  • Search for the BIOS flash tools and NVRAM/CMOS reading and writing tools, ask the vendor of your hardware. Copy it into the DOS image.
  • The ssh client works with a key - you avoid the passwd prompt. Put the key on the DOS image. You need to copy the freshly created NVRAM and CMOS images onto some remote server.

Later you put this BIOS image and the NVRAM/CMOS images into the DOS image. The client (running with the PXE-booted DOS image) must be able to ssh onto the FAI server to change the pxelinux.cfg files. This launches the FAI installation after a reboot.

  • reboot

Automation

Edit the autoexec.bat and modify it in such a way that all flashings and setting are done automatically.

@ECHO OFF 
SET dosdir=C:\FDOS
SET PATH=%dosdir%\bin;\b57;\PRO1000;\tools;\ssh;\watt32;\nicscan;\gnu\bin\;\IPMI;BIOS\DSML8277
SET HELPPATH=%dosdir%\HELP
SET temp=%dosdir%\temp
SET tmp=%dosdir%\temp
SET BLASTER=A220 I5 D1 H5 P330
REM ShsuCDhd /QQ /F:C:\FDBOOTCD.ISO
SET autofile=C:\autoexec.bat
alias halt=poweroff
SET CFGFILE=C:\fdconfig.sys
alias reboot=coldboot
REM Uncoment the network part if it really works
REM CALL b57\start.bat
PUSHD "C:\PRO1000"
CALL start.bat
POPD
REM find out ip address from dhcp and save it in MY_IP
REM ping is used to force a dhcp request
call tcpinfo > %TMP%\tcpinfo.log
rem CALL ping.exe 10.20.40.1
if not exist payload.bat goto :done
ECHO Start payload 
call payload.bat
:done


The payload.bat could look like:

@ECHO OFF
call bios.bat
call ipmi.bat
call neupdate.bat
call hd_dg.bat 
call finish.bat


The finish.bat does the communication with the FAI server:

REM we need the IP address of the FAI server which is most likely the DHCP server 
grep "DHCP.SERVER" %temp%\W32DHCP.TMP| cut -d " " -f 5 > %temp%\fai_ip.tmp
grep "MY_IP" %temp%\W32DHCP.TMP| cut -d " " -f 6 > %temp%\my_ip.tmp
SET /E FAI=cat %temp%\fai_ip.tmp
SET /E MY_IP=cat %temp%\my_ip.tmp
ssh2dos -i C:location_of_the_sshkey user %FAI% "faiboot_script_using_the clients_IP %MY_IP%" 
coldboot
Personal tools
Namespaces

Variants
Actions
Navigation
Tools