Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / util / catrom.pl
1 #!/usr/bin/perl -w
2
3 use warnings;
4 use strict;
5
6 use FindBin;
7 use lib "$FindBin::Bin";
8 use Option::ROM qw ( :all );
9
10 my @romfiles = @ARGV
11     or die "Usage: $0 rom-file-1 rom-file-2 ... > multi-rom-file\n";
12
13 while ( my $romfile = shift @romfiles ) {
14
15   # Read ROM file
16   my $rom = new Option::ROM;
17   $rom->load ( $romfile );
18
19   # Tag final image as non-final in all except the final ROM
20   if ( @romfiles ) {
21     my $image = $rom;
22     $image = $image->next_image() while $image->next_image();
23     $image->pci_header->{last_image} &= ~PCI_LAST_IMAGE;
24     $image->fix_checksum();
25   }
26
27   # Write ROM file to STDOUT
28   $rom->save ( "-" );
29 }