02
Apr

Creating a BIOS flashing Boot CD in FreeBSD

Written by James T. Nixon III. Posted in FreeBSD, iXsystems, PC-BSD

This post may be considered trivial to most of you, but I thought I’d post it up here for the sake of documentation.

The production manager approached me this morning and asked if I could make a bootable ISO for a customer who needed to flash the BIOS of several servers.  I suggested they PXE boot, but because of the volume of servers they have with PXE booting disabled, human involvement would be unavoidable.

I have several bootable floppies for flashing BIOSes, but our customer had specific configuration requests, so I had to switch out the zipped ROM file located within the floppy image.  Simple enough, right?

I was provided a floppy that flashes the BIOS with the wrong settings and a replacement ROM file to update those settings.

Step One: Make the image

Insert the floppy into your floppy drive and execute the following:

# dd if=/dev/da1 of=/home/james/flash.img bs=512

This created a raw image of the floppy disk (/dev/da1) and output ‘flash.img’ to ‘/home/james’ with a blocksize of 512 bytes. You may not see /dev/da1 on your system, so double check where the floppy is mounted by typing ‘mount’ at the command line.

Step Two: Remove the floppy and load the image into memory

After removing the floppy (you don’t need it anymore), you need to load the image into local memory.  You can do this using mdconfig. Enter the following into the command line:

# mdconfig -a -f /path/to/floppy.img
# md0

This should have output md0, but may be md1, md2, etc… md0 refers to the memory disk located at /dev/md0

Step Three: Mounting your image

Now that your image is loaded into local memory at /dev/md0, you need to mount it by executing the following:

# mount -t msdosfs /dev/md0 /mnt

This takes the memory disk with the specified msdos file system type and mounts it to /mnt.  We are now able modify the files located within the image under the /mnt directory.

Step Four: Replacing the ROM file

The ROM file contains the custom settings needed when flashing the BIOS and is located in a zip file of the same name under /mnt.

# rm -f /mnt/OLDBIOSROM.zip
# zip NEWBIOSROM.zip /path/to/NEWBIOSROM.rom
# cp NEWBIOSROM.zip /mnt

This should have removed the old rom file, zipped up your new rom, and copied the zip to /mnt. Now you need to edit /mnt/autoexec.bat to reflect the new ROM name that is being loaded (if applicable).  If the name of the file stayed the same, you don’t have to worry about this.

Make sure you unmount /dev/md0 before continuing (otherwise your changes will not take effect):

# umount /mnt

Step Five: Creating the boot disk

If you want to boot from the floppy, just dd floppy.img to the floppy disk.
Insert the floppy into the drive, then enter the following into the command line:

# dd if=/path/to/floppy.img of=/dev/da1 cs=512

Look familiar? Good! This is the exact opposite of what we did in Step One.  We’re just writing the raw image back to the floppy disk.

You now have a brand new floppy to use when flashing your BIOS.  Continue reading for instructions on turning this into a boot cd instead.

Step Six: Using mkisofs to create a boot cd

You can easily turn your bootable floppy into a boot cd using mkisofs.  Make sure you are in the directory where floppy.img is located and enter the following into the command line. (Read the mkisofs man page to explain the different options in detail, you may not need to use all the options I’ve listed.)

# mkisofs -joliet -joliet-long -full-iso9660-filenames -pad-output NEWBIOSROM.iso -rational-rock -rock -verbose -b floppy.img -c boot.catalog floppy.img

This should have created a file called NEWBIOSROM.iso, now all that is left is burning the ISO to a CD-R(W) with your favorite burning software.

Thanks for reading! I do all sorts of stuff at iXsystems, so check back for more bloggin’ on BSD, bitches!

  • Print
  • RSS
  • PDF
  • Facebook
  • Twitter
  • Identi.ca
  • Technorati

Tags: , , ,

Comments

  • Tweets that mention Dramashack! » FreeNAS 0.8 is Highly Experimental, Proceed with Caution! -- Topsy.com

    August 12, 2010 |

    [...] This post was mentioned on Twitter by Denise and Denise, James T. Nixon III. James T. Nixon III said: Blog: Understanding the new FreeNAS UI – http://bit.ly/cgocM5 #freenas #django #freebsd [...]

  • James T. Nixon III

    July 29, 2010 |

    Lol, I know right!?

  • Matt Olander

    July 29, 2010 |

    Great pix, James! Haha, that’s ironic that ISC, a customer of iX, won the server! PERFECT ;)

  • alan

    October 28, 2009 |

    One Question Habra version The 3 cds of the PC-BSD 8.0 Hubble Edition

  • Shaul

    September 4, 2009 |

    I would have to completely disagree with what you say how good PC-BSD is. And for the record, I do not use Linux, I do not have Linux installed on any systems. With the code they develop on top of FreeBSD for PC-BSD has consistency issue, and just don’t think they pay close enough attention to code correctness, I think it gets sluggish. Although my first choice is always to use OpenBSD on everything, I have set up FreeBSD as a desktop system. All I do is select minimal install, populate ports and source, patch the system, compile KDE4 from ports, and I find everything runs better and quicker that way. Once Firefox has been compiled from ports, I have seen it load instantaneously when you select it from KMenu. With PCBSD being developed for people who don’t know any tech stuff, and their own lack of proper auditing of code in the manner of say OpenBSD, I see definite performance issues, and some speed issues. I think it just gets bogged down. So that is why I would definitely disagree with what you say about how good PC-BSD is.