From f2ca6908795807bef841b1c98f10c47c831d2c41 Mon Sep 17 00:00:00 2001 From: srs5694 Date: Sun, 18 May 2014 15:42:20 -0400 Subject: [PATCH] Support for building with TianoCore UDK2014 in addition to UDK2010. --- BUILDING.txt | 67 ++++++++++++++++++++---------------------- EfiLib/BdsHelper.c | 2 +- EfiLib/BdsTianoCore.c | 2 +- EfiLib/BmLib.c | 2 +- EfiLib/DevicePath.c | 4 +-- EfiLib/legacy.c | 2 +- Make.tiano | 6 ++-- NEWS.txt | 3 ++ filesystems/Make.tiano | 4 +-- filesystems/Makefile | 8 +++++ gptsync/Make.tiano | 4 +-- libeg/screen.c | 2 +- refind.inf | 8 +++-- refind.spec | 2 +- refind/Make.tiano | 3 +- 15 files changed, 66 insertions(+), 53 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 0ef9fae..df00b42 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -15,30 +15,22 @@ To compile rEFInd, you'll need the following: * One of the following: * The TianoCore EDK2 package - (http://sourceforge.net/projects/tianocore/). I've tested using the - UDK2010.SR1 and UDK2010.SR1.UP1 variants - (http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UDK2010), - which are "frozen," rather than the main EDK2 development branch, which - is changing as the developers add features, fix bugs, and so on. Using - TianoCore EDK2 is supported in rEFInd version 0.4.3 and later (0.4.0 - and later for the filesystem drivers only). See below for TianoCore - setup instructions. + (http://sourceforge.net/projects/tianocore/). I initially used the + UDK2010 package and others in that series, but beginning with rEFInd + 0.8.2, I've been using UDK2014 + (http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UDK2014). + All of the UDK release are "frozen," rather than the main EDK2 + development branch, which is changing as the developers add features, + fix bugs, and so on. See below for TianoCore setup instructions. * The GNU-EFI package (http://sourceforge.net/projects/gnu-efi/). You can install this from a package called "gnu-efi"; however, rEFInd relies on - features that were added in (I think) 3.0l to provide driver-loading - capabilities. The versions I've used and that work are 3.0p, 3.0q, - 3.0r, 3.0s, and 3.0u, with a caveat: The new time-sensitive - default_selection feature causes rEFInd to hang when using 3.0s and - earlier. 3.0u works fine for this (tested with compilation on three - computers). I don't know if 3.0t would work. Through mid-to-late 2012, - most Linux distributions delivered rather elderly versions of GNU-EFI, - but many are catching up by late 2012. You should check your GNU-EFI - version number; you may need to download the latest source code, - compile it, and install it locally. Between rEFInd version 0.2.7 and - 0.6.1, the Makefiles assumed a locally-compiled GNU-EFI package, but - older and more recent versions assume GNU-EFI installation in typical - locations for distribution-provided packages. + features that were added sometime between version 3.0s and 3.0u, so I + recommend using 3.0u (or conceivably later). You should check your + GNU-EFI version number; you may need to download the latest source + code, compile it, and install it locally. The Makefiles assume a + GNU-EFI package installed via a package manager. If you install from + source code, you may need to adjust those Makefiles' paths. Of the two toolkits, I prefer to use TianoCore because it produces binaries that are about 20-30KiB smaller than those made by GNU-EFI, and I can @@ -47,7 +39,9 @@ had problems on a 32-bit Mac Mini with the drivers produced by GNU-EFI hanging the system if I try to load more than one of them. (I haven't encountered this problem on UEFI-based PCs.) That said, the TianoCore EDK2 package is much harder to install, so you may prefer to use GNU-EFI unless -you have a specific need for the TianoCore toolkit. +you have a specific need for the TianoCore toolkit. Automated build tools +like the OpenSUSE Build Service (OBS) and the Ubuntu Personal Package +Archive (PPA) mechanism don't yet support TianoCore. It's possible to use a non-Linux platform to compile rEFInd. To the best of my knowledge, the rEFInd code doesn't rely on anything Linux-specific in @@ -90,21 +84,21 @@ you MUST install the kit from source code using its own unusual compilation procedure. The installation documentation also omits at least one step and is a bit unclear about others. Here's how I installed the toolkit: -1) Download UDK2010.SR1.UP1.P1 from - https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UDK2010. +1) Download UDK2014.SR1.UP1.P1 from + https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UDK2014. -2) Type "mkdir /usr/local/UDK2010". You can use another directory, but the +2) Type "mkdir /usr/local/UDK2014". You can use another directory, but the Makefile for rEFInd's EFI drivers assumes this location. You'll need to edit the EDK2BASE line in the Make.tiano file if you install somewhere else. -3) Type "cd /usr/local/UDK2010". +3) Type "cd /usr/local/UDK2014". -4) Unzip the downloaded file (UDK2010.SR1.UP1.P1.Complete.MyWorkSpace.zip) - in the current directory (/usr/local/UDK2010). This creates a handful of +4) Unzip the downloaded file (UDK2014.SR1.UP1.P1.Complete.MyWorkSpace.zip) + in the current directory (/usr/local/UDK2014). This creates a handful of files, including a tarball and a couple of .zip files. -5) Type "unzip UDK2010.SR1.UP1.MyWorkSpace.zip". This extracts the +5) Type "unzip UDK2014.SR1.UP1.MyWorkSpace.zip". This extracts the platform-neutral portion of the development kit. 6) Type "cd MyWorkSpace". @@ -144,12 +138,15 @@ is a bit unclear about others. Here's how I installed the toolkit: to: *_GCC46_X64_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m64 -12) Type "make -C /usr/local/UDK2010/MyWorkSpace/BaseTools/Source/C". +12) Type "make -C /usr/local/UDK2014/MyWorkSpace/BaseTools/Source/C". (This step is not documented on the EDK Web page.) Note that this requires the g++ compiler and UUID development libraries. 13) Type "build" to build the main set of EDK2 files. This process is - likely to take a few minutes. + likely to take a few minutes. This step requires Python 2; if you have + Python 3 installed, you may need to adjust the default python for this + build (for instance, by typing "eselect python set python2.7" in + Gentoo). If you installed in a location other than the one I've specified, you must edit the EDK2BASE variable in the Make.tiano and filesystems/Make.tiano @@ -203,13 +200,13 @@ to the various GNU-EFI include files and libraries. Since rEFInd 0.6.2, the default Make.common file includes the following definitions: EFIINC = /usr/include/efi -GNUEFILIB = /usr/lib64 -EFILIB = /usr/lib64 -EFICRT0 = /usr/lib64 +GNUEFILIB = /usr/lib +EFILIB = /usr/lib +EFICRT0 = /usr/lib If you've installed GNU-EFI from source code, you may need to add "local" to those paths, as in "/usr/local/include/efi". You might need to change -references to "lib64" to "lib32" or "lib" on some systems. Recall that you +references to "lib" to "lib32" or "lib64" on some systems. Recall that you need at least GNU-EFI version 3.0l to build rEFInd, and until very recently, most distributions provided out-of-date versions of this package. diff --git a/EfiLib/BdsHelper.c b/EfiLib/BdsHelper.c index 563993a..b4ece24 100644 --- a/EfiLib/BdsHelper.c +++ b/EfiLib/BdsHelper.c @@ -8,7 +8,7 @@ #include "BdsHelper.h" #include "legacy.h" #include "../refind/screen.h" -#include "refit_call_wrapper.h" +#include "../include/refit_call_wrapper.h" EFI_GUID gEfiLegacyBootProtocolGuid = { 0xdb9a1e3d, 0x45cb, 0x4abb, { 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d }}; diff --git a/EfiLib/BdsTianoCore.c b/EfiLib/BdsTianoCore.c index 7c7d214..271758d 100644 --- a/EfiLib/BdsTianoCore.c +++ b/EfiLib/BdsTianoCore.c @@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "BdsHelper.h" #include "gnuefi-helper.h" #endif -#include "refit_call_wrapper.h" +#include "../include/refit_call_wrapper.h" EFI_GUID EfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }}; diff --git a/EfiLib/BmLib.c b/EfiLib/BmLib.c index 4feddd5..4e7ebaa 100644 --- a/EfiLib/BmLib.c +++ b/EfiLib/BmLib.c @@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #else #include "gnuefi-helper.h" #endif -#include "refit_call_wrapper.h" +#include "../include/refit_call_wrapper.h" /** diff --git a/EfiLib/DevicePath.c b/EfiLib/DevicePath.c index 75c666e..bfaf1c6 100644 --- a/EfiLib/DevicePath.c +++ b/EfiLib/DevicePath.c @@ -1159,7 +1159,7 @@ DevPathFvFilePath ( **/ VOID -DevPathRelativeOffsetRange ( +MyDevPathRelativeOffsetRange ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) @@ -1459,7 +1459,7 @@ DEVICE_PATH_STRING_TABLE DevPathTable[] = { { MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, - DevPathRelativeOffsetRange, + MyDevPathRelativeOffsetRange, }, { BBS_DEVICE_PATH, diff --git a/EfiLib/legacy.c b/EfiLib/legacy.c index 4541b31..3e5edee 100644 --- a/EfiLib/legacy.c +++ b/EfiLib/legacy.c @@ -23,7 +23,7 @@ #define EfiReallocatePool ReallocatePool #define EfiLibLocateProtocol LibLocateProtocol #else -#include "tiano_includes.h" +#include "../include/tiano_includes.h" #endif #include "legacy.h" #include "GenericBdsLib.h" diff --git a/Make.tiano b/Make.tiano index 5bfb158..546df73 100644 --- a/Make.tiano +++ b/Make.tiano @@ -29,8 +29,10 @@ ifeq ($(ARCH),x86_64) LD_CODE = elf_x86_64 endif -EDK2BASE = /usr/local/UDK2010/MyWorkSpace +EDK2BASE = /usr/local/UDK2014/MyWorkSpace #EDK2BASE = /usr/local/EDK2/tianocore-edk2 +#ENTRYPOINT=_ModuleEntryPoint +ENTRYPOINT=efi_main # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, GCC46, or GCC47) include $(EDK2BASE)/Conf/target.txt @@ -64,7 +66,7 @@ GENFW = $(EDK2BASE)/BaseTools/Source/C/bin/GenFw LDSCRIPT = $(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script LDFLAGS = -nostdlib -n -q --gc-sections --script=$(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script \ - --entry efi_main -u efi_main -m $(LD_CODE) + --entry $(ENTRYPOINT) -u $(ENTRYPOINT) -m $(LD_CODE) %.obj: %.c $(CC) $(ARCH_C_FLAGS) $(CFLAGS) $(INCLUDE_DIRS) -DNO_BUILTIN_VA_FUNCS -D__MAKEWITH_TIANO -c $< -o $@ diff --git a/NEWS.txt b/NEWS.txt index 32b4428..05ec22f 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,6 +1,9 @@ 0.8.2 (5/??/2014): ------------------ +- I've updated my personal build system, and therefore the rEFInd Makefiles + and related files, to use TianoCore UDK2014 rather than UDK2010. + - Added "deep_uefi_legacy_scan" token. When not set (the default), rEFInd does not modify EFI NVRAM settings when scanning for BIOS-mode boot loaders on UEFI-based (non-Mac) computers. Some computers require diff --git a/filesystems/Make.tiano b/filesystems/Make.tiano index b9ad0a8..39cdfa5 100644 --- a/filesystems/Make.tiano +++ b/filesystems/Make.tiano @@ -29,7 +29,7 @@ ifeq ($(ARCH),x86_64) LD_CODE = elf_x86_64 endif -EDK2BASE = /usr/local/UDK2010/MyWorkSpace +EDK2BASE = /usr/local/UDK2014/MyWorkSpace #EDK2BASE = /usr/local/edk2 # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, or GCC46) @@ -92,7 +92,7 @@ $(DLL_TARGET): $(OBJS) fsw_$(DRIVERNAME).obj $(LD) -o $(DRIVERNAME)_$(FILENAME_CODE).dll $(LDFLAGS) --start-group $(ALL_EFILIBS) $(OBJS) fsw_$(DRIVERNAME).obj --end-group $(BUILDME): $(DLL_TARGET) - $(OBJCOPY) --strip-unneeded $(DLL_TARGET) + $(OBJCOPY) --strip-unneeded -R .eh_frame $(DLL_TARGET) $(GENFW) -e UEFI_DRIVER -o $(BUILDME) $(DLL_TARGET) # $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ # -j .rela -j .reloc --rename-section .data=.hii --target=efi-bsdrv-$(ARCH) $< $@ diff --git a/filesystems/Makefile b/filesystems/Makefile index 4aa838e..74d03da 100644 --- a/filesystems/Makefile +++ b/filesystems/Makefile @@ -16,6 +16,10 @@ TEXTFILES = $(FILESYSTEMS:=*.txt) all: $(FILESYSTEMS) +xfs: + rm -f fsw_efi.obj + +make DRIVERNAME=xfs -f Make.tiano + ext2: rm -f fsw_efi.obj +make DRIVERNAME=ext2 -f Make.tiano @@ -46,6 +50,10 @@ gnuefi: $(FILESYSTEMS_GNUEFI) all_gnuefi: $(FILESYSTEMS_GNUEFI) +xfs_gnuefi: + rm -f fsw_efi.o + +make DRIVERNAME=xfs -f Make.gnuefi + ext2_gnuefi: rm -f fsw_efi.o +make DRIVERNAME=ext2 -f Make.gnuefi diff --git a/gptsync/Make.tiano b/gptsync/Make.tiano index b6c46f2..85823ee 100644 --- a/gptsync/Make.tiano +++ b/gptsync/Make.tiano @@ -29,7 +29,7 @@ ifeq ($(ARCH),x86_64) LD_CODE = elf_x86_64 endif -EDK2BASE = /usr/local/UDK2010/MyWorkSpace +EDK2BASE = /usr/local/UDK2014/MyWorkSpace #EDK2BASE = /usr/local/edk2 # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, or GCC46) @@ -100,7 +100,7 @@ $(DLL_TARGET): $(OBJS) $(LD) -o gptsync_$(FILENAME_CODE).dll $(LDFLAGS) --start-group $(ALL_EFILIBS) $(OBJS) --end-group $(BUILDME): $(DLL_TARGET) - $(OBJCOPY) --strip-unneeded $(DLL_TARGET) + $(OBJCOPY) --strip-unneeded -R .eh_frame $(DLL_TARGET) $(GENFW) -e UEFI_APPLICATION -o $(BUILDME) $(DLL_TARGET) endif diff --git a/libeg/screen.c b/libeg/screen.c index 9fa999b..cdf1506 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -47,7 +47,7 @@ #include "../refind/lib.h" #include "../include/refit_call_wrapper.h" #include "libeg.h" -#include "Handle.h" +#include "../include/Handle.h" #include #include diff --git a/refind.inf b/refind.inf index d98b25a..1b3f897 100644 --- a/refind.inf +++ b/refind.inf @@ -1,9 +1,9 @@ ## @file # -# refind.inf file to build rEFInd using the EDK2/UDK2010 development +# refind.inf file to build rEFInd using the EDK2/UDK2010/UDK2014 development # kit. # -# Copyright (c) 2012 by Roderick W. Smith +# Copyright (c) 2012-2014 by Roderick W. Smith # Released under the terms of the GPLv3, a copy of which should come # with this file. # @@ -32,7 +32,7 @@ EfiLib/BdsConnect.c #included into GenericBdsLib EfiLib/BdsHelper.c EfiLib/BdsTianoCore.c - EfiLib/Console.c + EfiLib/legacy.c mok/mok.c mok/guid.c mok/security_policy.c @@ -44,6 +44,8 @@ refind/menu.c refind/screen.c refind/driver_support.c + refind/gpt.c + refind/crc32.c libeg/image.c libeg/load_bmp.c libeg/load_icns.c diff --git a/refind.spec b/refind.spec index 3ab1ee5..3bf7d80 100644 --- a/refind.spec +++ b/refind.spec @@ -49,7 +49,7 @@ when paired with Linux kernels that provide EFI stub support. %setup -q %build -if [[ -d /usr/local/UDK2010 ]] ; then +if [[ -d /usr/local/UDK2014 ]] ; then make make fs else diff --git a/refind/Make.tiano b/refind/Make.tiano index d9bb187..6b1a890 100644 --- a/refind/Make.tiano +++ b/refind/Make.tiano @@ -26,6 +26,7 @@ ALL_EFILIBS = $(EFILIB)/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevel $(EFILIB)/DxeHobLib/DxeHobLib/OUTPUT/DxeHobLib.lib \ $(EFILIB)/BaseIoLibIntrinsic/BaseIoLibIntrinsic/OUTPUT/BaseIoLibIntrinsic.lib \ $(EFILIB)/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib +# $(EFILIB)/BasePerformanceLibNull/BasePerformanceLibNull/OUTPUT/BasePerformanceLibNull.lib \ # /usr/local/UDK2010/MyWorkSpace/Build/Mde/RELEASE_GCC46/X64/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu/OUTPUT/SecPeiDxeTimerLibCpu.lib \ # /usr/local/UDK2010/MyWorkSpace/Build/MdeModule/RELEASE_GCC46/X64/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/DxeCore.lib \ # /usr/local/UDK2010/MyWorkSpace/Build/Mde/RELEASE_GCC46/X64/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib/OUTPUT/BaseCacheMaintenanceLib.lib \ @@ -46,7 +47,7 @@ $(DLL_TARGET)_$(FILENAME_CODE).dll: $(OBJS) ../libeg/libeg.lib ../EfiLib/EfiLib. $(LD) -o $(DLL_TARGET)_$(FILENAME_CODE).dll $(LDFLAGS) --start-group $(ALL_EFILIBS) $(OBJS) ../libeg/libeg.lib ../EfiLib/EfiLib.lib ../mok/mok.lib --end-group $(BUILDME): $(DLL_TARGET)_$(FILENAME_CODE).dll - $(OBJCOPY) --strip-unneeded $(DLL_TARGET)_$(FILENAME_CODE).dll + $(OBJCOPY) --strip-unneeded -R .eh_frame $(DLL_TARGET)_$(FILENAME_CODE).dll $(GENFW) -e UEFI_APPLICATION -o $(BUILDME)_$(FILENAME_CODE).efi $(DLL_TARGET)_$(FILENAME_CODE).dll clean: -- 2.39.2