From 88f1df122ac8d79cfdfb5e52f7190d55a9a88cbc Mon Sep 17 00:00:00 2001 From: Trammell hudson Date: Thu, 18 Jan 2018 17:24:08 -0500 Subject: [PATCH] Use create-ffs in place of edk2 GenSec and GenFfs --- Makefile.nerf | 91 +++++++++++++++------------------------------------ 1 file changed, 26 insertions(+), 65 deletions(-) diff --git a/Makefile.nerf b/Makefile.nerf index b4b76977..0270bab6 100644 --- a/Makefile.nerf +++ b/Makefile.nerf @@ -11,14 +11,14 @@ EDK2_DIR := $(build)/$(edk2_dir)/BaseTools/BinWrappers/PosixLike # wtf edk2 doesn't hve a way to turn the inf file into an executable? # this build system sucks -RuntimeArchProtocolGuid := { 0xb7dfb4e1, 0x052f, 0x449f, { 0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 }} -AcpiTableProtocolGuid := { 0xFFE06BDD, 0x6107, 0x46A6, { 0x7B, 0xB2, 0x5A, 0x9C, 0x7E, 0xC5, 0x27, 0x5C }} -SmbiosProtocolGuid := {0x3583ff6, 0xcb36, 0x4940, { 0x94, 0x7e, 0xb9, 0xb3, 0x9f, 0x4a, 0xfa, 0xf7}} -VariableArchProtocolGuid := { 0x1E5668E2, 0x8481, 0x11D4, { 0xBC, 0xF1, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }} +RuntimeArchProtocolGuid := b7dfb4e1-052f-449f-87be-9818fc91b733 +AcpiTableProtocolGuid := FFE06BDD-6107-46A6-7BB2-5A9C7EC5275C +SmbiosProtocolGuid := 03583ff6-cb36-4940-947e-b9b39f4afaf7 +VariableArchProtocolGuid := 1E5668E2-8481-11D4-BCF1-0080C73C8881 dxe-$(CONFIG_BUNDLE_DXE) += DxeCore -DxeCore-filetype := EFI_FV_FILETYPE_DXE_CORE +DxeCore-filetype := DXE_CORE DxeCore-guid := D6A2CB7F-6A18-4E2F-B43B-9920A733700A #DxeCore-align := 1K @@ -32,7 +32,9 @@ AcpiTableDxe-depex := $(RuntimeArchProtocolGuid) dxe-$(CONFIG_BUNDLE_DXE) += AcpiPlatform AcpiPlatform-guid := cb933912-df8f-4305-b1f9-7b44fa11395c -AcpiPlatform-depex := $(RuntimeArchProtocolGuid) AND $(AcpiTableProtocolGuid) +AcpiPlatform-depex := \ + $(RuntimeArchProtocolGuid) \ + $(AcpiTableProtocolGuid) \ dxe-$(CONFIG_BUNDLE_DXE) += SmbiosDxe SmbiosDxe-guid := F9D88642-0737-49BC-81B5-6889CD57D9EA @@ -51,19 +53,13 @@ EmuVariableRuntimeDxe-depex := $(RuntimeArchProtocolGuid) #dxe-y += Acpi-data Acpi-data-file := /dev/null Acpi-data-guid := 7E374E25-8E01-4FEE-87F2-390C23C606CD -Acpi-data-filetype := EFI_FV_FILETYPE_FREEFORM -Acpi-data-sectiontype := EFI_SECTION_RAW +Acpi-data-filetype := FREEFORM Acpi-data.ffs: $(sort blobs/$(BOARD)/acpi/*) - for file in $^; do \ - $(EDK2_DIR)/GenSec \ - -s EFI_SECTION_RAW \ - -o `basename $$file`.sec $$file; \ - done - $(EDK2_DIR)/GenFfs \ - -t EFI_FV_FILETYPE_FREEFORM \ - -g $(Acpi-data-guid) \ + ./create-ffs \ -o $@ \ - $(foreach f,$^,-i $(notdir $f).sec) + -g $(Acpi-data-guid) \ + -t FREEFORM \ + $^ dxe-y += Linux @@ -72,66 +68,31 @@ Linux-version := $(linux-version) Linux-guid := DECAFBAD-6548-6461-732d-2f2d4e455246 Linux-depex := \ $(RuntimeArchProtocolGuid) \ - AND $(AcpiTableProtocolGuid) \ - AND $(SmbiosProtocolGuid) \ - AND $(VariableArchProtocolGuid) \ + $(AcpiTableProtocolGuid) \ + $(SmbiosProtocolGuid) \ + $(VariableArchProtocolGuid) \ dxe-y += Initrd Initrd-file := initrd.cpio.xz -Initrd-filetype := EFI_FV_FILETYPE_FREEFORM +Initrd-filetype := FREEFORM Initrd-guid := 74696e69-6472-632e-7069-6f2f62696f73 -Initrd-sectiontype := EFI_SECTION_RAW #$(build)/$(linux_dir)/arch/x86/boot/bzImage: linux.intermediate -%.dep: - $(EDK2_DIR)/GenDepex \ - -t DXE_DRIVER \ - -o $@ \ - -e '$($*-depex)' - -%.dep.sec: %.dep - $(EDK2_DIR)/GenSec \ - -S EFI_SECTION_DXE_DEPEX \ - -o $@ \ - $< - -%.name.sec: - $(EDK2_DIR)/GenSec \ - -S EFI_SECTION_USER_INTERFACE \ - -o "$@" \ - -n "$*" - -%.ver.sec: - $(EDK2_DIR)/GenSec \ - -S EFI_SECTION_VERSION \ - -o "$@" \ - -n "$(or $($*-version),1.0)" - define build-ffs = -$1.ffs: \ - $1.name.sec \ - $1.ver.sec \ - $(if $($1-depex),$1.dep.sec) \ - $1.file.sec \ - - $(EDK2_DIR)/GenFfs \ - -t $(or $($1-filetype),EFI_FV_FILETYPE_DRIVER) \ +$1.ffs: $(or $($1-file),$(build)/$(edk2_dir)/Build/MdeModule/DEBUG_GCC5/X64/$1.efi) + ./create-ffs \ + -o "$1.ffs" \ -g $($1-guid) \ - --align $(or $($1-align),4K) \ - -o $$@ \ - $$(addprefix -i ,$$^) \ - -$1.file.sec: \ - $(or $($1-file),$(build)/$(edk2_dir)/Build/MdeModule/DEBUG_GCC5/X64/$1.efi) - - $(EDK2_DIR)/GenSec \ - -S $(or $($1-sectiontype),EFI_SECTION_PE32) \ - -o $$@ \ + -t $(or $($1-filetype),DRIVER) \ + -n "$1" \ + -v "$(or $($1-version),0.1)" \ + -d "$($1-depex)" \ $$^ + # add a dependency on the edk2 module if we are picking up an # edk2 build DXEexecutable. ifndef $($1-file) @@ -157,7 +118,7 @@ $(build)/$(linux_dir)/arch/x86/boot/bzImage: linux.intermediate # up to PEI at 0xE40000, which leaves us almost 11 MB of space. # # x3550m5 -- pei starts at 0xb00000, bios is from 0x1000 == 0xaff -nerf.vol: $(addsuffix .ffs,$(dxe-y)) # Acpi-data.ffs # blobs/r630/acpi-data.ffs.uncompressed +nerf.vol: $(addsuffix .ffs,$(dxe-y)) Acpi-data.ffs # blobs/r630/acpi-data.ffs.uncompressed $(EDK2_DIR)/GenFv \ --numberblock $$[$(NERF_SIZE)/0x1000] \ --blocksize 0x1000 \