diff options
-rwxr-xr-x | draklive | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -680,14 +680,16 @@ sub allocate_partition { sub allocate_master { my ($live, $media, $dest, $size, $fs) = @_; mkdir_p(dirname($dest)); - my $heads = 16; - my $sectors_per_track = 63; + my $geom = { + heads => 16, + sectors => 63, # sectors per track + }; my $sector_size = 512; - my $track_size = $sector_size * $sectors_per_track; - my $cylinder_size = $track_size * $heads; + my $track_size = $sector_size * $geom->{sectors}; + my $cylinder_size = $track_size * $geom->{heads}; my $disk_size = $size + $track_size; - my $cylinders = int($disk_size / $cylinder_size); + $geom->{cylinders} = int($disk_size / $cylinder_size); MDV::Draklive::Utils::device_allocate_file($dest, $disk_size); @@ -699,7 +701,7 @@ sub allocate_master { require fs::type; my $pt_type = sprintf('%x', fs::type::fs_type2subpart($fs)->{pt_type}); - open(my $fdisk, "| fdisk -C $cylinders -S $sectors_per_track -H $heads $dest"); + open(my $fdisk, "| fdisk -C $geom->{cylinders} -S $geom->{sectors} -H $geom->{heads} $dest"); my $oem_rescue_idx = $media->find_partition_index('OEM_RESCUE'); if (defined $oem_rescue_idx) { |