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