2017-09-20 21:47:48 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2017-09-20 22:33:05 +00:00
|
|
|
# This should be done in some sort of automated way
|
|
|
|
# it is currently a little risk prone...
|
2017-09-20 21:47:48 +00:00
|
|
|
initrd: initrd.intermediate
|
2017-09-21 14:24:16 +00:00
|
|
|
cat blobs/r630/acpi.cpio initrd.cpio > $(build)/$(linux_dir)/initrd.cpio
|
2017-09-20 21:47:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
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" \
|
|
|
|
|
|
|
|
|
2017-09-20 22:24:54 +00:00
|
|
|
$(build)/$(linux_dir)/arch/x86/boot/bzImage: linux.intermediate
|
2017-09-20 21:47:48 +00:00
|
|
|
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 $@ \
|
|
|
|
|
|
|
|
|
2017-09-20 22:33:05 +00:00
|
|
|
$(build)/$(edk2_dir)/DxeCore.efi: edk2.intermediate
|
2017-09-20 21:47:48 +00:00
|
|
|
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 \
|
2017-09-20 22:24:54 +00:00
|
|
|
--align 1K \
|
2017-09-20 21:47:48 +00:00
|
|
|
$(addprefix -i ,$^) \
|
|
|
|
-o $@ \
|
|
|
|
|
2017-09-20 22:33:05 +00:00
|
|
|
$(build)/$(edk2_dir)/RuntimeDxe.efi: edk2.intermediate
|
2017-09-20 21:47:48 +00:00
|
|
|
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 $@ \
|
|
|
|
|
2017-09-20 22:59:24 +00:00
|
|
|
# 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.
|
2017-09-20 21:47:48 +00:00
|
|
|
nerf.vol: DxeCore.ffs RuntimeDxe.ffs linux.ffs
|
|
|
|
$(EDK2_DIR)/GenFv \
|
2017-09-20 22:59:24 +00:00
|
|
|
--numberblock 0xB3 \
|
2017-09-20 21:47:48 +00:00
|
|
|
--blocksize 0x10000 \
|
|
|
|
--FvNameGuid 4652454e-482f-6165-6473-2f4c696e7578 \
|
|
|
|
-o $@ \
|
2017-09-21 13:34:16 +00:00
|
|
|
$(addprefix -f ,$^)
|
2017-09-21 14:24:16 +00:00
|
|
|
@head -2 $@.txt
|
|
|
|
-$(RM) $@.txt $@.map
|
2017-09-20 21:47:48 +00:00
|
|
|
|
2017-09-20 22:59:24 +00:00
|
|
|
# You must provide your own r630.rom as input
|
2017-09-21 14:24:16 +00:00
|
|
|
# the ifd is only the first 64k, but we take all the way to the ME region
|
|
|
|
# dd < r630.rom bs=$[0x10000] skip=$[0x00] count=$[0x02] > blobs/r630/ifd.bin
|
|
|
|
# dd < r630.rom bs=$[0x10000] skip=$[0x02] count=$[0x2F] > blobs/r630/me.bin
|
|
|
|
# dd < r630.rom bs=$[0x10000] skip=$[0xe4] count=$[0x1C] > blobs/r630/pei.bin
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
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
|
2017-09-20 22:59:24 +00:00
|
|
|
|
2017-09-20 21:47:48 +00:00
|
|
|
|
|
|
|
|
2017-09-20 22:59:24 +00:00
|
|
|
nerf.intermediate: nerf-r630.rom
|