How to create a bootable floppy running GRUB4DOS on Linux (Ubuntu Hardy)

GRUB4DOS is a flexible, feature-extended version of the GRUB boot manager. This blog post explains how to create a bootable floppy which boots GRUB4DOS, from which you can boot almost anything. To create bootable CD instead, see http://ptspts.blogspot.com/2009/07/how-to-create-bootable-cd-running.html.

Run this shell script to create the 1.44MB floppy image grldr.img:
#! /bin/bash
# by pts@fazekas.hu at Sat Jul 11 11:02:14 CEST 2009
GRUB4DOS_DIR=grub4dos-0.4.4 # as extracted from $GRUB4DOS_ZIP
set -ex
type -p wget || TO_INSTALL="$TO_INSTALL wget"
type -p mformat || TO_INSTALL="$TO_INSTALL mtools"
type -p unzip || TO_INSTALL="$TO_INSTALL unzip"
test "$TO_INSTALL" && sudo apt-get install $TO_INSTALL
wget -O "$GRUB4DOS_ZIP" http://download.gna.org/grub4dos/"$GRUB4DOS_ZIP"
unzip -o "$GRUB4DOS_ZIP"
dd if=/dev/zero of=grldr.img bs=1474560 count=1
mformat -i grldr.img -f1440 ::
"$GRUB4DOS_DIR"/bootlace.com --floppy --chs grldr.img
mcopy -i grldr.img "$GRUB4DOS_DIR/grldr" ::GRLDR
mcopy -i grldr.img "$GRUB4DOS_DIR/menu.lst" ::menu.lst
: All OK, 1.44MB floppy image grldr.img created.
Please note that you may want to adjust the GRUB4DOS_ZIP variable above in order to download a more recent version of GRUB4DOS, when its available. you can get the list of versions from http://download.gna.org/grub4dos/.

You may use the floppy image grldr.img in your virtualization software (such as VirtualBox), or you may write it to a floppy disk with:
$ cat grldr.img >/dev/fd0

No comments: