board-qemu-arm.mk 1.9 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

10
11
QEMU_BIN ?= qemu-system-aarch64

Grant Likely's avatar
Grant Likely committed
12
13
14
15
16
17
18
19
20
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

21
22
all: $(FLASH_IMAGE)
$(FLASH_IMAGE): tfa/all tfa/fip
Grant Likely's avatar
Grant Likely committed
23
24
25
26
	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

27
all: semihosting
28
semihosting: tfa/all u-boot/all
29
30
	mkdir -p output
	cp $(TFA_OUTPUT)/$(TFA_PLAT)/release/*.bin output
31
ifeq ($(CONFIG_OPTEE),y)
32
33
34
	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
35
endif
36
37
	cp $(UBOOT_OUTPUT)/u-boot.bin output/bl33.bin

38
39
40
41
42
43
44
45
46
47
# 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

48
qemu-fip:
49
	$(QEMU_BIN) $(QEMU_BASE_CONFIG) -drive if=pflash,unit=0,file=$(FLASH_IMAGE) $(QEMU_EXTRA)
Grant Likely's avatar
Grant Likely committed
50

51
qemu-semihosting:
52
	cd output && $(QEMU_BIN) $(QEMU_BASE_CONFIG) -bios bl1.bin -semihosting-config enable,target=native $(QEMU_EXTRA)
Jose Marinho's avatar
Jose Marinho committed
53
54
55

qemu-%-dbg: qemu-%;
qemu-%-dbg: QEMU_EXTRA += -s -S