1# OP-TEE Trusted OS 2## Contents 31. [Introduction](#1-introduction) 42. [License](#2-license) 53. [Platforms supported](#3-platforms-supported) 6 3. [Development board for community user] (#31-development-board-for-community-user) 74. [Get and build OP-TEE software](#4-get-and-build-op-tee-software) 8 4. [Prerequisites](#41-prerequisites) 9 4. [Basic setup](#42-basic-setup) 10 4. [ARM Juno board](#43-arm-juno-board) 11 4. [STMicroelectronics boards](#44-stmicroelectronics-boards) 12 4. [Allwinner A80](#45-allwinner-a80) 13 4. [Freescale MX6UL EVK](#46-freescale-mx6ul-evk) 145. [repo manifests](#5-repo-manifests) 15 5. [Install repo](#51-install-repo) 16 5. [Get the source code](#52-get-the-source-code) 17 5. [Targets](#521-targets) 18 5. [Branches](#522-branches) 19 5. [Get the toolchains](#523-get-the-toolchains) 20 5. [QEMU](#53-qemu) 21 5. [FVP](#54-fvp) 22 5. [HiKey](#55-hikey) 23 5. [MT8173-EVB](#56-mt8173-evb) 24 5. [Tips and tricks](#57-tips-and-tricks) 25 5. [Reference existing project to speed up repo sync](#571-reference-existing-project-to-speed-up-repo-sync) 26 5. [Use ccache](#572-use-ccache) 276. [Load driver, tee-supplicant and run xtest](#6-load-driver-tee-supplicant-and-run-xtest) 287. [Coding standards](#7-coding-standards) 29 7. [checkpatch](#71-checkpatch) 30 31# 1. Introduction 32The `optee_os git`, contains the source code for the TEE in Linux using the 33ARM® TrustZone® technology. This component meets the GlobalPlatform 34TEE System Architecture specification. It also provides the TEE Internal core API 35v1.1 as defined by the GlobalPlatform TEE Standard for the development of 36Trusted Applications. For a general overview of OP-TEE and to find out how to 37contribute, please see the [Notice.md](Notice.md) file. 38 39The Trusted OS is accessible from the Rich OS (Linux) using the 40[GlobalPlatform TEE Client API Specification v1.0](http://www.globalplatform.org/specificationsdevice.asp), 41which also is used to trigger secure execution of applications within the TEE. 42 43--- 44## 2. License 45The software is distributed mostly under the 46[BSD 2-Clause](http://opensource.org/licenses/BSD-2-Clause) open source 47license, apart from some files in the `optee_os/lib/libutils` directory 48which are distributed under the 49[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) or public domain 50licenses. 51 52--- 53## 3. Platforms supported 54Several platforms are supported. In order to manage slight differences 55between platforms, a `PLATFORM_FLAVOR` flag has been introduced. 56The `PLATFORM` and `PLATFORM_FLAVOR` flags define the whole configuration 57for a chip the where the Trusted OS runs. Note that there is also a 58composite form which makes it possible to append `PLATFORM_FLAVOR` directly, 59by adding a dash in-between the names. The composite form is shown below 60for the different boards. For more specific details about build flags etc, 61please read the file [build_system.md](documentation/build_system.md). Some 62platforms have different sub-maintainers, please refer to the file 63[MAINTAINERS.md](MAINTAINERS.md) for contact details for various platforms. 64 65<!-- Please keep this list sorted in alphabetic order --> 66| Platform | Composite PLATFORM flag | Publicly available? | 67|----------|-------------------------|---------------------| 68| [Allwinner A80 Board](http://www.allwinnertech.com/en/clq/processora/A80.html)|`PLATFORM=sunxi`| No | 69| [ARM Juno Board](http://www.arm.com/products/tools/development-boards/versatile-express/juno-arm-development-platform.php) |`PLATFORM=vexpress-juno`| Yes | 70| [FSL ls1021a](http://www.freescale.com/tools/embedded-software-and-tools/hardware-development-tools/tower-development-boards/mcu-and-processor-modules/powerquicc-and-qoriq-modules/qoriq-ls1021a-tower-system-module:TWR-LS1021A?lang_cd=en)|`PLATFORM=ls-ls1021atwr`| Yes | 71| [FSL i.MX6 UltraLite EVK Board](http://www.freescale.com/products/arm-processors/i.mx-applications-processors-based-on-arm-cores/i.mx-6-processors/i.mx6qp/i.mx6ultralite-evaluation-kit:MCIMX6UL-EVK) |`PLATFORM=imx`| Yes | 72| [ARM Foundation FVP](http://www.arm.com/fvp) |`PLATFORM=vexpress-fvp`| Yes | 73| [HiKey Board (HiSilicon Kirin 620)](https://www.96boards.org/products/hikey)|`PLATFORM=hikey`| Yes | 74| [MediaTek MT8173 EVB Board](http://www.mediatek.com/en/products/mobile-communications/tablet/mt8173)|`PLATFORM=mediatek-mt8173`| No | 75| [QEMU](http://wiki.qemu.org/Main_Page) |`PLATFORM=vexpress-qemu_virt`| Yes | 76| [STMicroelectronics b2120 - h310 / h410](http://www.st.com/web/en/catalog/mmc/FM131/SC999/SS1628/PF258776) |`PLATFORM=stm-cannes`| No | 77| [STMicroelectronics b2020-h416](http://www.st.com/web/catalog/mmc/FM131/SC999/SS1633/PF253155?sc=internet/imag_video/product/253155.jsp)|`PLATFORM=stm-orly2`| No | 78| [Texas Instruments DRA7xx](http://www.ti.com/product/DRA746)|`PLATFORM=ti-dra7xx`| Yes | 79 80### 3.1 Development board for community user 81For community users, we suggest using [HiKey board](https://www.96boards.org/products/ce/hikey/) 82as development board. It provides detailed documentation including chip 83datasheet, board schematics, source code, binaries etc on the download link at 84the website. 85 86--- 87## 4. Get and build OP-TEE software 88There are a couple of different build options depending on the target you are 89going to use. If you just want to get the software and compile it, then you 90should follow the instructions under the "Basic setup" below. In case you are 91going to run for a certain hardware or FVP, QEMU for example, then please follow 92the respective section found below instead, having that said, we are moving from 93the shell script based setups to instead use 94[repo](https://source.android.com/source/downloading.html), so for some targets 95you will see that we are using repo ([section 5](#5-repo-manifests)) and for 96others we are still using the shell script based setup 97([section 4](#4-get-and-build-op-tee-software)), please see this transitions as 98work in progress. 99 100--- 101### 4.1 Prerequisites 102We believe that you can use any Linux distribution to build OP-TEE, but as 103maintainers of OP-TEE we are mainly using Ubuntu-based distributions and to be 104able to build and run OP-TEE there are a few packages that needs to be installed 105to start with. Therefore install the following packages regardless of what 106target you will use in the end. 107``` 108$ sudo apt-get install android-tools-fastboot autoconf bison cscope curl \ 109 flex gdisk libc6:i386 libfdt-dev libglib2.0-dev \ 110 libpixman-1-dev libstdc++6:i386 libz1:i386 netcat \ 111 python-crypto python-serial uuid-dev xz-utils zlib1g-dev 112``` 113 114--- 115### 4.2 Basic setup 116#### 4.2.1 Get the compiler 117We strive to use the latest available compiler from Linaro. Start by downloading 118and unpacking the compiler. Then export the `PATH` to the compilers `bin` 119folder. Beware that we are using a couple of different toolchains depending on 120the target device. This includes both 64- and 32-bit toolchains. For the exact 121toolchain in use, please have a look at [toolchain.mk](https://github.com/OP-TEE/build/blob/master/toolchain.mk) 122and then look at the targets makefile (see [build.git](https://github.com/OP-TEE/build)) 123to find out where the respective toolchain will be used. For example in the 124[QEMU makefile](https://github.com/OP-TEE/build/blob/master/qemu.mk#L12-L15) you 125will see: 126``` 127CROSS_COMPILE_NS_USER ?= "$(CCACHE)$(AARCH32_CROSS_COMPILE)" 128CROSS_COMPILE_NS_KERNEL ?= "$(CCACHE)$(AARCH32_CROSS_COMPILE)" 129CROSS_COMPILE_S_USER ?= "$(CCACHE)$(AARCH32_CROSS_COMPILE)" 130CROSS_COMPILE_S_KERNEL ?= "$(CCACHE)$(AARCH32_CROSS_COMPILE)" 131``` 132 133However, if you only want to compile optee_os, then you can do like this: 134``` 135$ cd $HOME 136$ mkdir toolchains 137$ cd toolchains 138$ wget http://releases.linaro.org/14.08/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-2014.08_linux.tar.xz 139$ tar xvf gcc-linaro-arm-linux-gnueabihf-4.9-2014.08_linux.tar.xz 140$ export PATH=$HOME/toolchains/gcc-linaro-arm-linux-gnueabihf-4.9-2014.08_linux/bin:$PATH 141``` 142 143#### 4.2.2 Download the source code 144``` 145$ cd $HOME 146$ mkdir devel 147$ cd devel 148$ git clone https://github.com/OP-TEE/optee_os.git 149``` 150 151#### 4.2.3 Build 152``` 153$ cd $HOME/devel/optee_os 154$ CROSS_COMPILE=arm-linux-gnueabihf- make 155``` 156 157#### 4.2.4 Compiler flags 158To be able to see the full command when building you could build using 159following flag: 160``` 161$ make V=1 162``` 163 164To enable debug builds use the following flag: 165``` 166$ make DEBUG=1 167``` 168 169OP-TEE supports a couple of different levels of debug prints for both TEE core 170itself and for the Trusted Applications. The level ranges from 1 to 4, where 171four is the most verbose. To set the level you use the following flag: 172``` 173$ make CFG_TEE_CORE_LOG_LEVEL=4 174``` 175 176--- 177### 4.3 ARM Juno board 178**Warning!** This setup is currently broken, `bl30.bin` and `bl33.bin` doesn't 179exist on the URLs stated any longer. We are working with a fix and once ready, 180we will replace this section and instead put Juno board within the repo 181section below. Until resolved, we will keep the information below for reference. 182 183+ The script `setup_juno_optee.sh` script provides a coherent set of components 184(OP-TEE client, driver, OS, Linux kernel version 3-16.0-rc5) 185 186+ Futures releases will align the Juno setup with other OP-TEE supported 187 platforms: 188 189 + Linux kernel version alignment (3.18-rc1) with QEMU/FVP (DMA_BUF API change). 190 + Will need arch/arm/Kconfig patch(es) (i.e DMA_SHARED_BUFFER etc...). 191 192+ Temporary patch files required for linux kernel and Juno DTB definition (found 193 in the `./scripts` folder) 194 195 + `config.linux-linaro-tracking.a226b22057c22b433caafc58eeae6e9b13ac6c8d.patch` 196 + `juno.dts.linux-linaro-tracking.a226b22057c22b433caafc58eeae6e9b13ac6c8d.patch` 197 198#### 4.3.1 Prerequisites for Juno board 199+ Download pre-built binaries (please see "Known issues" below) 200 201 + Juno boards pre-built binary `bl30.bin` (SCP runtime) 202 + Juno boards pre-built binary `bl33.bin` (UEFI) 203 + Download at → https://releases.linaro.org/members/arm/platforms/latest 204 205 206#### 4.3.2 Download the source code for Juno board 207``` 208$ wget https://raw.githubusercontent.com/OP-TEE/optee_os/master/scripts/setup_juno_optee.sh 209$ chmod 711 setup_juno_optee.sh 210$ ./setup_juno_optee.sh 211``` 212 213#### 4.3.3 Build 214List of helper scripts generated during installation: 215 216| Script | Explanation | 217|--------|--------| 218| `build_atf_opteed.sh` | This is used to build ARM-Trusted-Firmware and must be called when you have updated any component that are included in the FIP (like for example OP-TEE os). | 219| `build_linux.sh` | This is used to build the Linux Kernel. | 220| `build_normal.sh` | This is a pure helper script that build all the normal world components (in correct order). | 221| `build_optee_client.sh` | This will build OP-TEEs client library. | 222| `build_optee_linuxdriver.sh` | This will build OP-TEEs Linux Kernel driver (as a module). | 223| `build_optee_os.sh` | Builds the Trusted OS itself | 224| `build_optee_tests.sh` | This will build the test suite (pay attention to the access needed). | 225| `build_secure.sh` | This is the helper script for the secure side that will build all secure side components in the correct order. | 226| `clean_gits.sh` | This will clean all gits. Beware that it will not reset the commit to the one used when first cloning. Also note that it will only clean git's. | 227 228Run the scripts in the following order: 229 230``` 231$ ./build_secure.sh 232$ ./build_normal.sh 233``` 234 235#### 4.3.4 Booting up the Juno board 236 237+ Update the embedded flash memory (path: `JUNO/SOFTWARE`): 238 239 + `bl1.bin` 240 + `fip.bin` 241 + `Image` 242 + `juno.dtb` 243 244+ Copy OP-TEE binaries on the filesystem(*) located on the external USB key: 245 246 + user client libraries: `libteec.so*` 247 + supplicant: `tee-supplicant` 248 + driver modules: `optee.ko optee_armtz.ko` 249 + CA: `xtest` 250 + TAs: `*.ta` 251 252+ Connect the USB flash drive (containing the filesystem) on any connector of 253 the rear panel 254 255+ Connect a serial terminal (`115200, 8, n, 1`) to the upper 9-pin (`UART0`) 256 connector. 257 258+ Connect the 12V power, then press the red button on the rear panel. 259 260Note: 261The default configuration is to automatically boot a Linux kernel, which expects 262to find a root filesystem on `/dev/sda1` (any one of the rear panel USB ports). 263 264Download a minimal filesytem at → 265http://releases.linaro.org/14.02/openembedded/aarch64/linaro-image-minimal-genericarmv8-20140223-649.rootfs.tar.gz 266 267UEFI offers a 10 second window to interrupt the boot sequence by pressing a key 268on the serial terminal, after which the kernel is launched. 269 270Once booted you will get the prompt: 271``` 272root@genericarmv8:~# 273``` 274 275#### 4.3.5 Run OP-TEE on the Juno board 276Write in the console: 277``` 278root@genericarmv8:~# modprobe optee_armtz 279root@genericarmv8:~# tee-supplicant & 280``` 281Now everything has been set up and OP-TEE is ready to be used. 282 283#### 4.3.6 Known issues and limitations 284* `bl30.bin` (SCP) and `bl33.bin` (UEFI) are not available on previous download 285 location and therefore this setup is currently not working. We are working 286 with sorting out this issue and once done, we will start using repo manifests 287 for Juno also. 288* Not all USB flash drives seems to work, so we recommend using USB memory 3.0 289 formatted with an ext3/ext4 filesystem 290 291--- 292### 4.4 STMicroelectronics boards 293Currently OP-TEE is supported on Orly-2 (`b2020-h416`) and Cannes family 294(`b2120` both `h310` and `h410` chip). 295 296#### 4.4.1 Get the compiler for Orly-2 297Will be written soon. 298 299#### 4.4.2 Download the source code 300See section "4.2.2 Download the source code". 301 302#### 4.4.3 Build for Orly-2 303For Orly-2 do as follows 304``` 305$ PLATFORM=stm-orly2 CROSS_COMPILE=arm-linux-gnueabihf- make 306``` 307 308For Cannes family do as follows 309``` 310$ PLATFORM=stm-cannes CROSS_COMPILE=arm-linux-gnueabihf- make 311``` 312 313#### 4.4.4 Prepare and install the images 314Will be written soon. 315 316#### 4.4.5 Boot and run the software 317<!-- All magic with STM and so on must be stated here. --> 318Will be written soon. 319 320--- 321### 4.5 Allwinner A80 322 323#### 4.5.1 Locked versus unlocked A80 boards 324**Important!** All A80 boards sold to the general public are boards where secure 325side has been locked down, which means that you **cannot** use them for secure 326side development, i.e, it will not be possible to put OP-TEE on those devices. 327If you want to use A80 board for secure side development, then you will need to 328talk to 329[Allwinner](https://github.com/OP-TEE/optee_os/blob/master/MAINTAINERS.md) 330directly and ask if it is possible get a device from them. 331 332#### 4.5.2 Get the compiler and source 333Follow the instructions in the "4.2 Basic setup". 334 335#### 4.5.3 Build 336``` 337$ cd optee_os 338$ export PLATFORM=sunxi 339$ export CROSS_COMPILE=arm-linux-gnueabihf- 340$ make 341``` 342 343#### 4.5.4 Prepare the images to run on A80 Board 344 345Download Allwinner A80 platform SDK, the SDK refers to Allwinner A80 platform 346SDK root directory. A80 SDK directory tree looks like this: 347``` 348SDK/ 349 Android 350 lichee 351``` 352`Android` contains all source code related to Android and `lichee` 353contains the bootloader and Linux kernel. 354 355##### 4.5.4.1 Copy OP-TEE output to package directory 356Copy the OP-TEE output binary to `SDK/lichee/tools/pack/sun9i/bin` 357 358``` 359$ cd optee_os 360$ cp ./out/arm32-plat-sunxi/core/tee.bin SDK/lichee/tools/pack/sun9i/bin 361``` 362 363##### 4.5.4.2 Build Linux kernel 364In the `lichee` directory, run the following commands: 365``` 366$ cd SDK/lichee 367$ ./build.sh 368``` 369 370##### 4.5.4.3 Build Android 371In the Android directory, run the following commands: 372``` 373$ cd SDK/android 374$ extract-bsp 375$ make -j 376``` 377 378##### 4.5.4.4 Create the Android image 379In the Android directory, run the following commands: 380``` 381$ cd SDK/android 382$ pack 383``` 384The output image will been signed internally when packed. The output image name 385is `a80_android_board.img`. 386 387##### 4.5.4.5 Download the Android image 388Use `Allwinner PhoenixSuit` tool to download to A80 board. 389Choose the output image(`a80_android_board.img`), select download and wait 390for the download to complete. 391 392#### 4.5.5 Boot and run the software on A80 Board 393When the host platform is Windows, use a console application to connect A80 394board `uart0`. In the console window, You can install OP-TEE linux kernel 395driver `optee.ko`, load OP-TEE-Client daemon `tee-supplicant` and run 396the example "hello world" Trusted Application, do this by running: 397``` 398$ insmod /system/vendor/modules/optee.ko 399$ /system/bin/tee-supplicant & 400$ /system/bin/tee-helloworld 401``` 402 403--- 404### 4.6 Freescale MX6UL EVK 405Build: 406``` 407 PLATFORM_FLAVOR=mx6ulevk make PLATFORM=imx 408 ${CROSS_COMPILE}-objcopy -O binary out/arm-plat-imx/core/tee.elf optee.bin 409 copy optee.bin to the first partition of SD card which is used for boot. 410``` 411Run using U-Boot: 412``` 413 run loadfdt; 414 run loadimage; 415 fatload mmc 1:1 0x9c100000 optee.bin; 416 run mmcargs; 417 bootz ${loadaddr} - ${fdt_addr}; 418``` 419 420Note: 421 CAAM is not implemented now, this will be added later. 422 423--- 424## 5. repo manifests 425 426A Git repository is available at https://github.com/OP-TEE/manifest where you 427will find XML-files for use with the Android 'repo' tool. 428 429### 5.1. Install repo 430Follow the instructions under the "Installing Repo" section 431[here](https://source.android.com/source/downloading.html). 432 433### 5.2. Get the source code 434First ensure that you have the necessary Ubuntu packages installed, see [4.1 435Prerequisites](#41-prerequisites) (this is the only important step from section 4364 in case you are setting up any of the target devices mentioned below). 437 438``` 439$ mkdir -p $HOME/devel/optee 440$ cd $HOME/devel/optee 441$ repo init -u https://github.com/OP-TEE/manifest.git -m ${TARGET}.xml [-b ${BRANCH}] 442$ repo sync 443``` 444 445#### 5.2.1 Targets 446| Target | Latest | Stable | 447|--------|--------|--------| 448| QEMU | `default.xml` | `default_stable.xml` | 449| FVP | `fvp.xml` | `fvp_stable.xml` | 450| HiKey | `hikey.xml` | `hikey_stable.xml` | 451| MediaTek MT8173 EVB Board | `mt8173-evb.xml` | `mt8173-evb_stable.xml` | 452 453#### 5.2.2 Branches 454Currently we are only using one branch, i.e, the `master` branch. 455 456#### 5.2.3 Get the toolchains 457``` 458$ cd build 459$ make toolchains 460``` 461 462**Notes**<br> 463* The folder could be at any location, we are just giving a suggestion by 464 saying `$HOME/devel/optee`. 465* `repo sync` can take an additional parameter -j to sync multiple remotes. For 466 example `repo sync -j3` will sync three remotes in parallel. 467 468--- 469### 5.3. QEMU 470After getting the source and toolchain, just run (from the `build` folder) 471``` 472$ make all run 473``` 474and everything should compile and at the end QEMU should start. 475 476--- 477### 5.4. FVP 478After getting the source and toolchain you must also obtain Foundation Model 479([link](http://www.arm.com/products/tools/models/fast-models/foundation-model.php)) 480binaries and untar it to the forest root, then just run (from the `build` folder) 481 482``` 483$ make all run 484``` 485and everything should compile and at the end FVP should start. 486 487--- 488### 5.5. HiKey 489After getting the source and toolchain, just run (from the `build` folder) 490``` 491$ make all 492``` 493 494After that connect the board and flash the binaries by running: 495``` 496$ make flash 497``` 498 499(more information about how to flash individual binaries could be found 500[here](https://github.com/96boards/documentation/wiki/HiKeyUEFI#flash-binaries-to-emmc-)) 501 502The board is ready to be booted. 503 504--- 505### 5.6. MT8173-EVB 506After getting the source and toolchain, just run (from the `build` folder) 507 508``` 509$ make all run 510``` 511 512When `< waiting for device >` prompt appears, press reset button and the 513flashing procedure should begin. 514 515--- 516### 5.7 Tips and tricks 517#### 5.7.1 Reference existing project to speed up repo sync 518Doing a `repo init`, `repo sync` from scratch can take a fair amount of time. 519The main reason for that is simply because of the size of some of the gits we 520are using, like for the Linux kernel and EDK2. With repo you can reference an 521existing forest and by doing so you can speed up repo sync to instead taking ~20 522seconds instead of an hour. The way to do this are as follows. 523 5241. Start by setup a clean forest that you will not touch, in this example, let 525 us call that `optee-ref` and put that under for `$HOME/devel/optee-ref`. This 526 step will take roughly an hour. 5272. Then setup a cronjob (`crontab -e`) that does a `repo sync` in this folder 528 particular folder once a night (that is more than enough). 5293. Now you should setup your actual tree which you are going to use as your 530 working tree. The way to do this is almost the same as stated in the 531 instructions above, the only difference is that you reference the other local 532 forest when running `repo init`, like this 533 ``` 534 repo init -u https://github.com/OP-TEE/manifest.git --reference /home/jbech/devel/optee-ref 535 ``` 5364. The rest is the same above, but now it will only take a couple of seconds to 537 clone a forest. 538 539Normally step 1 and 2 above is something you will only do once. Also if you 540ignore step 2, then you will still get the latest from official git trees, since 541repo will also check for updates that aren't at the local reference. 542 543#### 5.7.2. Use ccache 544ccache is a tool that caches build object-files etc locally on the disc and can 545speed up build time significantly in subsequent builds. On Debian-based systems 546(Ubuntu, Mint etc) you simply install it by running: 547``` 548$ sudo apt-get install ccache 549``` 550 551The helper makefiles are configured to automatically find and use ccache if 552ccache is installed on your system, so other than having it installed you don't 553have to think about anything. 554 555--- 556## 6. Load driver, tee-supplicant and run xtest 557To actually run something on a device you need to probe the kernel driver for 558OP-TEE, run tee-supplicant. This is the same for almost all platforms, so when a 559device has booted, then run 560``` 561$ modprobe optee_armtz 562$ tee-supplicant & 563``` 564 565In case you want to try run something triggering both normal and secure side 566code you could run xtest (the main test suite for OP-TEE), run 567``` 568$ xtest 569``` 570 571--- 572## 7. Coding standards 573In this project we are trying to adhere to the same coding convention as used in 574the Linux kernel (see 575[CodingStyle](https://www.kernel.org/doc/Documentation/CodingStyle)). We achieve this by running 576[checkpatch](http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl) 577from Linux kernel. However there are a few exceptions that we had to make since 578the code also follows GlobalPlatform standards. The exceptions are as follows: 579 580- CamelCase for GlobalPlatform types are allowed. 581- And we also exclude checking third party code that we might use in this 582 project, such as LibTomCrypt, MPA, newlib (not in this particular git, but 583 those are also part of the complete TEE solution). The reason for excluding 584 and not fixing third party code is because we would probably deviate too much 585 from upstream and therefore it would be hard to rebase against those projects 586 later on (and we don't expect that it is easy to convince other software 587 projects to change coding style). 588 589### 7.1 checkpatch 590Since checkpatch is licensed under the terms of GNU GPL License Version 2, we 591cannot include this script directly into this project. Therefore we have 592written the Makefile so you need to explicitly point to the script by exporting 593an environment variable, namely CHECKPATCH. So, suppose that the source code for 594the Linux kernel is at `$HOME/devel/linux`, then you have to export like follows: 595 596 $ export CHECKPATCH=$HOME/devel/linux/scripts/checkpatch.pl 597thereafter it should be possible to use one of the different checkpatch targets 598in the [Makefile](Makefile). There are targets for checking all files, checking 599against latest commit, against a certain base-commit etc. For the details, read 600the [Makefile](Makefile). 601 602