Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 1 | .. _zynqmp: |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 2 | |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 3 | ######################### |
| 4 | ZynqMP zcu10x and Ultra96 |
| 5 | ######################### |
| 6 | Instructions below show how to run OP-TEE on ZynqMP zcu10x and Ultra96 board. |
| 7 | |
| 8 | Supported boards |
| 9 | **************** |
| 10 | This makefile supports the following ZynqMP boards: |
| 11 | |
| 12 | * zcu102 |
| 13 | * zcu104 |
| 14 | * zcu106 |
| 15 | * Ultra96v1 |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 16 | |
| 17 | Setting up the toolchain |
| 18 | ************************ |
| 19 | This build chain heavily relies on Petalinux 2018.2 therefore the first step is |
| 20 | to download and install the Petalinux 2018.2 toolchain from the Xilinx website |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 21 | (`Downloads`_). Then, you have to download the needed BSP file from the Xilinx |
| 22 | website (`Downloads`_). You may have to create a free Xilinx account to proceed |
| 23 | with the two previous steps. |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 24 | |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 25 | Configuring and building for zcu102 board |
| 26 | ***************************************** |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 27 | First, 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 | |
| 34 | Then, 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 | |
| 40 | Git clone the ``build`` repository of the OP-TEE project and source the |
| 41 | Petalinux settings: |
| 42 | |
| 43 | .. code-block:: bash |
| 44 | |
| 45 | $ git clone https://github.com/OP-TEE/build |
| 46 | $ cd ./build |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 47 | $ source /path/to/petalinux/settings.sh |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 48 | |
| 49 | Finally, use the following commands to create, patch, configure and build the |
| 50 | Petalinux project. Petalinux is a powerful but very slow tool, each command may |
| 51 | take a while according to the capabilities of your computer. |
| 52 | |
| 53 | .. code-block:: bash |
| 54 | |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 55 | $ make -f zynqmp.mk |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 56 | |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 57 | Once the last command ends up you are ready to run QEMU tool or to make a |
| 58 | bootable SD card. To run QEMU: |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 59 | |
| 60 | .. code-block:: bash |
| 61 | |
| 62 | $ make -f zynqmp.mk qemu |
| 63 | |
| 64 | QEMU will start and launch Petalinux distribution. At the end of the boot |
| 65 | process, log in using username ``root`` and password ``root``. Start the OP-TEE |
| 66 | Normal World service and run xtest: |
| 67 | |
| 68 | .. code-block:: bash |
| 69 | |
| 70 | $ tee-supplicant -d |
| 71 | $ xtest |
| 72 | |
| 73 | You can close QEMU session at any time by typing ``Ctrl-A+C`` and entering the |
| 74 | ``quit`` command. |
| 75 | |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 76 | Configuring and building for other ZynqMP boards |
| 77 | ************************************************* |
| 78 | To use this makefile with other supported boards, you have to download the |
| 79 | corresponding BSP and add option ``PLATFORM`` to each make command. |
Michael Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 80 | |
| 81 | .. code-block:: bash |
| 82 | |
Michael Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 83 | $ make -f zynqmp.mk PLATFORM=zcu106 |
| 84 | $ make -f zynqmp.mk PLATFORM=zcu106 qemu |
| 85 | |
| 86 | Hereafter 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 | |
| 99 | SD card creation |
| 100 | **************** |
| 101 | After completion of building process, you can create a bootable SD card. Here, |
| 102 | we consider that SD card corresponds to ``/dev/sdb``. We will use ``gparted`` |
| 103 | and ``e2image`` tools. |
| 104 | |
| 105 | Using ``gparted`` or any other partition manager tool create two partitions on |
| 106 | the card: |
| 107 | |
| 108 | * 1GB FAT32 bootable partition (``/dev/sdb1`` hereafter). |
| 109 | * EXT4 partition on the remaining memory space (``/dev/sdb2`` |
| 110 | hereafter). |
| 111 | |
| 112 | Once 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 | |
| 120 | Now 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 Grand | 7d61b05 | 2019-02-24 23:50:46 +0100 | [diff] [blame] | 125 | |
| 126 | Building a given version of OP-TEE |
| 127 | ********************************** |
| 128 | By default, the lastest version of OP-TEE is built. If you wish you can build a |
| 129 | given version of OP-TEE instead of the last one by using variable ``OPTEE_VER`` |
| 130 | with target ``petalinux-config``. See below an example where OP-TEE v3.4.0 is |
| 131 | built. |
| 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 | |
| 139 | Customizing the Petalinux distribution |
| 140 | ************************************** |
| 141 | You can customize the Petalinux project (i.e. kernel, rootfs, ...) as any |
| 142 | standard Petalinux project. Just enter the project directory and type your |
| 143 | commands. 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 Grand | 745ab74 | 2019-08-03 17:22:30 +0200 | [diff] [blame] | 148 | .. _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 |