| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
# TODO: create a bootable floppy
|
| 4 |
# syslinux: root=ip-server:/usr/lib/fai/nfsroot
|
| 5 |
# -h => help
|
| 6 |
|
| 7 |
# $Id$
|
| 8 |
#*********************************************************************
|
| 9 |
#
|
| 10 |
# mk3comimage -- create tftp boot image for 3Com network card
|
| 11 |
#
|
| 12 |
# This script is part of FAI (Fully Automatic Installation)
|
| 13 |
# Copyright (c) 2000 by Thomas Lange, lange@informatik.uni-koeln.de
|
| 14 |
# Universitaet zu Koeln
|
| 15 |
#
|
| 16 |
#*********************************************************************
|
| 17 |
|
| 18 |
# This scripts builds a bootable tftp boot image for 3Com network cards
|
| 19 |
# tested with the MBA v3.10 (or later) eproms
|
| 20 |
|
| 21 |
usage() {
|
| 22 |
cat <<EOF
|
| 23 |
mk3comimage [options] bzImage tftpimage rootdevice [parameter] ...
|
| 24 |
|
| 25 |
Parameter
|
| 26 |
|
| 27 |
bzImage input file, a kernel
|
| 28 |
tftpimage tftpimage that will be created
|
| 29 |
rootdevice normally /dev/nfs
|
| 30 |
EOF
|
| 31 |
exit 0
|
| 32 |
}
|
| 33 |
|
| 34 |
[ $# -eq 0 ] && usage
|
| 35 |
|
| 36 |
. /etc/fai.conf
|
| 37 |
|
| 38 |
mnt=/tmp/mountpoint.$$
|
| 39 |
dosdisk=/tmp/dosdisk.$$
|
| 40 |
|
| 41 |
if [ "$UID" -ne 0 ]; then
|
| 42 |
echo "You must be root!"
|
| 43 |
exit 9
|
| 44 |
fi
|
| 45 |
|
| 46 |
# where to find emptydosdisk and imagegen_firstblock
|
| 47 |
base=$LIBFAI/kernel/
|
| 48 |
|
| 49 |
bzimage=$1
|
| 50 |
shift
|
| 51 |
tftpimage=$1
|
| 52 |
shift
|
| 53 |
rootdevice=$1
|
| 54 |
shift
|
| 55 |
parameter=$*
|
| 56 |
|
| 57 |
if [ -f $tftpimage ]; then
|
| 58 |
mv $tftpimage $tftpimage.old
|
| 59 |
echo moved $tftpimage to $tftpimage.old
|
| 60 |
fi
|
| 61 |
|
| 62 |
trap 'cd /;umount $mnt ; rm -rf $dosdisk $bootdev $mnt' EXIT HUP INT QUIT
|
| 63 |
|
| 64 |
mkdir $mnt
|
| 65 |
gzip -dc $base/emptydosdisk.gz > $dosdisk
|
| 66 |
mount $dosdisk $mnt -t msdos -o loop
|
| 67 |
cp $bzimage $mnt/linux
|
| 68 |
cat <<EOF >$mnt/syslinux.cfg
|
| 69 |
TIMEOUT 20
|
| 70 |
PROMPT 0
|
| 71 |
DEFAULT linux
|
| 72 |
EOF
|
| 73 |
|
| 74 |
app="APPEND root=$rootdevice"
|
| 75 |
[ -n "$parameter" ] && app="$app $parameter"
|
| 76 |
echo $app >> $mnt/syslinux.cfg
|
| 77 |
|
| 78 |
#[ -n "$parameter" ] && echo "APPEND \"$parameter\"" >> $mnt/syslinux.cfg
|
| 79 |
syslinux $dosdisk
|
| 80 |
cat $base/imagegen_firstblock $dosdisk > $tftpimage
|
| 81 |
chmod a=r $tftpimage
|
| 82 |
|
| 83 |
exit 0
|