Browse Source

[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.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
7aee624881
2 changed files with 10 additions and 3 deletions
  1. 6
    0
      src/arch/i386/Makefile.pcbios
  2. 4
    3
      src/util/padimg.pl

+ 6
- 0
src/arch/i386/Makefile.pcbios View File

59
 %usb: $(BIN)/usbdisk.bin %hd
59
 %usb: $(BIN)/usbdisk.bin %hd
60
 	$(QM)$(ECHO) "  [FINISH] $@"
60
 	$(QM)$(ECHO) "  [FINISH] $@"
61
 	$(Q)cat $^ > $@
61
 	$(Q)cat $^ > $@
62
+
63
+# Padded floppy image (e.g. for iLO)
64
+NON_AUTO_MEDIA += pdsk
65
+%pdsk : %dsk
66
+	$(Q)cp $< $@
67
+	$(Q)$(PADIMG) --blksize=1474560 $@

+ 4
- 3
src/util/padimg.pl View File

23
 while ( my $filename = shift ) {
23
 while ( my $filename = shift ) {
24
   die "$filename is not a file\n" unless -f $filename;
24
   die "$filename is not a file\n" unless -f $filename;
25
   my $oldsize = -s $filename;
25
   my $oldsize = -s $filename;
26
-  my $newsize = ( ( $oldsize + $blksize - 1 ) & ~( $blksize - 1 ) );
27
-  my $padsize = ( $newsize - $oldsize );
26
+  my $padsize = ( ( -$oldsize ) % $blksize );
27
+  my $newsize = ( $oldsize + $padsize );
28
   next unless $padsize;
28
   next unless $padsize;
29
   if ( $verbosity >= 1 ) {
29
   if ( $verbosity >= 1 ) {
30
       printf "Padding %s from %d to %d bytes with %d x 0x%02x\n",
30
       printf "Padding %s from %d to %d bytes with %d x 0x%02x\n",
40
     truncate $filename, $newsize
40
     truncate $filename, $newsize
41
 	or die "Could not resize $filename: $!\n";
41
 	or die "Could not resize $filename: $!\n";
42
   }
42
   }
43
-  die "Failed to pad $filename\n" unless -s $filename == $newsize;
43
+  die "Failed to pad $filename\n"
44
+      unless ( ( ( -s $filename ) % $blksize ) == 0 );
44
 }
45
 }

Loading…
Cancel
Save