blob: c56545cb7ffdf530069fc96e930d875f73921900 [file] [log] [blame]
Simon Glassa20a7b72019-01-30 20:51:20 -07001Chromium OS Support in U-Boot
2=============================
Simon Glass26784fc2017-05-31 17:57:24 -06003
Simon Glassa20a7b72019-01-30 20:51:20 -07004Introduction
5------------
Simon Glass26784fc2017-05-31 17:57:24 -06006
Simon Glassa20a7b72019-01-30 20:51:20 -07007This describes how to use U-Boot with Chromium OS. Several options are
8available:
Simon Glass26784fc2017-05-31 17:57:24 -06009
Simon Glassa20a7b72019-01-30 20:51:20 -070010 - Running U-Boot from the 'altfw' feature, which is available on selected
11 Chromebooks from 2019 onwards (initially Grunt). Press '1' from the
12 developer-mode screen to get into U-Boot. See here for details:
13 https://sites.google.com/a/chromium.org/dev/chromium-os/poking-around-your-chrome-os-device?pli=1
Simon Glass26784fc2017-05-31 17:57:24 -060014
Simon Glassa20a7b72019-01-30 20:51:20 -070015 - Running U-Boot from the disk partition. This involves signing U-Boot and
16 placing it on the disk, for booting as a 'kernel'. See
17 README.chromium-chainload for information on this. This is the only
18 option on non-U-Boot Chromebooks from 2013 to 2018 and is somewhat
19 more involved.
Simon Glass26784fc2017-05-31 17:57:24 -060020
Simon Glassa20a7b72019-01-30 20:51:20 -070021 - Running U-Boot with Chromium OS verified boot. This allows U-Boot to be
22 used instead of either or both of depthcharge (a bootloader which forked
23 from U-Boot in 2013) and coreboot. See below for more information on
24 this.
Simon Glass26784fc2017-05-31 17:57:24 -060025
Simon Glass0167f192020-09-05 14:50:52 -060026 - Running U-Boot from coreboot. This allows U-Boot to run on more devices
27 since many of them only support coreboot as the bootloader and have
28 no bare-metal support in U-Boot. For this, use the 'coreboot' target.
29
Simon Glass26784fc2017-05-31 17:57:24 -060030
Simon Glassa20a7b72019-01-30 20:51:20 -070031U-Boot with Chromium OS verified boot
32-------------------------------------
Simon Glass26784fc2017-05-31 17:57:24 -060033
Simon Glassa20a7b72019-01-30 20:51:20 -070034To obtain:
Simon Glass26784fc2017-05-31 17:57:24 -060035
Simon Glassa20a7b72019-01-30 20:51:20 -070036 git clone https://github.com/sglass68/u-boot.git
37 cd u-boot
38 git checkout cros-master
Simon Glass26784fc2017-05-31 17:57:24 -060039
Simon Glass4872d932019-07-10 11:04:13 -060040 cd ..
41 git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference
42 cd vboot_reference
43 git checkout 45964294
44 # futility: updater: Correct output version for Snow
45
Simon Glassa20a7b72019-01-30 20:51:20 -070046To build for sandbox:
Simon Glass26784fc2017-05-31 17:57:24 -060047
Simon Glassa20a7b72019-01-30 20:51:20 -070048 UB=/tmp/b/chromeos_sandbox # U-Boot build directory
Simon Glass4872d932019-07-10 11:04:13 -060049 cd u-boot
50 make O=$UB chromeos_sandbox_defconfig
51 make O=$UB -j20 -s VBOOT_SOURCE=/path/to/vboot_reference \
Simon Glassa20a7b72019-01-30 20:51:20 -070052 MAKEFLAGS_VBOOT=DEBUG=1 QUIET=1
Simon Glass26784fc2017-05-31 17:57:24 -060053
Simon Glassa20a7b72019-01-30 20:51:20 -070054Replace sandbox with another supported target.
Simon Glass26784fc2017-05-31 17:57:24 -060055
Simon Glassa20a7b72019-01-30 20:51:20 -070056This produces $UB/image.bin which contains the firmware binaries in a SPI
57flash image.
Simon Glass26784fc2017-05-31 17:57:24 -060058
Simon Glassa20a7b72019-01-30 20:51:20 -070059To run on sandbox:
Simon Glass26784fc2017-05-31 17:57:24 -060060
Simon Glassa20a7b72019-01-30 20:51:20 -070061 $UB/tpl/u-boot-tpl -d $UB/u-boot.dtb.out \
62 -L6 -c "host bind 0 $CROS/src/build/images/cheza/latest/chromiumos_image.bin; vboot go auto" \
63 -l -w -s state.dtb -r
Simon Glass26784fc2017-05-31 17:57:24 -060064
Simon Glassa20a7b72019-01-30 20:51:20 -070065To run on other boards:
66 Install image.bin in the SPI flash of your device
67 Boot your system
Simon Glass26784fc2017-05-31 17:57:24 -060068
Simon Glass26784fc2017-05-31 17:57:24 -060069
Simon Glassa20a7b72019-01-30 20:51:20 -070070Sandbox
71-------
Simon Glass26784fc2017-05-31 17:57:24 -060072
Simon Glassa20a7b72019-01-30 20:51:20 -070073Most Chromium OS development with U-Boot is undertaken using sandbox. There is
74a sandbox target available (chromeos_sandbox) which allows running U-Boot on
75a Linux machine completion with emulations of the display, TPM, disk, etc.
Simon Glass26784fc2017-05-31 17:57:24 -060076
Simon Glassa20a7b72019-01-30 20:51:20 -070077Running sandbox starts TPL, which contains the first phase of vboot, providing
78a device tree and binding a Chromium OS disk image for use to find kernels
79(any Chromium OS image will do). It also saves driver state between U-Boot
80phases into state.dtb and will automatically ensure that memory is shared
81between all phases. TPL will jump to SPL and then on to U-Boot proper.
Simon Glass26784fc2017-05-31 17:57:24 -060082
Simon Glassa20a7b72019-01-30 20:51:20 -070083It is possible to run with debugging on, e.g.
Simon Glass26784fc2017-05-31 17:57:24 -060084
Simon Glassa20a7b72019-01-30 20:51:20 -070085 gdb --args $UB/tpl/u-boot-tpl -d ....
Simon Glass26784fc2017-05-31 17:57:24 -060086
Simon Glassa20a7b72019-01-30 20:51:20 -070087Breakpoints can be set in any U-Boot phase. Overall this is a good debugging
88environment for new verified-boot features.
Simon Glass26784fc2017-05-31 17:57:24 -060089
Simon Glass26784fc2017-05-31 17:57:24 -060090
Simon Glassa20a7b72019-01-30 20:51:20 -070091Samus
92-----
Simon Glass26784fc2017-05-31 17:57:24 -060093
Simon Glassa20a7b72019-01-30 20:51:20 -070094Basic support is available for samus, using the chromeos_samus target. If you
95have an em100, use:
Simon Glass26784fc2017-05-31 17:57:24 -060096
Simon Glassa20a7b72019-01-30 20:51:20 -070097 sudo em100 -s -c W25Q128FW -d $UB/image.bin -t -r
Simon Glass26784fc2017-05-31 17:57:24 -060098
Simon Glassa20a7b72019-01-30 20:51:20 -070099to write the image and then boot samus (Power-Refresh).
Simon Glass26784fc2017-05-31 17:57:24 -0600100
Simon Glass26784fc2017-05-31 17:57:24 -0600101
Simon Glassa20a7b72019-01-30 20:51:20 -0700102Boot flow
103---------
Simon Glass26784fc2017-05-31 17:57:24 -0600104
Simon Glassa20a7b72019-01-30 20:51:20 -0700105Verified boot starts in TPL, which selects the A or B SPL, which in turn selects
106the A or B U-Boot. Then this jumps to the selected kernel. If anything goes
107wrong, the device reboots and the recovery SPL and U-Boot are used instead.
Simon Glass26784fc2017-05-31 17:57:24 -0600108
Simon Glassa20a7b72019-01-30 20:51:20 -0700109More details are available here:
Simon Glass26784fc2017-05-31 17:57:24 -0600110
Simon Glassa20a7b72019-01-30 20:51:20 -0700111 https://www.chromium.org/chromium-os/chromiumos-design-docs/firmware-boot-and-recovery
Simon Glass26784fc2017-05-31 17:57:24 -0600112
113
Simon Glassa20a7b72019-01-30 20:51:20 -0700114New uclasses
115------------
Simon Glass3421e002017-05-31 17:57:36 -0600116
Simon Glassa20a7b72019-01-30 20:51:20 -0700117Several uclasses are provided in cros/:
Simon Glass3421e002017-05-31 17:57:36 -0600118
Simon Glassa20a7b72019-01-30 20:51:20 -0700119 UCLASS_CROS_AUX_FW Chrome OS auxiliary firmware
120 UCLASS_CROS_FWSTORE Chrome OS firmware storage
121 UCLASS_CROS_NVDATA Chrome OS non-volatile data device
122 UCLASS_CROS_VBOOT_EC Chrome OS vboot EC operations
123 UCLASS_CROS_VBOOT_FLAG Chrome OS verified boot flag
Simon Glass3421e002017-05-31 17:57:36 -0600124
Simon Glassa20a7b72019-01-30 20:51:20 -0700125The existing UCLASS_CROS_EC is also used.
Simon Glass3421e002017-05-31 17:57:36 -0600126
Simon Glass3421e002017-05-31 17:57:36 -0600127
Simon Glassa20a7b72019-01-30 20:51:20 -0700128Commands
129--------
Simon Glass3421e002017-05-31 17:57:36 -0600130
Simon Glassa20a7b72019-01-30 20:51:20 -0700131A new 'vboot' command is provided to run particular vboot stages. The most
132useful command is 'vboot go auto', which continues where the last stage left
133off.
Simon Glass3421e002017-05-31 17:57:36 -0600134
Simon Glassa20a7b72019-01-30 20:51:20 -0700135Note that TPL and SPL do not supports commands as yet, so the vboot code is
136called directly from the SPL boot devices (BOOT_DEVICE_CROS_VBOOT). See
137cros_load_image_tpl() and cros_load_image_spl() which both call
138vboot_run_auto().
Simon Glass3421e002017-05-31 17:57:36 -0600139
Simon Glass3421e002017-05-31 17:57:36 -0600140
Simon Glassa20a7b72019-01-30 20:51:20 -0700141Config options
142--------------
Simon Glass3421e002017-05-31 17:57:36 -0600143
Simon Glassa20a7b72019-01-30 20:51:20 -0700144The main option is CONFIG_CHROMEOS, which enables a wide array of other options
145so that the required features are present.
Simon Glass3421e002017-05-31 17:57:36 -0600146
Simon Glass3421e002017-05-31 17:57:36 -0600147
Simon Glassa20a7b72019-01-30 20:51:20 -0700148Device-tree config
149------------------
Simon Glass3421e002017-05-31 17:57:36 -0600150
Simon Glassa20a7b72019-01-30 20:51:20 -0700151Various options are available which control the operation of verified boot.
152See cros/dts/bindings/config.txt for details. Most config is handled at run-
153time, although build-time config (with Kconfig) could also be added fairly
154easily.
Simon Glass3421e002017-05-31 17:57:36 -0600155
Simon Glass3421e002017-05-31 17:57:36 -0600156
Simon Glassa20a7b72019-01-30 20:51:20 -0700157Porting to other hardware
158-------------------------
Simon Glass3421e002017-05-31 17:57:36 -0600159
Simon Glassa20a7b72019-01-30 20:51:20 -0700160A basic port to samus (Chromebook Pixel 2015) is in a basic working state,
161using the chromeos_samus target. Patches will likely be forthcoming in early
1622019. Ports to an ARM board and coreboot (for x86 Chromebooks) are in the
163dreaming state.
Simon Glass3421e002017-05-31 17:57:36 -0600164
Simon Glass26784fc2017-05-31 17:57:24 -0600165
Simon Glassa20a7b72019-01-30 20:51:20 -0700166Tests
167-----
Simon Glass26784fc2017-05-31 17:57:24 -0600168
Simon Glassa20a7b72019-01-30 20:51:20 -0700169Chromium OS firmware has a very limited set of tests. The tests that originally
170existed in U-Boot were not brought over to coreboot or depthcharge.
Simon Glass26784fc2017-05-31 17:57:24 -0600171
Simon Glassa20a7b72019-01-30 20:51:20 -0700172The U-Boot tests ('make check') do operate, but at present there are no
173Chromium OS tests available. These will hopefully come together over time. Of
174course the above sandbox feature provides a sort of functional test and can
Simon Glass0167f192020-09-05 14:50:52 -0600175detect problems that affect the flow or particular vboot features.
Simon Glass26784fc2017-05-31 17:57:24 -0600176
177
Simon Glassa20a7b72019-01-30 20:51:20 -0700178TO DO
179-----
Simon Glass26784fc2017-05-31 17:57:24 -0600180
Simon Glass0167f192020-09-05 14:50:52 -0600181Get the full ACPI tables working with Coral
Simon Glass26784fc2017-05-31 17:57:24 -0600182
Simon Glass26784fc2017-05-31 17:57:24 -0600183
Simon Glassa20a7b72019-01-30 20:51:20 -0700184Simon Glass
185sjg@chromium.org
1867 October 2018