aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-22 07:14:46 +0000
committerhpa <hpa>2004-12-22 07:14:46 +0000
commit77ab888b7c006189b9e5804184332f57a22925aa (patch)
tree59c1d0e317f218132b8a381d739cd12f6d0cd4a9
parent193a6862aa1c78969d8ace9cecbe948ae47b65f8 (diff)
downloadsyslinux.git-77ab888b7c006189b9e5804184332f57a22925aa.tar.gz
syslinux.git-77ab888b7c006189b9e5804184332f57a22925aa.tar.xz
syslinux.git-77ab888b7c006189b9e5804184332f57a22925aa.zip
Allow creation of FAT32 filesystems
-rwxr-xr-xmkdiskimage.in32
1 files changed, 23 insertions, 9 deletions
diff --git a/mkdiskimage.in b/mkdiskimage.in
index 1dc54544..4a06677f 100755
--- a/mkdiskimage.in
+++ b/mkdiskimage.in
@@ -2,7 +2,7 @@
## -----------------------------------------------------------------------
## $Id$
##
-## Copyright 2002-2003 H. Peter Anvin - All Rights Reserved
+## Copyright 2002-2004 H. Peter Anvin - All Rights Reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -49,9 +49,10 @@ $c += 0; $h += 0; $s += 0;
if ( !$file || $c < 1 || $c > 1024 ||
$h < 1 || $h > 256 || $s < 1 || $s > 63 ) {
- print STDERR "Usage: $0 [-do] file c h s (max: 1024 256 63)\n";
+ print STDERR "Usage: $0 [-doF] 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";
+ print STDERR " -F format partition as FAT32\n";
exit 1;
}
@@ -148,19 +149,32 @@ if ( $opt{'o'} ) {
}
$ENV{'MTOOLSRC'} = $cfgfile;
-system('mformat', 'z:');
+if ( $opt{'F'} ) {
+ system('mformat', '-F', 'z:');
+} else {
+ system('mformat', 'z:');
+}
# Clean up in /tmp
unlink($cfgfile);
unlink($imglink);
rmdir($tmpdir);
-seek(OUTPUT, $s*512+0x36, 0);
-read(OUTPUT, $fsname, 8);
-
-# FAT12: adjust partition type
-if ( $fsname eq 'FAT12 ' ) {
- $fstype = 0x01;
+if ( $opt{'F'} ) {
+ $fstype = 0x0b; # FAT32
+} else {
+ if ( $psize > 65536 ) {
+ $fstype = 0x06; # FAT16 > 32MB
+ } else {
+ $fstype = 0x04; # FAT16 <= 32MB
+ }
+ seek(OUTPUT, $s*512+0x36, 0);
+ read(OUTPUT, $fsname, 8);
+
+ # FAT12: adjust partition type
+ if ( $fsname eq 'FAT12 ' ) {
+ $fstype = 0x01; # FAT12
+ }
}
seek(OUTPUT, 446+4, 0);
print OUTPUT pack("C", $fstype);