1f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\documentclass[a4paper,twocolumn]{article} 2f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 3f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{abstract} 4f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{xspace} 5f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{amssymb} 6f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{latexsym} 7f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{tabularx} 8f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage[T1]{fontenc} 9f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{calc} 10f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{listings} 11f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{color} 12f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\usepackage{url} 13f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 14f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\title{Device trees everywhere} 15f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 16f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\author{David Gibson \texttt{<{dwg}{@}{au1.ibm.com}>}\\ 17f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson Benjamin Herrenschmidt \texttt{<{benh}{@}{kernel.crashing.org}>}\\ 18f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \emph{OzLabs, IBM Linux Technology Center}} 19f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 20f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\R}{\textsuperscript{\textregistered}\xspace} 21f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\tm}{\textsuperscript{\texttrademark}\xspace} 22f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\tge}{$\geqslant$} 23f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson%\newcommand{\ditto}{\textquotedbl\xspace} 24f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 25f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\fixme}[1]{$\bigstar$\emph{\textbf{\large #1}}$\bigstar$\xspace} 26f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 27f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\ppc}{\mbox{PowerPC}\xspace} 28f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\of}{Open Firmware\xspace} 29f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\benh}{Ben Herrenschmidt\xspace} 30f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\kexec}{\texttt{kexec()}\xspace} 31f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\dtbeginnode}{\texttt{OF\_DT\_BEGIN\_NODE\xspace}} 32f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\dtendnode}{\texttt{OF\_DT\_END\_NODE\xspace}} 33f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\dtprop}{\texttt{OF\_DT\_PROP\xspace}} 34f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\dtend}{\texttt{OF\_DT\_END\xspace}} 35f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\dtc}{\texttt{dtc}\xspace} 36f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\newcommand{\phandle}{\texttt{linux,phandle}\xspace} 37f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{document} 38f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 39f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\maketitle 40f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 41f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{abstract} 42f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson We present a method for booting a \ppc{}\R Linux\R kernel on an 43f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson embedded machine. To do this, we supply the kernel with a compact 44f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson flattened-tree representation of the system's hardware based on the 45f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson device tree supplied by Open Firmware on IBM\R servers and Apple\R 46f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson Power Macintosh\R machines. 47f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 48f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson The ``blob'' representing the device tree can be created using \dtc 49f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson --- the Device Tree Compiler --- that turns a simple text 50f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson representation of the tree into the compact representation used by 51f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson the kernel. The compiler can produce either a binary ``blob'' or an 52f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson assembler file ready to be built into a firmware or bootwrapper 53f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson image. 54f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 55f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson This flattened-tree approach is now the only supported method of 56f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson booting a \texttt{ppc64} kernel without Open Firmware, and we plan 57f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson to make it the only supported method for all \texttt{powerpc} 58f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson kernels in the future. 59f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{abstract} 60f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 61f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\section{Introduction} 62f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 63f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{OF and the device tree} 64f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 65f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonHistorically, ``everyday'' \ppc machines have booted with the help of 66f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\of (OF), a firmware environment defined by IEEE1275 \cite{IEEE1275}. 67f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonAmong other boot-time services, OF maintains a device tree that 68f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondescribes all of the system's hardware devices and how they're 69f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonconnected. During boot, before taking control of memory management, 70f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe Linux kernel uses OF calls to scan the device tree and transfer it 71f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonto an internal representation that is used at run time to look up 72f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonvarious device information. 73f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 74f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe device tree consists of nodes representing devices or 75f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbuses\footnote{Well, mostly. There are a few special exceptions.}. 76f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonEach node contains \emph{properties}, name--value pairs that give 77f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoninformation about the device. The values are arbitrary byte strings, 78f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonand for some properties, they contain tables or other structured 79f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoninformation. 80f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 81f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{The bad old days} 82f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 83f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonEmbedded systems, by contrast, usually have a minimal firmware that 84f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmight supply a few vital system parameters (size of RAM and the like), 85f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbut nothing as detailed or complete as the OF device tree. This has 86f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmeant that the various 32-bit \ppc embedded ports have required a 87f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonvariety of hacks spread across the kernel to deal with the lack of 88f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondevice tree. These vary from specialised boot wrappers to parse 89f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonparameters (which are at least reasonably localised) to 90f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonCONFIG-dependent hacks in drivers to override normal probe logic with 91f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonhardcoded addresses for a particular board. As well as being ugly of 92f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonitself, such CONFIG-dependent hacks make it hard to build a single 93f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonkernel image that supports multiple embedded machines. 94f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 95f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonUntil relatively recently, the only 64-bit \ppc machines without OF 96f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonwere legacy (pre-POWER5\R) iSeries\R machines. iSeries machines often 97f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsononly have virtual IO devices, which makes it quite simple to work 98f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonaround the lack of a device tree. Even so, the lack means the iSeries 99f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonboot sequence must be quite different from the pSeries or Macintosh, 100f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonwhich is not ideal. 101f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 102f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe device tree also presents a problem for implementing \kexec. When 103f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe kernel boots, it takes over full control of the system from OF, 104f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoneven re-using OF's memory. So, when \kexec comes to boot another 105f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonkernel, OF is no longer around for the second kernel to query. 106f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 107f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\section{The Flattened Tree} 108f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 109f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonIn May 2005 \benh implemented a new approach to handling the device 110f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontree that addresses all these problems. When booting on OF systems, 111f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe first thing the kernel runs is a small piece of code in 112f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{prom\_init.c}, which executes in the context of OF. This code 113f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonwalks the device tree using OF calls, and transcribes it into a 114f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoncompact, flattened format. The resulting device tree ``blob'' is then 115f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonpassed to the kernel proper, which eventually unflattens the tree into 116f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonits runtime form. This blob is the only data communicated between the 117f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{prom\_init.c} bootstrap and the rest of the kernel. 118f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 119f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonWhen OF isn't available, either because the machine doesn't have it at 120f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonall or because \kexec has been used, the kernel instead starts 121f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondirectly from the entry point taking a flattened device tree. The 122f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondevice tree blob must be passed in from outside, rather than generated 123f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonby part of the kernel from OF. For \kexec, the userland 124f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{kexec} tools build the blob from the runtime device tree 125f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbefore invoking the new kernel. For embedded systems the blob can 126f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoncome either from the embedded bootloader, or from a specialised 127f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonversion of the \texttt{zImage} wrapper for the system in question. 128f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 129f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Properties of the flattened tree} 130f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 131f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe flattened tree format should be easy to handle, both for the 132f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonkernel that parses it and the bootloader that generates it. In 133f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonparticular, the following properties are desirable: 134f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 135f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{itemize} 136f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{relocatable}: the bootloader or kernel should be able to 137f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson move the blob around as a whole, without needing to parse or adjust 138f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson its internals. In practice that means we must not use pointers 139f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson within the blob. 140f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{insert and delete}: sometimes the bootloader might want to 141f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson make tweaks to the flattened tree, such as deleting or inserting a 142f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson node (or whole subtree). It should be possible to do this without 143f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson having to effectively regenerate the whole flattened tree. In 144f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson practice this means limiting the use of internal offsets in the blob 145f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson that need recalculation if a section is inserted or removed with 146f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{memmove()}. 147f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{compact}: embedded systems are frequently short of 148f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson resources, particularly RAM and flash memory space. Thus, the tree 149f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson representation should be kept as small as conveniently possible. 150f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{itemize} 151f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 152f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Format of the device tree blob} 153f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\label{sec:format} 154f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 155f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{figure}[htb!] 156f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \centering 157f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \footnotesize 158f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \begin{tabular}{r|c|l} 159f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \multicolumn{1}{r}{\textbf{Offset}}& \multicolumn{1}{c}{\textbf{Contents}} \\\cline{2-2} 160f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x00} & \texttt{0xd00dfeed} & magic number \\\cline{2-2} 161f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x04} & \emph{totalsize} \\\cline{2-2} 162f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x08} & \emph{off\_struct} & \\\cline{2-2} 163f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x0C} & \emph{off\_strs} & \\\cline{2-2} 164f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x10} & \emph{off\_rsvmap} & \\\cline{2-2} 165f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x14} & \emph{version} \\\cline{2-2} 166f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x18} & \emph{last\_comp\_ver} & \\\cline{2-2} 167f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x1C} & \emph{boot\_cpu\_id} & \tge v2 only\\\cline{2-2} 168f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{0x20} & \emph{size\_strs} & \tge v3 only\\\cline{2-2} 169f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \multicolumn{1}{r}{\vdots} & \multicolumn{1}{c}{\vdots} & \\\cline{2-2} 170f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \emph{off\_rsvmap} & \emph{address0} & memory reserve \\ 171f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x04} & ...& table \\\cline{2-2} 172f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x08} & \emph{len0} & \\ 173f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x0C} & ...& \\\cline{2-2} 174f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \vdots & \multicolumn{1}{c|}{\vdots} & \\\cline{2-2} 175f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson & \texttt{0x00000000}- & end marker\\ 176f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson & \texttt{00000000} & \\\cline{2-2} 177f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson & \texttt{0x00000000}- & \\ 178f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson & \texttt{00000000} & \\\cline{2-2} 179f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \multicolumn{1}{r}{\vdots} & \multicolumn{1}{c}{\vdots} & \\\cline{2-2} 180f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \emph{off\_strs} & \texttt{'n' 'a' 'm' 'e'} & strings block \\ 181f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x04} & \texttt{~0~ 'm' 'o' 'd'} & \\ 182f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x08} & \texttt{'e' 'l' ~0~ \makebox[\widthof{~~~}]{\textrm{...}}} & \\ 183f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \vdots & \multicolumn{1}{c|}{\vdots} & \\\cline{2-2} 184f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \multicolumn{1}{r}{+ \emph{size\_strs}} \\ 185f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \multicolumn{1}{r}{\vdots} & \multicolumn{1}{c}{\vdots} & \\\cline{2-2} 186f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \emph{off\_struct} & \dtbeginnode & structure block \\\cline{2-2} 187f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x04} & \texttt{'/' ~0~ ~0~ ~0~} & root node\\\cline{2-2} 188f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x08} & \dtprop & \\\cline{2-2} 189f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x0C} & \texttt{0x00000005} & ``\texttt{model}''\\\cline{2-2} 190f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x10} & \texttt{0x00000008} & \\\cline{2-2} 191f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x14} & \texttt{'M' 'y' 'B' 'o'} & \\ 192f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson + \texttt{0x18} & \texttt{'a' 'r' 'd' ~0~} & \\\cline{2-2} 193f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \vdots & \multicolumn{1}{c|}{\vdots} & \\\cline{2-2} 194f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson & \texttt{\dtendnode} \\\cline{2-2} 195f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson & \texttt{\dtend} \\\cline{2-2} 19663dc9c7113cd0fff60d04b05cd8053e70279f9d4David Gibson \multicolumn{1}{r}{\vdots} & \multicolumn{1}{c}{\vdots} & \\\cline{2-2} 197f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \multicolumn{1}{r}{\emph{totalsize}} \\ 198f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \end{tabular} 199f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \caption{Device tree blob layout} 200f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \label{fig:blob-layout} 201f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{figure} 202f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 203f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe format for the blob we devised, was first described on the 204f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{linuxppc64-dev} mailing list in \cite{noof1}. The format has 205f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonsince evolved through various revisions, and the current version is 206f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonincluded as part of the \dtc (see \S\ref{sec:dtc}) git tree, 207f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\cite{dtcgit}. 208f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 209f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonFigure \ref{fig:blob-layout} shows the layout of the blob of data 210f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoncontaining the device tree. It has three sections of variable size: 211f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe \emph{memory reserve table}, the \emph{structure block} and the 212f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\emph{strings block}. A small header gives the blob's size and 213f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonversion and the locations of the three sections, plus a handful of 214f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonvital parameters used during early boot. 215f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 216f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe memory reserve map section gives a list of regions of memory that 217f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe kernel must not use\footnote{Usually such ranges contain some data 218f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonstructure initialised by the firmware that must be preserved by the 219f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonkernel.}. The list is represented as a simple array of (address, 220f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonsize) pairs of 64 bit values, terminated by a zero size entry. The 221f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonstrings block is similarly simple, consisting of a number of 222f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnull-terminated strings appended together, which are referenced from 223f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe structure block as described below. 224f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 225f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe structure block contains the device tree proper. Each node is 226f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonintroduced with a 32-bit \dtbeginnode tag, followed by the node's name 227f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonas a null-terminated string, padded to a 32-bit boundary. Then 228f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonfollows all of the properties of the node, each introduced with a 229f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\dtprop tag, then all of the node's subnodes, each introduced with 230f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontheir own \dtbeginnode tag. The node ends with an \dtendnode tag, and 231f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonafter the \dtendnode for the root node is an \dtend tag, indicating 232f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe end of the whole tree\footnote{This is redundant, but included for 233f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonease of parsing.}. The structure block starts with the \dtbeginnode 234f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonintroducing the description of the root node (named \texttt{/}). 235f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 236f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonEach property, after the \dtprop, has a 32-bit value giving an offset 237f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonfrom the beginning of the strings block at which the property name is 238f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonstored. Because it's common for many nodes to have properties with 239f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe same name, this approach can substantially reduce the total size 240f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonof the blob. The name offset is followed by the length of the 241f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonproperty value (as a 32-bit value) and then the data itself padded to 242f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsona 32-bit boundary. 243f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 244f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Contents of the tree} 245f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\label{sec:treecontents} 246f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 247f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonHaving seen how to represent the device tree structure as a flattened 248f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonblob, what actually goes into the tree? The short answer is ``the 249f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonsame as an OF tree''. On OF systems, the flattened tree is 250f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontranscribed directly from the OF device tree, so for simplicity we 251f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonalso use OF conventions for the tree on other systems. 252f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 253f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonIn many cases a flat tree can be simpler than a typical OF provided 254f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondevice tree. The flattened tree need only provide those nodes and 255f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonproperties that the kernel actually requires; the flattened tree 256f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsongenerally need not include devices that the kernel can probe itself. 257f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonFor example, an OF device tree would normally include nodes for each 258f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonPCI device on the system. A flattened tree need only include nodes 259f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonfor the PCI host bridges; the kernel will scan the buses thus 260f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondescribed to find the subsidiary devices. The device tree can include 261f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnodes for devices where the kernel needs extra information, though: 262f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonfor example, for ISA devices on a subsidiary PCI/ISA bridge, or for 263f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondevices with unusual interrupt routing. 264f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 265f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonWhere they exist, we follow the IEEE1275 bindings that specify how to 266f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondescribe various buses in the device tree (for example, 267f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\cite{IEEE1275-pci} describe how to represent PCI devices). The 268f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonstandard has not been updated for a long time, however, and lacks 269f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbindings for many modern buses and devices. In particular, embedded 270f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonspecific devices such as the various System-on-Chip buses are not 271f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoncovered. We intend to create new bindings for such buses, in keeping 272f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonwith the general conventions of IEEE1275 (a simple such binding for a 273f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonSystem-on-Chip bus was included in \cite{noof5} a revision of 274f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\cite{noof1}). 275f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 276f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonOne complication arises for representing ``phandles'' in the flattened 277f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontree. In OF, each node in the tree has an associated phandle, a 278f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson32-bit integer that uniquely identifies the node\footnote{In practice 279f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonusually implemented as a pointer or offset within OF memory.}. This 280f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonhandle is used by the various OF calls to query and traverse the tree. 281f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonSometimes phandles are also used within the tree to refer to other 282f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnodes in the tree. For example, devices that produce interrupts 283f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsongenerally have an \texttt{interrupt-parent} property giving the 284f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonphandle of the interrupt controller that handles interrupts from this 285f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondevice. Parsing these and other interrupt related properties allows 286f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe kernel to build a complete representation of the system's 287f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoninterrupt tree, which can be quite different from the tree of bus 288f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonconnections. 289f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 290f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonIn the flattened tree, a node's phandle is represented by a special 291f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\phandle property. When the kernel generates a flattened tree from 292f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonOF, it adds a \phandle property to each node, containing the phandle 293f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonretrieved from OF. When the tree is generated without OF, however, 294f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsononly nodes that are actually referred to by phandle need to have this 295f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonproperty. 296f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 297f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonAnother complication arises because nodes in an OF tree have two 298f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnames. First they have the ``unit name'', which is how the node is 299f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonreferred to in an OF path. The unit name generally consists of a 300f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsondevice type followed by an \texttt{@} followed by a \emph{unit 301f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonaddress}. For example \texttt{/memory@0} is the full path of a memory 302f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnode at address 0, \texttt{/ht@0,f2000000/pci@1} is the path of a PCI 303f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbus node, which is under a HyperTransport\tm bus node. The form of 304f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe unit address is bus dependent, but is generally derived from the 305f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnode's \texttt{reg} property. In addition, nodes have a property, 306f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{name}, whose value is usually equal to the first path of the 307f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonunit name. For example, the nodes in the previous example would have 308f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{name} properties equal to \texttt{memory} and \texttt{pci}, 309f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonrespectively. To save space in the blob, the current version of the 310f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonflattened tree format only requires the unit names to be present. 311f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonWhen the kernel unflattens the tree, it automatically generates a 312f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{name} property from the node's path name. 313f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 314f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\section{The Device Tree Compiler} 315f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\label{sec:dtc} 316f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 317f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{figure}[htb!] 318f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \centering 319f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \begin{lstlisting}[frame=single,basicstyle=\footnotesize\ttfamily, 320f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson tabsize=3,numbers=left,xleftmargin=2em] 321f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson/memreserve/ 0x20000000-0x21FFFFFF; 322f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 323f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson/ { 324f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson model = "MyBoard"; 325f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson compatible = "MyBoardFamily"; 326f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson #address-cells = <2>; 327f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson #size-cells = <2>; 328f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 329f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson cpus { 330f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson #address-cells = <1>; 331f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson #size-cells = <0>; 332f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson PowerPC,970@0 { 333f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson device_type = "cpu"; 334f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson reg = <0>; 335f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson clock-frequency = <5f5e1000>; 336f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson timebase-frequency = <1FCA055>; 337f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson linux,boot-cpu; 338f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson i-cache-size = <10000>; 339f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson d-cache-size = <8000>; 340f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson }; 341f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson }; 342f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 343f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson memory@0 { 344f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson device_type = "memory"; 345f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson memreg: reg = <00000000 00000000 346f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 00000000 20000000>; 347f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson }; 348f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 349f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson mpic@0x3fffdd08400 { 350f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson /* Interrupt controller */ 351f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson /* ... */ 352f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson }; 353f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 354f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson pci@40000000000000 { 355f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson /* PCI host bridge */ 356f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson /* ... */ 357f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson }; 358f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 359f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson chosen { 360f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson bootargs = "root=/dev/sda2"; 361f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson linux,platform = <00000600>; 362f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson interrupt-controller = 363f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson < &/mpic@0x3fffdd08400 >; 364f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson }; 365f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson}; 366f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{lstlisting} 367f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \caption{Example \dtc source} 368f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \label{fig:dts} 369f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{figure} 370f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 371f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonAs we've seen, the flattened device tree format provides a convenient 372f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonway of communicating device tree information to the kernel. It's 373f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonsimple for the kernel to parse, and simple for bootloaders to 374f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmanipulate. On OF systems, it's easy to generate the flattened tree 375f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonby walking the OF maintained tree. However, for embedded systems, the 376f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonflattened tree must be generated from scratch. 377f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 378f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonEmbedded bootloaders are generally built for a particular board. So, 379f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonit's usually possible to build the device tree blob at compile time 380f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonand include it in the bootloader image. For minor revisions of the 381f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonboard, the bootloader can contain code to make the necessary tweaks to 382f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe tree before passing it to the booted kernel. 383f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 384f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe device trees for embedded boards are usually quite simple, and 385f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonit's possible to hand construct the necessary blob by hand, but doing 386f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonso is tedious. The ``device tree compiler'', \dtc{}\footnote{\dtc can 387f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbe obtained from \cite{dtcgit}.}, is designed to make creating device 388f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontree blobs easier by converting a text representation of the tree 389f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoninto the necessary blob. 390f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 391f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Input and output formats} 392f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 393f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonAs well as the normal mode of compiling a device tree blob from text 394f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonsource, \dtc can convert a device tree between a number of 395f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonrepresentations. It can take its input in one of three different 396f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonformats: 397f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{itemize} 398f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item source, the normal case. The device tree is described in a text 399f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson form, described in \S\ref{sec:dts}. 400f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item blob (\texttt{dtb}), the flattened tree format described in 401f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \S\ref{sec:format}. This mode is useful for checking a pre-existing 402f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson device tree blob. 403f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item filesystem (\texttt{fs}), input is a directory tree in the 404f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson layout of \texttt{/proc/device-tree} (roughly, a directory for each 405f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson node in the device tree, a file for each property). This is useful 406f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson for building a blob for the device tree in use by the currently 407f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson running kernel. 408f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{itemize} 409f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 410f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonIn addition, \dtc can output the tree in one of three different 411f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonformats: 412f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{itemize} 413f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item blob (\texttt{dtb}), as in \S\ref{sec:format}. The most 414f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson straightforward use of \dtc is to compile from ``source'' to 415f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson ``blob'' format. 416f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item source (\texttt{dts}), as in \S\ref{sec:dts}. If used with blob 417f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson input, this allows \dtc to act as a ``decompiler''. 418f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item assembler source (\texttt{asm}). \dtc can produce an assembler 419f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson file, which will assemble into a \texttt{.o} file containing the 420f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson device tree blob, with symbols giving the beginning of the blob and 421f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson its various subsections. This can then be linked directly into a 422f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson bootloader or firmware image. 423f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{itemize} 424f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 425f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonFor maximum applicability, \dtc can both read and write any of the 426f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonexisting revisions of the blob format. When reading, \dtc takes the 427f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonversion from the blob header, and when writing it takes a command line 428f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonoption specifying the desired version. It automatically makes any 429f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnecessary adjustments to the tree that are necessary for the specified 430f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonversion. For example, formats before 0x10 require each node to have 431f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonan explicit \texttt{name} property. When \dtc creates such a blob, it 432f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonwill automatically generate \texttt{name} properties from the unit 433f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnames. 434f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 435f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Source format} 436f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\label{sec:dts} 437f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 438f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe ``source'' format for \dtc is a text description of the device 439f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontree in a vaguely C-like form. Figure \ref{fig:dts} shows an 440f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonexample. The file starts with \texttt{/memreserve/} directives, which 441f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsongives address ranges to add to the output blob's memory reserve table, 442f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthen the device tree proper is described. 443f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 444f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonNodes of the tree are introduced with the node name, followed by a 445f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{\{} ... \texttt{\};} block containing the node's properties 446f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonand subnodes. Properties are given as just {\emph{name} \texttt{=} 447f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \emph{value}\texttt{;}}. The property values can be given in any 448f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonof three forms: 449f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{itemize} 450f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{string} (for example, \texttt{"MyBoard"}). The property 451f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson value is the given string, including terminating NULL. C-style 452f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson escapes (\verb+\t+, \verb+\n+, \verb+\0+ and so forth) are allowed. 453f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{cells} (for example, \texttt{<0 8000 f0000000>}). The 454f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson property value is made up of a list of 32-bit ``cells'', each given 455f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson as a hex value. 456f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{bytestring} (for example, \texttt{[1234abcdef]}). The 457f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson property value is given as a hex bytestring. 458f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{itemize} 459f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 460f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonCell properties can also contain \emph{references}. Instead of a hex 461f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnumber, the source can give an ampersand (\texttt{\&}) followed by the 462f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonfull path to some node in the tree. For example, in Figure 463f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\ref{fig:dts}, the \texttt{/chosen} node has an 464f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{interrupt-controller} property referring to the interrupt 465f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsoncontroller described by the node \texttt{/mpic@0x3fffdd08400}. In the 466f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonoutput tree, the value of the referenced node's phandle is included in 467f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe property. If that node doesn't have an explicit phandle property, 468f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\dtc will automatically create a unique phandle for it. This approach 469f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmakes it easy to create interrupt trees without having to explicitly 470f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonassign and remember phandles for the various interrupt controller 471f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonnodes. 472f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 473f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe \dtc source can also include ``labels'', which are placed on a 474f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonparticular node or property. For example, Figure \ref{fig:dts} has a 475f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonlabel ``\texttt{memreg}'' on the \texttt{reg} property of the node 476f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{/memory@0}. When using assembler output, corresponding labels 477f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonin the output are generated, which will assemble into symbols 478f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonaddressing the part of the blob with the node or property in question. 479f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThis is useful for the common case where an embedded board has an 480f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonessentially fixed device tree with a few variable properties, such as 481f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe size of memory. The bootloader for such a board can have a device 482f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontree linked in, including a symbol referring to the right place in the 483f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonblob to update the parameter with the correct value determined at 484f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonruntime. 485f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 486f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Tree checking} 487f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 488f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonBetween reading in the device tree and writing it out in the new 489f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonformat, \dtc performs a number of checks on the tree: 490f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{itemize} 491f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{syntactic structure}: \dtc checks that node and property 492f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson names contain only allowed characters and meet length restrictions. 493f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson It checks that a node does not have multiple properties or subnodes 494f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson with the same name. 495f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{semantic structure}: In some cases, \dtc checks that 496f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson properties whose contents are defined by convention have appropriate 497f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson values. For example, it checks that \texttt{reg} properties have a 498f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson length that makes sense given the address forms specified by the 499f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{\#address-cells} and \texttt{\#size-cells} properties. It 500f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson checks that properties such as \texttt{interrupt-parent} contain a 501f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson valid phandle. 502f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{Linux requirements}: \dtc checks that the device tree 503f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson contains those nodes and properties that are required by the Linux 504f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson kernel to boot correctly. 505f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{itemize} 506f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 507f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThese checks are useful to catch simple problems with the device tree, 508f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonrather than having to debug the results on an embedded kernel. With 509f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthe blob input mode, it can also be used for diagnosing problems with 510f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonan existing blob. 511f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 512f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\section{Future Work} 513f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 514f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{Board ports} 515f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 516f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThe flattened device tree has always been the only supported way to 517f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonboot a \texttt{ppc64} kernel on an embedded system. With the merge of 518f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{ppc32} and \texttt{ppc64} code it has also become the only 519f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonsupported way to boot any merged \texttt{powerpc} kernel, 32-bit or 520f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson64-bit. In fact, the old \texttt{ppc} architecture exists mainly just 521f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonto support the old ppc32 embedded ports that have not been migrated 522f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonto the flattened device tree approach. We plan to remove the 523f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\texttt{ppc} architecture eventually, which will mean porting all the 524f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonvarious embedded boards to use the flattened device tree. 525f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 526f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\subsection{\dtc features} 527f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 528f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonWhile it is already quite usable, there are a number of extra features 529f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonthat \dtc could include to make creating device trees more convenient: 530f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\begin{itemize} 531f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{better tree checking}: Although \dtc already performs a 532f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson number of checks on the device tree, they are rather haphazard. In 533f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson many cases \dtc will give up after detecting a minor error early and 534f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson won't pick up more interesting errors later on. There is a 535f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \texttt{-f} parameter that forces \dtc to generate an output tree 536f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson even if there are errors. At present, this needs to be used more 537f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson often than one might hope, because \dtc is bad at deciding which 538f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson errors should really be fatal, and which rate mere warnings. 539f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{binary include}: Occasionally, it is useful for the device 540f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson tree to incorporate as a property a block of binary data for some 541f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson board-specific purpose. For example, many of Apple's device trees 542f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson incorporate bytecode drivers for certain platform devices. \dtc's 543f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson source format ought to allow this by letting a property's value be 544f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson read directly from a binary file. 545f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\item \emph{macros}: it might be useful for \dtc to implement some 546f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson sort of macros so that a tree containing a number of similar devices 547f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson (for example, multiple identical ethernet controllers or PCI buses) 548f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson can be written more quickly. At present, this can be accomplished 549f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson in part by running the source file through CPP before compiling with 550f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson \dtc. It's not clear whether ``native'' support for macros would be 551f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson more useful. 552f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{itemize} 553f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 554f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\bibliographystyle{amsplain} 555f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\bibliography{dtc-paper} 556f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 557f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\section*{About the authors} 558f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 559f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonDavid Gibson has been a member of the IBM Linux Technology Center, 560f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonworking from Canberra, Australia, since 2001. Recently he has worked 561f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonon Linux hugepage support and performance counter support for ppc64, 562f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonas well as the device tree compiler. In the past, he has worked on 563f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonbringup for various ppc and ppc64 embedded systems, the orinoco 564f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonwireless driver, ramfs, and a userspace checkpointing system 565f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson(\texttt{esky}). 566f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 567f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonBenjamin Herrenschmidt was a MacOS developer for about 10 years, but 568f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonultimately saw the light and installed Linux on his Apple PowerPC 569f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmachine. After writing a bootloader, BootX, for it in 1998, he 570f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonstarted contributing to the PowerPC Linux port in various areas, 571f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmostly around the support for Apple machines. He became official 572f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonPowerMac maintainer in 2001. In 2003, he joined the IBM Linux 573f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonTechnology Center in Canberra, Australia, where he ported the 64 bit 574f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonPowerPC kernel to Apple G5 machines and the Maple embedded board, 575f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonamong others things. He's a member of the ppc64 development ``team'' 576f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonand one of his current goals is to make the integration of embedded 577f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonplatforms smoother and more maintainable than in the 32-bit PowerPC 578f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonkernel. 579f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 580f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\section*{Legal Statement} 581f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 582f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonThis work represents the view of the author and does not necessarily 583f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonrepresent the view of IBM. 584f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 585f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonIBM, \ppc, \ppc Architecture, POWER5, pSeries and iSeries are 586f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsontrademarks or registered trademarks of International Business Machines 587f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonCorporation in the United States and/or other countries. 588f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 589f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonApple and Power Macintosh are a registered trademarks of Apple 590f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonComputer Inc. in the United States, other countries, or both. 591f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 592f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonLinux is a registered trademark of Linus Torvalds. 593f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 594f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David GibsonOther company, product, and service names may be trademarks or service 595f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibsonmarks of others. 596f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson 597f5aa792d81f5911eff088e4f88c0cd0a11ea9ca0David Gibson\end{document} 598