Blame view

doc/README.chromium 5.56 KB
9d73e85a8   Simon Glass   cros: Expand the ...
1
2
  Chromium OS Support in U-Boot
  =============================
c9af6673e   Simon Glass   README: Add instr...
3

9d73e85a8   Simon Glass   cros: Expand the ...
4
5
  Introduction
  ------------
c9af6673e   Simon Glass   README: Add instr...
6

9d73e85a8   Simon Glass   cros: Expand the ...
7
8
  This describes how to use U-Boot with Chromium OS. Several options are
  available:
c9af6673e   Simon Glass   README: Add instr...
9

9d73e85a8   Simon Glass   cros: Expand the ...
10
11
12
13
     - Running U-Boot from the 'altfw' feature, which is available on selected
          Chromebooks from 2019 onwards (initially Grunt). Press '1' from the
          developer-mode screen to get into U-Boot. See here for details:
          https://sites.google.com/a/chromium.org/dev/chromium-os/poking-around-your-chrome-os-device?pli=1
c9af6673e   Simon Glass   README: Add instr...
14

9d73e85a8   Simon Glass   cros: Expand the ...
15
16
17
18
19
     - Running U-Boot from the disk partition. This involves signing U-Boot and
          placing it on the disk, for booting as a 'kernel'. See
          README.chromium-chainload for information on this. This is the only
          option on non-U-Boot Chromebooks from 2013 to 2018 and is somewhat
          more involved.
c9af6673e   Simon Glass   README: Add instr...
20

9d73e85a8   Simon Glass   cros: Expand the ...
21
22
23
24
     - Running U-Boot with Chromium OS verified boot. This allows U-Boot to be
          used instead of either or both of depthcharge (a bootloader which forked
          from U-Boot in 2013) and coreboot. See below for more information on
          this.
c9af6673e   Simon Glass   README: Add instr...
25

c9af6673e   Simon Glass   README: Add instr...
26

9d73e85a8   Simon Glass   cros: Expand the ...
27
28
  U-Boot with Chromium OS verified boot
  -------------------------------------
c9af6673e   Simon Glass   README: Add instr...
29

9d73e85a8   Simon Glass   cros: Expand the ...
30
  To obtain:
c9af6673e   Simon Glass   README: Add instr...
31

9d73e85a8   Simon Glass   cros: Expand the ...
32
33
34
     git clone https://github.com/sglass68/u-boot.git
     cd u-boot
     git checkout cros-master
c9af6673e   Simon Glass   README: Add instr...
35

1b96da67a   Simon Glass   chromium: Update ...
36
37
38
39
40
     cd ..
     git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference
     cd vboot_reference
     git checkout 45964294
     #  futility: updater: Correct output version for Snow
9d73e85a8   Simon Glass   cros: Expand the ...
41
  To build for sandbox:
c9af6673e   Simon Glass   README: Add instr...
42

9d73e85a8   Simon Glass   cros: Expand the ...
43
     UB=/tmp/b/chromeos_sandbox    # U-Boot build directory
1b96da67a   Simon Glass   chromium: Update ...
44
45
46
     cd u-boot
     make O=$UB chromeos_sandbox_defconfig
     make O=$UB -j20 -s VBOOT_SOURCE=/path/to/vboot_reference \
9d73e85a8   Simon Glass   cros: Expand the ...
47
  	MAKEFLAGS_VBOOT=DEBUG=1 QUIET=1
c9af6673e   Simon Glass   README: Add instr...
48

9d73e85a8   Simon Glass   cros: Expand the ...
49
  Replace sandbox with another supported target.
c9af6673e   Simon Glass   README: Add instr...
50

9d73e85a8   Simon Glass   cros: Expand the ...
51
52
  This produces $UB/image.bin which contains the firmware binaries in a SPI
  flash image.
c9af6673e   Simon Glass   README: Add instr...
53

9d73e85a8   Simon Glass   cros: Expand the ...
54
  To run on sandbox:
c9af6673e   Simon Glass   README: Add instr...
55

9d73e85a8   Simon Glass   cros: Expand the ...
56
57
58
     $UB/tpl/u-boot-tpl -d $UB/u-boot.dtb.out \
  	-L6 -c "host bind 0 $CROS/src/build/images/cheza/latest/chromiumos_image.bin; vboot go auto" \
  	-l -w -s state.dtb -r
c9af6673e   Simon Glass   README: Add instr...
59

