1# OP-TEE Trusted OS 2## Contents 3<!--- TOC generated using http://doctoc.herokuapp.com/ --> 41. [Introduction](#1-introduction) 52. [License](#2-license) 63. [Platforms supported](#3-platforms-supported) 74. [Get and build the software](#4-get-and-build-the-software) 8 4. [Basic setup](#41-basic-setup) 9 4. [Foundation Models](#42-foundation-models) 10 4. [ARM Juno board](#43-juno) 11 4. [QEMU](#44-qemu) 12 4. [STMicroelectronics boards](#45-stmicroelectronics-boards) 13 4. [Allwinner A80](#46-allwinner-a80) 14 4. [Mediatek MT8173 EVB](#47-mediatek-mt8173-evb) 15 4. [HiKey Board](#48-hikey-board) 165. [Coding standards](#5-coding-standards) 17 5. [checkpatch](#51-checkpatch) 18 19# 1. Introduction 20The optee_os git, contains the source code for the TEE in Linux using the ARM(R) 21TrustZone(R) technology. This component meets the GlobalPlatform TEE System 22Architecture specification. It also provides the TEE Internal API v1.0 as 23defined by the Global Platform TEE Standard for the development of Trusted 24Applications. For a general overview of OP-TEE and to find out how to contribute, 25please see the [Notice.md](Notice.md) file. 26 27The Trusted OS is accessible from the Rich OS (Linux) using the 28[GlobalPlatform TEE Client API Specification v1.0](http://www.globalplatform.org/specificationsdevice.asp), 29which also is used to trigger secure execution of applications within the TEE. 30 31## 2. License 32The software is distributed mostly under the 33[BSD 2-Clause](http://opensource.org/licenses/BSD-2-Clause) open source 34license, apart from some files in the optee_os/lib/libutils directory which 35are distributed under the 36[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) or public domain 37licenses. 38 39## 3. Platforms supported 40Several platforms are supported. In order to manage slight differences 41between platforms, a `PLATFORM_FLAVOR` flag has been introduced. 42The `PLATFORM` and `PLATFORM_FLAVOR` flags define the whole configuration 43for a chip the where the Trusted OS runs. Note that there is also a 44composite form which makes it possible to append `PLATFORM_FLAVOR` directly, 45by adding a dash inbetween the names. The composite form is shown below 46for the different boards. For more specific details about build flags etc, 47please read the file [build_system.md](documentation/build_system.md). 48 49| Platform | Composite PLATFORM flag | 50|--------|--------| 51| [Foundation FVP](http://www.arm.com/fvp) |`PLATFORM=vexpress-fvp`| 52| [ARMs Juno Board](http://www.arm.com/products/tools/development-boards/versatile-express/juno-arm-development-platform.php) |`PLATFORM=vexpress-juno`| 53| [QEMU](http://wiki.qemu.org/Main_Page) |`PLATFORM=vexpress-qemu_virt`| 54| [STMicroelectronics b2120 - h310 / h410](http://www.st.com/web/en/catalog/mmc/FM131/SC999/SS1628/PF258776) |`PLATFORM=stm-cannes`| 55| [STMicroelectronics b2020-h416](http://www.st.com/web/catalog/mmc/FM131/SC999/SS1633/PF253155?sc=internet/imag_video/product/253155.jsp)|`PLATFORM=stm-orly2`| 56| [Allwinner A80 Board](http://www.allwinnertech.com/en/clq/processora/A80.html)|`PLATFORM=sunxi`| 57| [HiKey Board (HiSilicon Kirin 620)](https://www.96boards.org/products/hikey/)|`PLATFORM=hikey`| 58| MediaTek MT8173 EVB Board|`PLATFORM=mediatek-mt8173`| 59 60## 4. Get and build the software 61There are a couple of different build options depending on the target you are 62going to use. If you just want to get the software and compile it, then you 63should follow the instructions under the "Basic setup" below. In case you are 64going to run for a certain hardware or FVP, QEMU for example, then please follow 65the respective section instead. 66 67--- 68### 4.1 Basic setup 69#### 4.1.1 Get the compiler 70We will strive to use the latest available compiler from Linaro. Start by 71downloading and unpacking the compiler. Then export the PATH to the bin folder. 72 73``` 74$ cd $HOME 75$ mkdir toolchains 76$ cd toolchains 77$ wget http://releases.linaro.org/14.05/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux.tar.xz 78$ tar xvf gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux.tar.xz 79$ export PATH=$HOME/toolchains/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin:$PATH 80``` 81 82#### 4.1.2 Download the source code 83``` 84$ cd $HOME 85$ mkdir devel 86$ cd devel 87$ git clone https://github.com/OP-TEE/optee_os.git 88``` 89 90#### 4.1.3 Build 91``` 92$ cd $HOME/devel/optee_os 93$ CROSS_COMPILE=arm-linux-gnueabihf- make 94``` 95 96#### 4.1.4 Compiler flags 97To be able to see the full command when building you could build using 98following flag: 99``` 100$ make V=1 101``` 102 103To enable debug builds use the following flag: 104``` 105$ make DEBUG=1 106``` 107 108OP-TEE supports a couple of different levels of debug prints for both TEE core 109itself and for the Trusted Applications. The level ranges from 1 to 4, where 110four is the most verbose. To set the level you use the following flag: 111``` 112$ make CFG_TEE_CORE_LOG_LEVEL=4 113``` 114 115--- 116### 4.2 Foundation Models 117By following this section will setup OP-TEE using FVP (Foundation Models and 118also Fast Models). You will have to download a script in this git and then run 119it, modify it slightly and then run it again. The reason for this is that we 120are not allowed to share Foundation models. I.e, the user has to download it 121from ARM directly. 122 123#### 4.2.1 Prerequisites 124To be able run this script you will need to install a couple of dependencies. On 125a Debian based system (Ubuntu, Mint etc.), you will at least need to install the 126following packages: 127 128``` 129$ sudo apt-get install uuid-dev 130``` 131and in case you are running on a 64bits system, then you will need to install 132the following packages. 133 134``` 135$ sudo apt-get install libc6:i386 libstdc++6:i386 libz1:i386 136``` 137 138#### 4.2.2 Download and setup FVP 139``` 140$ wget https://raw.githubusercontent.com/OP-TEE/optee_os/master/scripts/setup_fvp_optee.sh 141$ chmod 711 setup_fvp_optee.sh 142$ ./setup_fvp_optee.sh 143``` 144Follow the instructions to download Foundation Models and then update the first 145few lines under the "EDIT" section in the script. Note that if you are not 146working in Linaro and belongs to Security Working Group you will probably not 147have access to teetest.git, hence you should most likely leave this as it is. 148Run the script again. 149``` 150$ ./setup_fvp_optee.sh 151``` 152After about one hour (it's mainly cloning the kernel and edk2 that takes time) 153everything should have been cloned and built and you should be ready to use 154this. Pay attention to the line saying `OP-TEE and FVP setup completed.` that 155would be displayed when the script successfully ended. If you don't see this at 156the end, then something went wrong. 157 158#### 4.2.3 Compile 159During installation a couple of helper scripts were generated, the main reason 160for this is that there is a lot of interdependencies between the different 161software components and it's a bit tricky to point to the correct toolchains and 162to know in which order to build things. 163 164* `build_atf_opteed.sh`: This is used to build ARM-Trusted-Firmware and must be 165 called when you have updated any component that are included in the FIP (like 166 for example OP-TEE os). 167 168* `build_linux.sh`: This is used to build the Linux Kernel. 169 170* `build_normal.sh`: This is a pure helper script that build all the normal 171 world components (in correct order). 172 173* `build_optee_client.sh`: This will build OP-TEEs client library. 174 175* `build_optee_linuxkernel.sh`: This will build OP-TEEs Linux Kernel driver (as 176 a module). 177 178* `build_optee_os.sh`: Builds the Trusted OS itself. 179 180* `build_optee_tests.sh`: This will build the test suite (pay attention to the 181 access needed). 182 183* `build_secure.sh`: This is the helper script for the secure side that will 184 build all secure side components in the correct order. 185 186* `build_uefi.sh`: This will build Tianocore (UEFI). 187 188* `clean_gits.sh`: This will clean all gits. Beware that it will not reset the 189 commit to the one used when first cloning. Also note that it will only clean 190 git's (meaning that it will not clean Foundation models, toolchain folders). 191 192* `run_foundation.sh`: This is the script to use when starting FVP. 193 194* `update_rootfs.sh`: This script will update rootfs. For example when you have 195 updated normal world component, you will need to put them into rootfs. Calling 196 this script will do so. In case you are creating a new Trusted Application, 197 you must also edit filelist-tee.text in the gen_rootfs folder accordingly. 198 199Depending on how you are working you have the option to build components 200separately or you can build everything by running two of the scripts above. 201In case you want to make sure that everything was built and updated, we suggest 202that you call the scripts in the following order. 203``` 204$ ./build_secure.sh 205$ ./build_normal.sh 206``` 207By doing so all components should be (re-)built in the correct order and rootfs 208will be updated accordingly. 209 210#### 4.2.4 Run Foundation models and OP-TEE 211You simply run the script `run_foundation.sh`, load the module and start 212tee-supplicant. 213``` 214$ ./run_foundation.sh 215``` 216and in the console write 217``` 218root@FVP:/ modprobe optee_armtz 219root@FVP:/ tee-supplicant & 220``` 221Now everything has been set up and OP-TEE is ready to be used. 222 223#### 4.2.5 Known problems and limitations 224* The script `setup_fvp_optee.sh` doesn't do much error checking and doesn't 225 have many fallbacks in case of a problem. 226* The script `setup_fvp_optee.sh` setup things using absolute paths, i.e, you 227 cannot just copy a working environment to a new location. 228* In some situations you will get an error message about `undefined reference to 229 raise`. We know about this issue and it is being tracked in 230 [#issue95](https://github.com/OP-TEE/optee_os/issues/95) at GitHub. 231 232--- 233### 4.3 Juno 234Juno has been supported in OP-TEE since mid October 2014. 235 236#### WARNING: 237 238+ The ```setup_juno_optee.sh``` script provides a coherent set of components (OP-TEE client/driver/os, 239Linux kernel version 3-16.0-rc5) 240 241+ Further release will align the ARM Juno setup with other OP-TEE supported platforms: 242 243 + Linux kernel version alignment (3.18-rc1) with QEMU/FVP (DMA_BUF API change). 244 + Will need arch/arm/Kconfig patch(es) (i.e DMA_SHARED_BUFFER etc...). 245 246+ Temporary patch files required for linux kernel and juno dtb definition: 247 248 + config.linux-linaro-tracking.a226b22057c22b433caafc58eeae6e9b13ac6c8d.patch 249 + juno.dts.linux-linaro-tracking.a226b22057c22b433caafc58eeae6e9b13ac6c8d.patch 250 251#### 4.3.1 Prerequisites 252+ The following packages must be installed: 253 254``` 255$ sudo apt-get install zlib1g-dev libglib2.0-dev libpixman-1-dev libfdt-dev \ 256 libc6:i386 libstdc++6:i386 libz1:i386 cscope 257``` 258 259+ Download ARM Juno pre-built binaries: 260 261 + ARM Juno Pre-built binary bl30.bin (SCP runtime) 262 + ARM Juno Pre-built binary bl33.bin (UEFI) 263 + Download at http://community.arm.com/docs/DOC-8401 264 265 266#### 4.3.2 Download and install ARM Juno 267``` 268$ wget https://raw.githubusercontent.com/OP-TEE/optee_os/master/scripts/setup_juno_optee.sh 269$ chmod 711 setup_juno_optee.sh 270$ ./setup_juno_optee.sh 271``` 272 273#### 4.3.3 Build 274+ List of helper scripts generated during installation: 275 276* `build_atf_opteed.sh`: This is used to build ARM-Trusted-Firmware and must be 277 called when you have updated any component that are included in the FIP (like 278 for example OP-TEE os). 279 280* `build_linux.sh`: This is used to build the Linux Kernel. 281 282* `build_normal.sh`: This is a pure helper script that build all the normal 283 world components (in correct order). 284 285* `build_optee_client.sh`: This will build OP-TEEs client library. 286 287* `build_optee_linuxdriver.sh`: This will build OP-TEEs Linux Kernel driver (as 288 a module). 289 290* `build_optee_os.sh`: Builds the Trusted OS itself. 291 292* `build_optee_tests.sh`: This will build the test suite (pay attention to the 293 access needed). 294 295* `build_secure.sh`: This is the helper script for the secure side that will 296 build all secure side components in the correct order. 297 298* `clean_gits.sh`: This will clean all gits. Beware that it will not reset the 299 commit to the one used when first cloning. Also note that it will only clean 300 git's. 301 302+ Run the scripts in the following order: 303 304``` 305$ ./build_secure.sh 306$ ./build_normal.sh 307``` 308 309#### 4.3.4 Booting up ARM Juno 310 311+ Update the ARM Juno embedded flash memory (path: JUNO/SOFTWARE): 312 313 + bl1.bin 314 + fip.bin 315 + Image 316 + juno.dtb 317 318+ Copy OP-TEE binaries on the filesystem(*) located on the external USB key: 319 320 + user client libraries: libteec.so* 321 + supplicant: tee-supplicant 322 + driver modules: optee.ko. optee_armtz.ko 323 + CA: xtest 324 + TAs: *.ta 325 326+ Connect the USB key (filesystem) on any connector of the rear panel 327 328+ Connect a serial terminal (115200, 8, n, 1) 329to the upper 9-pin (UART0) connector. 330 331+ Connect the 12 volt power, then press the red button on the rear panel. 332 333Note: 334The default configuration is to automatically boot a Linux kernel, 335which expects to find a root filesystem on /dev/sda1 336(any one of the rear panel USB ports). 337 338(*)Download a minimal filesytem at: 339http://releases.linaro.org/14.02/openembedded/aarch64/ 340linaro-image-minimal-genericarmv8-20140223-649.rootfs.tar.gz 341 342UEFI offers a 10 second window to interrupt the boot sequence by pressing 343a key on the serial terminal, after which the kernel is launched. 344 345Once booted you will get the prompt: 346``` 347root@genericarmv8:~# 348``` 349 350#### 4.3.4 Run OP-TEE on ARM Juno 351Write in the console: 352``` 353root@genericarmv8:~# modprobe optee 354root@genericarmv8:~# tee-supplicant & 355``` 356Now everything has been set up and OP-TEE is ready to be used. 357 358#### 4.3.5 Known problems and limitations 359ARM Juno could be sensitive on the USB memory type (filesystem) 360Recommendation: Use USB memory 3.0 (ext3/ext4 filesystem) 361 362--- 363### 4.4 QEMU 364You can run OP-TEE using QEMU since October 2014. 365 366#### 4.4.1 Prerequisites 367To be able run this script you will need to install a couple of dependencies. On 368a Debian based system (Ubuntu, Mint etc.), you will at least need to install the 369following packages: 370 371``` 372$ sudo apt-get install zlib1g-dev libglib2.0-dev libpixman-1-dev libfdt-dev \ 373 libc6:i386 libstdc++6:i386 libz1:i386 cscope 374``` 375 376#### 4.4.2 Download and setup QEMU 377``` 378$ wget https://raw.githubusercontent.com/OP-TEE/optee_os/master/scripts/setup_qemu_optee.sh 379$ chmod 711 setup_qemu_optee.sh 380$ ./setup_qemu_optee.sh 381``` 382 383#### 4.4.3 Compile for QEMU 384During installation a couple of helper scripts were generated, the main reason 385for this is that there is a lot of interdependencies between the different 386software components and it's a bit tricky to point to the correct toolchains and 387to know in which order to build things. 388 389* `build_bios.sh`: This build the BIOS needed in QEMU 390 391* `build_linux.sh`: This is used to build the Linux Kernel. 392 393* `build_optee_client.sh`: This will build OP-TEEs client library. 394 395* `build_optee_linuxkernel.sh`: This will build OP-TEEs Linux Kernel driver (as 396 a module). 397 398* `build_optee_os.sh`: Builds the Trusted OS itself. 399 400* `build.sh`: Builds all software components in the correct order. 401 402* `run_qemu.sh`: This script starts QEMU. 403 404* `serial_0.sh`: Starts listening to QEMUs normal world UART console. 405 406* `serial_1.sh`: Starts listening to QEMUs secure world UART console. 407 408* `update_rootfs.sh`: This script will update rootfs. For example when you have 409 updated normal world component, you will need to put them into rootfs. Calling 410 this script will do so. In case you are creating a new Trusted Application, 411 you must also edit filelist-tee.text in the gen_rootfs folder accordingly. 412 413To build everything you will need to run the script `build.sh`, which will build 414all gits and in the correct order. 415 416#### 4.4.4 Boot and run QEMU and OP-TEE 417To run this you need to lunch two consoles for the UARTs and one console for 418QEMU itself, so in separate shell windows run: 419``` 420$ ./serial_0.sh 421``` 422``` 423$ ./serial_1.sh 424``` 425and finally 426``` 427$ ./run_qemu.sh 428... 429QEMU 2.1.50 monitor - type 'help' for more information 430(qemu) c 431``` 432 433In the window for serial_0 you will now get the normal world console and here 434you need to load and OP-TEEs Linux Kernel driver and also load tee-supplicant. 435This is done by the following lines: 436 437``` 438$ root@Vexpress:/ modprobe optee_armtz 439$ root@Vexpress:/ tee-supplicant & 440``` 441 442--- 443### 4.5 STMicroelectronics boards 444Currently OP-TEE is supported on Orly-2 (b2020-h416) and Cannes family (b2120 445both h310 and h410 chip). 446 447#### 4.5.1 Get the compiler for Orly-2 448Will be written soon. 449 450#### 4.5.2 Download the source code 451See section "4.1.2 Download the source code". 452 453#### 4.5.3 Build for Orly-2 454Will be written soon. 455 456For Orly-2 do as follows 457``` 458$ PLATFORM_FLAVOR=orly2 CROSS_COMPILE=arm-linux-gnueabihf- make 459``` 460 461For Cannes family do as follows 462``` 463$ PLATFORM_FLAVOR=cannes CROSS_COMPILE=arm-linux-gnueabihf- make 464``` 465 466#### 4.5.4 Prepare and install the images 467Will be written soon. 468 469For Orly-2 do as follows 470``` 471To be written. 472``` 473 474For Cannes family do as follows 475``` 476To be written. 477``` 478 479#### 4.5.5 Boot and run the software 480Will be written soon. All magic with STM and so on must be stated here. 481 482For Orly-2 do as follows 483``` 484To be written. 485``` 486 487For Cannes family do as follows 488``` 489To be written. 490``` 491 492--- 493### 4.6 Allwinner A80 494Allwinner A80 platform has been supported in OP-TEE since mid December 2014. 495#### 4.6.1 Get the compiler and source 496Follow the instructions in the "4.1 Basic setup". 497 498#### 4.6.2 Build 499``` 500$ cd optee_os 501$ export PLATFORM=sunxi 502$ export CROSS_COMPILE=arm-linux-gnueabihf- 503$ make 504``` 505 506#### 4.6.3 Prepare the images to run on A80 Board 507 508Download Allwinner A80 platform SDK. 509The SDK refer to Allwinner A80 platform SDK root directory. 510A80 SDK directory tree like this: 511``` 512SDK/ 513 Android 514 lichee 515``` 516Android include all Android source code, 517lichee include bootloader and linux kernel. 518 519##### 4.6.3.1 Copy OP-TEE output to package directory 520copy the OP-TEE output binary to SDK/lichee/tools/pack/sun9i/bin 521``` 522$ cd optee_os 523$ cp ./out/arm32-plat-sunxi/core/tee.bin SDK/lichee/tools/pack/sun9i/bin 524``` 525 526##### 4.6.3.2 Build linux kernel 527In lichee directory, Type the following commands: 528``` 529$ cd SDK/lichee 530$ ./build.sh 531``` 532 533##### 4.6.3.3 Build Android 534In Android directory, Type the following commands: 535``` 536$ cd SDK/android 537$ extract-bsp 538$ make -j 539``` 540 541##### 4.6.3.4 Create Android image 542In andoid directory, Type the following commands: 543``` 544$ cd SDK/android 545$ pack 546``` 547The output image will been signed internally when pack. 548The output image name is a80_android_board.img. 549 550##### 4.6.3.5 Download Android image 551Use Allwinner PhoenixSuit tool to download to A80 board. 552Choose the output image(a80_android_board.img), 553Choose download, 554Wait for the download to complete. 555 556#### 4.6.4 Boot and run the software on A80 Board 557When the host platform is Windows, Use a console application 558to connect A80 board uart0. In the console window, 559You can install OP-TEE linux kernel driver optee.ko, 560Load OP-TEE-Client daemon tee-supplicant, 561Run OP-TEE example hello world application. 562This is done by the following lines: 563``` 564$ insmod /system/vendor/modules/optee.ko 565$ /system/bin/tee-supplicant & 566$ /system/bin/tee-helloworld 567``` 568Enjoying OP-TEE on A80 board. 569 570--- 571### 4.7 Mediatek MT8173 EVB 572Please refer to [8173 wiki](https://github.com/ibanezchen/linux-8173/wiki) 573to setup MT8173 evaluation board. 574 575#### 4.7.1 Setup MT8173 OP-TEE development environment 576``` 577$ wget https://raw.githubusercontent.com/OP-TEE/optee_os/master/scripts/setup_mtk_optee.sh 578$ chmod 711 setup_mtk_optee.sh 579$ ./setup_mtk_optee.sh 580``` 581 582#### 4.7.2 Compile source 583Run `build.sh` to compile all sources and generate firmware images 584(boot.img and trustzone.bin). 585``` 586$ ./build.sh 587``` 588 589#### 4.7.3 Update MT8173 EVB firmware images 590Run `flash_image.sh` to update MT8173 EVB firmware images 591``` 592$ ./flash_image.sh 593``` 594 595#### 4.7.4 Firmware recovery 596 597 1. Download pre-built images and recovery tools 598 ``` 599 $ git clone https://github.com/m943040028/evb-utils.git 600 $ cd evb-utils 601 $ ./get-fbtool.sh 602 ``` 603 604 2. Force EVB to enter fastboot mode (root privileges required) 605 ``` 606 $ ./update-recover.sh 607 ``` 608 609 The shell script will hold and wait for user to do the following actions: 610 `Press the DOWNLOAD button down and hold, click RESET button and wait 2~3 seconds 611 before release the DOWNLOAD button` 612 613 3. After `.update-recover.sh` command returned and EVB successfully enter 614 fastboot mode, run `./update.sh` to download the pre-built images to EVB 615 616 ``` 617 $ ./update.sh 618 ``` 619 620 **NOTE** - How to make sure EVB already enter fastboot mode: 621 622 If you can see the following messages in UART console, it means EVB is in 623 fastboot mode and ready to receive new images. 624 ``` 625 [2340] fastboot_init() 626 [3380] fastboot: processing commands: fastboot_mode=2 627 ``` 628 629 4. Press RESET button to reboot system 630 631--- 632### 4.8 HiKey board 633[HiKey](https://www.96boards.org/products/hikey/) is a 96Boards Consumer 634Edition compliant board equipped with a HiSilicon Kirin 620 SoC (8-core, 63564-bit ARM Cortex A53). It can run OP-TEE in 32- and 64-bit modes. 636 637To obtain all the required software pieces to run OP-TEE on this board, you 638may want to clone the [hikey_optee](https://github.com/jforissier/hikey_optee) 639repository. This GitHub project contains a master Makefile as well as Git 640submodules, which helps putting all the compatible pieces together, including: 641- Toolchains (Linaro Aarch32 and Aarch64 cross-compilers) 642- ARM Trusted Firmware 643- OP-TEE OS, client and driver 644- EDK2 UEFI bootloader 645- Linux kernel 646- A BusyBox-based root filesystem 647- The optee_test applications 648 649Clone the project with: 650``` 651$ git clone https://github.com/jforissier/hikey_optee 652``` 653Then, refer to the instructions in the project's README.md. 654 655## 5. Coding standards 656In this project we are trying to adhere to the same coding convention as used in 657the Linux kernel (see 658[CodingStyle](https://www.kernel.org/doc/Documentation/CodingStyle)). We achieve this by running 659[checkpatch](http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl) from Linux kernel. 660However there are a few exceptions that we had to make since the code also 661follows GlobalPlatform standards. The exceptions are as follows: 662 663- CamelCase for GlobalPlatform types are allowed. 664- And we also exclude checking third party code that we might use in this 665 project, such as LibTomCrypt, MPA, newlib (not in this particular git, but 666 those are also part of the complete TEE solution). The reason for excluding 667 and not fixing third party code is because we would probably deviate too much 668 from upstream and therefore it would be hard to rebase against those projects 669 later on (and we don't expect that it is easy to convince other software 670 projects to change coding style). 671 672### 5.1 checkpatch 673Since checkpatch is licensed under the terms of GNU GPL License Version 2, we 674cannot include this script directly into this project. Therefore we have 675written the Makefile so you need to explicitly point to the script by exporting 676an environment variable, namely CHECKPATCH. So, suppose that the source code for 677the Linux kernel is at `$HOME/devel/linux`, then you have to export like follows: 678 679 $ export CHECKPATCH=$HOME/devel/linux/scripts/checkpatch.pl 680thereafter it should be possible to use one of the different checkpatch targets 681in the [Makefile](Makefile). There are targets for checking all files, checking 682against latest commit, against a certain base-commit etc. For the details, read 683the [Makefile](Makefile). 684