File: milodisk.sh

package info (click to toggle)
boot-floppies 2.2.26
  • links: PTS
  • area: main
  • in suites: potato
  • size: 26,392 kB
  • ctags: 11,498
  • sloc: ansic: 103,144; sh: 5,839; makefile: 2,472; python: 1,489; yacc: 1,019; perl: 336; asm: 234; lex: 126; pascal: 114; lisp: 51; xml: 50; awk: 12
file content (43 lines) | stat: -rwxr-xr-x 1,067 bytes parent folder | download
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
#! /bin/sh
# MILO disk maker.  David Huggins-Daines, February 2000
# This is free software under the GNU General Public License

. ./common.sh

if [ $# -lt 2 ]; then
    echo "Usage: $0 image-name outfile" 1>&2
    exit 1
fi

# Name of the MILO image to use
image=$1

# File to output
outfile=$2

testroot

[ -f $image ] || error "can't find $image"
[ -f linload.exe ] || error "can't find linload.exe"

if ! command -v srmbootfat >/dev/null 2>&1; then
    error "can't find srmbootfat - it's in the MILO source, build it... sorry"
fi

floppy=$(tempfile -p milo -m 644)
size=720 # This is the smallest size that can hold MILO which srmbootfat will accept
mnt=${tmpdir}/boot-floppies/mnt.milo
make_tmpdir $mnt
trap "umount $mnt 2>/dev/null || true ; rmdir $mnt || true; rm -f $floppy" 0 1 2 15

info "making loop filesystem in $floppy, size $size"
dd if=/dev/zero of=$floppy bs=1k count=$size

mkdosfs -r 112 -F 12 $floppy $size
mount $floppy -o loop -t msdos $mnt

cp $image      $mnt/milo
cp linload.exe $mnt/
umount $mnt
srmbootfat $floppy milo
cp $floppy $outfile