diff --git a/Makefile b/Makefile index fd22e843..05b2f967 100644 --- a/Makefile +++ b/Makefile @@ -440,6 +440,7 @@ bootstrap: musl-cross.intermediate \ $(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc \ +include Makefile.nerf else # Wrong make version detected -- build our local version diff --git a/Makefile.nerf b/Makefile.nerf index 75ddd324..ef663b3d 100644 --- a/Makefile.nerf +++ b/Makefile.nerf @@ -26,6 +26,7 @@ GenSec-pe = $(EDK2_DIR)/GenSec \ "$2" \ +$(build)/$(linux_dir)/arch/x86/boot/bzImage: linux.intermediate linux-pe.sec: $(build)/$(linux_dir)/arch/x86/boot/bzImage $(call GenSec-pe,$@,$<) linux-name.sec: @@ -82,7 +83,7 @@ DxeCore.ffs: DxeCore-pe.sec DxeCore-name.sec DxeCore-version.sec $(EDK2_DIR)/GenFfs \ -t EFI_FV_FILETYPE_DXE_CORE \ -g D6A2CB7F-6A18-4E2F-B43B-9920A733700A \ - --align 64K \ + --align 1K \ $(addprefix -i ,$^) \ -o $@ \ @@ -112,6 +113,7 @@ nerf.vol: DxeCore.ffs RuntimeDxe.ffs linux.ffs nerf.intermediate: \ + linux.intermediate \ edk2.intermediate \ DxeCore.ffs \ RuntimeDxe.ffs \ diff --git a/config/edk2.makefile b/config/edk2.makefile deleted file mode 100644 index 54b0491c..00000000 --- a/config/edk2.makefile +++ /dev/null @@ -1,32 +0,0 @@ -# Wrapper around the edk2 "build" script to generate -# the few files that we actually want and avoid rebuilding -# if we don't have to. - -PWD := $(shell pwd) -EDK2_OUTPUT_DIR := $(PWD)/Build/MdeModule/DEBUG_GCC5/X64/MdeModulePkg/Core -EDK2_BIN_DIR := $(PWD)/BaseTools/BinWrappers/PosixLike - -export PATH := $(EDK2_BIN_DIR):$(PATH) -export CONFIG_PATH := $(PWD)/Conf -export EDK_TOOLS_PATH := $(PWD)/BaseTools -export WORKSPACE := $(PWD) - -EDK2_BINS += Dxe/DxeMain/DEBUG/DxeCore.efi -EDK2_BINS += RuntimeDxe/RuntimeDxe/DEBUG/RuntimeDxe.efi - -EDK2_OUTPUTS = $(addprefix $(EDK2_OUTPUT_DIR)/,$(EDK2_BINS)) - -# build takes too long, so we check to see if our executables exist -# before we start a build. run the clean target if they must be rebuilt -all: $(EDK2_OUTPUTS) - ls -Fla $(EDK2_OUTPUTS) - cp -a $(EDK2_OUTPUTS) . - -$(EDK2_OUTPUTS): - build - -clean: - $(RM) $(EDK2_OUTPUTS) - -real-clean: clean - build clean diff --git a/modules/edk2 b/modules/edk2 index 54c64d56..7eef5e1c 100644 --- a/modules/edk2 +++ b/modules/edk2 @@ -16,16 +16,7 @@ edk2_configure := \ -C BaseTools \ && pwd \ && cp ../../config/edk2.config ./Conf/target.txt \ - && cp ../../config/edk2.makefile ./Makefile \ && . ./edksetup.sh edk2_target := \ all - -NO:=\ - obj=./$(BOARD) \ - DOTCONFIG=../../config/edk2-$(BOARD).config \ - BUILD_TIMELESS=1 \ - CFLAGS_x86_32="$(EXTRA_FLAGS)" \ - CFLAGS_x86_64="$(EXTRA_FLAGS)" \ - $(MAKE_JOBS) diff --git a/patches/edk2.patch b/patches/edk2.patch new file mode 100644 index 00000000..61de288e --- /dev/null +++ b/patches/edk2.patch @@ -0,0 +1,71 @@ +diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +index 91e94a7..6b729df 100644 +--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c ++++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +@@ -743,6 +800,7 @@ CoreExitBootServices ( + // + // Disable Timer + // ++ if(gTimer) + gTimer->SetTimerPeriod (gTimer, 0); + + // +@@ -780,6 +838,7 @@ CoreExitBootServices ( + // + // Disable CPU Interrupts + // ++ if(gCpu) + gCpu->DisableInterrupt (gCpu); + + MemoryProtectionExitBootServicesCallback(); +diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +index a73c4cc..2c08b81 100644 +--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c ++++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +@@ -232,7 +232,7 @@ SetUefiImageMemoryAttributes ( + + DEBUG ((DEBUG_INFO, "SetUefiImageMemoryAttributes - 0x%016lx - 0x%016lx (0x%016lx)\n", BaseAddress, Length, FinalAttributes)); + +- ASSERT(gCpu != NULL); ++ if(gCpu) + gCpu->SetMemoryAttributes (gCpu, BaseAddress, Length, FinalAttributes); + } + +--- /dev/null 2017-09-19 09:53:09.766660422 -0400 ++++ ./Makefile 2017-09-20 15:24:01.850433474 -0400 +@@ -0,0 +1,35 @@ ++# Wrapper around the edk2 "build" script to generate ++# the few files that we actually want and avoid rebuilding ++# if we don't have to. ++ ++PWD := $(shell pwd) ++EDK2_OUTPUT_DIR := $(PWD)/Build/MdeModule/DEBUG_GCC5/X64/MdeModulePkg/Core ++EDK2_BIN_DIR := $(PWD)/BaseTools/BinWrappers/PosixLike ++ ++export PATH := $(EDK2_BIN_DIR):$(PATH) ++export CONFIG_PATH := $(PWD)/Conf ++export EDK_TOOLS_PATH := $(PWD)/BaseTools ++export WORKSPACE := $(PWD) ++ ++EDK2_BINS += Dxe/DxeMain/DEBUG/DxeCore.efi ++EDK2_BINS += RuntimeDxe/RuntimeDxe/DEBUG/RuntimeDxe.efi ++ ++EDK2_OUTPUTS = $(addprefix $(EDK2_OUTPUT_DIR)/,$(EDK2_BINS)) ++ ++# build takes too long, so we check to see if our executables exist ++# before we start a build. run the clean target if they must be rebuilt ++all: $(EDK2_OUTPUTS) ++ ls -Fla $(EDK2_OUTPUTS) ++ cp -a $(EDK2_OUTPUTS) . ++ ++$(EDK2_OUTPUTS): ++ build ++ ++build: ++ build ++ ++clean: ++ $(RM) $(EDK2_OUTPUTS) ++ ++real-clean: clean ++ build clean