README.chromium-chainload 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. Running U-Boot from coreboot on Chromebooks
  2. ===========================================
  3. U-Boot can be used as a secondary boot loader in a few situations such as from
  4. UEFI and coreboot (see README.x86). Recent Chromebooks use coreboot even on
  5. ARM platforms to start up the machine.
  6. This document aims to provide a guide to booting U-Boot on a Chromebook. It
  7. is only a starting point, and there are many guides on the interwebs. But
  8. placing this information in the U-Boot tree should make it easier to find for
  9. those who use U-Boot habitually.
  10. Most of these platforms are supported by U-Boot natively, but it is risky to
  11. replace the ROM unless you have a servo board and cable to restore it with.
  12. For all of these the standard U-Boot build instructions apply. For example on
  13. ARM:
  14. sudo apt install gcc-arm-linux-gnueabi
  15. mkdir b
  16. make O=b/nyan_big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
  17. You can obtain the vbutil_kernel utility here:
  18. https://drive.google.com/open?id=0B7WYZbZ9zd-3dHlVVXo4VXE2T0U
  19. Snow (Samsung ARM Chromebook)
  20. -----------------------------
  21. See here:
  22. https://www.chromium.org/chromium-os/firmware-porting-guide/using-nv-u-boot-on-the-samsung-arm-chromebook
  23. Nyan-big
  24. --------
  25. Compiled based on information here:
  26. https://lists.denx.de/pipermail/u-boot/2015-March/209530.html
  27. https://git.collabora.com/cgit/user/tomeu/u-boot.git/commit/?h=nyan-big
  28. https://lists.denx.de/pipermail/u-boot/2017-May/289491.html
  29. https://github.com/chromeos-nvidia-androidtv/gnu-linux-on-acer-chromebook-13#copy-data-to-the-sd-card
  30. 1. Build U-Boot
  31. mkdir b
  32. make -j8 O=b/nyan-big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
  33. 2. Select a .its file
  34. Select something from doc/chromium which matches your board, or create your
  35. own.
  36. Note that the device tree node is required, even though it is not actually
  37. used by U-Boot. This is because the Chromebook expects to pass it to the
  38. kernel, and crashes if it is not present.
  39. 3. Build and sign an image
  40. ./b/nyan-big/tools/mkimage -f doc/chromium/nyan-big.its u-boot-chromium.fit
  41. echo test >dummy.txt
  42. vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
  43. --signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
  44. --version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
  45. --bootloader dummy.txt --pack u-boot.kpart
  46. 4. Prepare an SD card
  47. DISK=/dev/sdc # Replace with your actual SD card device
  48. sudo cgpt create $DISK
  49. sudo cgpt add -b 34 -s 32768 -P 1 -S 1 -t kernel $DISK
  50. sudo cgpt add -b 32802 -s 2000000 -t rootfs $DISK
  51. sudo gdisk $DISK # Enter command 'w' to write a protective MBR to the disk
  52. 5. Write U-Boot to the SD card
  53. sudo dd if=u-boot.kpart of=/dev/sdc1; sync
  54. 6. Start it up
  55. Reboot the device in dev mode. Make sure that you have USB booting enabled. To
  56. do this, login as root (via Ctrl-Alt-forward_arrow) and type
  57. 'enable_dev_usb_boot'. You only need to do this once.
  58. Reboot the device with the SD card inserted. Press Clrl-U at the developer
  59. mode screen. It should show something like the following on the display:
  60. U-Boot 2017.07-00637-g242eb42-dirty (May 22 2017 - 06:14:21 -0600)
  61. Model: Acer Chromebook 13 CB5-311
  62. Board: Google/NVIDIA Nyan-big, ID: 1
  63. Net: No ethernet found.
  64. Hit any key to stop autoboot: 0
  65. Tegra124 (Nyan-big) #
  66. 7. Known problems
  67. On the serial console the word MMC is chopped at the start of the line:
  68. C: sdhci@700b0000: 2, sdhci@700b0400: 1, sdhci@700b0600: 0
  69. This is likely due to some problem with change-over of the serial driver
  70. during relocation (or perhaps updating the clock setup in board_init()).
  71. 9. Notes
  72. To check that you copied the u-boot.its file correctly, use these commands.
  73. You should see that the data at 0x100 in u-boot-chromium.fit is the first few
  74. bytes of U-Boot:
  75. hd u-boot-chromium.fit |head -20
  76. ...
  77. 00000100 b8 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................|
  78. hd b/nyan-big/u-boot.bin |head
  79. 00000000 b8 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................|
  80. The 'data' property of the FIT is set up to start at offset 0x100 bytes into
  81. the file. The change to CONFIG_SYS_TEXT_BASE is also an offset of 0x100 bytes
  82. from the load address. If this changes, you either need to modify U-Boot to be
  83. fully relocatable, or expect it to hang.
  84. chromebook_jerry
  85. ----------------
  86. The instruction are similar to those for Nyan with changes as noted below:
  87. 1. Patch U-Boot
  88. Open include/configs/rk3288_common.h
  89. Change:
  90. #define CONFIG_SYS_TEXT_BASE 0x00100000
  91. to:
  92. #define CONFIG_SYS_TEXT_BASE 0x02000100
  93. 2. Build U-Boot
  94. mkdir b
  95. make -j8 O=b/chromebook_jerry CROSS_COMPILE=arm-linux-gnueabi- \
  96. chromebook_jerry_defconfig all
  97. 3. See above
  98. 4. Build and sign an image
  99. ./b/chromebook_jerry/tools/mkimage -f doc/chromium/chromebook_jerry.its \
  100. u-boot-chromium.fit
  101. echo test >dummy.txt
  102. vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
  103. --signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
  104. --version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
  105. --bootloader dummy.txt --pack u-boot.kpart
  106. 5. See above
  107. 6. See above
  108. 7. Start it up
  109. Reboot the device in dev mode. Make sure that you have USB booting enabled. To
  110. do this, login as root (via Ctrl-Alt-forward_arrow) and type
  111. 'enable_dev_usb_boot'. You only need to do this once.
  112. Reboot the device with the SD card inserted. Press Clrl-U at the developer
  113. mode screen. It should show something like the following on the display:
  114. U-Boot 2017.05-00649-g72acdbf-dirty (May 29 2017 - 14:57:05 -0600)
  115. Model: Google Jerry
  116. Net: Net Initialization Skipped
  117. No ethernet found.
  118. Hit any key to stop autoboot: 0
  119. 8. Known problems
  120. None as yet.
  121. 9. Notes
  122. None as yet.
  123. Other notes
  124. ===========
  125. flashrom
  126. --------
  127. Used to make a backup of your firmware, or to replace it.
  128. See: https://www.chromium.org/chromium-os/packages/cros-flashrom
  129. coreboot
  130. --------
  131. Coreboot itself is not designed to actually boot an OS. Instead, a program
  132. called Depthcharge is used. This originally came out of U-Boot and was then
  133. heavily hacked and modified such that is is almost unrecognisable. It does
  134. include a very small part of the U-Boot command-line interface but is not
  135. usable as a general-purpose boot loader.
  136. In addition, it has a very unusual design in that it does not do device init
  137. itself, but instead relies on coreboot. This is similar to (in U-Boot) having
  138. a SPI driver with an empty probe() method, relying on whatever was set up
  139. beforehand. It can be quite hard to figure out between these two code bases
  140. what settings are actually used. When chain-loading into U-Boot we must be
  141. careful to reinit anything that U-Boot expects. If not, some peripherals (or
  142. the whole machine) may not work. This makes the process of chainloading more
  143. complicated than it could be on some platforms.
  144. Finally, it supports only a subset of the U-Boot's FIT format. In particular
  145. it uses a fixed address to load the FIT and does not support load/exec
  146. addresses. This means that U-Boot must be able to boot from whatever
  147. address Depthcharge happens to use (it is the CONFIG_KERNEL_START setting
  148. in Depthcharge). In practice this means that the data in the kernel@1 FIT node
  149. (see above) must start at the same address as U-Boot's CONFIG_SYS_TEXT_BASE.