1# OP-TEE Trusted OS 2The optee_os git, containing the source code for the TEE in Linux using 3the ARM(R) Trustzone(R) technology. This component meets the Global 4Platform TEE System Architecture specification. It also provides the 5TEE Internal API v1.0 as defined by the Global Platform TEE Standard 6for the development of trusted apllications. 7It is distributed mostly under the BSD 2-clause open-source license. 8It includes few external files under BSD 3-clause license or other free 9software licenses. For a general overview of OP-TEE, please see the 10[Notice.md](Notice.md) file. 11 12In this git, the binary to build is tee.elf. 13The Trusted OS is accessible from the Rich OS (Linux) through the Global 14Platform TEE Client API and performs secure execution of applications 15inside the TEE. 16 17## License 18The software is provided under the 19[BSD 2-Clause](http://opensource.org/licenses/BSD-2-Clause) license. 20[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license. 21 22## Platforms supported 23This software has hardware dependencies. 24The software has been tested using: 25 26- STMicroelectronics b2020-h416 (orly-2) hardware (32-bits) 27- STMicroelectronics cannes family hardware (32-bits), on b2120. 28 This includes both h310 and h410 chip. 29- Some initial testing has been done using 30[Foundation FVP](http://www.arm.com/fvp), which can be downloaded free of 31charge. 32 33## Get and build the software 34### Get the compiler 35We will strive to use the latest available compiler from Linaro. Start by 36downloading and unpacking the compiler. Then export the PATH to the bin folder. 37 38 $ cd $HOME 39 $ mkdir toolchains 40 $ cd toolchains 41 $ wget http://releases.linaro.org/14.05/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux.tar.xz 42 $ tar xvf gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux.tar.xz 43 $ export PATH=$HOME/toolchains/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin:$PATH 44 45### Download the source code 46 $ cd $HOME 47 $ mkdir devel 48 $ cd devel 49 $ git clone https://github.com/OP-TEE/optee_os.git 50 51### Build 52 $ cd $HOME/devel/optee_os 53 $ CROSS_COMPILE=arm-linux-gnueabihf- make 54 55Default build targets stm platform orly2. Compilation of cannes is performed using cannes flavor: 56 57 $ PLATFORM_FLAVOR=cannes CROSS_COMPILE=arm-linux-gnueabihf- make 58 59To build vexpress, one have to change the default platform using command: 60 61 $ PLATFORM=vexpress CROSS_COMPILE=arm-linux-gnueabihf- make 62 63 64 65#### Compiler flags 66To be able to see the full command when building you could build using following 67flag: 68 69`$ make V=1` 70 71## Coding standards 72In this project we are trying to adhere to the same coding convention as used in 73the Linux kernel (see 74[CodingStyle](https://www.kernel.org/doc/Documentation/CodingStyle)). We achieve this by running 75[checkpatch](http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl) from Linux kernel. 76However there are a few exceptions that we had to make since the code also 77follows GlobalPlatform standards. The exceptions are as follows: 78 79- CamelCase for GlobalPlatform types are allowed. 80- And we also exclude checking third party code that we might use in this 81 project, such as LibTomCrypt, MPA, newlib (not in this particular git, but 82 those are also part of the complete TEE solution). The reason for excluding 83 and not fixing third party code is because we would probably deviate too much 84 from upstream and therefore it would be hard to rebase against those projects 85 later on (and we don't expect that it is easy to convince other software 86 projects to change coding style). 87 88### checkpatch 89Since checkpatch is licensed under the terms of GNU GPL License Version 2, we 90cannot include this script directly into this project. Therefore we have 91written the Makefile so you need to explicitly point to the script by exporting 92an environment variable, namely CHECKPATCH. So, suppose that the source code for 93the Linux kernel is at `$HOME/devel/linux`, then you have to export like follows: 94 95 $ export CHECKPATCH=$HOME/devel/linux/scripts/checkpatch.pl 96thereafter it should be possible to use one of the different checkpatch targets 97in the [Makefile](Makefile). There are targets for checking all files, checking 98against latest commit, against a certain base-commit etc. For the details, read 99the [Makefile](Makefile). 100