9d73e85a8   Simon Glass   cros: Expand the ...
60
61
62
  To run on other boards:
     Install image.bin in the SPI flash of your device
     Boot your system
c9af6673e   Simon Glass   README: Add instr...
63

c9af6673e   Simon Glass   README: Add instr...
64

9d73e85a8   Simon Glass   cros: Expand the ...
65
66
  Sandbox
  -------
c9af6673e   Simon Glass   README: Add instr...
67

9d73e85a8   Simon Glass   cros: Expand the ...
68
69
70
  Most Chromium OS development with U-Boot is undertaken using sandbox. There is
  a sandbox target available (chromeos_sandbox) which allows running U-Boot on
  a Linux machine completion with emulations of the display, TPM, disk, etc.
c9af6673e   Simon Glass   README: Add instr...
71

9d73e85a8   Simon Glass   cros: Expand the ...
72
73
74
75
76
  Running sandbox starts TPL, which contains the first phase of vboot, providing
  a device tree and binding a Chromium OS disk image for use to find kernels
  (any Chromium OS image will do). It also saves driver state between U-Boot
  phases into state.dtb and will automatically ensure that memory is shared
  between all phases. TPL will jump to SPL and then on to U-Boot proper.
c9af6673e   Simon Glass   README: Add instr...
77

9d73e85a8   Simon Glass   cros: Expand the ...
78
  It is possible to run with debugging on, e.g.
c9af6673e   Simon Glass   README: Add instr...
79

9d73e85a8   Simon Glass   cros: Expand the ...
80
     gdb --args $UB/tpl/u-boot-tpl -d ....
c9af6673e   Simon Glass   README: Add instr...
81

9d73e85a8   Simon Glass   cros: Expand the ...
82
83
  Breakpoints can be set in any U-Boot phase. Overall this is a good debugging
  environment for new verified-boot features.
c9af6673e   Simon Glass   README: Add instr...
84

c9af6673e   Simon Glass   README: Add instr...
85

9d73e85a8   Simon Glass   cros: Expand the ...
86
87
  Samus
  -----
c9af6673e   Simon Glass   README: Add instr...
88

9d73e85a8   Simon Glass   cros: Expand the ...
89
90
  Basic support is available for samus, using the chromeos_samus target. If you
  have an em100, use:
c9af6673e   Simon Glass   README: Add instr...
91

9d73e85a8   Simon Glass   cros: Expand the ...
92
     sudo em100 -s -c W25Q128FW -d $UB/image.bin -t -r
c9af6673e   Simon Glass   README: Add instr...
93

9d73e85a8   Simon Glass   cros: Expand the ...
94
  to write the image and then boot samus (Power-Refresh).
c9af6673e   Simon Glass   README: Add instr...
95

c9af6673e   Simon Glass   README: Add instr...
96

9d73e85a8   Simon Glass   cros: Expand the ...
97
98
  Boot flow
  ---------
c9af6673e   Simon Glass   README: Add instr...
99

9d73e85a8   Simon Glass   cros: Expand the ...
100
101
102
  Verified boot starts in TPL, which selects the A or B SPL, which in turn selects
  the A or B U-Boot. Then this jumps to the selected kernel. If anything goes
  wrong, the device reboots and the recovery SPL and U-Boot are used instead.
c9af6673e   Simon Glass   README: Add instr...
103

9d73e85a8   Simon Glass   cros: Expand the ...
104
  More details are available here:
c9af6673e   Simon Glass   README: Add instr...
105

9d73e85a8   Simon Glass   cros: Expand the ...
106
     https://www.chromium.org/chromium-os/chromiumos-design-docs/firmware-boot-and-recovery
c9af6673e   Simon Glass   README: Add instr...
107

c9af6673e   Simon Glass   README: Add instr...
108

9d73e85a8   Simon Glass   cros: Expand the ...
109
110
  New uclasses
  ------------
c9af6673e   Simon Glass   README: Add instr...
111

9d73e85a8   Simon Glass   cros: Expand the ...
112
  Several uclasses are provided in cros/:
fe67eaccd   Simon Glass   README: Add instr...
113

9d73e85a8   Simon Glass   cros: Expand the ...
114
115
116
117
118
  	UCLASS_CROS_AUX_FW		Chrome OS auxiliary firmware
  	UCLASS_CROS_FWSTORE		Chrome OS firmware storage
  	UCLASS_CROS_NVDATA		Chrome OS non-volatile data device
  	UCLASS_CROS_VBOOT_EC		Chrome OS vboot EC operations
  	UCLASS_CROS_VBOOT_FLAG		Chrome OS verified boot flag
