blob: 096bc4f1f7f0f16a9cb4bdae9bb716bfb4efb4f7 [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 Glass26784fc2017-05-31 17:57:24 -060026
Simon Glassa20a7b72019-01-30 20:51:20 -070027U-Boot with Chromium OS verified boot
28-------------------------------------
Simon Glass26784fc2017-05-31 17:57:24 -060029
Simon Glassa20a7b72019-01-30 20:51:20 -070030To obtain:
Simon Glass26784fc2017-05-31 17:57:24 -060031
Simon Glassa20a7b72019-01-30 20:51:20 -070032 git clone https://github.com/sglass68/u-boot.git
33 cd u-boot
34 git checkout cros-master
Simon Glass26784fc2017-05-31 17:57:24 -060035
Simon Glassa20a7b72019-01-30 20:51:20 -070036To build for sandbox:
Simon Glass26784fc2017-05-31 17:57:24 -060037
Simon Glassa20a7b72019-01-30 20:51:20 -070038 UB=/tmp/b/chromeos_sandbox # U-Boot build directory
39 CROS=/home/sglass/cosarm # Chromium OS directory
40 make O=$UB/chromeos_sandbox_defconfig
41 make O=$UB -j20 -s VBOOT_SOURCE=$CROS/src/platform/vboot_reference \
42 MAKEFLAGS_VBOOT=DEBUG=1 QUIET=1
Simon Glass26784fc2017-05-31 17:57:24 -060043
Simon Glassa20a7b72019-01-30 20:51:20 -070044Replace sandbox with another supported target.
Simon Glass26784fc2017-05-31 17:57:24 -060045
Simon Glassa20a7b72019-01-30 20:51:20 -070046This produces $UB/image.bin which contains the firmware binaries in a SPI
47flash image.
Simon Glass26784fc2017-05-31 17:57:24 -060048
Simon Glassa20a7b72019-01-30 20:51:20 -070049To run on sandbox:
Simon Glass26784fc2017-05-31 17:57:24 -060050
Simon Glassa20a7b72019-01-30 20:51:20 -070051 $UB/tpl/u-boot-tpl -d $UB/u-boot.dtb.out \
52 -L6 -c "host bind 0 $CROS/src/build/images/cheza/latest/chromiumos_image.bin; vboot go auto" \
53 -l -w -s state.dtb -r
Simon Glass26784fc2017-05-31 17:57:24 -060054
Simon Glassa20a7b72019-01-30 20:51:20 -070055To run on other boards:
56 Install image.bin in the SPI flash of your device
57 Boot your system
Simon Glass26784fc2017-05-31 17:57:24 -060058
Simon Glass26784fc2017-05-31 17:57:24 -060059
Simon Glassa20a7b72019-01-30 20:51:20 -070060Sandbox
61-------
Simon Glass26784fc2017-05-31 17:57:24 -060062
Simon Glassa20a7b72019-01-30 20:51:20 -070063Most Chromium OS development with U-Boot is undertaken using sandbox. There is
64a sandbox target available (chromeos_sandbox) which allows running U-Boot on
65a Linux machine completion with emulations of the display, TPM, disk, etc.
Simon Glass26784fc2017-05-31 17:57:24 -060066
Simon Glassa20a7b72019-01-30 20:51:20 -070067Running sandbox starts TPL, which contains the first phase of vboot, providing
68a device tree and binding a Chromium OS disk image for use to find kernels
69(any Chromium OS image will do). It also saves driver state between U-Boot
70phases into state.dtb and will automatically ensure that memory is shared
71between all phases. TPL will jump to SPL and then on to U-Boot proper.
Simon Glass26784fc2017-05-31 17:57:24 -060072
Simon Glassa20a7b72019-01-30 20:51:20 -070073It is possible to run with debugging on, e.g.
Simon Glass26784fc2017-05-31 17:57:24 -060074
Simon Glassa20a7b72019-01-30 20:51:20 -070075 gdb --args $UB/tpl/u-boot-tpl -d ....
Simon Glass26784fc2017-05-31 17:57:24 -060076
Simon Glassa20a7b72019-01-30 20:51:20 -070077Breakpoints can be set in any U-Boot phase. Overall this is a good debugging
78environment for new verified-boot features.
Simon Glass26784fc2017-05-31 17:57:24 -060079
Simon Glass26784fc2017-05-31 17:57:24 -060080
Simon Glassa20a7b72019-01-30 20:51:20 -070081Samus
82-----
Simon Glass26784fc2017-05-31 17:57:24 -060083
Simon Glassa20a7b72019-01-30 20:51:20 -070084Basic support is available for samus, using the chromeos_samus target. If you
85have an em100, use:
Simon Glass26784fc2017-05-31 17:57:24 -060086
Simon Glassa20a7b72019-01-30 20:51:20 -070087 sudo em100 -s -c W25Q128FW -d $UB/image.bin -t -r
Simon Glass26784fc2017-05-31 17:57:24 -060088
Simon Glassa20a7b72019-01-30 20:51:20 -070089to write the image and then boot samus (Power-Refresh).
Simon Glass26784fc2017-05-31 17:57:24 -060090
Simon Glass26784fc2017-05-31 17:57:24 -060091
Simon Glassa20a7b72019-01-30 20:51:20 -070092Boot flow
93---------
Simon Glass26784fc2017-05-31 17:57:24 -060094
Simon Glassa20a7b72019-01-30 20:51:20 -070095Verified boot starts in TPL, which selects the A or B SPL, which in turn selects
96the A or B U-Boot. Then this jumps to the selected kernel. If anything goes
97wrong, the device reboots and the recovery SPL and U-Boot are used instead.
Simon Glass26784fc2017-05-31 17:57:24 -060098
Simon Glassa20a7b72019-01-30 20:51:20 -070099More details are available here:
Simon Glass26784fc2017-05-31 17:57:24 -0600100
Simon Glassa20a7b72019-01-30 20:51:20 -0700101 https://www.chromium.org/chromium-os/chromiumos-design-docs/firmware-boot-and-recovery
Simon Glass26784fc2017-05-31 17:57:24 -0600102
103
Simon Glassa20a7b72019-01-30 20:51:20 -0700104New uclasses
105------------
Simon Glass3421e002017-05-31 17:57:36 -0600106
Simon Glassa20a7b72019-01-30 20:51:20 -0700107Several uclasses are provided in cros/:
Simon Glass3421e002017-05-31 17:57:36 -0600108
Simon Glassa20a7b72019-01-30 20:51:20 -0700109 UCLASS_CROS_AUX_FW Chrome OS auxiliary firmware
110 UCLASS_CROS_FWSTORE Chrome OS firmware storage
111 UCLASS_CROS_NVDATA Chrome OS non-volatile data device
112 UCLASS_CROS_VBOOT_EC Chrome OS vboot EC operations
113 UCLASS_CROS_VBOOT_FLAG Chrome OS verified boot flag
Simon Glass3421e002017-05-31 17:57:36 -0600114
Simon Glassa20a7b72019-01-30 20:51:20 -0700115The existing UCLASS_CROS_EC is also used.
Simon Glass3421e002017-05-31 17:57:36 -0600116
Simon Glass3421e002017-05-31 17:57:36 -0600117
Simon Glassa20a7b72019-01-30 20:51:20 -0700118Commands
119--------
Simon Glass3421e002017-05-31 17:57:36 -0600120
Simon Glassa20a7b72019-01-30 20:51:20 -0700121A new 'vboot' command is provided to run particular vboot stages. The most
122useful command is 'vboot go auto', which continues where the last stage left
123off.
Simon Glass3421e002017-05-31 17:57:36 -0600124
Simon Glassa20a7b72019-01-30 20:51:20 -0700125Note that TPL and SPL do not supports commands as yet, so the vboot code is
126called directly from the SPL boot devices (BOOT_DEVICE_CROS_VBOOT). See
127cros_load_image_tpl() and cros_load_image_spl() which both call
128vboot_run_auto().
Simon Glass3421e002017-05-31 17:57:36 -0600129
Simon Glass3421e002017-05-31 17:57:36 -0600130
Simon Glassa20a7b72019-01-30 20:51:20 -0700131Config options
132--------------
Simon Glass3421e002017-05-31 17:57:36 -0600133
Simon Glassa20a7b72019-01-30 20:51:20 -0700134The main option is CONFIG_CHROMEOS, which enables a wide array of other options
135so that the required features are present.
Simon Glass3421e002017-05-31 17:57:36 -0600136
Simon Glass3421e002017-05-31 17:57:36 -0600137
Simon Glassa20a7b72019-01-30 20:51:20 -0700138Device-tree config
139------------------
Simon Glass3421e002017-05-31 17:57:36 -0600140
Simon Glassa20a7b72019-01-30 20:51:20 -0700141Various options are available which control the operation of verified boot.
142See cros/dts/bindings/config.txt for details. Most config is handled at run-
143time, although build-time config (with Kconfig) could also be added fairly
144easily.
Simon Glass3421e002017-05-31 17:57:36 -0600145
Simon Glass3421e002017-05-31 17:57:36 -0600146
Simon Glassa20a7b72019-01-30 20:51:20 -0700147Porting to other hardware
148-------------------------
Simon Glass3421e002017-05-31 17:57:36 -0600149
Simon Glassa20a7b72019-01-30 20:51:20 -0700150A basic port to samus (Chromebook Pixel 2015) is in a basic working state,
151using the chromeos_samus target. Patches will likely be forthcoming in early
1522019. Ports to an ARM board and coreboot (for x86 Chromebooks) are in the
153dreaming state.
Simon Glass3421e002017-05-31 17:57:36 -0600154
Simon Glass26784fc2017-05-31 17:57:24 -0600155
Simon Glassa20a7b72019-01-30 20:51:20 -0700156Tests
157-----
Simon Glass26784fc2017-05-31 17:57:24 -0600158
Simon Glassa20a7b72019-01-30 20:51:20 -0700159Chromium OS firmware has a very limited set of tests. The tests that originally
160existed in U-Boot were not brought over to coreboot or depthcharge.
Simon Glass26784fc2017-05-31 17:57:24 -0600161
Simon Glassa20a7b72019-01-30 20:51:20 -0700162The U-Boot tests ('make check') do operate, but at present there are no
163Chromium OS tests available. These will hopefully come together over time. Of
164course the above sandbox feature provides a sort of functional test and can
165detecte problems that affect the flow or particular vboot features.
Simon Glass26784fc2017-05-31 17:57:24 -0600166
167
Simon Glassa20a7b72019-01-30 20:51:20 -0700168TO DO
169-----
Simon Glass26784fc2017-05-31 17:57:24 -0600170
Simon Glassa20a7b72019-01-30 20:51:20 -0700171- Support for booting from coreboot (patches expected March 2019)
172- Support for booting from an ARM board, e.g. bob
Simon Glass26784fc2017-05-31 17:57:24 -0600173
Simon Glass26784fc2017-05-31 17:57:24 -0600174
Simon Glassa20a7b72019-01-30 20:51:20 -0700175Simon Glass
176sjg@chromium.org
1777 October 2018