[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>
This commit is contained in:
Michael Brown
2012-06-10 18:25:26 +01:00
parent 12be8bc544
commit 9e8d431a0d
5 changed files with 198 additions and 74 deletions

View File

@@ -663,18 +663,22 @@ install_prealloc:
/* Save decompression temporary area physical address */
pushl %edi
/* Install .text16.early */
/* Install .text16.early and calculate %ecx as offset to next block */
progress " .text16.early\n"
pushl %esi
xorl %esi, %esi
movw %cs, %si
shll $4, %esi
pushl %esi /* Save original %cs:0000 */
addl $_text16_early_lma, %esi
movzwl %ax, %edi
shll $4, %edi
movl $_text16_early_filesz, %ecx
movl $_text16_early_memsz, %edx
call install_block /* .text16.early */
popl %ecx /* Calculate offset to next block */
subl %esi, %ecx
negl %ecx
popl %esi
#ifndef KEEP_IT_REAL
@@ -729,7 +733,7 @@ payload_death_message:
jnz 1f
movw %cs, %si
shll $4, %esi
1: addl payload_lma, %esi
1: addl %ecx, %esi
/* Install .text16.late and .data16 */
progress " .text16.late\n"
@@ -850,17 +854,6 @@ close_payload_vector:
.word 0
.size close_payload_vector, . - close_payload_vector
/* Payload address */
.section ".prefix.lib", "awx", @progbits
payload_lma:
.long 0
.section ".zinfo.fixup", "a", @progbits /* Compressor fixups */
.ascii "ADHL"
.long payload_lma
.long 1
.long 0
.previous
/* Dummy routines to open and close payload */
.section ".text16.early.data", "aw", @progbits
.weak open_payload
@@ -914,6 +907,10 @@ uninstall:
.ascii "PAYL"
.long 0
.long 0
.long _payload_align
.ascii "COPY"
.long _pprefix_lma
.long _pprefix_filesz
.long _max_align
.ascii PACK_OR_COPY
.long _text16_late_lma
@@ -927,3 +924,6 @@ uninstall:
.long _textdata_lma
.long _textdata_filesz
.long _max_align
.weak _payload_align
.equ _payload_align, 1