All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 12/12] README: Add instructions for chain-loading U-Boot
Date: Mon, 22 May 2017 05:17:32 -0600	[thread overview]
Message-ID: <20170522111732.11265-13-sjg@chromium.org> (raw)
In-Reply-To: <20170522111732.11265-1-sjg@chromium.org>

Most Chromebooks support chain-loading U-Boot but instructions are
somewhat scattered. Add a README to hold this information within the
U-Boot tree. Also add the standard developer keys to simplify the
instructions, since they are small.

For now this only supports nyan-big.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/README.chromium                          | 222 +++++++++++++++++++++++++++
 doc/chromium/devkeys/kernel.keyblock         | Bin 0 -> 1208 bytes
 doc/chromium/devkeys/kernel_data_key.vbprivk | Bin 0 -> 1199 bytes
 3 files changed, 222 insertions(+)
 create mode 100644 doc/README.chromium
 create mode 100644 doc/chromium/devkeys/kernel.keyblock
 create mode 100644 doc/chromium/devkeys/kernel_data_key.vbprivk

diff --git a/doc/README.chromium b/doc/README.chromium
new file mode 100644
index 0000000000..1dd111c65d
--- /dev/null
+++ b/doc/README.chromium
@@ -0,0 +1,222 @@
+Running U-Boot from coreboot on Chromebooks
+===========================================
+
+U-Boot can be used as a secondary boot loader in a few situations such as from
+UEFI and coreboot (see README.x86). Recent Chromebooks use coreboot even on
+ARM platforms to start up the machine.
+
+This document aims to provide a guide to booting U-Boot on a Chromebook. It
+is only a starting point, and there are many guides on the interwebs. But
+placing this information in the U-Boot tree should make it easier to find for
+those who use U-Boot habitually.
+
+Most of these platforms are supported by U-Boot natively, but it is risky to
+replace the ROM unless you have a servo board and cable to restore it with.
+
+
+For all of these the standard U-Boot build instructions apply. For example on
+ARM:
+
+   sudo apt install gcc-arm-linux-gnueabi
+   mkdir b
+   make O=b/nyan_big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
+
+You can obtain the vbutil_kernel utility here:
+
+   https://drive.google.com/open?id=0B7WYZbZ9zd-3dHlVVXo4VXE2T0U
+
+
+Snow (Samsung ARM Chromebook)
+-----------------------------
+
+See here:
+
+https://www.chromium.org/chromium-os/firmware-porting-guide/using-nv-u-boot-on-the-samsung-arm-chromebook
+
+
+Nyan-big
+--------
+
+Compiled based on information here:
+https://lists.denx.de/pipermail/u-boot/2015-March/209530.html
+https://git.collabora.com/cgit/user/tomeu/u-boot.git/commit/?h=nyan-big
+https://lists.denx.de/pipermail/u-boot/2017-May/289491.html
+https://github.com/chromeos-nvidia-androidtv/gnu-linux-on-acer-chromebook-13#copy-data-to-the-sd-card
+
+1. Patch U-Boot
+
+Open include/configs/tegra124-common.h
+
+Change:
+
+#define CONFIG_SYS_TEXT_BASE	0x80110000
+
+to:
+
+#define CONFIG_SYS_TEXT_BASE	0x81000100
+
+
+2. Build U-Boot
+
+   mkdir b
+   make -j8 O=b/nyan-big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
+
+
+3. Create a file called u-boot.its as follows:
+
+/dts-v1/;
+
+/ {
+	description = "U-Boot mainline";
+	#address-cells = <1>;
+
+	images {
+		kernel at 1 {
+			description = "U-Boot mainline";
+			type = "kernel_noload";
+			arch = "arm";
+			os = "linux";
+			data = /incbin/("./b/nyan-big/u-boot.bin");
+			compression = "none";
+			load = <0>;
+			entry = <0>;
+			hash at 2 {
+				algo = "sha1";
+			};
+		};
+
+		fdt at 1{
+			description = "tegra124-nyan-big.dtb";
+			data = /incbin/("./b/nyan-big/u-boot.dtb");
+			type = "flat_dt";
+			arch = "arm";
+			compression = "none";
+			hash at 1{
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		default = "config at 1";
+		config at 1 {
+			description = "Boot U-Boot";
+			kernel = "kernel at 1";
+			fdt = "fdt at 1";
+		};
+	};
+};
+
+
+Note that the device tree node is required, even though it is not actually
+used by U-Boot. This is because the Chromebook expects to pass it to the
+kernel, and crashes if it is not present.
+
+
+4. Build and sign an image
+
+   ./b/nyan-big/tools/mkimage -f u-boot.its u-boot-chromium.fit
+   vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
+	--signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
+	--version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
+	--bootloader dummy.txt --pack u-boot.kpart
+
+
+5. Prepare an SD card
+
+   DISK=/dev/sdc   # Replace with your actual SD card device
+   sudo cgpt create $DISK
+   sudo cgpt add -b 34 -s 32768 -P 1 -S 1 -t kernel $DISK
+   sudo cgpt add -b 32802 -s 2000000 -t rootfs $DISK
+   sudo gdisk $DISK   #
+
+
+6. Write U-Boot to the SD card
+
+   sudo dd if=u-boot.kpart of=/dev/sdc1; sync
+
+
+7. Start it up
+
+Reboot the device in dev mode. Make sure that you have USB booting enabled. To
+do this, login as root (via Ctrl-Alt-forward_arrow) and type
+'enable_dev_usb_boot'. You only need to do this once.
+
+Reboot the device with the SD card inserted. Press Clrl-U at the developer
+mode screen. It should show something like the following on the display:
+
+   U-Boot 2017.07-00637-g242eb42-dirty (May 22 2017 - 06:14:21 -0600)
+
+   Model: Acer Chromebook 13 CB5-311
+   Board: Google/NVIDIA Nyan-big, ID: 1
+
+   Net:   No ethernet found.
+   Hit any key to stop autoboot:  0
+   Tegra124 (Nyan-big) #
+
+
+8. Known problems
+
+On the serial console the word MMC is chopped at the start of the line:
+
+C:   sdhci at 700b0000: 2, sdhci at 700b0400: 1, sdhci at 700b0600: 0
+
+This is likely due to some problem with change-over of the serial driver
+during relocation (or perhaps updating the clock setup in board_init()).
+
+
+9. Notes
+
+To check that you copied the u-boot.its file correctly, use these commands.
+You should see that the data at 0x100 in u-boot-chromium.fit is the first few
+bytes of U-Boot:
+
+   hd u-boot-chromium.fit |head -20
+   ...
+   00000100  b8 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
+
+   hd b/nyan-big/u-boot.bin |head
+   00000000  b8 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
+
+
+The 'data' property of the FIT is set up to start at offset 0x100 bytes into
+the file. The change to CONFIG_SYS_TEXT_BASE is also an offset of 0x100 bytes
+from the load address. If this changes, you either need to modify U-Boot to be
+fully relocatable, or expect it to hang.
+
+
+Other notes
+===========
+
+flashrom
+--------
+
+   Used to make a backup of your firmware, or to replace it.
+
+   See: https://www.chromium.org/chromium-os/packages/cros-flashrom
+
+
+coreboot
+--------
+
+Coreboot itself is not designed to actually boot an OS. Instead, a program
+called Depthcharge is used. This originally came out of U-Boot and was then
+heavily hacked and modified such that is is almost unrecognisable. It does
+include a very small part of the U-Boot command-line interface but is not
+usable as a general-purpose boot loader.
+
+In addition, it has a very unusual design in that it does not do device init
+itself, but instead relies on coreboot. This is similar to (in U-Boot) having
+a SPI driver with an empty probe() method, relying on whatever was set up
+beforehand. It can be quite hard to figure out between these two code bases
+what settings are actually used. When chain-loading into U-Boot we must be
+careful to reinit anything that U-Boot expects. If not, some peripherals (or
+the whole machine) may not work. This makes the process of chainloading more
+complicated than it could be on some platforms.
+
+Finally, it supports only a subset of the U-Boot's FIT format. In particular
+it uses a fixed address to load the FIT and does not support load/exec
+addresses. This means that U-Boot must be able to boot from whatever
+address Depthcharge happens to use (it is the CONFIG_KERNEL_START setting
+in Depthcharge). In practice this means that the data in the kernel at 1 FIT node
+(see above) must start at the same address as U-Boot's CONFIG_SYS_TEXT_BASE.
diff --git a/doc/chromium/devkeys/kernel.keyblock b/doc/chromium/devkeys/kernel.keyblock
new file mode 100644
index 0000000000000000000000000000000000000000..9740be4e60070658d01e96c13acba8e726f68a59
GIT binary patch
literal 1208
zcmZ?v2=e!J^$%uZU|?Vb;vFnN0tgm>1V8{vS3qeGDD422WMF`avqSj`P?`g(4r(0O
zY><=#5T9mpaFo?;<IfE~b7uK$=~H)<jvTToS}LUYuR?YXb1Ki2UAED2GsL>quTPJ1
z>(Ke2mAdzM<e7q(jDEE}&U!MrMWX936wcpb_1vZDVsrQ0oRpdCZ+D%!c&&Nal2<Dm
zW#>yr_58T4rns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XnkkKn^k<@s1kR~^4$b|E*w<I1zW
z7j&nK>uz>iEy?#}&ELtZd3 at IHkC0xac9!?n`qQsBNXEFy&)%>@C}+9fj^*+~*+2Gq
zuVmTs)9lR6s}tAMy%auBf9m?3eJeLy(-7CccAqcXL-1PQ@!a-r9NTj;zhBb`s4H1J
zEsN(=_QsF*7RM`p)p8N!U;JIgOxpNa-A%rw-3xYfx4ygZB-8oW&v^BvCljsv)+d!a
zZBvhbJFRW=dm}?<z3TPRk4l@0)>_9-Iw-p8w<7z?RYx9OpV^#KWSMWOF!#ZYAGeEC
Tp7v_~RjJ<N@pAW}mg74Ct|TeM

