blob: e00e2a4916fb186ca25bb52f001934c782cc59c4 [file] [log] [blame]
Joakim Bech8e5c5b32018-10-25 08:18:32 +02001On this page you will find device specific information for QEMU v7 (Armv7-A) and
2QEMU v8 (Armv8-A).
3
4.. _qemu_v7:
5
6#######
7QEMU v7
8#######
9The instructions here will tell how to run OP-TEE using QEMU for Armv7-A.
10
11Build instructions
12******************
13As long as you pick the v7 manifest, i.e., ``default.xml`` the
14":ref:`get_and_build_the_solution`" tells all you need to know to build and boot
15up QEMU v7.
16
17
18Consoles
19********
20After running ``make run`` you will end up in the QEMU console and it will also
21spawn two UART consoles. One console containing the UART for secure world and
22one console containing the UART for normal world. You will see that it stops
23waiting for input on the QEMU console. To continue, do:
24
25.. code-block:: none
26
27 (qemu) c
28
29Host-Guest folder sharing
30*************************
31You can use the VirtFS QEMU feature to avoid changing rootfs CPIO archive every
32time you need to add additional files or modify existing files. To do this, you
33share a folder between the guest and host operating systems. To enable and use
34this feature you have to provide additional arguments when running make,
35example:
36
37.. code-block:: bash
38
39 $ make QEMU_VIRTFS_ENABLE=y QEMU_USERNET_ENABLE=y
40
41.. hint::
42
43 You can also add ``QEMU_VIRTFS_HOST_DIR=<share>`` in case you don't want to
44 use the default sharing location (which is the root of <qemu-v7-project>).
45
46When QEMU with OP-TEE is up and running, you can mount the host folder in QEMU
47(normal world UART).
48
49.. code-block:: none
50
51 # mount -t 9p -o trans=virtio host <mount_point>
52
53``<mount_point>`` here is folder in the QEMU where you want to mount the host
54PC's shared folder. So if you want to mount it at ``/mnt/host`` you typically do
55this from QEMU NW/UART.
56
57.. code-block:: none
58
59 # mkdir -p /mnt/host
60 # mount -t 9p -o trans=virtio host /mnt/host
61
62Networking
63**********
64After booting QEMU, ``eth0`` will automatically receive an IP address from
65QEMU via DHCP using the SLiRP user networking feature. QEMU will act as a
66gateway to the host network `SLiRP`_.
67
68Please note that ICMP won't work in the guest unless additional configuration is
69made, so the ``ping`` utility won't work.
70
71GDB - Normal world
72******************
73If you need to debug a client application, using GDB in a remote debugging
74configuration may be useful. Remote debugging means ``gdb`` runs on your PC,
75where it can access the source code, while the program being debugged runs on
76the remote system (in this case, in the QEMU environment in normal world). Here
77is how to do that. On your PC, build with ``GDBSERVER=y``:
78
79.. code-block:: bash
80
81 $ cd <qemu-v7-project>/build
82 # You **only** need to rm -rf the first time you build with the new flag.
83 # If you omit doing so, it's likely that you will see "stamp" errors in the
84 # build log.
85 $ rm -rf <qemu-v7-project>/out-br
86 $ make -j8 run GDBSERVER=y
87
88Boot up as usual
89
90.. code-block:: bash
91
92 (qemu) c
93
94Inside QEMU (Normal World UART), run your application with gdbserver (for
95example ``xtest 4002``):
96
97.. code-block:: none
98
99 # gdbserver :12345 xtest 4002
100 Process xtest created; pid = 654
101 Listening on port 12345
102
103Back on your PC, open another terminal, start GDB and connect to the target:
104
105.. code-block:: bash
106
107 $ <qemu-v7-project>/out-br/host/bin/arm-buildroot-linux-gnueabihf-gdb
108 (gdb) set sysroot <qemu-v7-project>/out-br/host/arm-buildroot-linux-gnueabihf/sysroot
109 (gdb) target remote :12345
110
111Now GDB is connected to the remote application. You may use GDB normally.
112
113.. code-block:: none
114
115 (gdb) b main
116 (gdb) c
117
118
119.. _qemu_v8:
120
121#######
122QEMU v8
123#######
124The instructions here will tell how to run OP-TEE using QEMU for Armv7-A.
125
126Build instructions
127******************
128As long as you pick the v8 manifest, i.e., ``qemu_v8.xml`` the
129":ref:`get_and_build_the_solution`" tells all you need to know to build and boot
130up QEMU v8.
131
132All other things (networking, GDB etc) in the v7 section above is also
133applicable on QEMU v8 as long as you replace ``<qemu-v7-project>`` with
134``<qemu-v8-project>`` to get the correct paths relative to your QEMU v8 setup.
135
136.. _SLiRP: https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29