summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarty Connor2009-03-29 07:25:15 +0200
committerMichael Brown2009-08-02 12:04:13 +0200
commit96f4f96540b75d760e073bd02cd6273f0e50a4f6 (patch)
treed58a3648ac932cd390b55b5179b39c52d652fbee
parent[rtl818x] Add driver for Realtek 8180/8185 wireless cards (diff)
downloadipxe-96f4f96540b75d760e073bd02cd6273f0e50a4f6.tar.gz
ipxe-96f4f96540b75d760e073bd02cd6273f0e50a4f6.tar.xz
ipxe-96f4f96540b75d760e073bd02cd6273f0e50a4f6.zip
[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>
-rw-r--r--src/arch/i386/Makefile.pcbios6
-rwxr-xr-xsrc/util/genliso44
-rw-r--r--src/util/gensdsk66
3 files changed, 89 insertions, 27 deletions
diff --git a/src/arch/i386/Makefile.pcbios b/src/arch/i386/Makefile.pcbios
index b1854181..d4044567 100644
--- a/src/arch/i386/Makefile.pcbios
+++ b/src/arch/i386/Makefile.pcbios
@@ -45,6 +45,12 @@ NON_AUTO_MEDIA += liso
$(QM)$(ECHO) " [GENLISO] $@"
$(Q)bash util/genliso $@ $<
+# rule to make a syslinux floppy image (mountable, bootable)
+NON_AUTO_MEDIA += sdsk
+%sdsk: %lkrn util/gensdsk
+ $(QM)$(ECHO) " [GENSDSK] $@"
+ $(Q)bash util/gensdsk $@ $<
+
# Special target for building Master Boot Record binary
$(BIN)/mbr.bin : $(BIN)/mbr.o
$(QM)$(ECHO) " [OBJCOPY] $@"
diff --git a/src/util/genliso b/src/util/genliso
index 0a67eb3c..17823841 100755
--- a/src/util/genliso
+++ b/src/util/genliso
@@ -2,24 +2,18 @@
#
# Generate a legacy floppy emulation ISO boot image
#
-# genliso foo.liso foo.lkrn
+# genliso foo.liso foo.lkrn bar.lkrn ...
#
-# the ISO image is the first argument so that a list of .lkrn images
-# to include can be specified
-#
-case $0 in
-*genliso)
- ;;
-*genfdimg)
- genfdimg=1
- ;;
-esac
+# The .liso image filename is the first argument followed by
+# a list of .lkrn images include in .liso image
+
case $# in
0|1)
echo Usage: $0 foo.liso foo.lkrn ...
exit 1
;;
esac
+
case "`mtools -V`" in
Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
;;
@@ -28,25 +22,23 @@ Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
exit 1
;;
esac
+
out=$1
shift
+
dir=bin/liso.dir
mkdir -p $dir
-case "$genfdimg" in
-1)
- img=$out
- ;;
-*)
- img=$dir/boot.img
- ;;
-esac
+
+img=$dir/boot.img
mformat -f 1440 -C -i $img ::
+
cfg=bin/syslinux.cfg
cat > $cfg <<EOF
# These default options can be changed in the genliso script
-SAY Etherboot ISO boot image generated by genliso
+SAY gPXE ISO boot image generated by genliso
TIMEOUT 30
EOF
+
first=
for f
do
@@ -70,16 +62,14 @@ do
echo "" KERNEL $g
mcopy -m -i $img $f ::$g
done >> $cfg
+
mcopy -i $img $cfg ::syslinux.cfg
+
if ! syslinux $img
then
exit 1
fi
-case "$genfdimg" in
-1)
- ;;
-*)
- mkisofs -o $out -c boot.cat -b boot.img $dir
- ;;
-esac
+
+mkisofs -o $out -c boot.cat -b boot.img $dir
+
rm -fr $dir
diff --git a/src/util/gensdsk b/src/util/gensdsk
new file mode 100644
index 00000000..68c339c2
--- /dev/null
+++ b/src/util/gensdsk
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# Generate a syslinux floppy that loads a gPXE image
+#
+# gensdsk foo.sdsk foo.lkrn
+#
+# the floppy image is the first argument
+# followed by list of .lkrn images
+#
+
+case $# in
+0|1)
+ echo Usage: $0 foo.sdsk foo.lkrn ...
+ exit 1
+ ;;
+esac
+case "`mtools -V`" in
+Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
+ ;;
+*)
+ echo Mtools version 3.9.9 or later is required
+ exit 1
+ ;;
+esac
+img=$1
+shift
+dir=bin/sdsk.dir
+mkdir -p $dir
+
+mformat -f 1440 -C -i $img ::
+cfg=bin/syslinux.cfg
+cat > $cfg <<EOF
+
+# These default options can be changed in the gensdsk script
+TIMEOUT 30
+EOF
+first=
+for f
+do
+ if [ ! -r $f ]
+ then
+ echo $f does not exist, skipping 1>&2
+ continue
+ fi
+ # shorten name for 8.3 filesystem
+ b=$(basename $f)
+ g=${b%.lkrn}
+ g=${g//[^a-z0-9]}
+ g=${g:0:8}.krn
+ case "$first" in
+ "")
+ echo DEFAULT $g
+ ;;
+ esac
+ first=$g
+ echo LABEL $b
+ echo "" KERNEL $g
+ mcopy -m -i $img $f ::$g
+done >> $cfg
+mcopy -i $img $cfg ::syslinux.cfg
+if ! syslinux $img
+then
+ exit 1
+fi
+
+rm -fr $dir