Browse Source

[util] Update mergerom.pl to handle iPXE ROM header

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
8cac5c0c92
1 changed files with 18 additions and 3 deletions
  1. 18
    3
      src/util/mergerom.pl

+ 18
- 3
src/util/mergerom.pl View File

@@ -44,9 +44,6 @@ my $offset = $baserom->length;
44 44
 
45 45
 foreach my $rom ( @roms ) {
46 46
 
47
-  # Update base length
48
-  $baserom->{length} += $rom->{length};
49
-
50 47
   # Merge initialisation entry point
51 48
   merge_entry_points ( $baserom->{init}, $rom->{init}, $offset );
52 49
 
@@ -85,6 +82,24 @@ foreach my $rom ( @roms ) {
85 82
     merge_entry_points ( $baserom_pnp->{bev}, $rom_pnp->{bev}, $offset );
86 83
   }
87 84
 
85
+  # Update iPXE header, if present
86
+  my $baserom_ipxe = $baserom->ipxe_header;
87
+  my $rom_ipxe = $rom->ipxe_header;
88
+  if ( $baserom_ipxe ) {
89
+
90
+    # Update shrunk length
91
+    $baserom_ipxe->{shrunk_length} = ( $baserom->{length} +
92
+				       ( $rom_ipxe ?
93
+					 $rom_ipxe->{shrunk_length} :
94
+					 $rom->{length} ) );
95
+
96
+    # Fix checksum
97
+    $baserom_ipxe->fix_checksum();
98
+  }
99
+
100
+  # Update base length
101
+  $baserom->{length} += $rom->{length};
102
+
88 103
   # Fix checksum for this ROM segment
89 104
   $rom->fix_checksum();
90 105
 

Loading…
Cancel
Save