board-qemu-arm.mk 1.8 KB
Newer Older
Grant Likely's avatar
Grant Likely committed
1
2

TFA_PLAT := qemu
Grant Likely's avatar
Grant Likely committed
3
OPTEE_PLATFORM := vexpress-qemu_armv8a
Grant Likely's avatar
Grant Likely committed
4
5
6
7

UBOOT_EXTRA_CONFIGS += scripts/qemu_arm64_tfa.config
FLASH_IMAGE := nor_flash.bin

8
9
OPTEE_EXTRA += CFG_RPMB_FS_DEV_ID=1

Grant Likely's avatar
Grant Likely committed
10
11
12
13
14
15
16
17
18
ifneq ($(CONFIG_TFABOOT)$(CONFIG_POSITION_INDEPENDENT),yy)
tweakconfig:
	echo "CONFIG_POSITION_INDEPENDENT=y" >> $(UBOOT_OUTPUT)/.config
	echo "CONFIG_TFABOOT=y" >> $(UBOOT_OUTPUT)/.config
	$(MAKE) -C $(UBOOT_PATH) $(UBOOT_EXTRA) olddefconfig

u-boot/all u-boot/u-boot.bin: tweakconfig
endif

19
20
all: $(FLASH_IMAGE)
$(FLASH_IMAGE): tfa/all tfa/fip
Grant Likely's avatar
Grant Likely committed
21
22
23
24
	dd if=/dev/zero of=$(FLASH_IMAGE) count=$$((64*1024*1024>>9))
	dd if=$(TFA_OUTPUT)/$(TFA_PLAT)/release/bl1.bin of=$(FLASH_IMAGE) bs=4096 conv=notrunc
	dd if=$(TFA_OUTPUT)/$(TFA_PLAT)/release/fip.bin of=$(FLASH_IMAGE) bs=4096 seek=64 conv=notrunc

25
26
27
28
all: semihosting
semihosting: tfa/all
	mkdir -p output
	cp $(TFA_OUTPUT)/$(TFA_PLAT)/release/*.bin output
29
ifeq ($(CONFIG_OPTEE),y)
30
31
32
	cp $(OPTEE_OUTPUT)/arm-plat-vexpress/core/tee-header_v2.bin output/bl32.bin
	cp $(OPTEE_OUTPUT)/arm-plat-vexpress/core/tee-pager_v2.bin output/bl32_extra1.bin
	cp $(OPTEE_OUTPUT)/arm-plat-vexpress/core/tee-pageable_v2.bin output/bl32_extra2.bin
33
endif
34
35
	cp $(UBOOT_OUTPUT)/u-boot.bin output/bl33.bin

36
37
38
39
40
41
42
43
44
45
# Core QEMU configuration.
QEMU_BASE_CONFIG += -machine virt,secure=on -cpu cortex-a57
QEMU_BASE_CONFIG += -smp 2 -m 1024 -d unimp -monitor null -no-acpi
QEMU_BASE_CONFIG += -nographic
QEMU_BASE_CONFIG += -serial stdio  # Non-secure; u-boot console
QEMU_BASE_CONFIG += -serial tcp::5000,server,nowait # Secure; optee
ifneq ($(VIRTDISK),)
QEMU_BASE_CONFIG += -drive if=virtio,format=raw,file=$(VIRTDISK)
endif

46
qemu-fip:
47
	qemu-system-aarch64 $(QEMU_BASE_CONFIG) -bios $(FLASH_IMAGE) $(QEMU_EXTRA)
Grant Likely's avatar
Grant Likely committed
48

49
qemu-semihosting:
50
	cd output && qemu-system-aarch64 $(QEMU_BASE_CONFIG) -bios bl1.bin -semihosting-config enable,target=native $(QEMU_EXTRA)