fe67eaccd   Simon Glass   README: Add instr...
119

9d73e85a8   Simon Glass   cros: Expand the ...
120
  The existing UCLASS_CROS_EC is also used.
fe67eaccd   Simon Glass   README: Add instr...
121

fe67eaccd   Simon Glass   README: Add instr...
122

9d73e85a8   Simon Glass   cros: Expand the ...
123
124
  Commands
  --------
fe67eaccd   Simon Glass   README: Add instr...
125

9d73e85a8   Simon Glass   cros: Expand the ...
126
127
128
  A new 'vboot' command is provided to run particular vboot stages. The most
  useful command is 'vboot go auto', which continues where the last stage left
  off.
fe67eaccd   Simon Glass   README: Add instr...
129

9d73e85a8   Simon Glass   cros: Expand the ...
130
131
132
133
  Note that TPL and SPL do not supports commands as yet, so the vboot code is
  called directly from the SPL boot devices (BOOT_DEVICE_CROS_VBOOT). See
  cros_load_image_tpl() and cros_load_image_spl() which both call
  vboot_run_auto().
fe67eaccd   Simon Glass   README: Add instr...
134

fe67eaccd   Simon Glass   README: Add instr...
135

9d73e85a8   Simon Glass   cros: Expand the ...
136
137
  Config options
  --------------
fe67eaccd   Simon Glass   README: Add instr...
138

9d73e85a8   Simon Glass   cros: Expand the ...
139
140
  The main option is CONFIG_CHROMEOS, which enables a wide array of other options
  so that the required features are present.
fe67eaccd   Simon Glass   README: Add instr...
141

fe67eaccd   Simon Glass   README: Add instr...
142

9d73e85a8   Simon Glass   cros: Expand the ...
143
144
  Device-tree config
  ------------------
fe67eaccd   Simon Glass   README: Add instr...
145

9d73e85a8   Simon Glass   cros: Expand the ...
146
147
148
149
  Various options are available which control the operation of verified boot.
  See cros/dts/bindings/config.txt for details. Most config is handled at run-
  time, although build-time config (with Kconfig) could also be added fairly
  easily.
fe67eaccd   Simon Glass   README: Add instr...
150

fe67eaccd   Simon Glass   README: Add instr...
151

9d73e85a8   Simon Glass   cros: Expand the ...
152
153
  Porting to other hardware
  -------------------------
fe67eaccd   Simon Glass   README: Add instr...
154

9d73e85a8   Simon Glass   cros: Expand the ...
155
156
157
158
  A basic port to samus (Chromebook Pixel 2015) is in a basic working state,
  using the chromeos_samus target. Patches will likely be forthcoming in early
  2019. Ports to an ARM board and coreboot (for x86 Chromebooks) are in the
  dreaming state.
fe67eaccd   Simon Glass   README: Add instr...
159

fe67eaccd   Simon Glass   README: Add instr...
160

9d73e85a8   Simon Glass   cros: Expand the ...
161
162
  Tests
  -----
fe67eaccd   Simon Glass   README: Add instr...
163

9d73e85a8   Simon Glass   cros: Expand the ...
164
165
  Chromium OS firmware has a very limited set of tests. The tests that originally
  existed in U-Boot were not brought over to coreboot or depthcharge.
c9af6673e   Simon Glass   README: Add instr...
166

9d73e85a8   Simon Glass   cros: Expand the ...
167
168
169
170
  The U-Boot tests ('make check') do operate, but at present there are no
  Chromium OS tests available. These will hopefully come together over time. Of
  course the above sandbox feature provides a sort of functional test and can
  detecte problems that affect the flow or particular vboot features.
c9af6673e   Simon Glass   README: Add instr...
171

c9af6673e   Simon Glass   README: Add instr...
172

9d73e85a8   Simon Glass   cros: Expand the ...
173
174
  TO DO
  -----
c9af6673e   Simon Glass   README: Add instr...
175

9d73e85a8   Simon Glass   cros: Expand the ...
176
177
  - Support for booting from coreboot (patches expected March 2019)
  - Support for booting from an ARM board, e.g. bob
c9af6673e   Simon Glass   README: Add instr...
178

c9af6673e   Simon Glass   README: Add instr...
179

9d73e85a8   Simon Glass   cros: Expand the ...
180
181
182
  Simon Glass
  sjg@chromium.org
  7 October 2018