1#!/bin/bash
2#
3# Formats a floppy to use Syslinux
4
5dummy=""
6
7
8# need to have mtools installed
9if [ -z `which mformat` -o -z `which mcopy` ]; then
10	echo "You must have the mtools package installed to run this script"
11	exit 1
12fi
13
14
15# need an arg for the location of the kernel
16if [ -z "$1" ]; then
17	echo "usage: `basename $0` path/to/linux/kernel"
18	exit 1
19fi
20
21
22# need to have a root file system built
23if [ ! -f rootfs.gz ]; then
24	echo "You need to have a rootfs built first."
25	echo "Hit RETURN to make one now or Control-C to quit."
26	read dummy
27	./mkrootfs.sh
28fi
29
30
31# prepare the floppy
32echo "Please insert a blank floppy in the drive and press RETURN to format"
33echo "(WARNING: All data will be erased! Hit Control-C to abort)"
34read dummy
35
36echo "Formatting the floppy..."
37mformat a:
38echo "Making it bootable with Syslinux..."
39syslinux -s /dev/fd0
40echo "Copying Syslinux configuration files..."
41mcopy syslinux.cfg display.txt a:
42echo "Copying root filesystem file..."
43mcopy rootfs.gz a:
44# XXX: maybe check for "no space on device" errors here
45echo "Copying linux kernel..."
46mcopy $1 a:linux
47# XXX: maybe check for "no space on device" errors here too
48echo "Finished: boot floppy created"
49