aboutsummaryrefslogtreecommitdiffstats
path: root/utils/mkdiskimage.in
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-21 13:34:12 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-21 13:35:22 -0700
commitd4d9f190900d31b5e9428401a0175012957d7cb7 (patch)
tree3b1bfe13f7b711905591ee1e92fde70ee3ab437d /utils/mkdiskimage.in
parent652070309f5d283efacaa8c5102368da20a92c4a (diff)
downloadsyslinux.git-d4d9f190900d31b5e9428401a0175012957d7cb7.tar.gz
syslinux.git-d4d9f190900d31b5e9428401a0175012957d7cb7.tar.xz
syslinux.git-d4d9f190900d31b5e9428401a0175012957d7cb7.zip
isohybrid: allow selecting the _c and _f versions of the prefix
Allow selecting the _f or _c versions of the prefix in addition to the default one. This is specified with the -forcehd0 or -ctrlhd0 options. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'utils/mkdiskimage.in')
-rw-r--r--utils/mkdiskimage.in22
1 files changed, 15 insertions, 7 deletions
diff --git a/utils/mkdiskimage.in b/utils/mkdiskimage.in
index 1ce8b64f..9231fa21 100644
--- a/utils/mkdiskimage.in
+++ b/utils/mkdiskimage.in
@@ -2,6 +2,7 @@
## -----------------------------------------------------------------------
##
## Copyright 2002-2008 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
@@ -55,6 +56,19 @@ sub get_random() {
return ($$+time()) & 0xffffffff;
}
+sub get_hex_data() {
+ my $mbr = '';
+ my $line, $byte;
+ while ( $line = <DATA> ) {
+ chomp $line;
+ last if ($line eq '*');
+ foreach $byte ( split(/\s+/, $line) ) {
+ $mbr .= chr(hex($byte));
+ }
+ }
+ return $mbr;
+}
+
$is_linux = is_linux();
if ( $is_linux ) {
# IOCTL numbers
@@ -157,13 +171,7 @@ if ( $opt{'d'} ) {
}
# Print the MBR and partition table
-$mbr = '';
-while ( $line = <DATA> ) {
- chomp $line;
- foreach $byte ( split(/\s+/, $line) ) {
- $mbr .= chr(hex($byte));
- }
-}
+$mbr = get_hex_data();
if ( length($mbr) > 440 ) {
die "$0: Bad MBR code\n";
}