aboutsummaryrefslogtreecommitdiffstats
path: root/mbr/checksize.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-04-04 15:32:24 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-04-04 15:32:24 -0700
commitf7b5a2254ab7c8aa87679c1b731d2ea285c22e80 (patch)
tree08e1e00576717e1ca557101164b7e6639e0172a1 /mbr/checksize.pl
parentdd51053bbd4a1613d1e3384928a7da7bb164562f (diff)
downloadsyslinux.git-f7b5a2254ab7c8aa87679c1b731d2ea285c22e80.tar.gz
syslinux.git-f7b5a2254ab7c8aa87679c1b731d2ea285c22e80.tar.xz
syslinux.git-f7b5a2254ab7c8aa87679c1b731d2ea285c22e80.zip
mbr: generate normal versions, force-80 versions, and ctrl-80 versions
Produce MBR variants with normal (DL) behavior, force to drive 80 behavior, and force to 80 on Ctrl pressed behavior. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'mbr/checksize.pl')
-rwxr-xr-xmbr/checksize.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/mbr/checksize.pl b/mbr/checksize.pl
index a3643101..4648c95c 100755
--- a/mbr/checksize.pl
+++ b/mbr/checksize.pl
@@ -1,6 +1,7 @@
## -----------------------------------------------------------------------
##
## Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+## Copyright 2009 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
@@ -20,6 +21,21 @@ use bytes;
($file, $maxsize, $padsize) = @ARGV;
+if (!defined($maxsize)) {
+ # Defaults based on the filename
+ if ($file =~ /^mbr[^0-9a-z]/) {
+ $maxsize = $padsize = 440;
+ } elsif ($file =~ /^gptmbr[^0-9a-z]/) {
+ $maxsize = $padsize = 424;
+ } elsif ($file =~ /^isohdpfx[^0-9a-z]/) {
+ $maxsize = $padsize = 432;
+ } elsif ($file =~ /^altmbr[^0-9a-z]/) {
+ $maxsize = 439; $padsize = 440;
+ } else {
+ die "$0: no default size for filename: $file\n";
+ }
+}
+
$padsize = $maxsize unless(defined($padsize));
open(FILE, '+<', $file) or die;