aboutsummaryrefslogtreecommitdiffstats
path: root/utils/mkdiskimage.in
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-03 16:06:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-03 16:06:41 -0800
commitaddaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa (patch)
tree2ffea726dc494e87ecc9f506bc6a2bc9242730e3 /utils/mkdiskimage.in
parent5c0f48e49f8d7d084810ecf0b98a76aaebb44835 (diff)
parente7a5f95432132c8fc8f8ede39fda1d368002ddd8 (diff)
downloadsyslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.tar.gz
syslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.tar.xz
syslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.zip
Merge branch 'master' into i915res
Diffstat (limited to 'utils/mkdiskimage.in')
-rw-r--r--utils/mkdiskimage.in16
1 files changed, 10 insertions, 6 deletions
diff --git a/utils/mkdiskimage.in b/utils/mkdiskimage.in
index 9231fa21..533193a1 100644
--- a/utils/mkdiskimage.in
+++ b/utils/mkdiskimage.in
@@ -2,7 +2,7 @@
## -----------------------------------------------------------------------
##
## Copyright 2002-2008 H. Peter Anvin - All Rights Reserved
-## Copyright 2009 Intel Corporation; author: H. Peter Anvin
+## Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
##
## 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
@@ -144,6 +144,7 @@ if ( $file eq '' || $c < 1 || $h < 1 || $h > 256 || $s < 1 || $s > 63 ) {
print STDERR " -z use zipdisk geometry (h=64 s=32)\n";
print STDERR " -4 use partition entry 4 (standard for zipdisks)\n";
print STDERR " -i specify the MBR ID\n";
+ print STDERR " -s output a sparse file (don't allocate all blocks)\n";
exit 1;
}
@@ -216,13 +217,16 @@ print OUTPUT "\x55\xaa";
$totalsize = $c*$h*$s;
$tracks = $c*$h;
-$track = "\0" x (512*$s);
+# If -s is given, try to simply use truncate...
+unless ($opt{'s'} && truncate(OUTPUT, $totalsize)) {
+ $track = "\0" x (512*$s);
-# Print fractional track
-print OUTPUT "\0" x (512 * ($s-1));
+ # Print fractional track
+ print OUTPUT "\0" x (512 * ($s-1));
-for ( $i = 1 ; $i < $tracks ; $i++ ) {
- print OUTPUT $track;
+ for ( $i = 1 ; $i < $tracks ; $i++ ) {
+ print OUTPUT $track;
+ }
}
# Print mtools temp file