literal 0
HcmV?d00001

diff --git a/doc/chromium/devkeys/kernel_data_key.vbprivk b/doc/chromium/devkeys/kernel_data_key.vbprivk
new file mode 100644
index 0000000000000000000000000000000000000000..8d392fb294c15edb09cbf1bf775a1d87d0d2bc2d
GIT binary patch
literal 1199
zcmV;g1W@|~000000000mf&`-i0RRGm0RaHZ)>JFM>_R88JaB<>;=<4p5K>c+*K#Y6
zBfBykhKVD49Fzsa)CSq;EL at ysOE}{Y1QbOkeMzXIn1*HkEIs5LcG}w7(`q+}qU9hF
zmOyI-0>uhn3C89i#sS7u2n!yxsXxhQf!Qn2+<m8)Z;N;{x7SiCL1{>7mXE~>8wQ9U
z`{=Njy=^@xg8tQRp;sQuLw>pujKym3l2d!KAtu}Sj9MF?9f7Ipq^5(`(aeh5ubE_Q
zor{Cff<)&!w4ZU%uN87_94<qQeNF-CaLif9y=5x!EQm&0XRoh{7MNaJJ-U<(WdocY
zc>W<0rE)sL#3J0v8=I%h%u{U-hAkZe0|5X50)hbmO}OfvNAK|kt9k7>9<xF(4n#EX
z@-c)m0wV3S-8VQvR3`v+_C|SHOF`!fC!-Y%*F}cu8x;7e8C_`^sKNWwXWJF_4=g{r
z?-`Yz6}F+*Y_PJc60_>4Lgd{xUqUtGK4q?vz$)#)+(E{Z$(32Fx}>GBiMA<A*dFz;
z-ujUdRo0#1r=0Tioqv`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f302169-goog

  parent reply	other threads:[~2017-05-22 11:17 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-22 11:17 [U-Boot] [PATCH 00/12] tegra: nyan-big: Support chainloading and add documentation Simon Glass
2017-05-22 11:17 ` [U-Boot] [PATCH 01/12] arm: arm720t: Support CONFIG_SKIP_LOWLEVEL_INIT_ONLY Simon Glass
2017-05-23  1:15   ` Tom Rini
2017-05-22 11:17 ` [U-Boot] [PATCH 02/12] tegra: Init clocks even when SPL did not run Simon Glass
2017-05-22 11:17 ` [U-Boot] [PATCH 03/12] tegra: dts: Add cros-ec SPI settings Simon Glass
2017-05-22 11:17 ` [U-Boot] [PATCH 04/12] arm: Rename HCTR to HTCR Simon Glass
2017-05-23  1:15   ` Tom Rini
2017-05-22 11:17 ` [U-Boot] [PATCH 05/12] arm: Don't try to support CONFIG_ARMV7_LPAE on ARMv4T Simon Glass
2017-05-23  1:15   ` Tom Rini
2017-06-09  3:00     ` Simon Glass
2017-06-09 11:16       ` Tom Rini
2017-05-22 11:17 ` [U-Boot] [PATCH 06/12] arm: Disable LPAE if not enabled Simon Glass
2017-05-23  1:15   ` Tom Rini
2017-05-22 11:17 ` [U-Boot] [PATCH 07/12] tegra: spi: Wait a little after setting the clocks Simon Glass
2017-05-22 11:17 ` [U-Boot] [PATCH 08/12] tegra: nyan-big: Enable the dhrystone benchmark Simon Glass
2017-05-22 11:17 ` [U-Boot] [PATCH 09/12] tegra: video: Don't power up the SOR twice Simon Glass
2017-06-07 12:52   ` Anatolij Gustschin
2017-05-22 11:17 ` [U-Boot] [PATCH 10/12] tegra: Enable CP15 init Simon Glass
2017-05-22 11:17 ` [U-Boot] [PATCH 11/12] tegra: clock: Avoid a divide-by-zero error Simon Glass
2017-05-22 11:17 ` Simon Glass [this message]
2017-05-29 13:29   ` [U-Boot] [PATCH 12/12] README: Add instructions for chain-loading U-Boot Peter Robinson
2017-06-01  3:11     ` Simon Glass
2017-05-31 18:28 ` [U-Boot] [PATCH 00/12] tegra: nyan-big: Support chainloading and add documentation Matthew Gorski
2017-05-31 18:40   ` Matthew Gorski
2017-05-31 19:19     ` Simon Glass
2017-06-01 13:52   ` Matthew Gorski
2017-06-07 11:58     ` Simon Glass
2017-06-07 15:32       ` Tom Warren
2017-06-07 15:41         ` Stephen Warren
2017-06-09 12:27           ` Simon Glass
2017-06-27 20:09             ` Thomas Hoff
2017-07-07  3:58               ` Simon Glass
2017-07-07  7:27                 ` Thomas Hoff
2017-07-08 16:09                   ` Simon Glass
2017-07-09 13:59                     ` Tom Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170522111732.11265-13-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.