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