DosBoot
From FAIWiki
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. Now, one is faced with the following problems:
- Probably, one needs more the one floopy image, since on 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 in particular 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
- Download a freedos installation image from http://www.freedos.org/ and brun it
- 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
- We have not been able to install freedos on a box with a
- Fujitsu Siemens D2461-A2 board
- 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.
- Install a basic dos environment with mbr writing tools (smbtmgrx) and other programs you consider to be useful.
- Reboot the box and go into the dos environment, execute a mbr writing tool.
- Reboot again using liveCD (Knoppix/GRML).
- Copy the first 63+N blocks of the hd into a file dd if=/dev/sda of=hd.img bs=512 count=63.
- Copy the the complete dos partition into another file dd if=/dev/sda1 of=dos.img bs=512.
- 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:
- WATT-32 (TCP/IP stack for DOS) http://www.bgnett.no/~giva/
- card driver http://www.georgpotthast.de/sioux/packet.htm . In our case it worked with broadcom ethernet cards
- ssh2dos http://sourceforge.net/projects/sshdos
- and misc. tools like vim
- Ask the vendor of your hardware for BIOS flash programs and CMOS/NVRAM read and writing tools.
- Other firmware images and flashing tools, e.g., for IPMI cards, HDs and network cards.
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 you sample machine according to you needs (you must not forget toenable netboot)
- You should be able to boot into the dos image and see all the tools you have put 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 you hardware. Copy it onto your 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 images on the DOS image. Moreover,the client can ssh onto the FAI server and change the pxelinux.cfg files to initialize the FAI installation (using fai-chboot) for the next boot cycle.
- 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
