xref: /OK3568_Linux_fs/u-boot/doc/README.TPL (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunGeneric TPL framework
2*4882a593Smuzhiyun=====================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunOverview
5*4882a593Smuzhiyun--------
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunTPL---Third Program Loader.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunDue to the SPL on some boards(powerpc mpc85xx) has a size limit and cannot
10*4882a593Smuzhiyunbe compatible with all the external device(e.g. DDR). So add a tertiary
11*4882a593Smuzhiyunprogram loader (TPL) to enable a loader stub loaded by the code from the
12*4882a593SmuzhiyunSPL. It loads the final uboot image into DDR, then jump to it to begin
13*4882a593Smuzhiyunexecution. Now, only the powerpc mpc85xx has this requirement and will
14*4882a593Smuzhiyunimplemente it.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunKeep consistent with SPL, with this framework almost all source files for a
17*4882a593Smuzhiyunboard can be reused. No code duplication or symlinking is necessary anymore.
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunHow it works
20*4882a593Smuzhiyun------------
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunThere has been a directory $(srctree)/spl which contains only a Makefile. The
23*4882a593SmuzhiyunMakefile is shared by SPL and TPL.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe object files are built separately for SPL/TPL and placed in the
26*4882a593Smuzhiyundirectory spl/tpl. The final binaries which are generated are
27*4882a593Smuzhiyunu-boot-{spl|tpl}, u-boot-{spl|tpl}.bin and u-boot-{spl|tpl}.map.
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunDuring the TPL build a variable named CONFIG_TPL_BUILD is exported in the
30*4882a593Smuzhiyunmake environment and also appended to CPPFLAGS with -DCONFIG_TPL_BUILD.
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunThe SPL options are shared by SPL and TPL, the board config file should
33*4882a593Smuzhiyundetermine which SPL options to choose based on whether CONFIG_TPL_BUILD
34*4882a593Smuzhiyunis set. Source files can be compiled for TPL with options choosed in the
35*4882a593Smuzhiyunboard config file.
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunFor example:
38*4882a593Smuzhiyun
39*4882a593Smuzhiyunspl/Makefile:
40*4882a593SmuzhiyunLIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/libcommon.o
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunCONFIG_SPL_LIBCOMMON_SUPPORT is defined in board config file:
43*4882a593Smuzhiyun#ifdef CONFIG_TPL_BUILD
44*4882a593Smuzhiyun#define CONFIG_SPL_LIBCOMMON_SUPPORT
45*4882a593Smuzhiyun#endif
46