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