|
|
4210fa |
From fa525bc4632e04346fae82a98ce23b31c6cfc86d Mon Sep 17 00:00:00 2001
|
|
|
4210fa |
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
|
|
4210fa |
Date: Tue, 12 Aug 2014 15:33:22 +0200
|
|
|
4210fa |
Subject: [PATCH 49/74] Add support for 32-bit ARM
|
|
|
4210fa |
|
|
|
4210fa |
This adds support for building the shim for a 32-bit ARM UEFI environment.
|
|
|
4210fa |
|
|
|
4210fa |
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
|
|
4210fa |
---
|
|
|
4210fa |
Cryptlib/OpenSSL/Makefile | 3 +++
|
|
|
4210fa |
Makefile | 10 ++++++++
|
|
|
4210fa |
cert.S | 30 ++++++++++------------
|
|
|
4210fa |
elf_arm_efi.lds | 65 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
4210fa |
4 files changed, 92 insertions(+), 16 deletions(-)
|
|
|
4210fa |
create mode 100644 elf_arm_efi.lds
|
|
|
4210fa |
|
|
|
4210fa |
diff --git a/Cryptlib/OpenSSL/Makefile b/Cryptlib/OpenSSL/Makefile
|
|
|
4210fa |
index 17b5695..7990b3c 100644
|
|
|
4210fa |
--- a/Cryptlib/OpenSSL/Makefile
|
|
|
4210fa |
+++ b/Cryptlib/OpenSSL/Makefile
|
|
|
4210fa |
@@ -15,6 +15,9 @@ endif
|
|
|
4210fa |
ifeq ($(ARCH),aarch64)
|
|
|
4210fa |
CFLAGS += -O2 -DSIXTY_FOUR_BIT_LONG -ffreestanding -I$(shell $(CC) -print-file-name=include)
|
|
|
4210fa |
endif
|
|
|
4210fa |
+ifeq ($(ARCH),arm)
|
|
|
4210fa |
+ CFLAGS += -O2 -DTHIRTY_TWO_BIT -ffreestanding -I$(shell $(CC) -print-file-name=include)
|
|
|
4210fa |
+endif
|
|
|
4210fa |
LDFLAGS = -nostdlib -znocombreloc
|
|
|
4210fa |
|
|
|
4210fa |
TARGET = libopenssl.a
|
|
|
4210fa |
diff --git a/Makefile b/Makefile
|
|
|
4210fa |
index 3529b45..5bc513c 100644
|
|
|
4210fa |
--- a/Makefile
|
|
|
4210fa |
+++ b/Makefile
|
|
|
4210fa |
@@ -41,6 +41,10 @@ ifeq ($(ARCH),aarch64)
|
|
|
4210fa |
CFLAGS += -ffreestanding -I$(shell $(CC) -print-file-name=include)
|
|
|
4210fa |
endif
|
|
|
4210fa |
|
|
|
4210fa |
+ifeq ($(ARCH),arm)
|
|
|
4210fa |
+ CFLAGS += -ffreestanding -I$(shell $(CC) -print-file-name=include)
|
|
|
4210fa |
+endif
|
|
|
4210fa |
+
|
|
|
4210fa |
ifneq ($(origin VENDOR_CERT_FILE), undefined)
|
|
|
4210fa |
CFLAGS += -DVENDOR_CERT_FILE=\"$(VENDOR_CERT_FILE)\"
|
|
|
4210fa |
endif
|
|
|
4210fa |
@@ -118,6 +122,12 @@ SUBSYSTEM := 0xa
|
|
|
4210fa |
LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
|
|
|
4210fa |
endif
|
|
|
4210fa |
|
|
|
4210fa |
+ifeq ($(ARCH),arm)
|
|
|
4210fa |
+FORMAT := -O binary
|
|
|
4210fa |
+SUBSYSTEM := 0xa
|
|
|
4210fa |
+LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
|
|
|
4210fa |
+endif
|
|
|
4210fa |
+
|
|
|
4210fa |
FORMAT ?= --target efi-app-$(ARCH)
|
|
|
4210fa |
|
|
|
4210fa |
%.efi: %.so
|
|
|
4210fa |
diff --git a/cert.S b/cert.S
|
|
|
4210fa |
index 3cfd665..cfc4525 100644
|
|
|
4210fa |
--- a/cert.S
|
|
|
4210fa |
+++ b/cert.S
|
|
|
4210fa |
@@ -1,9 +1,7 @@
|
|
|
4210fa |
.globl cert_table
|
|
|
4210fa |
- .data
|
|
|
4210fa |
- .align 16
|
|
|
4210fa |
- .type cert_table, @object
|
|
|
4210fa |
+ .type cert_table, %object
|
|
|
4210fa |
.size cert_table, 4
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
cert_table:
|
|
|
4210fa |
#if defined(VENDOR_CERT_FILE)
|
|
|
4210fa |
.long vendor_cert_priv_end - vendor_cert_priv
|
|
|
4210fa |
@@ -20,48 +18,48 @@ cert_table:
|
|
|
4210fa |
#if defined(VENDOR_CERT_FILE)
|
|
|
4210fa |
.data
|
|
|
4210fa |
.align 1
|
|
|
4210fa |
- .type vendor_cert_priv, @object
|
|
|
4210fa |
+ .type vendor_cert_priv, %object
|
|
|
4210fa |
.size vendor_cert_priv, vendor_cert_priv_end-vendor_cert_priv
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
vendor_cert_priv:
|
|
|
4210fa |
.incbin VENDOR_CERT_FILE
|
|
|
4210fa |
vendor_cert_priv_end:
|
|
|
4210fa |
#else
|
|
|
4210fa |
.bss
|
|
|
4210fa |
- .type vendor_cert_priv, @object
|
|
|
4210fa |
+ .type vendor_cert_priv, %object
|
|
|
4210fa |
.size vendor_cert_priv, 1
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
vendor_cert_priv:
|
|
|
4210fa |
.zero 1
|
|
|
4210fa |
|
|
|
4210fa |
.data
|
|
|
4210fa |
.align 4
|
|
|
4210fa |
- .type vendor_cert_size_priv, @object
|
|
|
4210fa |
+ .type vendor_cert_size_priv, %object
|
|
|
4210fa |
.size vendor_cert_size_priv, 4
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
vendor_cert_priv_end:
|
|
|
4210fa |
#endif
|
|
|
4210fa |
#if defined(VENDOR_DBX_FILE)
|
|
|
4210fa |
.data
|
|
|
4210fa |
.align 1
|
|
|
4210fa |
- .type vendor_dbx_priv, @object
|
|
|
4210fa |
+ .type vendor_dbx_priv, %object
|
|
|
4210fa |
.size vendor_dbx_priv, vendor_dbx_priv_end-vendor_dbx_priv
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
vendor_dbx_priv:
|
|
|
4210fa |
.incbin VENDOR_DBX_FILE
|
|
|
4210fa |
vendor_dbx_priv_end:
|
|
|
4210fa |
#else
|
|
|
4210fa |
.bss
|
|
|
4210fa |
- .type vendor_dbx_priv, @object
|
|
|
4210fa |
+ .type vendor_dbx_priv, %object
|
|
|
4210fa |
.size vendor_dbx_priv, 1
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
vendor_dbx_priv:
|
|
|
4210fa |
.zero 1
|
|
|
4210fa |
|
|
|
4210fa |
.data
|
|
|
4210fa |
.align 4
|
|
|
4210fa |
- .type vendor_dbx_size_priv, @object
|
|
|
4210fa |
+ .type vendor_dbx_size_priv, %object
|
|
|
4210fa |
.size vendor_dbx_size_priv, 4
|
|
|
4210fa |
- .section .vendor_cert, "a", @progbits
|
|
|
4210fa |
+ .section .vendor_cert, "a", %progbits
|
|
|
4210fa |
vendor_dbx_priv_end:
|
|
|
4210fa |
#endif
|
|
|
4210fa |
diff --git a/elf_arm_efi.lds b/elf_arm_efi.lds
|
|
|
4210fa |
new file mode 100644
|
|
|
4210fa |
index 0000000..fd1075d
|
|
|
4210fa |
--- /dev/null
|
|
|
4210fa |
+++ b/elf_arm_efi.lds
|
|
|
4210fa |
@@ -0,0 +1,65 @@
|
|
|
4210fa |
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
|
|
4210fa |
+OUTPUT_ARCH(arm)
|
|
|
4210fa |
+ENTRY(_start)
|
|
|
4210fa |
+SECTIONS
|
|
|
4210fa |
+{
|
|
|
4210fa |
+ .text 0x0 : {
|
|
|
4210fa |
+ *(.text.head)
|
|
|
4210fa |
+ *(.text)
|
|
|
4210fa |
+ *(.text.*)
|
|
|
4210fa |
+ *(.gnu.linkonce.t.*)
|
|
|
4210fa |
+ *(.srodata)
|
|
|
4210fa |
+ *(.rodata*)
|
|
|
4210fa |
+ . = ALIGN(16);
|
|
|
4210fa |
+ _etext = .;
|
|
|
4210fa |
+ }
|
|
|
4210fa |
+ .dynamic : { *(.dynamic) }
|
|
|
4210fa |
+ .data :
|
|
|
4210fa |
+ {
|
|
|
4210fa |
+ *(.sdata)
|
|
|
4210fa |
+ *(.data)
|
|
|
4210fa |
+ *(.data1)
|
|
|
4210fa |
+ *(.data)
|
|
|
4210fa |
+ *(.got.plt)
|
|
|
4210fa |
+ *(.got)
|
|
|
4210fa |
+
|
|
|
4210fa |
+ /* the EFI loader doesn't seem to like a .bss section, so we stick
|
|
|
4210fa |
+ it all into .data: */
|
|
|
4210fa |
+ . = ALIGN(16);
|
|
|
4210fa |
+ _bss = .;
|
|
|
4210fa |
+ *(.sbss)
|
|
|
4210fa |
+ *(.scommon)
|
|
|
4210fa |
+ *(.dynbss)
|
|
|
4210fa |
+ *(.bss)
|
|
|
4210fa |
+ *(COMMON)
|
|
|
4210fa |
+ . = ALIGN(16);
|
|
|
4210fa |
+ _bss_end = .;
|
|
|
4210fa |
+ }
|
|
|
4210fa |
+
|
|
|
4210fa |
+ . = ALIGN(4096);
|
|
|
4210fa |
+ .vendor_cert :
|
|
|
4210fa |
+ {
|
|
|
4210fa |
+ *(.vendor_cert)
|
|
|
4210fa |
+ }
|
|
|
4210fa |
+ . = ALIGN(4096);
|
|
|
4210fa |
+
|
|
|
4210fa |
+ .rel.dyn : { *(.rel.dyn) }
|
|
|
4210fa |
+ .rel.plt : { *(.rel.plt) }
|
|
|
4210fa |
+ .rel.got : { *(.rel.got) }
|
|
|
4210fa |
+ .rel.data : { *(.rel.data) *(.rel.data*) }
|
|
|
4210fa |
+ _edata = .;
|
|
|
4210fa |
+ _data_size = . - _etext;
|
|
|
4210fa |
+
|
|
|
4210fa |
+ . = ALIGN(4096);
|
|
|
4210fa |
+ .dynsym : { *(.dynsym) }
|
|
|
4210fa |
+ . = ALIGN(4096);
|
|
|
4210fa |
+ .dynstr : { *(.dynstr) }
|
|
|
4210fa |
+ . = ALIGN(4096);
|
|
|
4210fa |
+ /DISCARD/ :
|
|
|
4210fa |
+ {
|
|
|
4210fa |
+ *(.rel.reloc)
|
|
|
4210fa |
+ *(.eh_frame)
|
|
|
4210fa |
+ *(.note.GNU-stack)
|
|
|
4210fa |
+ }
|
|
|
4210fa |
+ .comment 0 : { *(.comment) }
|
|
|
4210fa |
+}
|
|
|
4210fa |
--
|
|
|
4210fa |
1.9.3
|
|
|
4210fa |
|