tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
xen: Build Xen EFI binary
Alexei Robyn
5 years ago
22fdd246
6048a3c1
+93
-4
3 changed files
expand all
collapse all
unified
split
pkgs
applications
virtualization
xen
0004-makefile-use-efi-ld.patch
0005-makefile-fix-efi-mountdir-use.patch
generic.nix
+36
pkgs/applications/virtualization/xen/0004-makefile-use-efi-ld.patch
···
1
1
+
diff -Naur xen-4.10.4-orig/xen/arch/x86/Makefile xen-4.10.4-patched/xen/arch/x86/Makefile
2
2
+
--- xen-4.10.4-orig/xen/arch/x86/Makefile 2019-07-04 01:28:50.000000000 +1000
3
3
+
+++ xen-4.10.4-patched/xen/arch/x86/Makefile 2020-03-03 13:32:34.607951507 +1100
4
4
+
@@ -166,7 +166,7 @@
5
5
+
# Check if the compiler supports the MS ABI.
6
6
+
export XEN_BUILD_EFI := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
7
7
+
# Check if the linker supports PE.
8
8
+
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y))
9
9
+
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(EFI_LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y))
10
10
+
CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
11
11
+
12
12
+
$(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
13
13
+
@@ -188,20 +188,20 @@
14
14
+
15
15
+
$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
16
16
+
$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
17
17
+
- $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
18
18
+
+ $(guard) $(EFI_LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
19
19
+
$(BASEDIR)/common/symbols-dummy.o $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
20
20
+
$(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
21
21
+
$(guard) $(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
22
22
+
| $(guard) $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
23
23
+
$(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
24
24
+
$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
25
25
+
- $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
26
26
+
+ $(guard) $(EFI_LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
27
27
+
$(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file) -o $(@D)/.$(@F).$(base).1 &&) :
28
28
+
$(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
29
29
+
$(guard) $(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
30
30
+
| $(guard) $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
31
31
+
$(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
32
32
+
- $(guard) $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
33
33
+
+ $(guard) $(EFI_LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
34
34
+
$(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file) -o $@
35
35
+
if $(guard) false; then rm -f $@; echo 'EFI support disabled'; \
36
36
+
else $(NM) -pa --format=sysv $(@D)/$(@F) \
+35
pkgs/applications/virtualization/xen/0005-makefile-fix-efi-mountdir-use.patch
···
1
1
+
EFI_MOUNTPOINT is conventionally /boot/efi or /boot/EFI or something
2
2
+
like that, and (on my machine) has directories within that called
3
3
+
{Boot, nixos, gummiboot}.
4
4
+
5
5
+
This patch does two things:
6
6
+
7
7
+
1) Xen apparently wants to put files in
8
8
+
$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR) - we remove the duplicate 'efi' name
9
9
+
because I can't see why we have it
10
10
+
11
11
+
2) Ensures the said directory exists
12
12
+
13
13
+
14
14
+
--- a/xen/Makefile 2016-01-08 01:50:58.028045657 +0000
15
15
+
+++ b/xen/Makefile 2016-01-08 01:51:33.560268718 +0000
16
16
+
@@ -49,7 +49,9 @@
17
17
+
ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).efi; \
18
18
+
ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T).efi; \
19
19
+
if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \
20
20
+
- $(INSTALL_DATA) $(TARGET).efi $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi; \
21
21
+
+ [ -d $(D)$(EFI_MOUNTPOINT)/$(EFI_VENDOR) ] || \
22
22
+
+ $(INSTALL_DIR) $(D)$(EFI_MOUNTPOINT)/$(EFI_VENDOR) ;\
23
23
+
+ $(INSTALL_DATA) $(TARGET).efi $(D)$(EFI_MOUNTPOINT)/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi; \
24
24
+
elif [ "$(D)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(D))" ]; then \
25
25
+
echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \
26
26
+
fi; \
27
27
+
@@ -69,7 +69,7 @@
28
28
+
rm -f $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).$(XEN_SUBVERSION).efi
29
29
+
rm -f $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).efi
30
30
+
rm -f $(D)$(EFI_DIR)/$(T).efi
31
31
+
- rm -f $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi
32
32
+
+ rm -f $(D)$(EFI_MOUNTPOINT)/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi
33
33
+
34
34
+
.PHONY: _debug
35
35
+
_debug:
+22
-4
pkgs/applications/virtualization/xen/generic.nix
···
20
20
# python2Packages.markdown
21
21
, transfig, ghostscript, texinfo, pandoc
22
22
23
23
+
, binutils-unwrapped
24
24
+
23
25
, ...} @ args:
24
26
25
27
with stdenv.lib;
···
42
44
}
43
45
( __do )
44
46
'');
47
47
+
48
48
+
# We don't want to use the wrapped version, because this version of ld is
49
49
+
# only used for linking the Xen EFI binary, and the build process really
50
50
+
# needs control over the LDFLAGS used
51
51
+
efiBinutils = binutils-unwrapped.overrideAttrs (oldAttrs: {
52
52
+
name = "efi-binutils";
53
53
+
configureFlags = oldAttrs.configureFlags ++ [
54
54
+
"--enable-targets=x86_64-pep"
55
55
+
];
56
56
+
doInstallCheck = false; # We get a spurious failure otherwise, due to host/target mis-match
57
57
+
});
45
58
in
46
59
47
60
stdenv.mkDerivation (rec {
···
119
132
'')}
120
133
'';
121
134
122
122
-
patches = [ ./0000-fix-ipxe-src.patch
123
123
-
./0000-fix-install-python.patch
124
124
-
] ++ optional (versionOlder version "4.8.5") ./acpica-utils-20180427.patch
125
125
-
++ (config.patches or []);
135
135
+
patches = [
136
136
+
./0000-fix-ipxe-src.patch
137
137
+
./0000-fix-install-python.patch
138
138
+
./0004-makefile-use-efi-ld.patch
139
139
+
./0005-makefile-fix-efi-mountdir-use.patch
140
140
+
] ++ (config.patches or []);
126
141
127
142
postPatch = ''
128
143
### Hacks
···
185
200
substituteInPlace tools/hotplug/Linux/xendomains \
186
201
--replace /bin/ls ls
187
202
'';
203
203
+
204
204
+
EFI_LD = "${efiBinutils}/bin/ld";
205
205
+
EFI_VENDOR = "nixos";
188
206
189
207
# TODO: Flask needs more testing before enabling it by default.
190
208
#makeFlags = [ "XSM_ENABLE=y" "FLASK_ENABLE=y" "PREFIX=$(out)" "CONFIG_DIR=/etc" "XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files" ];