blob: 830a0b457ad4e15264c0e7176b1bdd1980880fff [file] [log] [blame]
Michael Grand745ab742019-08-03 17:22:30 +02001.. _zynqmp:
Michael Grand7d61b052019-02-24 23:50:46 +01002
Michael Grand745ab742019-08-03 17:22:30 +02003#########################
4ZynqMP zcu10x and Ultra96
5#########################
6Instructions below show how to run OP-TEE on ZynqMP zcu10x and Ultra96 board.
7
8Supported boards
9****************
10This makefile supports the following ZynqMP boards:
11
12 * zcu102
13 * zcu104
14 * zcu106
15 * Ultra96v1
Michael Grand7d61b052019-02-24 23:50:46 +010016
17Setting up the toolchain
18************************
19This build chain heavily relies on Petalinux 2018.2 therefore the first step is
20to download and install the Petalinux 2018.2 toolchain from the Xilinx website
Michael Grand745ab742019-08-03 17:22:30 +020021(`Downloads`_). Then, you have to download the needed BSP file from the Xilinx
22website (`Downloads`_). You may have to create a free Xilinx account to proceed
23with the two previous steps.
Michael Grand7d61b052019-02-24 23:50:46 +010024
Michael Grand745ab742019-08-03 17:22:30 +020025Configuring and building for zcu102 board
26*****************************************
Michael Grand7d61b052019-02-24 23:50:46 +010027First, create a new directory which will be used as root directory:
28
29.. code-block:: bash
30
31 $ mkdir -p ~/petalinux-optee
32 $ cd ~/petalinux-optee
33
34Then, copy the zcu102 BSP file into the newly created directory:
35
36.. code-block:: bash
37
38 $ cp ~/Downloads/xilinx-zcu102-v2018.2-final.bsp .
39
40Git clone the ``build`` repository of the OP-TEE project and source the
41Petalinux settings:
42
43.. code-block:: bash
44
45 $ git clone https://github.com/OP-TEE/build
46 $ cd ./build
Michael Grand745ab742019-08-03 17:22:30 +020047 $ source /path/to/petalinux/settings.sh
Michael Grand7d61b052019-02-24 23:50:46 +010048
49Finally, use the following commands to create, patch, configure and build the
50Petalinux project. Petalinux is a powerful but very slow tool, each command may
51take a while according to the capabilities of your computer.
52
53.. code-block:: bash
54
Michael Grand745ab742019-08-03 17:22:30 +020055 $ make -f zynqmp.mk
Michael Grand7d61b052019-02-24 23:50:46 +010056
Michael Grand745ab742019-08-03 17:22:30 +020057Once the last command ends up you are ready to run QEMU tool or to make a
58bootable SD card. To run QEMU:
Michael Grand7d61b052019-02-24 23:50:46 +010059
60.. code-block:: bash
61
62 $ make -f zynqmp.mk qemu
63
64QEMU will start and launch Petalinux distribution. At the end of the boot
65process, log in using username ``root`` and password ``root``. Start the OP-TEE
66Normal World service and run xtest:
67
68.. code-block:: bash
69
70 $ tee-supplicant -d
71 $ xtest
72
73You can close QEMU session at any time by typing ``Ctrl-A+C`` and entering the
74``quit`` command.
75
Michael Grand745ab742019-08-03 17:22:30 +020076Configuring and building for other ZynqMP boards
77*************************************************
78To use this makefile with other supported boards, you have to download the
79corresponding BSP and add option ``PLATFORM`` to each make command.
Michael Grand7d61b052019-02-24 23:50:46 +010080
81.. code-block:: bash
82
Michael Grand745ab742019-08-03 17:22:30 +020083 $ make -f zynqmp.mk PLATFORM=zcu106
84 $ make -f zynqmp.mk PLATFORM=zcu106 qemu
85
86Hereafter the list of available ``PLATFORM``:
87
88 * ``zcu102``
89 * ``zcu104``
90 * ``zcu106``
91 * ``ultra96-reva``
92
93.. warning::
94
95 On Ultra96 board, UART is not directly available. You have to connect
96 through WIFI Access Point using the procedure detailed here
97 `Getting started`_.
98
99SD card creation
100****************
101After completion of building process, you can create a bootable SD card. Here,
102we consider that SD card corresponds to ``/dev/sdb``. We will use ``gparted``
103and ``e2image`` tools.
104
105Using ``gparted`` or any other partition manager tool create two partitions on
106the card:
107
108 * 1GB FAT32 bootable partition (``/dev/sdb1`` hereafter).
109 * EXT4 partition on the remaining memory space (``/dev/sdb2``
110 hereafter).
111
112Once SD card is partitioned, use the following commands:
113
114.. code-block:: bash
115
116 $ cp /path/to/project/images/linux/BOOT.BIN /dev/sdb1
117 $ cp /path/to/project/images/linux/image.ub /dev/sdb1
118 $ sudo e2image -rap /path/to/project/images/linux/rootfs.ext4 /dev/sdb2
119
120Now you can use the newly created SD card to boot your board.
121
122.. note::
123
124 Check that your board is actually configured to boot on the SD card.
Michael Grand7d61b052019-02-24 23:50:46 +0100125
126Building a given version of OP-TEE
127**********************************
128By default, the lastest version of OP-TEE is built. If you wish you can build a
129given version of OP-TEE instead of the last one by using variable ``OPTEE_VER``
130with target ``petalinux-config``. See below an example where OP-TEE v3.4.0 is
131built.
132
133.. code-block:: bash
134
135 $ make -f zynqmp.mk petalinux-create
136 $ make -f zynqmp.mk OPTEE_VER=3.4.0 petalinux-config
137 $ make -f zynqmp.mk petalinux-build
138
139Customizing the Petalinux distribution
140**************************************
141You can customize the Petalinux project (i.e. kernel, rootfs, ...) as any
142standard Petalinux project. Just enter the project directory and type your
143commands. For additional information, refer to Petalinux Tool Documentation
144(`UG1144`_).
145
146.. _UG1144: https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug1144-petalinux-tools-reference-guide.pdf
147.. _Downloads: https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools/2018-2.html
Michael Grand745ab742019-08-03 17:22:30 +0200148.. _pyelftools: https://pypi.org/project/pyelftools/
149.. _pycrypto: https://pypi.org/project/pycrypto/
150.. _Getting started: https://ultra96-pynq.readthedocs.io/en/latest/getting_started.html