Browse Source

[build] Add syslinux floppy image type .sdsk

We add a syslinux floppy disk type using parts of the genliso script.
This floppy image cat be dd'ed to a physical floppy or used in
instances where a virtual floppy with an mountable DOS filesystem is
useful.

We also modify the genliso script to only generate .liso images
rather than creating images depending on how it is called.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
tags/v0.9.8
Marty Connor 15 years ago
parent
commit
96f4f96540
3 changed files with 89 additions and 27 deletions
  1. 6
    0
      src/arch/i386/Makefile.pcbios
  2. 17
    27
      src/util/genliso
  3. 66
    0
      src/util/gensdsk

+ 6
- 0
src/arch/i386/Makefile.pcbios View File

@@ -45,6 +45,12 @@ NON_AUTO_MEDIA	+= liso
45 45
 	$(QM)$(ECHO) "  [GENLISO] $@"
46 46
 	$(Q)bash util/genliso $@ $<
47 47
 
48
+# rule to make a syslinux floppy image (mountable, bootable)
49
+NON_AUTO_MEDIA	+= sdsk
50
+%sdsk:	%lkrn util/gensdsk
51
+	$(QM)$(ECHO) "  [GENSDSK] $@"
52
+	$(Q)bash util/gensdsk $@ $<
53
+
48 54
 # Special target for building Master Boot Record binary
49 55
 $(BIN)/mbr.bin : $(BIN)/mbr.o
50 56
 	$(QM)$(ECHO) "  [OBJCOPY] $@"

+ 17
- 27
src/util/genliso View File

@@ -2,24 +2,18 @@
2 2
 #
3 3
 # Generate a legacy floppy emulation ISO boot image
4 4
 #
5
-# genliso foo.liso foo.lkrn
5
+# genliso foo.liso foo.lkrn bar.lkrn ...
6 6
 #
7
-# the ISO image is the first argument so that a list of .lkrn images
8
-# to include can be specified
9
-#
10
-case $0 in
11
-*genliso)
12
-	;;
13
-*genfdimg)
14
-	genfdimg=1
15
-	;;
16
-esac
7
+# The .liso image filename is the first argument followed by
8
+#   a list of .lkrn images  include in .liso image
9
+
17 10
 case $# in
18 11
 0|1)
19 12
 	echo Usage: $0 foo.liso foo.lkrn ...
20 13
 	exit 1
21 14
 	;;
22 15
 esac
16
+
23 17
 case "`mtools -V`" in
24 18
 Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
25 19
 	;;
@@ -28,25 +22,23 @@ Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
28 22
 	exit 1
29 23
 	;;
30 24
 esac
25
+
31 26
 out=$1
32 27
 shift
28
+
33 29
 dir=bin/liso.dir
34 30
 mkdir -p $dir
35
-case "$genfdimg" in
36
-1)
37
-	img=$out
38
-	;;
39
-*)
40
-	img=$dir/boot.img
41
-	;;
42
-esac
31
+
32
+img=$dir/boot.img
43 33
 mformat -f 1440 -C -i $img ::
34
+
44 35
 cfg=bin/syslinux.cfg
45 36
 cat > $cfg <<EOF
46 37
 # These default options can be changed in the genliso script
47
-SAY Etherboot ISO boot image generated by genliso
38
+SAY gPXE ISO boot image generated by genliso
48 39
 TIMEOUT 30
49 40
 EOF
41
+
50 42
 first=
51 43
 for f
52 44
 do
@@ -70,16 +62,14 @@ do
70 62
 	echo "" KERNEL $g
71 63
 	mcopy -m -i $img $f ::$g
72 64
 done >> $cfg
65
+
73 66
 mcopy -i $img $cfg ::syslinux.cfg
67
+
74 68
 if ! syslinux $img
75 69
 then
76 70
 	exit 1
77 71
 fi
78
-case "$genfdimg" in
79
-1)
80
-	;;
81
-*)
82
-	mkisofs -o $out -c boot.cat -b boot.img $dir
83
-	;;
84
-esac
72
+
73
+mkisofs -o $out -c boot.cat -b boot.img $dir
74
+
85 75
 rm -fr $dir

+ 66
- 0
src/util/gensdsk View File

@@ -0,0 +1,66 @@
1
+#!/bin/bash
2
+#
3
+# Generate a syslinux floppy that loads a gPXE image
4
+#
5
+# gensdsk foo.sdsk foo.lkrn
6
+#
7
+# the floppy image is the first argument
8
+#   followed by list of .lkrn images
9
+#
10
+
11
+case $# in
12
+0|1)
13
+	echo Usage: $0 foo.sdsk foo.lkrn ...
14
+	exit 1
15
+	;;
16
+esac
17
+case "`mtools -V`" in
18
+Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
19
+	;;
20
+*)
21
+	echo Mtools version 3.9.9 or later is required
22
+	exit 1
23
+	;;
24
+esac
25
+img=$1
26
+shift
27
+dir=bin/sdsk.dir
28
+mkdir -p $dir
29
+
30
+mformat -f 1440 -C -i $img ::
31
+cfg=bin/syslinux.cfg
32
+cat > $cfg <<EOF
33
+
34
+# These default options can be changed in the gensdsk script
35
+TIMEOUT 30
36
+EOF
37
+first=
38
+for f
39
+do
40
+	if [ ! -r $f ]
41
+	then
42
+		echo $f does not exist, skipping 1>&2
43
+		continue
44
+	fi
45
+	# shorten name for 8.3 filesystem
46
+	b=$(basename $f)
47
+	g=${b%.lkrn}
48
+	g=${g//[^a-z0-9]}
49
+	g=${g:0:8}.krn
50
+	case "$first" in
51
+	"")
52
+		echo DEFAULT $g
53
+		;;
54
+	esac
55
+	first=$g
56
+	echo LABEL $b
57
+	echo "" KERNEL $g
58
+	mcopy -m -i $img $f ::$g
59
+done >> $cfg
60
+mcopy -i $img $cfg ::syslinux.cfg
61
+if ! syslinux $img
62
+then
63
+	exit 1
64
+fi
65
+
66
+rm -fr $dir

Loading…
Cancel
Save