blob: 95b466e4af9597dc1dea9bb3e123f010f38d23e6 [file] [log] [blame]
Ying Zhang3aa29de2013-08-16 15:16:15 +08001Generic TPL framework
2=====================
3
4Overview
5--------
6
7TPL---Third Program Loader.
8
9Due to the SPL on some boards(powerpc mpc85xx) has a size limit and cannot
10be compatible with all the external device(e.g. DDR). So add a tertiary
11program loader (TPL) to enable a loader stub loaded by the code from the
12SPL. It loads the final uboot image into DDR, then jump to it to begin
13execution. Now, only the powerpc mpc85xx has this requirement and will
14implemente it.
15
16Keep consistent with SPL, with this framework almost all source files for a
17board can be reused. No code duplication or symlinking is necessary anymore.
18
19How it works
20------------
21
Masahiro Yamada4379ac62014-03-11 11:05:19 +090022There has been a directory $(srctree)/spl which contains only a Makefile. The
Ying Zhang3aa29de2013-08-16 15:16:15 +080023Makefile is shared by SPL and TPL.
24
25The object files are built separately for SPL/TPL and placed in the
26directory spl/tpl. The final binaries which are generated are
27u-boot-{spl|tpl}, u-boot-{spl|tpl}.bin and u-boot-{spl|tpl}.map.
28
29During the TPL build a variable named CONFIG_TPL_BUILD is exported in the
30make environment and also appended to CPPFLAGS with -DCONFIG_TPL_BUILD.
31
32The SPL options are shared by SPL and TPL, the board config file should
33determine which SPL options to choose based on whether CONFIG_TPL_BUILD
Thomas Hebb32f2ca22019-11-13 18:18:03 -080034is set. Source files can be compiled for TPL with options chosen in the
Ying Zhang3aa29de2013-08-16 15:16:15 +080035board config file.
36
Patrick Delaunay54e12232019-05-21 19:19:13 +020037TPL use a small device tree (u-boot-tpl.dtb), containing only the nodes with
Simon Glassea4299a2023-02-13 08:56:36 -070038the pre-relocation properties: 'bootph-all' and 'bootph-pre-sram'
39(see doc/develop/spl.rst for details).
Patrick Delaunay54e12232019-05-21 19:19:13 +020040
Ying Zhang3aa29de2013-08-16 15:16:15 +080041For example:
42
43spl/Makefile:
44LIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/libcommon.o
45
46CONFIG_SPL_LIBCOMMON_SUPPORT is defined in board config file:
47#ifdef CONFIG_TPL_BUILD
48#define CONFIG_SPL_LIBCOMMON_SUPPORT
49#endif