mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-19 04:57:55 +00:00
115573adc9
This links in the AcpiTableDxe and AcpiPlatform executables from the edk2 build tree and adds a depex dependency for the Linux kernel on the AcpiTable being setup. The `acpi.cpio` file is no longer included in the Linux kernel bzImage. The `Makefile.nerf` has been re-written to generate the firmware file system (FFS) files via rules. TODO: figure out how to add LZMA compressed sections so that the 900k acpi tables can be compressed to about 100k.
181 lines
4.8 KiB
Makefile
181 lines
4.8 KiB
Makefile
|
|
# Targets specific for the NERF firmware
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
# build/edk2-UDK2017/Build/MdeModule/DEBUG_GCC5/X64/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT
|
|
# 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 }}
|
|
|
|
|
|
dxe-y += DxeCore
|
|
DxeCore-filetype := EFI_FV_FILETYPE_DXE_CORE
|
|
DxeCore-guid := D6A2CB7F-6A18-4E2F-B43B-9920A733700A
|
|
|
|
dxe-y += RuntimeDxe
|
|
RuntimeDxe-depex := TRUE
|
|
RuntimeDxe-guid := B601F8C4-43B7-4784-95B1-F4226CB40CEE
|
|
|
|
dxe-y += AcpiTableDxe
|
|
AcpiTableDxe-guid := 9622E42C-8E38-4a08-9E8F-54F784652F6B
|
|
AcpiTableDxe-depex := $(RuntimeArchProtocolGuid)
|
|
|
|
dxe-y += AcpiPlatform
|
|
AcpiPlatform-guid := cb933912-df8f-4305-b1f9-7b44fa11395c
|
|
AcpiPlatform-depex := $(RuntimeArchProtocolGuid) AND $(AcpiTableProtocolGuid)
|
|
|
|
|
|
dxe-y += Linux
|
|
Linux-file := $(build)/$(linux_dir)/arch/x86/boot/bzImage
|
|
Linux-version := $(linux-version)
|
|
Linux-guid := DECAFBAD-6548-6461-732d-2f2d4e455246
|
|
Linux-depex := $(RuntimeArchProtocolGuid) AND $(AcpiTableProtocolGuid)
|
|
|
|
|
|
dxe-y += Initrd
|
|
Initrd-file := initrd.cpio.xz
|
|
Initrd-filetype := EFI_FV_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.file.sec $1.ver.sec $1.name.sec \
|
|
$(if $($1-depex),$1.dep.sec) \
|
|
|
|
$(EDK2_DIR)/GenFfs \
|
|
-t $(or $($1-filetype),EFI_FV_FILETYPE_DRIVER) \
|
|
-g $($1-guid) \
|
|
--align 64K \
|
|
-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 $$@ \
|
|
$$^
|
|
|
|
# add a dependency on the edk2 module if we are picking up an
|
|
# edk2 build DXEexecutable.
|
|
ifndef $($1-file)
|
|
$(build)/$(edk2_dir)/Build/MdeModule/DEBUG_GCC5/X64/$1.efi: edk2.intermediate
|
|
endif
|
|
|
|
endef
|
|
|
|
# For everything that we will include in our DXE filesystem, we
|
|
# have to instatiate targets for the ffs and file sections.
|
|
# If there is no DEPEX defined, do not create a depex file dependency
|
|
$(call map,build-ffs,$(dxe-y))
|
|
|
|
$(build)/$(linux_dir)/arch/x86/boot/bzImage: linux.intermediate
|
|
|
|
|
|
# Generate a firmware file with a well known guid
|
|
|
|
# If you have to fit within the normal UEFI image, the volume is
|
|
# limited to 0x47 blocks.
|
|
#
|
|
# But you can also replace the entire region from 0x310000
|
|
# up to PEI at 0xE40000, which leaves us almost 11 MB of space.
|
|
nerf.vol: $(addsuffix .ffs,$(dxe-y)) blobs/r630/acpi-data.ffs
|
|
$(EDK2_DIR)/GenFv \
|
|
--numberblock 0xB3 \
|
|
--blocksize 0x10000 \
|
|
--FvNameGuid 4652454e-482f-6165-6473-2f4c696e7578 \
|
|
-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.
|
|
# ifdtool -u blobs/r630/ifd.bin && mv blobs/r630/ifd.bin.new blobs/r630/ifd.bin
|
|
blobs/r630/me.bin: r630.rom
|
|
dd < $< bs=$$[0x10000] skip=$$[0x02] count=$$[0x2F] > $@
|
|
blobs/r630/pei.bin: r630.rom
|
|
dd < $< bs=$$[0x10000] skip=$$[0xE4] count=$$[0x1C] > $@
|
|
|
|
nerf-r630.rom: \
|
|
blobs/r630/ifd.bin \
|
|
blobs/r630/me.bin \
|
|
nerf.vol \
|
|
blobs/r630/pei.bin \
|
|
|
|
cat $^ > $@
|
|
@if [ `stat -c'%s' $@` -ne 16777216 ]; then \
|
|
echo -n >&2 "$@ SHOULD BE 16MB. size "; \
|
|
stat -c'%s' $@ >&2 ; \
|
|
mv $@ $@.bad; \
|
|
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/r630/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 $@
|
|
|
|
|
|
nerf.intermediate: nerf-r630.rom
|