sbsigntool: add support for ARM and Aarch64 PE/COFF images
Note that for the ARM case, we are using IMAGE_FILE_MACHINE_THUMB (0x1c2) rather than IMAGE_FILE_MACHINE_ARM (0x1c0), as the latter refers to an older calling convention that is incompatible with Tianocore UEFI. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
84d8361642
commit
ca6ad33055
2 changed files with 9 additions and 5 deletions
|
@ -151,6 +151,7 @@
|
|||
#define IMAGE_FILE_MACHINE_THUMB 0x01c2
|
||||
#define IMAGE_FILE_MACHINE_TRICORE 0x0520
|
||||
#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
|
||||
#define IMAGE_FILE_MACHINE_AARCH64 0xaa64
|
||||
|
||||
#define IMAGE_SUBSYSTEM_UNKNOWN 0
|
||||
#define IMAGE_SUBSYSTEM_NATIVE 1
|
||||
|
|
13
src/image.c
13
src/image.c
|
@ -237,13 +237,16 @@ static int image_pecoff_parse(struct image *image)
|
|||
image->opthdr.addr = image->pehdr + 1;
|
||||
magic = pehdr_u16(image->pehdr->f_magic);
|
||||
|
||||
if (magic == IMAGE_FILE_MACHINE_AMD64) {
|
||||
switch (magic) {
|
||||
case IMAGE_FILE_MACHINE_AMD64:
|
||||
case IMAGE_FILE_MACHINE_AARCH64:
|
||||
rc = image_pecoff_parse_64(image);
|
||||
|
||||
} else if (magic == IMAGE_FILE_MACHINE_I386) {
|
||||
break;
|
||||
case IMAGE_FILE_MACHINE_I386:
|
||||
case IMAGE_FILE_MACHINE_THUMB:
|
||||
rc = image_pecoff_parse_32(image);
|
||||
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Invalid PE header magic\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue