2018-01-26 16:27:20 +00:00
|
|
|
#
|
|
|
|
# Specific targets and things for the qemu "mainboard"
|
|
|
|
#
|
|
|
|
# The ROM image is generated from the edk2 build in the main directory
|
|
|
|
# as part of the "OVMF" package.
|
|
|
|
#
|
|
|
|
# This pulls that image apart and inserts the Linux kernel and Initrd
|
2018-01-26 22:08:20 +00:00
|
|
|
# The ROM layout is:
|
|
|
|
# 0x000000.fv NVRAM
|
|
|
|
# 0x084000.fv FV (DXE and PEI)
|
|
|
|
# 0.fv PEI
|
|
|
|
# 1.fv DXE
|
|
|
|
# 0x7cc000.fv SEC
|
2018-01-26 16:27:20 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2018-01-27 03:44:51 +00:00
|
|
|
dxe-size := 0xA00000
|
2018-01-27 03:05:46 +00:00
|
|
|
merged-size := 0x748000
|
2018-01-26 16:27:20 +00:00
|
|
|
|
2018-01-27 03:05:46 +00:00
|
|
|
fv-path := $(BUILD)/rom/0x00084000/9e21fd93-9c72-4c15-8c4b-e77f1db2d792
|
2018-01-26 22:08:20 +00:00
|
|
|
dxe-path := $(fv-path)/1
|
2018-01-26 16:27:20 +00:00
|
|
|
|
2018-03-16 14:43:29 +00:00
|
|
|
dxe-files := $(shell awk \
|
2018-01-26 22:08:20 +00:00
|
|
|
'/^[0-9A-Fa-f]/ {print "$(dxe-path)/"$$1".ffs"}' \
|
|
|
|
boards/$(BOARD)/image-files.txt \
|
|
|
|
)
|
|
|
|
|
2018-03-16 14:43:29 +00:00
|
|
|
|
|
|
|
# since the 0.fv is nested inside another FV, we have to add an
|
|
|
|
# explicit dependency on the extract target to ensure that it is created
|
2018-04-30 19:22:33 +00:00
|
|
|
$(fv-path)/0.fv: $(BUILD)/$(BOARD).txt
|
|
|
|
@true
|
2018-03-16 14:43:29 +00:00
|
|
|
|
2018-01-27 03:05:46 +00:00
|
|
|
FVS := \
|
|
|
|
$(BUILD)/rom/0x00000000.fv \
|
2018-01-26 22:08:20 +00:00
|
|
|
$(BUILD)/merged.vol \
|
2018-01-27 03:05:46 +00:00
|
|
|
$(BUILD)/rom/0x007cc000.fv \
|
2018-01-26 22:08:20 +00:00
|
|
|
|
|
|
|
$(BUILD)/merged.vol: \
|
|
|
|
$(fv-path)/0.fv \
|
|
|
|
$(BUILD)/dxe.vol \
|
|
|
|
|
|
|
|
./bin/create-ffs \
|
|
|
|
--compress \
|
|
|
|
--type FIRMWARE_VOLUME_IMAGE \
|
|
|
|
$^ \
|
|
|
|
| ./bin/create-fv \
|
2018-01-27 03:05:46 +00:00
|
|
|
--size $(merged-size) \
|
2018-01-26 22:08:20 +00:00
|
|
|
-o $@
|
|
|
|
|
|
|
|
$(BUILD)/dxe.vol: \
|
|
|
|
$(BUILD)/DxeCore.ffs \
|
2018-03-16 14:43:29 +00:00
|
|
|
$(dxe-files) \
|
2018-05-07 19:53:12 +00:00
|
|
|
./dxe/linuxboot.ffs \
|
2018-01-26 22:08:20 +00:00
|
|
|
$(BUILD)/Linux.ffs \
|
|
|
|
$(BUILD)/Initrd.ffs \
|
|
|
|
|
2018-01-26 16:27:20 +00:00
|
|
|
|
2018-01-27 03:05:46 +00:00
|
|
|
# We can build a firmware image from edk2
|
|
|
|
# it is not necessary to provide one
|
2018-01-26 16:27:20 +00:00
|
|
|
boards/$(BOARD)/$(BOARD).rom: edk2/.git
|
|
|
|
( cd edk2/OvmfPkg ; ./build.sh )
|
|
|
|
cp edk2/Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd $@
|
2018-01-26 22:08:20 +00:00
|
|
|
|
2018-01-27 03:05:46 +00:00
|
|
|
# We can also launch a qemu with the LinuxBoot kernel
|
|
|
|
run: $(BUILD)/linuxboot.rom
|
2018-05-07 19:53:12 +00:00
|
|
|
-qemu-system-x86_64 \
|
2018-01-27 03:05:46 +00:00
|
|
|
-machine q35,smm=on \
|
|
|
|
-global ICH9-LPC.disable_s3=1 \
|
|
|
|
-global driver=cfi.pflash01,property=secure,value=on \
|
2018-05-07 19:53:12 +00:00
|
|
|
--serial $(or $(SERIAL),stdio) \
|
2018-01-27 03:05:46 +00:00
|
|
|
-drive if=pflash,format=raw,unit=0,file=$<
|
2018-05-07 19:53:12 +00:00
|
|
|
stty sane
|