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