Merge branch 'nerf' of ssh://github.com/osresearch/heads into nerf

This commit is contained in:
Trammell hudson 2018-02-02 15:51:16 -05:00
commit 23bded6e8f
Failed to extract signature
27 changed files with 540 additions and 99 deletions

View File

@ -2,6 +2,8 @@
# Targets specific for the NERF firmware
#
NERF_FULL_SIZE=0xF00000
# this assumes that we've already made the edk2 things, via
# edk2.intermediate or something like that.
EDK2_DIR := $(build)/$(edk2_dir)/BaseTools/BinWrappers/PosixLike
@ -11,14 +13,28 @@ 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
EfiPciRootBridgeIoProtocolGuid := 2F707EBB-4A1A-11D4-9A38-0090273FC14D
EfiPciEnumerationCompleteProtocolGuid := 30cfe3e7-3de1-4586-be20-deaba1b3b793
EfiPcdProtocolGuid := 13a3f0f6-264a-3ef0-f2e0-dec512342f34
EfiTimerArchProtocolGuid := 26BACCB3-6F42-11D4-BCE7-0080C73C8881
EfiCpuIo2ProtocolGuid := ad61f191-ae5f-4c0e-b9fa-e869d288c64f
EfiIioUdsProtocolGuid := A7CED760-C71C-4E1A-ACB1-89604D5216CB
EfiSmmAccess2ProtocolGuid := c2702b74-800c-4131-8746-8fb5b89ce4ac
EfiSmmControl2ProtocolGuid := 843dc720-ab1e-42cb-9357-8a0078f3561b
IntelRegAccessProtocolGuid := FD480A76-B134-4EF7-ADFE-B0E054639807
EfiMpServiceProtocolGuid := 3fdda605-a76e-4f46-ad29-12f4531b3d08
IntelPlatformTypeGuid := a7ced760-c71c-4e1a-acb1-89604d5216cb
IntelPlatformCpuPolicy := ADB7B9E6-70B7-48D4-B6A5-18FA15EBCD78
IntelCrystalRidgeGuid := 626967C7-071B-4D9A-9D0C-F112CF0836E9
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,12 +48,25 @@ 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
SmbiosDxe-depex := $(RuntimeArchProtocolGuid)
dxe-$(CONFIG_BUNDLE_DXE) += Legacy8259
Legacy8259-guid := 99998642-0737-49BC-81B5-6889CD57D9EA
Legacy8259-file := Legacy8259.efi
Legacy8259-depex := $(RuntimeArchProtocolGuid)
dxe-$(CONFIG_BUNDLE_DXE) += PciBusDxe
PciBusDxe-depex := $(RuntimeArchProtocolGuid)
dxe-$(CONFIG_BUNDLE_DXE) += PciHostBridgeDxe
PciHostBridgeDxe-depex := $(RuntimeArchProtocolGuid)
# the VariableStore doesn't work with most vendor firmwares for some reason.
# instead we link in the EmuRuntimeDxe, which avoids the
dxe-n += VariableRuntimeDxe
@ -51,20 +80,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.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) \
Acpi-data-filetype := FREEFORM
Acpi-data.$(BOARD).ffs: $(sort blobs/$(BOARD)/acpi/*)
./create-ffs \
-o $@ \
$(foreach f,$^,-i $(notdir $f).sec)
--guid "$(Acpi-data-guid)" \
--type FREEFORM \
$^
dxe-y += Linux
Linux-file := $(build)/$(linux_dir)/arch/x86/boot/bzImage
@ -72,66 +94,33 @@ Linux-version := $(linux-version)
Linux-guid := DECAFBAD-6548-6461-732d-2f2d4e455246
Linux-depex := \
$(RuntimeArchProtocolGuid) \
AND $(AcpiTableProtocolGuid) \
AND $(SmbiosProtocolGuid) \
AND $(VariableArchProtocolGuid) \
NO=\
$(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) \
-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 $$@ \
$1.ffs: $(or $($1-file),$(build)/$(edk2_dir)/Build/MdeModule/DEBUG_GCC5/X64/$1.efi)
./create-ffs \
-o "$1.ffs" \
--guid "$($1-guid)" \
--type $(or $($1-filetype),DRIVER) \
--name "$1" \
--version "$(or $($1-version),0.1)" \
--depex "$($1-depex)" \
$$^
# add a dependency on the edk2 module if we are picking up an
# edk2 build DXEexecutable.
ifndef $($1-file)
@ -157,9 +146,9 @@ $(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-$(BOARD).full.vol: $(addsuffix .ffs,$(dxe-y)) Acpi-data.$(BOARD).ffs # blobs/r630/acpi-data.ffs.uncompressed
$(EDK2_DIR)/GenFv \
--numberblock $$[$(NERF_SIZE)/0x1000] \
--numberblock $$[$(NERF_FULL_SIZE)/0x1000] \
--blocksize 0x1000 \
--FvNameGuid 4652454e-482f-6165-6473-2f4c696e7578 \
-o $@ \
@ -167,6 +156,25 @@ nerf.vol: $(addsuffix .ffs,$(dxe-y)) # Acpi-data.ffs # blobs/r630/acpi-data.ffs
@head -2 $@.txt
-$(RM) $@.txt $@.map
#nerf-$(BOARD).lz.ffs: nerf-$(BOARD).full.vol
nerf-$(BOARD).lz.ffs: vendor-$(BOARD).full.rom
./create-ffs \
--compress \
--type FIRMWARE_VOLUME_IMAGE \
-o "$@" \
"$^"
nerf-$(BOARD).vol: nerf-$(BOARD).lz.ffs
$(EDK2_DIR)/GenFv \
--numberblock $$[$(NERF_SIZE)/0x1000] \
--blocksize 0x1000 \
--FvNameGuid 01234567-89ab-cdef-5a5a-5a5a5a5a5a5a \
-o $@ \
$(addprefix -f ,$^)
@head -2 $@.txt
-$(RM) $@.txt $@.map
# You must provide your own r630.rom as input for the ME and PEI sections.
# the ifd is only the first 64k, but we take all the way to the ME region
# and unlock the IFD (from coreboot) to allow flashrom to write to the ROM.
@ -190,34 +198,15 @@ nerf-$(BOARD).rom: \
exit 1; \
fi
#
# Generate a compressed section
# LZMA guid is EE4E5898-3914-4259-9D6E-DC7BD79403CF
# Embedded filesystem is 8C8CE578-8A3D-4F1C-9935-896185C32DD3
#
acpi-lz.ffs: blobs/$(BOARD)/acpi-data.ffs
$(EDK2_DIR)/GenFfs \
-t EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE \
-g 8C8CE578-8A3D-4F1C-9935-896185C32DD3 \
-o $<.ffs.fv \
-a 16 \
-i $<
$(EDK2_DIR)/LzmaCompress \
-e \
-q \
-o $<.fv.lz \
$<.fv
$(EDK2_DIR)/GenSec \
-s EFI_SECTION_GUID_DEFINED \
-g EE4E5898-3914-4259-9D6E-DC7BD79403CF \
-r PROCESSING_REQUIRED \
-o $<.fv.lz.sec \
$<.fv.lz
$(EDK2_DIR)/GenFfs \
-t EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE \
-g 8C8CE578-8A3D-4F1C-9935-896185C32DD3 \
-i $<.fv.lz.sec \
-o $@
vendor-$(BOARD).full.rom: blobs/$(BOARD)/vendor-files.txt Linux.ffs Initrd.ffs
$(EDK2_DIR)/GenFv \
--numberblock $$[$(NERF_FULL_SIZE)/0x1000] \
--blocksize 0x1000 \
--FvNameGuid 4652454e-482f-6165-6473-2f4c696e7578 \
-o $@ \
`awk '/^[0-9A-Fa-f]/ {print "-f blobs/$(BOARD)/files/file-"$$1"/file.obj"}' $<` \
-f Linux.ffs \
-f Initrd.ffs \
nerf.intermediate: edk2.intermediate nerf-$(BOARD).rom

BIN
blobs/s2600wf/acpi/APIC Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/DSDT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/FACP Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/FACS Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/HPET Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/MCFG Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/MSCT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/OEM1 Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/OEM2 Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/OEM3 Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/OEM4 Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/PCAT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/PCCT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/RASF Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/SLIT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/SPMI Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/SRAT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/SSDT1 Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/SSDT2 Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/UEFI Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/WDDT Normal file

Binary file not shown.

BIN
blobs/s2600wf/acpi/WSMT Normal file

Binary file not shown.

View File

@ -0,0 +1,123 @@
fc510ee7-ffdc-11d4-bd41-0080c73c8881 DxeApriori
d6a2cb7f-6a18-4e2f-b43b-9920a733700a DxeCore
350d356d-f340-45d7-a3b5-335f0085924c FastVideoDxe
80cf7257-87ab-47f9-a3fe-d50b76d89541 PcdDxe
56d60ee4-5ccf-485c-bbbb-fedae2b24146 RegAccessDxe
d93ce3d8-a7eb-4730-8c8e-cc466a9ecc3c ReportStatusCodeRouterRuntimeDxe
6c2004ef-4e0e-4be4-b14c-340eb4aa5891 StatusCodeHandlerRuntimeDxe
fede0a1b-bca2-4a9f-bb2b-d9fd7dec2e9f StatusCodeRuntimeDxe
801adca0-815e-46a4-84f7-657f53621a57 SectionExtractionDxe
e0471a15-76dc-4203-8b27-6db4f8ba644a UbaConfigDatabaseDxe
69e6dd6d-f09e-485f-9627-eb70e9cfc82a UbaInitDxe
466a36cc-494a-4a33-bbfe-8c4416155c1d StaticSkuDataDxeWolfPass
a813aedf-9525-4bca-8b8c-039910a68eeb SetupConfigUpdateDxeWolfPass
5b83efff-fbf9-432d-8b4c-85981b42d54b OpromUpdateDxeWolfPass
3631014e-bdb8-4f58-ae2e-a7ee7c30c83e SmbiosDataUpdateDxeWolfPass
4e042122-0de2-487e-a7ac-cbf9c445d129 UsbOcUpdateDxeWolfPass
cbaeb5fd-e23d-499b-8930-0e66321502a2 IioCfgUpdateDxeWolfPass
9f9eb36d-d3ab-4f5c-92ad-513647ba6a6e SlotDataUpdateDxeWolfPass
5be2bdc0-5a11-4dcf-a905-0864376aaf0b PchUsb2EyeDiagramDxeWolfPass
6d9dd029-d030-4268-a7e1-f9b3a63c4865 SsidSvidDataUpdateDxeWolfPass
e9bbeba6-5e97-487e-80e2-528a4a14b326 FpkConfigUpdateWolfPass
57e81aa9-9b3f-4398-a925-1d13b53ca265 DMIMarginUpdateDxeWolfPass
788dd6a1-f1ee-4bba-a925-c0e7d66271bd SystemBoardDxe
2e6a521c-f697-402d-9774-98b2b7e140f3 PlatformType
bfe40e55-e8a9-43eb-9005-59c0522fd256 IioAspmWA
825ac08e-16c8-4b9a-8fdb-ec2bfeb813cf SpdRawData
dae6b815-877d-4597-a637-cfcfccc431ed PlatformStatusCodeHandlerDxe
d3be40fc-81d9-45fb-b8b0-f4774e91bc9d SysconfigSysinfoHide
b88303f6-2e0e-41cc-8510-f5892bf1d9d9 PlatformVariableInitDxe
9f7dcade-11ea-448a-a46f-76e003657dd1 VariableSmmRuntimeDxe
417b885b-1737-4bbe-9b09-4414696d93ac StartupMarkerFileBootOrder
96fcec89-bbd9-4413-93cd-144631db7431 SmbiosPcTable
213609e5-3451-4395-9ed6-8ceceadb74a7 SecureBootErrorHandlerDxe
99677785-7339-4fab-b15a-ceb7354cccaa SecureBootProvisionDxe
3bc456c8-c12c-4c86-9902-73b183a1fb72 SecureBootSetup
d564771b-573e-4dd5-a6f2-f4c30c610815 SecureBootCtrlDxe
62dc08ac-a651-4ee9-af81-eaa9261e9780 S3NvramSave
7f8d35bd-0ce3-4654-b5d3-73fc4b38aabf PlatformEarlyDxe
bae7599f-3c6b-43b7-bdf0-9ce07aa91aa6 CpuIoDxe
a19b1fe7-c1bc-49f8-875f-54a5d542443f CpuIo2Dxe
348c4d62-bfbd-4882-9ece-c80bb1c4783b HiiDatabase
79ca4208-bba1-4a9a-8456-e1e66a81484e Legacy8259
62d171cb-78cd-4480-8678-c6a2a797a8de CpuArchDxe
76a7b4fc-c8d5-462d-a4d2-6e88338a772a PlatformCpuPolicy
40beab40-cece-4909-b133-20a413ae19e9 CpuMpDxe
b3461d39-7b7b-41ca-8722-9be487d58038 SMBIOSFilter
c8339973-a563-4561-b858-d8476f9defc4 Metronome
f099d67f-71ae-4c36-b2a3-dceb0eb2b7d8 WatchdogTimer
378d7b65-8da9-4773-b6e4-a47826a833e1 PcRtc
b601f8c4-43b7-4784-95b1-f4226cb40cee RuntimeDxe
d58ebce1-af26-488d-be66-c164417f8c13 PciHostBridge
3ffcae95-23cf-4967-94f5-16352f68e43b PpmInitialize
4143c17d-54bc-4903-9958-2454216bb21e LpcPlatform
2a537c0e-5d9c-45d3-a6ce-3ad02d3e3b53 ReserveMem
ad608272-d07f-4964-801e-7bd3b7888652 MonotonicCounterRuntimeDxe
f80697e9-7fd6-4665-8646-88e33ef71dfc SecurityStubDxe
42857f0a-13f2-4b21-8a23-53d3f714b840 CapsuleRuntimeDxe
37d00905-5a90-4b82-9d44-011990b28a8d CpPcBiosId
9622e42c-8e38-4a08-9e8f-54f784652f6b AcpiTableDxe
4495e47e-42a9-4007-8c17-b6664f909d04 BlockIoDxe
9b680fce-ad6b-4f3a-b60b-f59899003443 DevicePathDxe
aa7b4695-00b4-4468-ad92-99370ac031c5 LegacyRegion2
96b5c032-df4c-4b6e-8232-438dcf448d0e NullMemoryTestDxe
de23acee-cf55-4fb6-aa77-984ab53de823 PchInitDxe
e052d8a6-224a-4c32-8d37-2e0ae162364d PchSmbusDxe
c1c418f9-591d-461c-82a2-b9cd96dfea86 LegacyInterrupt
a0bad9f7-ab78-491b-b583-c52b7f84b9e0 SmmControl
c194c6ea-b68c-4981-b64b-9bd271474b20 PchSpiRuntime
fc1b7640-3466-4c06-b1cc-1c935394b5c2 PchSerialGpio
90cb75db-71fc-489d-aacf-943477ec7212 SmartTimer
bb1fbd4f-2e30-4793-9bed-74f672bc8ffe PchResetRuntime
5aab83e5-f027-4ca7-bfd0-16358cc9e453 WdtDxe
253e85e9-993b-439b-b74c-6120f77b4723 PlatformReset
bb55f6b2-5a6f-4cd0-b128-6243d73acc97 PlatformPreVariableDxe
433fbed1-d908-434d-a10b-4b0524537375
13381490-aa8f-466a-8c65-26a0247c8d00 DFSDxe
ad70855e-0cc5-4abf-8979-be762a949ea3 IncompatiblePciDeviceSupport
f34f24d7-7531-4b83-9116-bd03fcf99878 SyscfgSyncDxe
e2441b64-7ef4-41fe-b3a3-8caa7f8d3017 PciPlatform
02a6de33-3ea9-4c17-8ea2-5681cc7afded VMDVROC2
dc2378e1-11d3-49f7-9425-61f8430011b8 VMDVROC1
93b80004-9fb3-11d4-9a3a-0090273fc14d PciBusDxe
6a3def38-0a45-4107-a74e-abf2b8eaed86 MemorySubClass
c8885b5c-48ba-44e1-b992-7f3dc826b36f PlatformDevsUpdate
f9d88642-0737-49bc-81b5-6889cd57d9ea SmbiosDxe
d27fed59-abb4-4fed-bead-2a878c7e4a7e SmbiosMeasurementDxe
87ab821c-79b8-4ef6-a913-21d22063f55f AcpiPlatform
274f0c8f-9e57-41d8-9966-29ccd48d31c2 SmmAccess
8faad0a7-02b4-432f-8f5c-b880965d8b41 SmmCommunicationBuffer
bdce85bb-fbaa-4f4e-9264-501a2c249581 S3SaveStateDxe
2bded685-f733-455f-a840-43a22b791fb3 AcpiS3SaveDxe
7c46c6a4-362f-4964-af20-9333e552dcc3 PciHotPlug
55e76644-78a5-4a82-a900-7126a5798892 HeciInitDxe
abbce13d-e25a-4d9f-a1f9-2f7710786892 Platform
515fac42-8580-4ce6-91c3-aff7d15694cd SmbiosMisc
fcb337d0-bb67-4fa7-83d9-67cc7b0baf9d SmbiosIFWI
7e374e25-8e01-4fee-87f2-390c23c606cd EfiAcpiTableStorage
a381a73e-23c9-4939-8f88-30b544dc4023
f59daa23-d5d5-4d16-91fc-d03abdc12ffe BmcAcpiDxe
64a11188-5b86-4f59-a702-73365896e65e AcpiVTD
ee0bff80-2b33-4005-8ef1-3f9b23c25136 GetCpuInfo
34fb5a1b-e3cd-4893-9403-0a39ba62fda0 SvSmmSupport
06d20d84-a032-4e25-969a-346d255e46d1 CpuCsrAccess
c4eb3614-4986-42b9-8c0d-9fe118278908 CrystalRidge
e72527cf-505b-4b50-99cd-a32467fa4aa4 AsfTable
4896840d-46bb-412b-a30a-a62abfb3682f
63809859-f029-41c3-9f34-eeeb9ea787a5 IioInit
6ec99217-69bb-4ad6-9b4e-8f4ab9af72b9 ResetTesting
6b6fd380-2c55-42c6-98bf-cbbc5a9aa666 SocketSetup
deb0ee00-18df-415c-af03-74d09b0aad87 JedecNvDimm
2fa2a6da-11d5-4dc3-999a-749648b03c56 PiSmmIpl
e94f54cd-81eb-47ed-aec3-856f5dc157a9 PiSmmCore
d96a2393-8790-4baa-9ceb-42533f016ee9 RegAccessSMM
7d94b7a4-b8d7-4371-8d12-92083adf5e47 SmiVariable
23a089b3-eed5-4ac5-b2ab-43e3298c2343 VariableSmm
f5ac7057-5650-466e-b692-76a47223efb0 AcpiSmmPlatform
a3ff0ef5-0c28-42f5-b544-8c7de1e80014 PiSmmCpuDxeSmm
b0d6ed53-b844-43f5-bd2f-61095264e77e PchSmiDispatcher
a47ee2d8-f60e-42fd-8e58-7bd65ee4c29b CpuIo2Smm
470cb248-e8ac-473c-bb4f-81069a1fe6fd SmmFaultTolerantWriteDxe
6d4baa0b-f431-4370-af19-99d6209239f6 BiosGuardServices
a469ddbd-16d0-4535-bae3-77274bd70b4c FwBlockServiceSmm
27f4917b-a707-4aad-9676-26df168cbf0d PchSpiSmm

329
create-ffs Executable file
View File

@ -0,0 +1,329 @@
#!/usr/bin/perl
# Create a UEFI "Firmware File" (FFS) with optional features.
# Address Size Designation
# ------- ---- -----------
#
# EFI_FFS_FILE_HEADER:
# 0x0000 16 Name (EFI_GUID)
# 0x0010 1 IntegrityCheck.Header (Header Checksum)
# 0x0011 1 IntegrityCheck.File -> set to 0xAA (FFS_FIXED_CHECKSUM) and clear bit 0x40 of Attributes
# 0x0012 1 FileType -> 0x07 = EFI_FV_FILETYPE_DRIVER
# 0x0013 1 Attributes -> 0x00
# 0x0014 3 Size, including header and all other sections
# 0x0017 1 State (unused) -> 0X00
#
# EFI_COMMON_SECTION_HEADER:
# 0x0000 3 Size, including this header
# 0x0003 1 Type -> 0x10 (EFI_SECTION_PE32)
# 0x0004 #### <PE data>
#
# EFI_COMMON_SECTION_HEADER:
# 0x0000 3 Size, including this header
# 0x0003 1 Type -> 0x15 (EFI_SECTION_USER_INTERFACE)
# 0x0004 #### NUL terminated UTF-16 string (eg "FAT\0")
#
# EFI_COMMON_SECTION_HEADER:
# 0x0000 3 Size, including this header
# 0x0003 1 Type -> 0x14 (EFI_SECTION_VERSION)
# 0x0004 #### NUL terminated UTF-16 string (eg "1.0\0")
use warnings;
use strict;
use Getopt::Long;
use File::Temp 'tempfile';
use Digest::SHA 'sha1';
my $usage = <<"";
Usage:
$0 -o output.ffs [options] file.efi [...]
Options:
-o | --output output.ffs Output file (default is stdout)
-n | --name FileName Name to include in UI Section
-t | --type Type FREEFORM|DRIVER|SMM|DXE_CORE|SMM_CORE|PEIM
-v | --version 1.0 Version section
-g | --guid GUID This file GUID (default is hash of Name)
-d | --depex 'guid guid..' Optional dependencies (all ANDed, or TRUE)
-z | --compress Enable LZMA compression
my $output = '-';
my $name;
my $type = 'FREEFORM';
my $version;
my $guid;
my $depex;
my $compress;
GetOptions(
"o|output=s" => \$output,
"n|name=s" => \$name,
"t|type=s" => \$type,
"v|version=s" => \$version,
"g|guid=s" => \$guid,
"d|depex=s" => \$depex,
"z|compress+" => \$compress,
) or die $usage;
my %file_types = qw/
RAW 0x01
FREEFORM 0x02
SECURITY_CORE 0x03
PEI_CORE 0x04
DXE_CORE 0x05
PEIM 0x06
DRIVER 0x07
COMBINED_PEIM_DRIVER 0x08
APPLICATION 0x09
SMM 0x0A
FIRMWARE_VOLUME_IMAGE 0x0B
COMBINED_SMM_DXE 0x0C
SMM_CORE 0x0D
DEBUG_MIN 0xe0
DEBUG_MAX 0xef
FFS_PAD 0xf0
/;
my %section_types = qw/
GUID_DEFINED 0x02
PE32 0x10
PIC 0x11
TE 0x12
DXE_DEPEX 0x13
VERSION 0x14
USER_INTERFACE 0x15
COMPATIBILITY16 0x16
FIRMWARE_VOLUME_IMAGE 0x17
FREEFORM_SUBTYPE_GUID 0x18
RAW 0x19
PEI_DEPEX 0x1B
SMM_DEPEX 0x1C
/;
# Some special cases for non-PE32 sections
my %section_type_map = qw/
FREEFORM RAW
FIRMWARE_VOLUME_IMAGE FIRMWARE_VOLUME_IMAGE
/;
# Special cases for DEPEX sections
my %depex_type_map = qw/
PEIM PEI_DEPX
DRIVER DXE_DEPEX
SMM SMM_DEPEX
/;
my $data = '';
$data .= section(USER_INTERFACE => ucs16($name))
if $name;
$data .= section(VERSION => ucs16(chr(0x00) . $version))
if $version;
$data .= depex($type, split /\s+/, $depex)
if $depex;
# Read entire files at a time and append a new section
# for each file read. Some special types have their own
# section type; otherwise we're adding a PE32
local $/ = undef;
while(<>)
{
$data .= section($section_type_map{$type} || 'PE32', $_);
}
# If no GUID was provided, make one from the name
# if there is no name from the data
if ($guid)
{
$guid = guid($guid);
} else {
# Generate a deterministic GUID based on either
# the UI name or the hash of the input data
$guid = substr(sha1($name || $data), 0, 16);
}
my $file_type = $file_types{$type}
or die "$type: unknown file type\n";
# If we're compressing, compress the data and wrap it with a GUIDed header
if ($compress)
{
my ($fh,$filename) = tempfile();
print $fh $data;
close $fh;
# -7 produces the same bit-stream as the UEFI tools
my $lz_data = `lzma --compress --stdout -7 $filename`;
printf STDERR "%d compressed to %d\n", length($data), length($lz_data);
# fixup the size field in the lzma compressed data
substr($lz_data, 5, 8) = pack("VV", length($data), 0);
# wrap the lzdata in a GUIDed section
my $lz_header = ''
. guid('EE4E5898-3914-4259-9D6E-DC7BD79403CF')
. chr(0x18) # data offset
. chr(0x00)
. chr(0x01) # Processing required
. chr(0x00)
;
# and replace our data with the GUID defined LZ compressed data
$data = section(GUID_DEFINED => $lz_header . $lz_data);
}
# Generate the FFS header around the sections
my $len = length($data) + 0x18;
my $ffs = ''
. $guid # 0x00
. chr(0x00) # 0x10 header checksum
. chr(0x00) # 0x11 FFS_FIXED_CHECKSUM
. chr(hex $file_type) # 0x12
. chr(0x28) # 0x13 attributes
. chr(($len >> 0) & 0xFF) # 0x14 length
. chr(($len >> 8) & 0xFF)
. chr(($len >> 16) & 0xFF)
. chr(0x07) # 0x17 state (done?)
;
# fixup the header checksum
my $sum = 0;
for my $i (0..length($ffs)-2) {
$sum -= ord(substr($ffs, $i, 1));
}
substr($ffs, 0x10, 2) = chr($sum & 0xFF) . chr(0xAA);
# Add the rest of the data
$ffs .= $data;
# should we pad to align the FFS length?
#my $unaligned = length($ffs) % 8;
#$ffs .= chr(0x00) x (8 - $unaligned)
# if $unaligned != 0;
if ($output eq '-')
{
print $ffs;
} else {
open OUTPUT, ">", $output
or die "$output: Unable to open: $!\n";
print OUTPUT $ffs;
close OUTPUT;
}
# Convert a string to UCS-16 and add a nul terminator
sub ucs16
{
my $val = shift;
my $rc = '';
for(my $i = 0 ; $i < length $val ; $i++)
{
$rc .= substr($val, $i, 1) . chr(0x0);
}
# nul terminate the string
$rc .= chr(0x0) . chr(0x0);
return $rc;
}
# output an EFI Common Section Header
# Since we might be dealing with ones larger than 16 MB, we should use extended
# section type that gives us a 4-byte length.
sub section
{
my $type = shift;
my $data = shift;
die "$type: Unknown section type\n"
unless exists $section_types{$type};
my $len = length($data) + 4;
die "Section length $len > 16 MB, can't include it in a section!\n"
if $len >= 0x1000000;
my $sec = ''
. chr(($len >> 0) & 0xFF)
. chr(($len >> 8) & 0xFF)
. chr(($len >> 16) & 0xFF)
. chr(hex $section_types{$type})
. $data;
my $unaligned = length($sec) % 4;
$sec .= chr(0x00) x (4 - $unaligned)
if $unaligned != 0;
return $sec;
}
# convert text GUID to hex
sub guid
{
my $guid = shift;
my ($g1,$g2,$g3,$g4,$g5) =
$guid =~ /
([0-9a-fA-F]{8})
-([0-9a-fA-F]{4})
-([0-9a-fA-F]{4})
-([0-9a-fA-F]{4})
-([0-9([0-9a-fA-F]{12})
/x
or die "$guid: Unable to parse guid\n";
return pack("VvvnCCCCCC",
hex $g1,
hex $g2,
hex $g3,
hex $g4,
hex substr($g5, 0, 2),
hex substr($g5, 2, 2),
hex substr($g5, 4, 2),
hex substr($g5, 6, 2),
hex substr($g5, 8, 2),
hex substr($g5,10, 2),
);
}
# Generate a DEPEX
sub depex
{
my $type = shift;
my $section_type = $depex_type_map{$type}
or die "$type: DEPEX is not supported\n";
if ($depex eq 'TRUE')
{
# Special case for short-circuit
return section($section_type, chr(0x06) . chr(0x08));
}
my $data = '';
my $count = 0;
for my $guid (@_)
{
# push the guid
$data .= chr(0x02) . guid($guid);
$count++;
}
# AND them all together (1 minus the number of GUIDs)
$data .= chr(0x03) for 1..$count-1;
$data .= chr(0x08);
return section($section_type, $data);
}

View File

@ -8,7 +8,7 @@ flashrom_depends := pciutils $(musl_dep)
flashrom_version := 0.9.9
flashrom_dir := flashrom-$(flashrom_version)
flashrom_tar := flashrom-$(flashrom_version).tar.bz2
flashrom_url := http://download.flashrom.org/releases/$(flashrom_tar)
flashrom_url := https://download.flashrom.org/releases/$(flashrom_tar)
flashrom_hash := cb3156b0f63eb192024b76c0814135930297aac41f80761a5d293de769783c45
flashrom_target := \

View File

@ -431,7 +431,7 @@ index 8648dfa..9905200 100644
[PcdsFixedAtBuild.IPF]
--- /dev/null 2017-11-25 22:22:20.266607670 -0500
+++ Makefile 2017-10-20 17:30:30.300473143 -0400
+++ b/Makefile 2017-10-20 17:30:30.300473143 -0400
@@ -0,0 +1,38 @@
+# Wrapper around the edk2 "build" script to generate
+# the few files that we actually want and avoid rebuilding