Android DTB/DTBO Partition: GraphViz block diagram (.dot) source

Format for Android DTB/DTBO partitions. It's kind of archive with dtb/dtbo files. Used only when there is a separate unique partition (dtb, dtbo) on an android device to organize device tree files. The format consists of a header with info about size and number of device tree entries and the entries themselves. This format description could be used to extract device tree entries from a partition images and decompile them with dtc (device tree compiler).

File extension

img

KS implementation details

License: CC0-1.0

This page hosts a formal specification of Android DTB/DTBO Partition using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

GraphViz block diagram source

android_dto.dot

digraph {
	rankdir=LR;
	node [shape=plaintext];
	subgraph cluster__android_dto {
		label="AndroidDto";
		graph[style=dotted];

		android_dto__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
			<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
			<TR><TD PORT="header_pos">0</TD><TD PORT="header_size">32</TD><TD>DtTableHeader</TD><TD PORT="header_type">header</TD></TR>
			<TR><TD PORT="entries_pos">32</TD><TD PORT="entries_size">32</TD><TD>DtTableEntry</TD><TD PORT="entries_type">entries</TD></TR>
			<TR><TD COLSPAN="4" PORT="entries__repeat">repeat header.dt_entry_count times</TD></TR>
		</TABLE>>];
		subgraph cluster__dt_table_header {
			label="AndroidDto::DtTableHeader";
			graph[style=dotted];

			dt_table_header__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="magic_pos">0</TD><TD PORT="magic_size">4</TD><TD></TD><TD PORT="magic_type">magic</TD></TR>
				<TR><TD PORT="total_size_pos">4</TD><TD PORT="total_size_size">4</TD><TD>u4be</TD><TD PORT="total_size_type">total_size</TD></TR>
				<TR><TD PORT="header_size_pos">8</TD><TD PORT="header_size_size">4</TD><TD>u4be</TD><TD PORT="header_size_type">header_size</TD></TR>
				<TR><TD PORT="dt_entry_size_pos">12</TD><TD PORT="dt_entry_size_size">4</TD><TD>u4be</TD><TD PORT="dt_entry_size_type">dt_entry_size</TD></TR>
				<TR><TD PORT="dt_entry_count_pos">16</TD><TD PORT="dt_entry_count_size">4</TD><TD>u4be</TD><TD PORT="dt_entry_count_type">dt_entry_count</TD></TR>
				<TR><TD PORT="dt_entries_offset_pos">20</TD><TD PORT="dt_entries_offset_size">4</TD><TD>u4be</TD><TD PORT="dt_entries_offset_type">dt_entries_offset</TD></TR>
				<TR><TD PORT="page_size_pos">24</TD><TD PORT="page_size_size">4</TD><TD>u4be</TD><TD PORT="page_size_type">page_size</TD></TR>
				<TR><TD PORT="version_pos">28</TD><TD PORT="version_size">4</TD><TD>u4be</TD><TD PORT="version_type">version</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__dt_table_entry {
			label="AndroidDto::DtTableEntry";
			graph[style=dotted];

			dt_table_entry__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="dt_size_pos">0</TD><TD PORT="dt_size_size">4</TD><TD>u4be</TD><TD PORT="dt_size_type">dt_size</TD></TR>
				<TR><TD PORT="dt_offset_pos">4</TD><TD PORT="dt_offset_size">4</TD><TD>u4be</TD><TD PORT="dt_offset_type">dt_offset</TD></TR>
				<TR><TD PORT="id_pos">8</TD><TD PORT="id_size">4</TD><TD>u4be</TD><TD PORT="id_type">id</TD></TR>
				<TR><TD PORT="rev_pos">12</TD><TD PORT="rev_size">4</TD><TD>u4be</TD><TD PORT="rev_type">rev</TD></TR>
				<TR><TD PORT="custom_pos">16</TD><TD PORT="custom_size">4</TD><TD>u4be</TD><TD PORT="custom_type">custom</TD></TR>
				<TR><TD COLSPAN="4" PORT="custom__repeat">repeat 4 times</TD></TR>
			</TABLE>>];
			dt_table_entry__inst__body [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="body_pos">dt_offset</TD><TD PORT="body_size">dt_size</TD><TD></TD><TD PORT="body_type">body</TD></TR>
			</TABLE>>];
		}
	}
	android_dto__seq:header_type -> dt_table_header__seq [style=bold];
	android_dto__seq:entries_type -> dt_table_entry__seq [style=bold];
	dt_table_header__seq:dt_entry_count_type -> android_dto__seq:entries__repeat [color="#404040"];
	dt_table_entry__seq:dt_offset_type -> dt_table_entry__inst__body:body_pos [color="#404040"];
	dt_table_entry__seq:dt_size_type -> dt_table_entry__inst__body:body_size [color="#404040"];
}