coreboot.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. .. sectionauthor:: Bin Meng <bmeng.cn@gmail.com>
  3. Coreboot
  4. ========
  5. Build Instructions for U-Boot as coreboot payload
  6. -------------------------------------------------
  7. Building U-Boot as a coreboot payload is just like building U-Boot for targets
  8. on other architectures, like below::
  9. $ make coreboot_defconfig
  10. $ make all
  11. Test with coreboot
  12. ------------------
  13. For testing U-Boot as the coreboot payload, there are things that need be paid
  14. attention to. coreboot supports loading an ELF executable and a 32-bit plain
  15. binary, as well as other supported payloads. With the default configuration,
  16. U-Boot is set up to use a separate Device Tree Blob (dtb). As of today, the
  17. generated u-boot-dtb.bin needs to be packaged by the cbfstool utility (a tool
  18. provided by coreboot) manually as coreboot's 'make menuconfig' does not provide
  19. this capability yet. The command is as follows::
  20. # in the coreboot root directory
  21. $ ./build/util/cbfstool/cbfstool build/coreboot.rom add-flat-binary \
  22. -f u-boot-dtb.bin -n fallback/payload -c lzma -l 0x1110000 -e 0x1110000
  23. Make sure 0x1110000 matches CONFIG_TEXT_BASE, which is the symbol address
  24. of _x86boot_start (in arch/x86/cpu/start.S).
  25. If you want to use ELF as the coreboot payload, change U-Boot configuration to
  26. use CONFIG_OF_EMBED instead of CONFIG_OF_SEPARATE.
  27. To enable video you must enable these options in coreboot:
  28. - Set framebuffer graphics resolution (1280x1024 32k-color (1:5:5))
  29. - Keep VESA framebuffer
  30. At present it seems that for Minnowboard Max, coreboot does not pass through
  31. the video information correctly (it always says the resolution is 0x0). This
  32. works correctly for link though.
  33. 64-bit U-Boot
  34. -------------
  35. In addition to the 32-bit 'coreboot' build there is a 'coreboot64' build. This
  36. produces an image which can be booted from coreboot (32-bit). Internally it
  37. works by using a 32-bit SPL binary to switch to 64-bit for running U-Boot. It
  38. can be useful for running UEFI applications, for example.
  39. This has only been lightly tested.
  40. CBFS access
  41. -----------
  42. You can use the 'cbfs' commands to access the Coreboot filesystem::
  43. => cbfsinit
  44. => cbfsinfo
  45. CBFS version: 0x31313132
  46. ROM size: 0x100000
  47. Boot block size: 0x4
  48. CBFS size: 0xffdfc
  49. Alignment: 64
  50. Offset: 0x200
  51. => cbfsls
  52. size type name
  53. ------------------------------------------
  54. 32 cbfs header cbfs master header
  55. 16720 17 fallback/romstage
  56. 53052 17 fallback/ramstage
  57. 398 raw config
  58. 715 raw revision
  59. 117 raw build_info
  60. 4044 raw fallback/dsdt.aml
  61. 640 cmos layout cmos_layout.bin
  62. 17804 17 fallback/postcar
  63. 335797 payload fallback/payload
  64. 607000 null (empty)
  65. 10752 bootblock bootblock
  66. 12 file(s)
  67. =>
  68. Memory map
  69. ----------
  70. ========== ==================================================================
  71. Address Region at that address
  72. ========== ==================================================================
  73. ffffffff Top of ROM (and last byte of 32-bit address space)
  74. 7a9fd000 Typical top of memory available to U-Boot
  75. (use cbsysinfo to see where memory range 'table' starts)
  76. 10000000 Memory reserved by coreboot for mapping PCI devices
  77. (typical size 2151000, includes framebuffer)
  78. 1920000 CONFIG_SYS_CAR_ADDR, fake Cache-as-RAM memory, used during startup
  79. 1110000 CONFIG_TEXT_BASE (start address of U-Boot code, before reloc)
  80. 110000 CONFIG_BLOBLIST_ADDR (before being relocated)
  81. 100000 CONFIG_PRE_CON_BUF_ADDR
  82. f0000 ACPI tables set up by U-Boot
  83. (typically redirects to 7ab10030 or similar)
  84. 500 Location of coreboot sysinfo table, used during startup
  85. ========== ==================================================================
  86. Debug UART
  87. ----------
  88. It is possible to enable the debug UART with coreboot. To do this, use the
  89. info from the cbsysinfo command to locate the UART base. For example::
  90. => cbsysinfo
  91. ...
  92. Serial I/O port: 00000000
  93. base : 00000000
  94. pointer : 767b51bc
  95. type : 2
  96. base : fe03e000
  97. baud : 0d115200
  98. regwidth : 4
  99. input_hz : 0d1843200
  100. PCI addr : 00000010
  101. ...
  102. Here you can see that the UART base is fe03e000, regwidth is 4 (1 << 2) and the
  103. input clock is 1843200. So you can add the following CONFIG options::
  104. CONFIG_DEBUG_UART=y
  105. CONFIG_DEBUG_UART_BASE=fe03e000
  106. CONFIG_DEBUG_UART_CLOCK=1843200
  107. CONFIG_DEBUG_UART_SHIFT=2
  108. CONFIG_DEBUG_UART_ANNOUNCE=y
  109. coreboot in CI
  110. --------------
  111. CI runs tests using a pre-built coreboot image. This ensures that U-Boot can
  112. boot as a coreboot payload, based on a known-good build of coreboot.
  113. To update the `coreboot.rom` file which is used:
  114. #. Build coreboot with `CONFIG_LINEAR_FRAMEBUFFER=y`. If using `make menuconfig`
  115. this is under
  116. `Devices ->Display->Framebuffer mode->Linear "high resolution" framebuffer`.
  117. #. Compress the resulting `coreboot.rom`::
  118. xz -c /path/to/coreboot/build/coreboot.rom >coreboot.rom.xz
  119. #. Upload the file to Google drive
  120. #. Send a patch to change the file ID used by wget in the CI yaml files.