sysutils/shim: introduce new ARCH support (i386)

Makefile
        bump PORTREVISION;
        USE_CSTD: gnu89 became gnu99 [0];

    files/
        *: if ARCH=i386, replaces ARCH with ia32;
        elf_ia32_efi.lds: sync OUTPUT_FORMAT [1];
        MokManager.c: used UINT32 for MokNum.

Reported by:	pkg-fallout
Approved by:	araujo (mentor)
Differential Revision:	https://reviews.freebsd.org/D18572

[0] shim.c:2176:3: error: this decimal constant is unsigned only in ISO C90
[1] patch-elf_x86_64_efi.lds always appended -freebsd as OUTPUT_FORMAT
This commit is contained in:
Vinícius Zavam 2018-12-19 17:30:22 +00:00
parent f20fc578b3
commit b3cd746e21
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=487805
7 changed files with 44 additions and 8 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= shim
PORTVERSION= 0.9
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MAINTAINER= egypcio@FreeBSD.org
@ -16,7 +16,7 @@ BUILD_DEPENDS= ${LOCALBASE}/lib/libgnuefi.a:devel/gnu-efi \
bash:shells/bash
USES= compiler gmake shebangfix
USE_CSTD= gnu89
USE_CSTD= gnu99
USE_GCC= yes
SHEBANG_FILES= make-certs

View File

@ -1,8 +1,11 @@
--- Cryptlib/Makefile.orig 2015-06-30 18:20:12 UTC
+++ Cryptlib/Makefile
@@ -1,3 +1,6 @@
@@ -1,3 +1,9 @@
+ifeq ($(ARCH),amd64)
+ override ARCH = x86_64
+endif
+ifeq ($(ARCH),i386)
+ override ARCH = ia32
+endif
EFI_INCLUDES = -IInclude -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol

View File

@ -1,8 +1,11 @@
--- Cryptlib/OpenSSL/Makefile.orig 2015-06-30 18:20:12 UTC
+++ Cryptlib/OpenSSL/Makefile
@@ -1,3 +1,6 @@
@@ -1,3 +1,9 @@
+ifeq ($(ARCH),amd64)
+ override ARCH = x86_64
+endif
+ifeq ($(ARCH),i386)
+ override ARCH = ia32
+endif
EFI_INCLUDES = -I../Include -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol

View File

@ -7,7 +7,7 @@
ifneq ($(RELEASE),"")
RELEASE="-$(RELEASE)"
endif
@@ -9,15 +9,20 @@ LD = $(CROSS_COMPILE)ld
@@ -9,15 +9,23 @@ LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
ARCH = $(shell $(CC) -dumpmachine | cut -f1 -d- | sed s,i[3456789]86,ia32,)
@ -15,6 +15,9 @@
+ifeq ($(ARCH),amd64)
+ override ARCH := x86_64
+endif
+ifeq ($(ARCH),i386)
+ override ARCH := ia32
+endif
+
OBJCOPY_GTE224 = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.* //g' | cut -f1-2 -d.` \>= 2.24)
@ -32,7 +35,7 @@
LIB_GCC = $(shell $(CC) -print-libgcc-file-name)
EFI_LIBS = -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group $(LIB_GCC)
@@ -65,7 +70,7 @@ endif
@@ -65,7 +73,7 @@ endif
LDFLAGS = --hash-style=sysv -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_PATH) -L$(LIB_PATH) -LCryptlib -LCryptlib/OpenSSL $(EFI_CRT_OBJS) --build-id=sha1
@ -41,7 +44,7 @@
OBJS = shim.o netboot.o cert.o replacements.o version.o
KEYS = shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key shim.cer
SOURCES = shim.c shim.h netboot.c include/PeImage.h include/wincert.h include/console.h replacements.c replacements.h version.c version.h
@@ -156,9 +161,6 @@ endif
@@ -156,9 +164,6 @@ endif
-j .note.gnu.build-id \
$(FORMAT) $^ $@.debug

View File

@ -0,0 +1,16 @@
--- MokManager.c.orig 2015-06-30 18:20:12 UTC
+++ MokManager.c
@@ -588,11 +588,11 @@ static void show_mok_info (EFI_GUID Type
static EFI_STATUS list_keys (void *KeyList, UINTN KeyListSize, CHAR16 *title)
{
- INTN MokNum = 0;
+ UINT32 MokNum = 0;
MokListNode *keys = NULL;
UINT32 key_num = 0;
CHAR16 **menu_strings;
- int i;
+ UINT32 i;
if (KeyListSize < (sizeof(EFI_SIGNATURE_LIST) +
sizeof(EFI_SIGNATURE_DATA))) {

View File

@ -0,0 +1,8 @@
--- elf_ia32_efi.lds.orig 2018-12-15 14:43:25 UTC
+++ elf_ia32_efi.lds
@@ -1,4 +1,4 @@
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS

View File

@ -1,9 +1,12 @@
--- lib/Makefile.orig 2015-06-30 18:20:12 UTC
+++ lib/Makefile
@@ -1,3 +1,7 @@
@@ -1,3 +1,10 @@
+ifeq ($(ARCH),amd64)
+ override ARCH = x86_64
+endif
+ifeq ($(ARCH),i386)
+ override ARCH = ia32
+endif
+
TARGET = lib.a