Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 483030 | Differences between
and this patch

Collapse All | Expand All

(-)a/Make.rules (-14 / +16 lines)
Lines 1-11 Link Here
1
EFISIGNED = $(patsubst %.efi,%-signed.efi,$(EFIFILES))
1
EFISIGNED	= $(patsubst %.efi,%-signed.efi,$(EFIFILES))
2
MANPAGES = $(patsubst doc/%.1.in,doc/%.1,$(wildcard doc/*.1.in))
2
MANPAGES	= $(patsubst doc/%.1.in,doc/%.1,$(wildcard doc/*.1.in))
3
HELP2MAN = help2man
3
HELP2MAN	= help2man
4
ARCH	= $(shell uname -m)
4
ARCH		= $(shell uname -m)
5
INCDIR	   = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
5
INCDIR		= -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
6
CPPFLAGS   = -DCONFIG_$(ARCH)
6
CPPFLAGS_EFI	= -DCONFIG_$(ARCH)
7
CFLAGS	   = -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector -g
7
CFLAGS		?= -O2 -g
8
LDFLAGS	   = -nostdlib
8
LDFLAGS		?= -Wl,-O1 -Wl,--as-needed
9
CFLAGS_EFI	= -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector -g
10
LDFLAGS_EFI	= -nostdlib
9
CRTOBJ		= crt0-efi-$(ARCH).o
11
CRTOBJ		= crt0-efi-$(ARCH).o
10
CRTPATHS	= /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi
12
CRTPATHS	= /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi
11
CRTPATH		= $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done)
13
CRTPATH		= $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done)
Lines 13-19 CRTOBJS = $(CRTPATH)/$(CRTOBJ) Link Here
13
# there's a bug in the gnu tools ... the .reloc section has to be
15
# there's a bug in the gnu tools ... the .reloc section has to be
14
# aligned otherwise the file alignment gets screwed up
16
# aligned otherwise the file alignment gets screwed up
15
LDSCRIPT	= $(TOPDIR)/elf_$(ARCH)_efi.lds
17
LDSCRIPT	= $(TOPDIR)/elf_$(ARCH)_efi.lds
16
LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH)
18
LDFLAGS_EFI	+= -T $(LDSCRIPT) -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH)
17
LOADLIBES	= -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
19
LOADLIBES	= -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
18
FORMAT		= efi-app-$(ARCH)
20
FORMAT		= efi-app-$(ARCH)
19
OBJCOPY		= objcopy
21
OBJCOPY		= objcopy
Lines 25-31 EFIDIR = $(DESTDIR)/usr/share/efitools/efi Link Here
25
DOCDIR		= $(DESTDIR)/usr/share/efitools
27
DOCDIR		= $(DESTDIR)/usr/share/efitools
26
28
27
ifeq ($(ARCH),x86_64)
29
ifeq ($(ARCH),x86_64)
28
  CFLAGS += -DEFI_FUNCTION_WRAPPER
30
	CFLAGS_EFI += -DEFI_FUNCTION_WRAPPER
29
endif
31
endif
30
32
31
%.efi: %.so
33
%.efi: %.so
Lines 33-39 endif Link Here
33
		-j .rela -j .reloc --target=$(FORMAT) $*.so $@
35
		-j .rela -j .reloc --target=$(FORMAT) $*.so $@
34
36
35
%.so: %.o
37
%.so: %.o
36
	$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
38
	$(LD) $(LDFLAGS_EFI) $^ -o $@ $(LOADLIBES)
37
	# check we have no undefined symbols
39
	# check we have no undefined symbols
38
	nm -D $@ | grep ' U ' && exit 1 || exit 0
40
	nm -D $@ | grep ' U ' && exit 1 || exit 0
39
41
Lines 47-59 endif Link Here
47
	./cert-to-efi-sig-list -g $(MYGUID) $< $@
49
	./cert-to-efi-sig-list -g $(MYGUID) $< $@
48
50
49
%.o: %.c
51
%.o: %.c
50
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
52
	$(CC) $(INCDIR) $(CFLAGS_EFI) $(CPPFLAGS_EFI) -c $< -o $@
51
53
52
%.efi.o: %.c
54
%.efi.o: %.c
53
	$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@
55
	$(CC) $(INCDIR) $(CFLAGS_EFI) $(CPPFLAGS_EFI) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@
54
56
55
%.efi.s: %.c
57
%.efi.s: %.c
56
	$(CC) -S $(INCDIR) $(CFLAGS) $(CPPFLAGS) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@
58
	$(CC) -S $(INCDIR) $(CFLAGS_EFI) $(CPPFLAGS_EFI) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@
57
59
58
60
59
%.cer: %.crt
61
%.cer: %.crt
(-)a/Makefile (-8 / +7 lines)
Lines 76-100 PreLoader.so: lib/lib-efi.a Link Here
76
HelloWorld.so: lib/lib-efi.a
76
HelloWorld.so: lib/lib-efi.a
77
77
78
cert-to-efi-sig-list: cert-to-efi-sig-list.o lib/lib.a
78
cert-to-efi-sig-list: cert-to-efi-sig-list.o lib/lib.a
79
	$(CC) -o $@ $< -lcrypto lib/lib.a
79
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) -lcrypto lib/lib.a
80
80
81
sig-list-to-certs: sig-list-to-certs.o lib/lib.a
81
sig-list-to-certs: sig-list-to-certs.o lib/lib.a
82
	$(CC) -o $@ $< -lcrypto lib/lib.a
82
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) -lcrypto lib/lib.a
83
83
84
sign-efi-sig-list: sign-efi-sig-list.o lib/lib.a
84
sign-efi-sig-list: sign-efi-sig-list.o lib/lib.a
85
	$(CC) -o $@ $< -lcrypto lib/lib.a
85
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) -lcrypto lib/lib.a
86
86
87
hash-to-efi-sig-list: hash-to-efi-sig-list.o lib/lib.a
87
hash-to-efi-sig-list: hash-to-efi-sig-list.o lib/lib.a
88
	$(CC) -o $@ $< lib/lib.a
88
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) lib/lib.a
89
89
90
efi-keytool: efi-keytool.o lib/lib.a
90
efi-keytool: efi-keytool.o lib/lib.a
91
	$(CC) -o $@ $< lib/lib.a
91
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) lib/lib.a
92
92
93
efi-readvar: efi-readvar.o lib/lib.a
93
efi-readvar: efi-readvar.o lib/lib.a
94
	$(CC) -o $@ $< -lcrypto lib/lib.a
94
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) -lcrypto lib/lib.a
95
95
96
efi-updatevar: efi-updatevar.o lib/lib.a
96
efi-updatevar: efi-updatevar.o lib/lib.a
97
	$(CC) -o $@ $< -lcrypto lib/lib.a
97
	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) -lcrypto lib/lib.a
98
98
99
clean:
99
clean:
100
	rm -f PK.* KEK.* DB.* $(EFIFILES) $(EFISIGNED) $(BINARIES) *.o *.so
100
	rm -f PK.* KEK.* DB.* $(EFIFILES) $(EFISIGNED) $(BINARIES) *.o *.so
101
- 

Return to bug 483030