xref: /openbmc/u-boot/doc/README.chromium (revision fe67eaccd0d265ac01974980edad5395ade488eb)
1c9af6673SSimon GlassRunning U-Boot from coreboot on Chromebooks
2c9af6673SSimon Glass===========================================
3c9af6673SSimon Glass
4c9af6673SSimon GlassU-Boot can be used as a secondary boot loader in a few situations such as from
5c9af6673SSimon GlassUEFI and coreboot (see README.x86). Recent Chromebooks use coreboot even on
6c9af6673SSimon GlassARM platforms to start up the machine.
7c9af6673SSimon Glass
8c9af6673SSimon GlassThis document aims to provide a guide to booting U-Boot on a Chromebook. It
9c9af6673SSimon Glassis only a starting point, and there are many guides on the interwebs. But
10c9af6673SSimon Glassplacing this information in the U-Boot tree should make it easier to find for
11c9af6673SSimon Glassthose who use U-Boot habitually.
12c9af6673SSimon Glass
13c9af6673SSimon GlassMost of these platforms are supported by U-Boot natively, but it is risky to
14c9af6673SSimon Glassreplace the ROM unless you have a servo board and cable to restore it with.
15c9af6673SSimon Glass
16c9af6673SSimon Glass
17c9af6673SSimon GlassFor all of these the standard U-Boot build instructions apply. For example on
18c9af6673SSimon GlassARM:
19c9af6673SSimon Glass
20c9af6673SSimon Glass   sudo apt install gcc-arm-linux-gnueabi
21c9af6673SSimon Glass   mkdir b
22c9af6673SSimon Glass   make O=b/nyan_big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
23c9af6673SSimon Glass
24c9af6673SSimon GlassYou can obtain the vbutil_kernel utility here:
25c9af6673SSimon Glass
26c9af6673SSimon Glass   https://drive.google.com/open?id=0B7WYZbZ9zd-3dHlVVXo4VXE2T0U
27c9af6673SSimon Glass
28c9af6673SSimon Glass
29c9af6673SSimon GlassSnow (Samsung ARM Chromebook)
30c9af6673SSimon Glass-----------------------------
31c9af6673SSimon Glass
32c9af6673SSimon GlassSee here:
33c9af6673SSimon Glass
34c9af6673SSimon Glasshttps://www.chromium.org/chromium-os/firmware-porting-guide/using-nv-u-boot-on-the-samsung-arm-chromebook
35c9af6673SSimon Glass
36c9af6673SSimon Glass
37c9af6673SSimon GlassNyan-big
38c9af6673SSimon Glass--------
39c9af6673SSimon Glass
40c9af6673SSimon GlassCompiled based on information here:
41c9af6673SSimon Glasshttps://lists.denx.de/pipermail/u-boot/2015-March/209530.html
42c9af6673SSimon Glasshttps://git.collabora.com/cgit/user/tomeu/u-boot.git/commit/?h=nyan-big
43c9af6673SSimon Glasshttps://lists.denx.de/pipermail/u-boot/2017-May/289491.html
44c9af6673SSimon Glasshttps://github.com/chromeos-nvidia-androidtv/gnu-linux-on-acer-chromebook-13#copy-data-to-the-sd-card
45c9af6673SSimon Glass
46c9af6673SSimon Glass1. Patch U-Boot
47c9af6673SSimon Glass
48c9af6673SSimon GlassOpen include/configs/tegra124-common.h
49c9af6673SSimon Glass
50c9af6673SSimon GlassChange:
51c9af6673SSimon Glass
52c9af6673SSimon Glass#define CONFIG_SYS_TEXT_BASE	0x80110000
53c9af6673SSimon Glass
54c9af6673SSimon Glassto:
55c9af6673SSimon Glass
56c9af6673SSimon Glass#define CONFIG_SYS_TEXT_BASE	0x81000100
57c9af6673SSimon Glass
58c9af6673SSimon Glass
59c9af6673SSimon Glass2. Build U-Boot
60c9af6673SSimon Glass
61c9af6673SSimon Glass   mkdir b
62c9af6673SSimon Glass   make -j8 O=b/nyan-big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
63c9af6673SSimon Glass
64c9af6673SSimon Glass
65c9af6673SSimon Glass3. Select a .its file
66c9af6673SSimon Glass
67c9af6673SSimon GlassSelect something from doc/chromium which matches your board, or create your
68c9af6673SSimon Glassown.
69c9af6673SSimon Glass
70c9af6673SSimon GlassNote that the device tree node is required, even though it is not actually
71c9af6673SSimon Glassused by U-Boot. This is because the Chromebook expects to pass it to the
72c9af6673SSimon Glasskernel, and crashes if it is not present.
73c9af6673SSimon Glass
74c9af6673SSimon Glass
75c9af6673SSimon Glass4. Build and sign an image
76c9af6673SSimon Glass
77c9af6673SSimon Glass   ./b/nyan-big/tools/mkimage -f doc/chromium/nyan-big.its u-boot-chromium.fit
78c9af6673SSimon Glass   echo test >dummy.txt
79c9af6673SSimon Glass   vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
80c9af6673SSimon Glass	--signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
81c9af6673SSimon Glass	--version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
82c9af6673SSimon Glass	--bootloader dummy.txt --pack u-boot.kpart
83c9af6673SSimon Glass
84c9af6673SSimon Glass
85c9af6673SSimon Glass5. Prepare an SD card
86c9af6673SSimon Glass
87c9af6673SSimon Glass   DISK=/dev/sdc   # Replace with your actual SD card device
88c9af6673SSimon Glass   sudo cgpt create $DISK
89c9af6673SSimon Glass   sudo cgpt add -b 34 -s 32768 -P 1 -S 1 -t kernel $DISK
90c9af6673SSimon Glass   sudo cgpt add -b 32802 -s 2000000 -t rootfs $DISK
91c9af6673SSimon Glass   sudo gdisk $DISK   # Enter command 'w' to write a protective MBR to the disk
92c9af6673SSimon Glass
93c9af6673SSimon Glass
94c9af6673SSimon Glass6. Write U-Boot to the SD card
95c9af6673SSimon Glass
96c9af6673SSimon Glass   sudo dd if=u-boot.kpart of=/dev/sdc1; sync
97c9af6673SSimon Glass
98c9af6673SSimon Glass
99c9af6673SSimon Glass7. Start it up
100c9af6673SSimon Glass
101c9af6673SSimon GlassReboot the device in dev mode. Make sure that you have USB booting enabled. To
102c9af6673SSimon Glassdo this, login as root (via Ctrl-Alt-forward_arrow) and type
103c9af6673SSimon Glass'enable_dev_usb_boot'. You only need to do this once.
104c9af6673SSimon Glass
105c9af6673SSimon GlassReboot the device with the SD card inserted. Press Clrl-U at the developer
106c9af6673SSimon Glassmode screen. It should show something like the following on the display:
107c9af6673SSimon Glass
108c9af6673SSimon Glass   U-Boot 2017.07-00637-g242eb42-dirty (May 22 2017 - 06:14:21 -0600)
109c9af6673SSimon Glass
110c9af6673SSimon Glass   Model: Acer Chromebook 13 CB5-311
111c9af6673SSimon Glass   Board: Google/NVIDIA Nyan-big, ID: 1
112c9af6673SSimon Glass
113c9af6673SSimon Glass   Net:   No ethernet found.
114c9af6673SSimon Glass   Hit any key to stop autoboot:  0
115c9af6673SSimon Glass   Tegra124 (Nyan-big) #
116c9af6673SSimon Glass
117c9af6673SSimon Glass
118c9af6673SSimon Glass8. Known problems
119c9af6673SSimon Glass
120c9af6673SSimon GlassOn the serial console the word MMC is chopped at the start of the line:
121c9af6673SSimon Glass
122c9af6673SSimon GlassC:   sdhci@700b0000: 2, sdhci@700b0400: 1, sdhci@700b0600: 0
123c9af6673SSimon Glass
124c9af6673SSimon GlassThis is likely due to some problem with change-over of the serial driver
125c9af6673SSimon Glassduring relocation (or perhaps updating the clock setup in board_init()).
126c9af6673SSimon Glass
127c9af6673SSimon Glass
128c9af6673SSimon Glass9. Notes
129c9af6673SSimon Glass
130c9af6673SSimon GlassTo check that you copied the u-boot.its file correctly, use these commands.
131c9af6673SSimon GlassYou should see that the data at 0x100 in u-boot-chromium.fit is the first few
132c9af6673SSimon Glassbytes of U-Boot:
133c9af6673SSimon Glass
134c9af6673SSimon Glass   hd u-boot-chromium.fit |head -20
135c9af6673SSimon Glass   ...
136c9af6673SSimon Glass   00000100  b8 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
137c9af6673SSimon Glass
138c9af6673SSimon Glass   hd b/nyan-big/u-boot.bin |head
139c9af6673SSimon Glass   00000000  b8 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
140c9af6673SSimon Glass
141c9af6673SSimon Glass
142c9af6673SSimon GlassThe 'data' property of the FIT is set up to start at offset 0x100 bytes into
143c9af6673SSimon Glassthe file. The change to CONFIG_SYS_TEXT_BASE is also an offset of 0x100 bytes
144c9af6673SSimon Glassfrom the load address. If this changes, you either need to modify U-Boot to be
145c9af6673SSimon Glassfully relocatable, or expect it to hang.
146c9af6673SSimon Glass
147c9af6673SSimon Glass
148*fe67eaccSSimon Glasschromebook_jerry
149*fe67eaccSSimon Glass----------------
150*fe67eaccSSimon Glass
151*fe67eaccSSimon GlassThe instruction are similar to those for Nyan with changes as noted below:
152*fe67eaccSSimon Glass
153*fe67eaccSSimon Glass1. Patch U-Boot
154*fe67eaccSSimon Glass
155*fe67eaccSSimon GlassOpen include/configs/rk3288_common.h
156*fe67eaccSSimon Glass
157*fe67eaccSSimon GlassChange:
158*fe67eaccSSimon Glass
159*fe67eaccSSimon Glass#define CONFIG_SYS_TEXT_BASE		0x00100000
160*fe67eaccSSimon Glass
161*fe67eaccSSimon Glassto:
162*fe67eaccSSimon Glass
163*fe67eaccSSimon Glass#define CONFIG_SYS_TEXT_BASE		0x02000100
164*fe67eaccSSimon Glass
165*fe67eaccSSimon Glass
166*fe67eaccSSimon Glass
167*fe67eaccSSimon Glass2. Build U-Boot
168*fe67eaccSSimon Glass
169*fe67eaccSSimon Glass   mkdir b
170*fe67eaccSSimon Glass   make -j8 O=b/chromebook_jerry CROSS_COMPILE=arm-linux-gnueabi- \
171*fe67eaccSSimon Glass	chromebook_jerry_defconfig all
172*fe67eaccSSimon Glass
173*fe67eaccSSimon Glass
174*fe67eaccSSimon Glass3. See above
175*fe67eaccSSimon Glass
176*fe67eaccSSimon Glass4. Build and sign an image
177*fe67eaccSSimon Glass
178*fe67eaccSSimon Glass   ./b/chromebook_jerry/tools/mkimage -f doc/chromium/chromebook_jerry.its \
179*fe67eaccSSimon Glass	u-boot-chromium.fit
180*fe67eaccSSimon Glass   echo test >dummy.txt
181*fe67eaccSSimon Glass   vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
182*fe67eaccSSimon Glass	--signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
183*fe67eaccSSimon Glass	--version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
184*fe67eaccSSimon Glass	--bootloader dummy.txt --pack u-boot.kpart
185*fe67eaccSSimon Glass
186*fe67eaccSSimon Glass
187*fe67eaccSSimon Glass5. See above
188*fe67eaccSSimon Glass
189*fe67eaccSSimon Glass6. See above
190*fe67eaccSSimon Glass
191*fe67eaccSSimon Glass7. Start it up
192*fe67eaccSSimon Glass
193*fe67eaccSSimon GlassReboot the device in dev mode. Make sure that you have USB booting enabled. To
194*fe67eaccSSimon Glassdo this, login as root (via Ctrl-Alt-forward_arrow) and type
195*fe67eaccSSimon Glass'enable_dev_usb_boot'. You only need to do this once.
196*fe67eaccSSimon Glass
197*fe67eaccSSimon GlassReboot the device with the SD card inserted. Press Clrl-U at the developer
198*fe67eaccSSimon Glassmode screen. It should show something like the following on the display:
199*fe67eaccSSimon Glass
200*fe67eaccSSimon Glass   U-Boot 2017.05-00649-g72acdbf-dirty (May 29 2017 - 14:57:05 -0600)
201*fe67eaccSSimon Glass
202*fe67eaccSSimon Glass   Model: Google Jerry
203*fe67eaccSSimon Glass   Net:   Net Initialization Skipped
204*fe67eaccSSimon Glass   No ethernet found.
205*fe67eaccSSimon Glass   Hit any key to stop autoboot:  0
206*fe67eaccSSimon Glass
207*fe67eaccSSimon Glass
208*fe67eaccSSimon Glass8. Known problems
209*fe67eaccSSimon Glass
210*fe67eaccSSimon GlassNone as yet.
211*fe67eaccSSimon Glass
212*fe67eaccSSimon Glass
213*fe67eaccSSimon Glass9. Notes
214*fe67eaccSSimon Glass
215*fe67eaccSSimon GlassNone as yet.
216*fe67eaccSSimon Glass
217*fe67eaccSSimon Glass
218c9af6673SSimon GlassOther notes
219c9af6673SSimon Glass===========
220c9af6673SSimon Glass
221c9af6673SSimon Glassflashrom
222c9af6673SSimon Glass--------
223c9af6673SSimon Glass
224c9af6673SSimon Glass   Used to make a backup of your firmware, or to replace it.
225c9af6673SSimon Glass
226c9af6673SSimon Glass   See: https://www.chromium.org/chromium-os/packages/cros-flashrom
227c9af6673SSimon Glass
228c9af6673SSimon Glass
229c9af6673SSimon Glasscoreboot
230c9af6673SSimon Glass--------
231c9af6673SSimon Glass
232c9af6673SSimon GlassCoreboot itself is not designed to actually boot an OS. Instead, a program
233c9af6673SSimon Glasscalled Depthcharge is used. This originally came out of U-Boot and was then
234c9af6673SSimon Glassheavily hacked and modified such that is is almost unrecognisable. It does
235c9af6673SSimon Glassinclude a very small part of the U-Boot command-line interface but is not
236c9af6673SSimon Glassusable as a general-purpose boot loader.
237c9af6673SSimon Glass
238c9af6673SSimon GlassIn addition, it has a very unusual design in that it does not do device init
239c9af6673SSimon Glassitself, but instead relies on coreboot. This is similar to (in U-Boot) having
240c9af6673SSimon Glassa SPI driver with an empty probe() method, relying on whatever was set up
241c9af6673SSimon Glassbeforehand. It can be quite hard to figure out between these two code bases
242c9af6673SSimon Glasswhat settings are actually used. When chain-loading into U-Boot we must be
243c9af6673SSimon Glasscareful to reinit anything that U-Boot expects. If not, some peripherals (or
244c9af6673SSimon Glassthe whole machine) may not work. This makes the process of chainloading more
245c9af6673SSimon Glasscomplicated than it could be on some platforms.
246c9af6673SSimon Glass
247c9af6673SSimon GlassFinally, it supports only a subset of the U-Boot's FIT format. In particular
248c9af6673SSimon Glassit uses a fixed address to load the FIT and does not support load/exec
249c9af6673SSimon Glassaddresses. This means that U-Boot must be able to boot from whatever
250c9af6673SSimon Glassaddress Depthcharge happens to use (it is the CONFIG_KERNEL_START setting
251c9af6673SSimon Glassin Depthcharge). In practice this means that the data in the kernel@1 FIT node
252c9af6673SSimon Glass(see above) must start at the same address as U-Boot's CONFIG_SYS_TEXT_BASE.
253