summaryrefslogtreecommitdiff
path: root/mkdiskimage.in
diff options
context:
space:
mode:
authorhpa <hpa>2002-10-29 06:12:58 +0000
committerhpa <hpa>2002-10-29 06:12:58 +0000
commitff6ca4781bf1d9694537a070c85bde5b9e9b82a0 (patch)
tree13b30dcffc4e90346026460bc83997a9e746318d /mkdiskimage.in
parente4f84982db57372d435f2d9239f839df3a5e77db (diff)
downloadsyslinux-ff6ca4781bf1d9694537a070c85bde5b9e9b82a0.tar.gz
Support DOSEMU-style hard disk imagessyslinux-2.01-pre1
Diffstat (limited to 'mkdiskimage.in')
-rwxr-xr-xmkdiskimage.in16
1 files changed, 13 insertions, 3 deletions
diff --git a/mkdiskimage.in b/mkdiskimage.in
index a250af29..f75d0ac9 100755
--- a/mkdiskimage.in
+++ b/mkdiskimage.in
@@ -22,7 +22,9 @@ sub absolute_path($) {
for $a ( @ARGV ) {
if ( $a =~ /^\-/ ) {
- $opt{$'} = 1;
+ foreach $o ( split(//, substr($a,1)) ) {
+ $opt{$o} = 1;
+ }
} else {
push(@args, $a);
}
@@ -33,7 +35,8 @@ $c += 0; $h += 0; $s += 0;
if ( !$file || $c < 1 || $c > 1024 ||
$h < 1 || $h > 256 || $s < 1 || $s > 63 ) {
- print STDERR "Usage: $0 [-o] file c h s (max: 1024 256 63)\n";
+ print STDERR "Usage: $0 [-do] file c h s (max: 1024 256 63)\n";
+ print STDERR " -d add DOSEMU header\n";
print STDERR " -o print filesystem offset to stdout\n";
exit 1;
}
@@ -43,6 +46,13 @@ $cylsize = $h*$s*512;
sysopen(OUTPUT, $file, O_CREAT|O_RDWR|O_TRUNC, 0666)
or die "$0: Cannot open: $file\n";
+# Print out DOSEMU header, if requested
+if ( $opt{'d'} ) {
+ $emuhdr = "DOSEMU\0" . pack("VVVV", $h, $s, $c, 128);
+ $emuhdr .= "\0" x (128 - length($emuhdr));
+ print OUTPUT $emuhdr;
+}
+
# Print the MBR and partition table
$mbr = '';
while ( $line = <DATA> ) {
@@ -106,7 +116,7 @@ $imglink = $tmpdir.'/disk.img';
die "$0: Failed to create symlink $imglink\n"
if ( !symlink(absolute_path($file), $imglink) );
-$offset = $s*512;
+$offset = $s*512 + ($opt{'d'} ? 128 : 0);
open(MCONFIG, "> ${cfgfile}") or die "$0: Cannot make mtools config\n";
print MCONFIG "drive z:\n";
print MCONFIG "file=\"${imglink}\"\n";