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