dtbtool.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. Copyright (c) 2012, The Linux Foundation. All rights reserved.
  2. Redistribution and use in source form and compiled forms (SGML, HTML,
  3. PDF, PostScript, RTF and so forth) with or without modification, are
  4. permitted provided that the following conditions are met:
  5. Redistributions in source form must retain the above copyright
  6. notice, this list of conditions and the following disclaimer as the
  7. first lines of this file unmodified.
  8. Redistributions in compiled form (transformed to other DTDs,
  9. converted to PDF, PostScript, RTF and other formats) must reproduce
  10. the above copyright notice, this list of conditions and the following
  11. disclaimer in the documentation and/or other materials provided with
  12. the distribution.
  13. THIS DOCUMENTATION IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  14. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND
  16. NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD
  17. DOCUMENTATION PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  19. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  24. DAMAGE.
  25. June 2014, Ketut Putu Kumajaya
  26. Samsung Exynos DTBH device tree documentation.
  27. Android - Table of Device Tree
  28. ==============================
  29. 0) Document revision
  30. v1.0 - Initial version (dng)
  31. 1) Android boot image:
  32. ----------------------
  33. 1.1) Header:
  34. 1) Magic (8B)
  35. 2) kernel size (4B)
  36. 3) kernel addr (4B)
  37. 4) ramdisk size (4B)
  38. 5) ramdisk addr (4B)
  39. 6) 2ndary size (4B)
  40. 7) 2ndary addr (4B)
  41. 8) tags addr (4B)
  42. 9) page size (4B)
  43. 10) unused #1 (4B) (zero in standard Android)
  44. 11) unused #2 (4B) (zero in standard Android)
  45. 12) product name (16B)
  46. 13) kernel cmdline (512B)
  47. 14) id (8B)
  48. 1.2) Layout:
  49. A) header (as above - 1 page)
  50. B) kernel (n pages)
  51. C) ramdisk (m pages)
  52. D) second stage (o pages)
  53. 2) Exynos DTBH table of device tree
  54. --------------------------
  55. 2.1) Changes:
  56. i) use "unused #1, #2" members in existing boot image
  57. header to point to new table of device tree
  58. (#1 - size of Exynos DTBH table of DT)
  59. ii) append table of device tree (described later)
  60. after "D) second stage"
  61. 2.2) Format:
  62. size
  63. x +------------------+
  64. | | MAGIC ("DTBH") | 4B
  65. | +------------------+
  66. header | VERSION | uint32 (version 2, 0x00000002)
  67. | +------------------+
  68. | | num of DTBs | uint32 (number of DTB entries, e.g. 5 entries, 0x00000005)
  69. x +------------------+
  70. | | chip #1 | uint32 (e.g. ID for 5422, 0x0000152e)
  71. | +------------------+
  72. | | platform #1 | uint32 (e.g. ID for k3g, 0x00001e92)
  73. | +------------------+
  74. device | subtype #1 | uint32 (e.g. ID for k3g_eur_open, 0x7d64f612)
  75. #1 +------------------+
  76. entry | hw_rev #1 | uint32 (e.g. k3g rev 2, 0x00000002)
  77. | +------------------+
  78. | | hw_rev_end #1 | uint32 (e.g. k3g rev_end 2, 0x00000002)
  79. | +------------------+
  80. | | offset #1 | uint32 (byte offset from start/before MAGIC
  81. | +------------------+ to DTB entry, e.g. 0x00000800)
  82. | | size #1 | uint32 (size in bytes of DTB blob
  83. | +------------------+ e.g. 110,592 bytes, 0x0001b000)
  84. | | space #1 | uint32 (0x00000020)
  85. x +------------------+
  86. . .
  87. . . (repeat)
  88. . .
  89. x +------------------+
  90. | | chip #Z | uint32 (e.g. ID for 5422, 0x0000152e)
  91. | +------------------+
  92. | | platform #Z | uint32 (e.g. ID for k3g, 0x00001e92)
  93. | +------------------+
  94. device | subtype #Z | uint32 (e.g. ID for k3g_eur_open, 0x7d64f612)
  95. #1 +------------------+
  96. entry | hw_rev #Z | uint32 (e.g. k3g rev 10, 0x0000000A)
  97. | +------------------+
  98. | | hw_rev_end #Z | uint32 (e.g. k3g rev_end 255, 0x000000FF)
  99. | +------------------+
  100. | | offset #Z | uint32 (byte offset from start/before MAGIC
  101. | +------------------+ to DTB entry, e.g. 0x0006c800)
  102. | | size #Z | uint32 (size in bytes of DTB blob
  103. | +------------------+ e.g. 110,592 bytes, 0x0001b000)
  104. | | space #Z | uint32 (0x00000020)
  105. x +------------------+
  106. | padding | variable length for next DTB to start on
  107. +------------------+ page boundary
  108. | DTB #1 | variable (start is page aligned)
  109. | |
  110. | |
  111. +------------------+
  112. | padding | variable length for next DTB to start on
  113. +------------------+ page boundary
  114. .
  115. .
  116. .
  117. +------------------+
  118. | DTB #Z (last) | variable (start is page aligned)
  119. | |
  120. | |
  121. +------------------+