mirror of
https://github.com/ipxe/ipxe
synced 2025-12-11 22:11:08 +03:00
[build] Reinstate the .pdsk padded-floppy image format
Some utilities that expect a floppy disk image (e.g. iLO?) may test for a file of the correct size. Reinstate the .pdsk image format in order to provide this if needed.
This commit is contained in:
@@ -59,3 +59,9 @@ NON_AUTO_MEDIA += usb
|
|||||||
%usb: $(BIN)/usbdisk.bin %hd
|
%usb: $(BIN)/usbdisk.bin %hd
|
||||||
$(QM)$(ECHO) " [FINISH] $@"
|
$(QM)$(ECHO) " [FINISH] $@"
|
||||||
$(Q)cat $^ > $@
|
$(Q)cat $^ > $@
|
||||||
|
|
||||||
|
# Padded floppy image (e.g. for iLO)
|
||||||
|
NON_AUTO_MEDIA += pdsk
|
||||||
|
%pdsk : %dsk
|
||||||
|
$(Q)cp $< $@
|
||||||
|
$(Q)$(PADIMG) --blksize=1474560 $@
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ GetOptions ( { map { /^(\w+)/; $1 => $opts->{$_} } keys %$opts }, keys %$opts )
|
|||||||
while ( my $filename = shift ) {
|
while ( my $filename = shift ) {
|
||||||
die "$filename is not a file\n" unless -f $filename;
|
die "$filename is not a file\n" unless -f $filename;
|
||||||
my $oldsize = -s $filename;
|
my $oldsize = -s $filename;
|
||||||
my $newsize = ( ( $oldsize + $blksize - 1 ) & ~( $blksize - 1 ) );
|
my $padsize = ( ( -$oldsize ) % $blksize );
|
||||||
my $padsize = ( $newsize - $oldsize );
|
my $newsize = ( $oldsize + $padsize );
|
||||||
next unless $padsize;
|
next unless $padsize;
|
||||||
if ( $verbosity >= 1 ) {
|
if ( $verbosity >= 1 ) {
|
||||||
printf "Padding %s from %d to %d bytes with %d x 0x%02x\n",
|
printf "Padding %s from %d to %d bytes with %d x 0x%02x\n",
|
||||||
@@ -40,5 +40,6 @@ while ( my $filename = shift ) {
|
|||||||
truncate $filename, $newsize
|
truncate $filename, $newsize
|
||||||
or die "Could not resize $filename: $!\n";
|
or die "Could not resize $filename: $!\n";
|
||||||
}
|
}
|
||||||
die "Failed to pad $filename\n" unless -s $filename == $newsize;
|
die "Failed to pad $filename\n"
|
||||||
|
unless ( ( ( -s $filename ) % $blksize ) == 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user