aboutsummaryrefslogtreecommitdiff
path: root/examples/bootfloppy/mksyslinux.sh
blob: e254173535069468ecd05d199c719e313bd4eeb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# Formats a floppy to use Syslinux

dummy=""


# need to have mtools installed
if [ -z `which mformat` -o -z `which mcopy` ]; then
	echo "You must have the mtools package installed to run this script"
	exit 1
fi


# need an arg for the location of the kernel
if [ -z "$1" ]; then
	echo "usage: `basename $0` path/to/linux/kernel"
	exit 1
fi


# need to have a root file system built
if [ ! -f rootfs.gz ]; then
	echo "You need to have a rootfs built first."
	echo "Hit RETURN to make one now or Control-C to quit."
	read dummy
	./mkrootfs.sh
fi


# prepare the floppy
echo "Please insert a blank floppy in the drive and press RETURN to format"
echo "(WARNING: All data will be erased! Hit Control-C to abort)"
read dummy

echo "Formatting the floppy..."
mformat a:
echo "Making it bootable with Syslinux..."
syslinux -s /dev/fd0
echo "Copying Syslinux configuration files..."
mcopy syslinux.cfg display.txt a:
echo "Copying root filesystem file..."
mcopy rootfs.gz a:
# XXX: maybe check for "no space on device" errors here
echo "Copying linux kernel..."
mcopy $1 a:linux
# XXX: maybe check for "no space on device" errors here too
echo "Finished: boot floppy created"