2018-02-05 16:27:45 +00:00
|
|
|
modules-$(CONFIG_LINUXBOOT) += linuxboot
|
|
|
|
|
|
|
|
linuxboot_version := git
|
|
|
|
linuxboot_repo := https://github.com/osresearch/linuxboot
|
|
|
|
linuxboot_dir := linuxboot-$(linuxboot_version)
|
|
|
|
|
|
|
|
# linuxboot builds are specialized on a per-target basis.
|
2018-02-05 20:59:26 +00:00
|
|
|
# They can be specialized by defining $(CONFIG_LINUXBOOT_BOARD)
|
2018-02-05 16:27:45 +00:00
|
|
|
# otherwise it is assumed that it will have the same name
|
|
|
|
# as the Heads BOARD.
|
2018-02-05 20:59:26 +00:00
|
|
|
linuxboot_board := $(or $(CONFIG_LINUXBOOT_BOARD),$(BOARD))
|
2018-02-05 16:27:45 +00:00
|
|
|
|
2018-03-15 00:31:47 +00:00
|
|
|
|
|
|
|
linuxboot_configure := \
|
2018-03-15 15:49:02 +00:00
|
|
|
echo >&2 "Pre-building edk2" ; \
|
|
|
|
$(MAKE) \
|
|
|
|
BOARD=$(linuxboot_board) \
|
|
|
|
edk2.force \
|
|
|
|
|| exit 1 ; \
|
2018-03-15 00:31:47 +00:00
|
|
|
if [ "$(linuxboot_board)" = "qemu" ]; then \
|
|
|
|
echo >&2 "Pre-building edk2 OVMF" ; \
|
2018-03-15 15:49:02 +00:00
|
|
|
( cd edk2/OvmfPkg ; ./build.sh -n `nproc` ) \
|
|
|
|
|| exit 1 ; \
|
|
|
|
fi ; \
|
|
|
|
touch .config ; \
|
2018-03-15 00:31:47 +00:00
|
|
|
|
2018-02-05 16:27:45 +00:00
|
|
|
linuxboot_target := \
|
2018-02-08 21:02:29 +00:00
|
|
|
BOARD=$(linuxboot_board) \
|
2018-02-05 16:27:45 +00:00
|
|
|
KERNEL=$(build)/$(BOARD)/bzImage \
|
|
|
|
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
2018-02-08 21:02:29 +00:00
|
|
|
$(if $(CONFIG_LINUXBOOT_ROM), ROM=$(pwd)/$(CONFIG_LINUXBOOT_ROM)) \
|
2018-02-05 16:27:45 +00:00
|
|
|
all
|
|
|
|
|
|
|
|
#
|
|
|
|
# Most mainboards will define a ROM file that contains the vendor ROM
|
2018-02-08 20:21:38 +00:00
|
|
|
# for the image. Provide a reasonable error if the ROM file doesn't exist.
|
2018-02-05 16:27:45 +00:00
|
|
|
#
|
|
|
|
ifneq "$(CONFIG_LINUXBOOT_ROM)" ""
|
|
|
|
ifneq "y" "$(shell [ -r '$(CONFIG_LINUXBOOT_ROM)' ] && echo y)"
|
|
|
|
$(error $(CONFIG_LINUXBOOT_ROM): you must provide a ROM file)
|
|
|
|
endif
|
|
|
|
|
2018-02-08 20:21:38 +00:00
|
|
|
# Force a rebuild of the LinuxBoot ROM if the vendor ROM changes
|
|
|
|
linuxboot.intermediate: $(CONFIG_LINUXBOOT_ROM)
|
|
|
|
|
2018-02-05 16:27:45 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# The output file from the LinuxBoot build is a full ROM
|
|
|
|
# ready to flash onto the mainboard. There might be partial
|
|
|
|
# firmware volumes as well, but that depends on the board
|
|
|
|
# so this only retrieves the final one
|
2018-02-05 20:59:26 +00:00
|
|
|
linuxboot_output := $(build)/$(linuxboot_dir)/build/$(linuxboot_board)/linuxboot.rom
|
2018-02-05 16:27:45 +00:00
|
|
|
|
|
|
|
$(linuxboot_output): linuxboot.intermediate
|
|
|
|
|
|
|
|
$(build)/$(BOARD)/linuxboot.rom: $(linuxboot_output)
|
|
|
|
$(call do-copy,$<,$@)
|
|
|
|
|
|
|
|
# The Linux kernel and Heads initrd must be built before linuxboot
|
|
|
|
# unless the user has specified "FAST=1" on the make command line,
|
|
|
|
# which will assume that the kernel and initrd are fresh
|
2018-03-15 15:49:02 +00:00
|
|
|
#
|
|
|
|
# There is not an explicit dependency of linuxboot on linux
|
|
|
|
# or initrd so that the configuration can pre-build all of edk2
|
|
|
|
# overlapping with the other builds.
|
2018-02-05 16:27:45 +00:00
|
|
|
ifneq "$(FAST)" "1"
|
2018-02-05 16:56:15 +00:00
|
|
|
linuxboot.intermediate: $(build)/$(BOARD)/bzImage
|
|
|
|
linuxboot.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
|
2018-02-05 16:27:45 +00:00
|
|
|
endif
|
2018-02-05 22:27:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
linuxboot.run: $(build)/$(BOARD)/linuxboot.rom
|
|
|
|
$(MAKE) -C $(build)/$(linuxboot_dir) \
|
|
|
|
BOARD:=$(linuxboot_board) \
|
|
|
|
KERNEL=$(build)/$(BOARD)/bzImage \
|
|
|
|
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
|
|
|
run
|