-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.qemu
74 lines (53 loc) · 2.41 KB
/
Makefile.qemu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Qemu will be built around the kernel (see Makefile.kernel). Very few
# things will be overriden.
# ==== CONFIGURATION ======
# Uncomment to debug qemu
QEMU = $(TOOLS_DIR)/bin/qemu-system-arm
## Memory preallocation
# MEM_PREALLOC="-mem-prealloc -mem-path /dev/shm"
## Select kernel
# KERNEL=/homes/cperivol/Projects/zynq_linux/kernel/zImage
# KERNEL=/homes/ggkitsas/Projects/zynq-linux/linux-xlnx/arch/arm/boot/zImage
QEMU_KERNEL = $(RESOURCES_DIR)/zImage
## A ramdisk
QEMU_RAMDISK = $(RESOURCES_DIR)/ramdisk.image.gz
## Networking
# NET="-redir tcp:5555::80 -redir tcp:5556::445"
# NET="-net nic -net tap,ifname=tap0"
## Boot
CMA=cma=80M
SERIAL=-nographic -serial null -serial mon:stdio
# BOOTCMD="console=ttyPS0,115200 root=/dev/ram rw ip=:::::eth0:dhcp earlyprintk ramdisk_size=$(du --apparent-size $RAMDISK | awk '{print $1}'),1 $CMA"
BOOTCMD=-append "console=ttyPS0,115200 root=/dev/nfs rw nfsroot=10.0.2.2:/srv/nfs,proto=tcp 2049,proto=tcp ip=:::::eth0:dhcp $(CMA)"
QEMU_ARGS = -M xilinx-zynq-a9 $(SERIAL) -m 1024 $(MEM_PREALLOC) -dtb $(DTB_TREE) -kernel $(QEMU_KERNEL) $(NET)
# /======= CONFIG ======
qemu-git-repo=git@github.com:fakedrake/qemu
GIT_PROJECTS += qemu
qemu-build: $(QEMU) $(QEMU_KERNEL) $(DTB_TREE) $(QEMU_RAMDISK)
$(QEMU): | qemu $(TOOLS_DIR)/python
$(call remote-maybe, cd $(SOURCES_DIR)/qemu-git; \
git submodule update --init dtc && \
git submodule update --init pixman && \
./configure --without-system-pixman --enable-debug --prefix=$(TOOLS_DIR) --target-list="arm-softmmu" --enable-fdt --disable-kvm --disable-werror --python=$(TOOLS_DIR)/python)
$(call remote-maybe, $(MAKE) CFLAGS='-std=gnu90' ARFLAGS=rv -C $(SOURCES_DIR)/qemu-git)
$(call remote-maybe, $(MAKE) -C $(SOURCES_DIR)/qemu-git install)
qemu-run: qemu-build
grep $(FILESYSTEM_ROOT) /etc/exports || ( \
echo "I need to read from nfs:\n\techo '$(FILESYSTEM_ROOT) *(rw,sync,no_subtree_check)' >> /etc/exports" && \
false)
$(QEMU) $(QEMU_ARGS) $(BOOTCMD)
QEMU_GDBINIT = "cd $(SOURCES_DIR)/linux-git\nfile vmlinux\ntarget remote :1234"
QEMU_KERNEL_GDBINIT = "$(QEMU_GDBINIT)\nb panic\nb sys_sync\nstart $(QEMU_ARGS) $(BOOTCMD)"
.PHONY:
qemu-debug: qemu-build
echo 'start $(QEMU_ARGS) $(BOOTCMD)' > .gdbinit
gdb $(QEMU)
rm -rf .gdbinit
.PHONY:
qemu-debug-kernel: qemu-build
echo $(QEMU_GDBINIT) > .gdbinit
$(QEMU) $(QEMU_ARGS) -s -S $(BOOTCMD)
@echo "Now run 'gdb' in this directory."
.PHONY:
qemu-clean: qemu-git-clean
rm -rf $(QEMU)