View Single Post
  #2   (View Single Post)  
Old 11th March 2010
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,053
Default

An update to the method used before, previously I used MS-DOS 1.44 MB bootable floppy and added BIOS files to CD-ROM image, so an emulated floppy needed to load CD-ROM driver and then you was able to flash the BIOS. Now I use open/free 2.88 MB floppy with FreeDOS instead, and BIOS files are kept directly on the emulated floppy, so no need to load all these CD-ROM drivers, so it also boots a lot faster.

The script itself is here:
Code:
#! /bin/sh

trap __clean 1 2 3 4 5 6 7 8 9 10 11 12 14 15

# bootable 2.88 MB floppy image from: http://fdos.org/bootdisks/
FLOPPY=FDSTD.288

__status() {
  [ ${?} -eq 0 ] || {
    echo "ER: ${@}"
    exit 1
    }
  }

__clean() {
  cd /
  umount mnt 1> /dev/null 2> /dev/null
  UNIT=$( echo ${UNIT} | tr -d 'a-z' 2> /dev/null )
  mdconfig -d -u ${UNIT} 1> /dev/null 2> /dev/null
  }

[ ${USER} = root ] || {
  echo "ER: only root may use that script"
  exit 1
  }

for I in fetch gzip mdconfig mkdir mount_msdosfs cp umount rm tr mkisofs
do
  which ${I} 1> /dev/null 2> /dev/null || {
    echo "ER: ${I} is not available in ${PATH}"
    exit 1
    }
done

fetch http://www.fdos.org/bootdisks/autogen/${FLOPPY}.gz 1> /dev/null 2> /dev/null
__status "fetch(1) failed"

gzip -d -f ${FLOPPY}.gz 1> /dev/null 2> /dev/null
__status "gzip(1) failed"

UNIT=$( mdconfig -a -t vnode -f ${FLOPPY} 2> /dev/null )
__status "mdconfig(8) failed (create)"

mkdir -p mnt 1> /dev/null 2> /dev/null
__status "mkdir(1) failed"

mount_msdosfs /dev/${UNIT} mnt 1> /dev/null 2> /dev/null
__status "mount(8) failed"

cp bios/* mnt 1> /dev/null 2> /dev/null
__status "cp(1) failed"

umount mnt 1> /dev/null 2> /dev/null
__status "umount(8) failed"

rm -r mnt 1> /dev/null 2> /dev/null
__status "rm(1) failed"

UNIT=$( echo ${UNIT} | tr -d 'a-z' 2> /dev/null )
__status "tr(1) failed"

mdconfig -d -u ${UNIT} 1> /dev/null 2> /dev/null
__status "mdconfig(8) failed (destroy)"

mkisofs -J -R -b ${FLOPPY} -o bios.iso ${FLOPPY} 1> /dev/null 2> /dev/null
__status "mkisofs(1) failed"


Put all BIOS related stuff (flashing program/BIOS itself) into bios directory in the same place as this script is, lets call it create_bios_iso.sh, the listing will look like that:
Code:
# find .
./bios
./bios/flash.exe
./bios/bios.img
./create_bios_iso.sh


... and after usage:
Code:
# find .
./FDSTD.288
./bios.iso
./bios
./bios/flash.exe
./bios/bios.img
./create_bios_iso.sh
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote