2016-08-02 23:25:47 +00:00
|
|
|
#
|
2018-01-25 23:23:51 +00:00
|
|
|
# Builds the LinuxBoot firmware image.
|
2016-08-02 23:25:47 +00:00
|
|
|
#
|
2018-01-25 23:23:51 +00:00
|
|
|
# This requires the vendor firmware image, a Linux kernel and an initrd.cpio.xz file.
|
2016-08-02 23:25:47 +00:00
|
|
|
#
|
2018-01-25 23:23:51 +00:00
|
|
|
#
|
|
|
|
all: vendor linuxboot
|
2016-08-02 23:25:47 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
-include .config
|
|
|
|
include Makefile.rules
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
# The config file should set the BOARD variable
|
|
|
|
BOARD ?= qemu
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
# Bring in the board specific things
|
|
|
|
include boards/$(BOARD)/Makefile.board
|
2016-08-03 01:23:18 +00:00
|
|
|
|
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
# edk2 outputs will be in this deeply nested directory
|
|
|
|
EDK2_OUTPUT_DIR := edk2/Build/MdeModule/DEBUG_GCC5/X64
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
vendor:
|
2016-11-29 16:19:48 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
$(EDK2_OUTPUT_DIR)/DxeCore.efi: edk2/.git
|
|
|
|
$(MAKE) -C edk2
|
2016-12-13 18:10:21 +00:00
|
|
|
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
edk2.force: edk2/.git
|
|
|
|
$(MAKE) -C edk2 build
|
2017-09-22 19:09:57 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
# If the edk2 directory doesn't exist, checkout a shallow branch of it
|
|
|
|
# and build the various Dxe/Smm files
|
|
|
|
edk2/.git:
|
|
|
|
git clone --depth 1 --branch UDK2018 https://github.com/linuxboot/edk2
|
2016-08-03 01:59:14 +00:00
|
|
|
|
2017-03-29 19:15:03 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
vendor: vendor-$(BOARD).vol
|
|
|
|
linuxboot: linuxboot-$(BOARD).vol
|
2016-08-03 12:40:51 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
vendor-$(BOARD).vol: \
|
|
|
|
DxeCore.ffs \
|
|
|
|
PiSmmCore.ffs \
|
|
|
|
$(vendor-files) \
|
2016-08-06 21:13:22 +00:00
|
|
|
|
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
linuxboot-$(BOARD).vol: \
|
|
|
|
Linux.ffs \
|
|
|
|
Initrd.ffs \
|
2017-04-03 18:53:29 +00:00
|
|
|
|
2016-08-14 20:02:15 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
Linux.ffs: bzImage
|
|
|
|
Initrd.ffs: initrd.cpio.xz
|
2017-04-08 21:46:54 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
RuntimeArchProtocolGuid := b7dfb4e1-052f-449f-87be-9818fc91b733
|
|
|
|
AcpiTableProtocolGuid := FFE06BDD-6107-46A6-7BB2-5A9C7EC5275C
|
|
|
|
SmbiosProtocolGuid := 03583ff6-cb36-4940-947e-b9b39f4afaf7
|
|
|
|
VariableArchProtocolGuid := 1E5668E2-8481-11D4-BCF1-0080C73C8881
|
2017-01-27 21:17:03 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
Linux-guid := DECAFBAD-6548-6461-732d-2f2d4e455246
|
|
|
|
Linux-depex := \
|
|
|
|
$(RuntimeArchProtocolGuid) \
|
|
|
|
$(AcpiTableProtocolGuid) \
|
|
|
|
$(SmbiosProtocolGuid) \
|
|
|
|
$(VariableArchProtocolGuid) \
|
2017-04-08 21:46:54 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
Initrd-guid := 74696e69-6472-632e-7069-6f2f62696f73
|
|
|
|
Initrd-type := FREEFORM
|
2017-04-08 19:19:26 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
DxeCore-type := DXE_CORE
|
|
|
|
PiSmmCore-type := SMM_CORE
|
2017-01-27 21:17:03 +00:00
|
|
|
|
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
Linux.ffs: bzImage
|
2017-01-27 21:17:03 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
%.ffs: $(EDK2_OUTPUT_DIR)/%.efi
|
|
|
|
$(create-ffs)
|
|
|
|
%.ffs:
|
|
|
|
$(create-ffs)
|
2017-02-28 23:02:10 +00:00
|
|
|
|
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
%.vol:
|
|
|
|
./bin/create-fv \
|
|
|
|
-o $@ \
|
|
|
|
--size $(or $($(basename $@)-size),0x400000) \
|
|
|
|
--compress $(or $($(basename $@)-compress),0) \
|
|
|
|
$^
|
2017-01-27 21:17:03 +00:00
|
|
|
|
2018-01-25 23:23:51 +00:00
|
|
|
create-ffs = \
|
|
|
|
./bin/create-ffs \
|
|
|
|
-o $@ \
|
|
|
|
--name $(basename $@) \
|
|
|
|
--version 1.0 \
|
|
|
|
--type $(or $($(basename $@)-type),DRIVER) \
|
|
|
|
--depex "$($(basename $@)-depex)" \
|
|
|
|
--guid "$($(basename $@)-guid)" \
|
|
|
|
$^
|