blob: 4a46fed069e4a5cc228281ab6dfbb76aa13ab95e [file] [log] [blame]
Park, Aiden9835d6d2019-08-03 08:31:11 +00001.. SPDX-License-Identifier: GPL-2.0+
2.. sectionauthor:: Aiden Park <aiden.park@intel.com>
3
4Slim Bootloader
5===============
6
7Introduction
8------------
9
10This target is to enable U-Boot_ as a payload of `Slim Bootloader`_ (a.k.a SBL)
11boot firmware which currently supports QEMU, Apollolake, Whiskeylake,
12Coffeelake-R platforms.
13
14The `Slim Bootloader`_ is designed with multi-stages (Stage1A/B, Stage2, Payload)
15architecture to cover from reset vector to OS booting and it consumes
16`Intel FSP`_ for silicon initialization.
17
18* Stage1A: Reset vector, CAR init with FSP-T
19* Stage1B: Memory init with FSP-M, CAR teardown, Continue execution in memory
20* Stage2 : Rest of Silicon init with FSP-S, Create HOB, Hand-off to Payload
21* Payload: Payload init with HOB, Load OS from media, Booting OS
22
23The Slim Bootloader stages (Stage1A/B, Stage2) focus on chipset, hardware and
24platform specific initialization, and it provides useful information to a
25payload in a HOB (Hand-Off Block) which has serial port, memory map, performance
26data info and so on. This is Slim Bootloader architectural design to make a
27payload light-weight, platform independent and more generic across different
28boot solutions or payloads, and to minimize hardware re-initialization in a
29payload.
30
31Build Instruction for U-Boot as a Slim Bootloader payload
32---------------------------------------------------------
33
34Build U-Boot and obtain u-boot-dtb.bin::
35
36 $ make distclean
37 $ make slimbootloader_defconfig
38 $ make all
39
40Prepare Slim Bootloader
41-----------------------
42
431. Setup Build Environment for Slim Bootloader.
44
45 Refer to `Getting Started`_ page in `Slim Bootloader`_ document site.
46
472. Get source code. Let's simply clone the repo::
48
49 $ git clone https://github.com/slimbootloader/slimbootloader.git
50
513. Copy u-boot-dtb.bin to Slim Bootloader.
52 Slim Bootloader looks for a payload from the specific location.
53 Copy the build u-boot-dtb.bin to the expected location::
54
55 $ mkdir -p <Slim Bootloader Dir>/PayloadPkg/PayloadBins/
56 $ cp <U-Boot Dir>/u-boot-dtb.bin <Slim Bootloader Dir>/PayloadPkg/PayloadBins/u-boot-dtb.bin
57
58Build Instruction for Slim Bootloader for QEMU target
59-----------------------------------------------------
60
61Slim Bootloader supports multiple payloads, and a board of Slim Bootloader
62detects its target payload by PayloadId in board configuration.
63The PayloadId can be any 4 Bytes value.
64
651. Update PayloadId. Let's use 'U-BT' as an example::
66
67 $ vi Platform/QemuBoardPkg/CfgData/CfgDataExt_Brd1.dlt
68 -GEN_CFG_DATA.PayloadId | 'AUTO'
69 +GEN_CFG_DATA.PayloadId | 'U-BT'
70
712. Update payload text base. PAYLOAD_EXE_BASE must be the same as U-Boot
72 CONFIG_SYS_TEXT_BASE in board/intel/slimbootloader/Kconfig.
73 PAYLOAD_LOAD_HIGH must be 0::
74
75 $ vi Platform/QemuBoardPkg/BoardConfig.py
76 + self.PAYLOAD_LOAD_HIGH = 0
77 + self.PAYLOAD_EXE_BASE = 0x00100000
78
793. Build QEMU target. Make sure u-boot-dtb.bin and U-BT PayloadId
80 in build command. The output is Outputs/qemu/SlimBootloader.bin::
81
82 $ python BuildLoader.py build qemu -p "OsLoader.efi:LLDR:Lz4;u-boot-dtb.bin:U-BT:Lzma"
83
844. Launch Slim Bootloader on QEMU.
85 You should reach at U-Boot serial console::
86
87 $ qemu-system-x86_64 -machine q35 -nographic -serial mon:stdio -pflash Outputs/qemu/SlimBootloader.bin
88
89Build Instruction for Slim Bootloader for LeafHill (APL) target
90--------------------------------------------------------------
91
92LeafHill is using PCI UART2 device as a serial port.
93For MEM32 serial port, CONFIG_SYS_NS16550_MEM32 needs to be enabled in U-Boot.
94
951. Enable CONFIG_SYS_NS16550_MEM32 in U-Boot::
96
97 $ vi include/configs/slimbootloader.h
98 +#define CONFIG_SYS_NS16550_MEM32
99 #ifdef CONFIG_SYS_NS16550_MEM3
100
1012. Build U-Boot::
102
103 $ make disclean
104 $ make slimbootloader_defconfig
105 $ make all
106
1073. Copy u-boot-dtb.bin to Slim Bootloader.
108 Slim Bootloader looks for a payload from the specific location.
109 Copy the build u-boot-dtb.bin to the expected location::
110
111 $ mkdir -p <Slim Bootloader Dir>/PayloadPkg/PayloadBins/
112 $ cp <U-Boot Dir>/u-boot-dtb.bin <Slim Bootloader Dir>/PayloadPkg/PayloadBins/u-boot-dtb.bin
113
1144. Update PayloadId. Let's use 'U-BT' as an example::
115
116 $ vi Platform/ApollolakeBoardPkg/CfgData/CfgData_Int_LeafHill.dlt
117 -GEN_CFG_DATA.PayloadId | 'AUTO
118 +GEN_CFG_DATA.PayloadId | 'U-BT'
119
1205. Update payload text base.
121
122* PAYLOAD_EXE_BASE must be the same as U-Boot CONFIG_SYS_TEXT_BASE
123 in board/intel/slimbootloader/Kconfig.
124* PAYLOAD_LOAD_HIGH must be 0::
125
126 $ vi Platform/ApollolakeBoardPkg/BoardConfig.py
127 + self.PAYLOAD_LOAD_HIGH = 0
128 + self.PAYLOAD_EXE_BASE = 0x00100000
129
1306. Build APL target. Make sure u-boot-dtb.bin and U-BT PayloadId
131 in build command. The output is Outputs/apl/Stitch_Components.zip::
132
133 $ python BuildLoader.py build apl -p "OsLoader.efi:LLDR:Lz4;u-boot-dtb.bin:U-BT:Lzma"
134
1357. Stitch IFWI.
136
137 Refer to Apollolake_ page in Slim Bootloader document site::
138
139 $ python Platform/ApollolakeBoardPkg/Script/StitchLoader.py -i <Existing IFWI> -s Outputs/apl/Stitch_Components.zip -o <Output IFWI>
140
1418. Flash IFWI.
142
143 Use DediProg to flash IFWI. You should reach at U-Boot serial console.
144
145
146Build Instruction to use ELF U-Boot
147-----------------------------------
148
1491. Enable CONFIG_OF_EMBED::
150
151 $ vi configs/slimbootloader_defconfig
152 +CONFIG_OF_EMBED=y
153
1542. Build U-Boot::
155
156 $ make disclean
157 $ make slimbootloader_defconfig
158 $ make all
159 $ strip u-boot (removing symbol for reduced size)
160
1613. Do same steps as above
162
163* Copy u-boot (ELF) to PayloadBins directory
164* Update PayloadId 'U-BT' as above.
165* No need to set PAYLOAD_LOAD_HIGH and PAYLOAD_EXE_BASE.
166* Build Slim Bootloader. Use u-boot instead of u-boot-dtb.bin::
167
168 $ python BuildLoader.py build <qemu or apl> -p "OsLoader.efi:LLDR:Lz4;u-boot:U-BT:Lzma"
169
170.. _U-Boot: https://gitlab.denx.de/
171.. _`Slim Bootloader`: https://github.com/slimbootloader/
172.. _`Intel FSP`: https://github.com/IntelFsp/
173.. _`Getting Started`: https://slimbootloader.github.io/getting-started/
174.. _Apollolake: https://slimbootloader.github.io/supported-hardware/apollo-lake-crb.html#stitching