heads/Makefile.nerf

121 lines
2.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
initrd: initrd.intermediate
cat blobs/r630/acpi.initrd initrd.cpio > $(linux_dir)/initrd.cpio
GenSec-name = $(EDK2_DIR)/GenSec \
-S EFI_SECTION_USER_INTERFACE \
-o "$1" \
-n $2 \
GenSec-version = $(EDK2_DIR)/GenSec \
-S EFI_SECTION_VERSION \
-o "$1" \
-n $2 \
GenSec-pe = $(EDK2_DIR)/GenSec \
-S EFI_SECTION_PE32 \
-o "$1" \
"$2" \
linux-pe.sec: $(build)/$(linux_dir)/arch/x86/boot/bzImage
$(call GenSec-pe,$@,$<)
linux-name.sec:
$(call GenSec-name,$@,"HeadsNERF")
linux-version.sec:
$(call GenSec-version,$@,"0.1")
# Linux depends on the RuntimeArchProtocolGuid to have been installed,
# so we hand code a PUSH GUID, END dependecy file.
linux-dep.sec:
perl -e 'print chr(hex($$_)) for @ARGV' > $@.tmp \
02 \
e1 b4 df b7 \
2f 05 \
9f 44 \
87 be \
98 18 fc 91 b7 33 \
08 \
$(EDK2_DIR)/GenSec \
-S EFI_SECTION_DXE_DEPEX \
-o $@ \
$@.tmp
-$(RM) $@.tmp
# The RuntimeDxe has no dependencies, so we create an empty
# DEPEX file for it (TRUE, END). GenDepex could be used, but its
# commandline parser makes no sense.
nop-dep.sec:
perl -e 'print chr(hex($$_)) for qw/06 08/' > $@.tmp
$(EDK2_DIR)/GenSec \
-S EFI_SECTION_DXE_DEPEX \
-o $@ \
$@.tmp
-$(RM) $@.tmp
linux.ffs: linux-pe.sec linux-name.sec linux-version.sec nop-dep.sec
$(EDK2_DIR)/GenFfs \
-t EFI_FV_FILETYPE_DRIVER \
-g DECAFBAD-4865-6164-732d-2f2d4e455246 \
--align 64K \
$(addprefix -i ,$^) \
-o $@ \
DxeCore-pe.sec: $(build)/$(edk2_dir)/DxeCore.efi
$(call GenSec-pe,$@,$<)
DxeCore-name.sec:
$(call GenSec-name,$@,"DxeCore")
DxeCore-version.sec:
$(call GenSec-version,$@,"1.0")
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 \
$(addprefix -i ,$^) \
-o $@ \
RuntimeDxe-pe.sec: $(build)/$(edk2_dir)/RuntimeDxe.efi
$(call GenSec-pe,$@,$<)
RuntimeDxe-name.sec:
$(call GenSec-name,$@,"RuntimeDxe")
RuntimeDxe-version.sec:
$(call GenSec-version,$@,"1.0")
RuntimeDxe.ffs: RuntimeDxe-pe.sec RuntimeDxe-name.sec RuntimeDxe-version.sec nop-dep.sec
$(EDK2_DIR)/GenFfs \
-t EFI_FV_FILETYPE_DRIVER \
-g B601F8C4-43B7-4784-95B1-F4226CB40CEE \
--align 64K \
$(addprefix -i ,$^) \
-o $@ \
# For now we generate a FV that matches the existing UEFI image in size.
# This will change once we modify the image
nerf.vol: DxeCore.ffs RuntimeDxe.ffs linux.ffs
$(EDK2_DIR)/GenFv \
--numberblock 0x47 \
--blocksize 0x10000 \
--FvNameGuid 4652454e-482f-6165-6473-2f4c696e7578 \
-o $@ \
$(addprefix -f ,$^) \
nerf.intermediate: \
edk2.intermediate \
DxeCore.ffs \
RuntimeDxe.ffs \
no=\
linux.ffs \