Ying Zhang | 2d2e3b6 | 2013-08-16 15:16:15 +0800 | [diff] [blame] | 1 | Generic TPL framework |
| 2 | ===================== |
| 3 | |
| 4 | Overview |
| 5 | -------- |
| 6 | |
| 7 | TPL---Third Program Loader. |
| 8 | |
| 9 | Due to the SPL on some boards(powerpc mpc85xx) has a size limit and cannot |
| 10 | be compatible with all the external device(e.g. DDR). So add a tertiary |
| 11 | program loader (TPL) to enable a loader stub loaded by the code from the |
| 12 | SPL. It loads the final uboot image into DDR, then jump to it to begin |
| 13 | execution. Now, only the powerpc mpc85xx has this requirement and will |
| 14 | implemente it. |
| 15 | |
| 16 | Keep consistent with SPL, with this framework almost all source files for a |
| 17 | board can be reused. No code duplication or symlinking is necessary anymore. |
| 18 | |
| 19 | How it works |
| 20 | ------------ |
| 21 | |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 22 | There has been a directory $(srctree)/spl which contains only a Makefile. The |
Ying Zhang | 2d2e3b6 | 2013-08-16 15:16:15 +0800 | [diff] [blame] | 23 | Makefile is shared by SPL and TPL. |
| 24 | |
| 25 | The object files are built separately for SPL/TPL and placed in the |
| 26 | directory spl/tpl. The final binaries which are generated are |
| 27 | u-boot-{spl|tpl}, u-boot-{spl|tpl}.bin and u-boot-{spl|tpl}.map. |
| 28 | |
| 29 | During the TPL build a variable named CONFIG_TPL_BUILD is exported in the |
| 30 | make environment and also appended to CPPFLAGS with -DCONFIG_TPL_BUILD. |
| 31 | |
| 32 | The SPL options are shared by SPL and TPL, the board config file should |
| 33 | determine which SPL options to choose based on whether CONFIG_TPL_BUILD |
| 34 | is set. Source files can be compiled for TPL with options choosed in the |
| 35 | board config file. |
| 36 | |
Patrick Delaunay | 63e4d11 | 2019-05-21 19:19:13 +0200 | [diff] [blame] | 37 | TPL use a small device tree (u-boot-tpl.dtb), containing only the nodes with |
| 38 | the pre-relocation properties: 'u-boot,dm-pre-reloc' and 'u-boot,dm-tpl' |
| 39 | (see README.SPL for details). |
| 40 | |
Ying Zhang | 2d2e3b6 | 2013-08-16 15:16:15 +0800 | [diff] [blame] | 41 | For example: |
| 42 | |
| 43 | spl/Makefile: |
| 44 | LIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/libcommon.o |
| 45 | |
| 46 | CONFIG_SPL_LIBCOMMON_SUPPORT is defined in board config file: |
| 47 | #ifdef CONFIG_TPL_BUILD |
| 48 | #define CONFIG_SPL_LIBCOMMON_SUPPORT |
| 49 | #endif |