diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-06-10 18:25:26 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-06-12 15:15:03 +0100 |
commit | 9e8d431a0d58caba3c5f65d4e30fd259d2f782e1 (patch) | |
tree | 357391dd1bbd9b6f0d98dd099aafec60f9bdf80e /src/util | |
parent | 12be8bc544b25fbed1fa5ef6c89cad42aaa268ea (diff) | |
download | ipxe-9e8d431a0d58caba3c5f65d4e30fd259d2f782e1.tar.gz |
[romprefix] Add a dummy ROM header to cover the .mrom payload
The header of a .mrom image declares its length to be only a few
kilobytes; the remainder is accessed via a sideband mechanism. This
makes it difficult to append an additional ROM image, such as an EFI
ROM.
Add a second, dummy ROM header covering the payload portion of the
.mrom image, allowing consumers to locate any appended ROM images in
the usual way.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/zbin.c | 70 |
1 files changed, 62 insertions, 8 deletions
diff --git a/src/util/zbin.c b/src/util/zbin.c index a9195164..0dabaf1e 100644 --- a/src/util/zbin.c +++ b/src/util/zbin.c @@ -237,15 +237,15 @@ static int process_zinfo_add ( struct input_file *input __attribute__ (( unused )), struct output_file *output, size_t len, - struct zinfo_add *add, + struct zinfo_add *add, size_t offset, size_t datasize ) { - size_t offset = add->offset; void *target; signed long addend; unsigned long size; signed long val; unsigned long mask; + offset += add->offset; if ( ( offset + datasize ) > output->len ) { fprintf ( stderr, "Add at %#zx outside output buffer\n", offset ); @@ -319,42 +319,90 @@ static int process_zinfo_addb ( struct input_file *input, struct output_file *output, union zinfo_record *zinfo ) { return process_zinfo_add ( input, output, output->len, - &zinfo->add, 1 ); + &zinfo->add, 0, 1 ); } static int process_zinfo_addw ( struct input_file *input, struct output_file *output, union zinfo_record *zinfo ) { return process_zinfo_add ( input, output, output->len, - &zinfo->add, 2 ); + &zinfo->add, 0, 2 ); } static int process_zinfo_addl ( struct input_file *input, struct output_file *output, union zinfo_record *zinfo ) { return process_zinfo_add ( input, output, output->len, - &zinfo->add, 4 ); + &zinfo->add, 0, 4 ); } static int process_zinfo_adhb ( struct input_file *input, struct output_file *output, union zinfo_record *zinfo ) { return process_zinfo_add ( input, output, output->hdr_len, - &zinfo->add, 1 ); + &zinfo->add, 0, 1 ); } static int process_zinfo_adhw ( struct input_file *input, struct output_file *output, union zinfo_record *zinfo ) { return process_zinfo_add ( input, output, output->hdr_len, - &zinfo->add, 2 ); + &zinfo->add, 0, 2 ); } static int process_zinfo_adhl ( struct input_file *input, struct output_file *output, union zinfo_record *zinfo ) { return process_zinfo_add ( input, output, output->hdr_len, - &zinfo->add, 4 ); + &zinfo->add, 0, 4 ); +} + +static int process_zinfo_adpb ( struct input_file *input, + struct output_file *output, + union zinfo_record *zinfo ) { + return process_zinfo_add ( input, output, + ( output->len - output->hdr_len ), + &zinfo->add, 0, 1 ); +} + +static int process_zinfo_adpw ( struct input_file *input, + struct output_file *output, + union zinfo_record *zinfo ) { + return process_zinfo_add ( input, output, + ( output->len - output->hdr_len ), + &zinfo->add, 0, 2 ); +} + +static int process_zinfo_adpl ( struct input_file *input, + struct output_file *output, + union zinfo_record *zinfo ) { + return process_zinfo_add ( input, output, + ( output->len - output->hdr_len ), + &zinfo->add, 0, 4 ); +} + +static int process_zinfo_appb ( struct input_file *input, + struct output_file *output, + union zinfo_record *zinfo ) { + return process_zinfo_add ( input, output, + ( output->len - output->hdr_len ), + &zinfo->add, output->hdr_len, 1 ); +} + +static int process_zinfo_appw ( struct input_file *input, + struct output_file *output, + union zinfo_record *zinfo ) { + return process_zinfo_add ( input, output, + ( output->len - output->hdr_len ), + &zinfo->add, output->hdr_len, 2 ); +} + +static int process_zinfo_appl ( struct input_file *input, + struct output_file *output, + union zinfo_record *zinfo ) { + return process_zinfo_add ( input, output, + ( output->len - output->hdr_len ), + &zinfo->add, output->hdr_len, 4 ); } struct zinfo_processor { @@ -374,6 +422,12 @@ static struct zinfo_processor zinfo_processors[] = { { "ADHB", process_zinfo_adhb }, { "ADHW", process_zinfo_adhw }, { "ADHL", process_zinfo_adhl }, + { "ADPB", process_zinfo_adpb }, + { "ADPW", process_zinfo_adpw }, + { "ADPL", process_zinfo_adpl }, + { "APPB", process_zinfo_appb }, + { "APPW", process_zinfo_appw }, + { "APPL", process_zinfo_appl }, }; static int process_zinfo ( struct input_file *input, |