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