2 % Copyright (c) 2010-2011 Dream Multimedia GmbH, Germany
3 % http://www.dream-multimedia-tv.de/
5 % Andreas Oberritter <obi@opendreambox.org>
7 % Permission is hereby granted, free of charge, to any person obtaining a copy
8 % of this software and associated documentation files (the "Software"), to deal
9 % in the Software without restriction, including without limitation the rights
10 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 % copies of the Software, and to permit persons to whom the Software is
12 % furnished to do so, subject to the following conditions:
14 % The above copyright notice and this permission notice shall be included in
15 % all copies or substantial portions of the Software.
17 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 \documentclass[a4paper]{article}
39 %\setlength{\textwidth}{12cm}
41 \newcommand{\plaintext}[1]{\texttt{\small #1}}
42 \newcommand{\shell}[1]{\texttt{\small #1}}
46 \author{Andreas Oberritter \shell{<obi@opendreambox.org>}}
49 %\thispagestyle{empty}
54 \section{Introduction}
56 This document briefly describes the OpenDreambox distribution, an embedded Linux
57 distribution for Set-Top-Boxes manufactured by \href{http://www.dream-multimedia-tv.de/}{Dream Multimedia GmbH}.
59 OpenDreambox is based on the \href{http://www.openembedded.org/}{OpenEmbedded} build framework, which
60 uses \href{http://bitbake.berlios.de/}{BitBake} to transform build instructions into
61 distributable firmare images and software packages.
64 \subsection{Target audience}
66 Developers familiar with previous versions of OpenDreambox or OpenEmbedded
70 \subsection{Supported products}
73 The current version includes support for the following machines:
75 \begin{tabular}{ | l | l | }
77 \textbf{Product name} & \textbf{Environment variable} \\ \hline
79 DM 500 HD & \shell{MACHINE=dm500hd} \\
80 DM 800 HD PVR & \shell{MACHINE=dm800} \\
81 DM 800 HD SE & \shell{MACHINE=dm800se} \\
82 DM 7020 HD & \shell{MACHINE=dm7020hd} \\
83 DM 8000 HD PVR & \shell{MACHINE=dm8000} \\
92 Copyright (c) 2010-2012 Dream Multimedia GmbH, Germany
93 http://www.dream-multimedia-tv.de/
95 Andreas Frisch <fraxinas@opendreambox.org>
96 Andreas Monzner <ghost@opendreambox.org>
97 Andreas Oberritter <obi@opendreambox.org>
98 Mladen Horvat <acid-burn@opendreambox.org>
99 Stefan Pluecken <thedoc@opendreambox.org>
100 Stephan Reichholf <reichi@opendreambox.org>
102 Permission is hereby granted, free of charge, to any person obtaining a copy
103 of this software and associated documentation files (the "Software"), to deal
104 in the Software without restriction, including without limitation the rights
105 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
106 copies of the Software, and to permit persons to whom the Software is
107 furnished to do so, subject to the following conditions:
109 The above copyright notice and this permission notice shall be included in
110 all copies or substantial portions of the Software.
112 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
113 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
114 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
115 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
116 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
117 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
121 \subsection{Obtaining the source code}
122 OpenDreambox uses the Git version control system. To obtain the source
123 code, it is required to install Git. See \url{http://git-scm.com/}.
125 To initially download the source into the current directory, issue the
128 \shell{git clone git://git.opendreambox.org/git/opendreambox.git}
130 \subsection{Quick start}
133 \shell{make -C opendreambox image}
135 If this command fails, prerequisites my be missing. See section \ref{prerequisites}.
137 \subsection{Directory structure}
138 OpenDreambox consists of a set of layers containing build instructions.
139 This meta data is used by BitBake to download and compile source code
140 and to assemble installable software packages and firmware images.
142 Currently, there are five layers, ordered by priority from lowest to
146 \item \shell{openembedded-core}
147 \item \shell{meta-openembedded}
148 \item \shell{meta-opendreambox}
149 \item \shell{meta-bsp/common}
150 \item \shell{meta-bsp/\$\{MACHINE\}}
153 If a recipe for the same package exists in multiple layers,
154 then the higher priority layer takes precedence over the lower priority
157 For example, \shell{libmad\_0.15.1b.bb} exists in both
158 \shell{meta-openembedded} and \shell{openembedded-core}. The recipe in
159 \shell{meta-openembedded} will be used, because \shell{openembedded-core}
162 \textbf{NOTE:} This would still be true even if the version of \shell{libmad} in
163 \shell{openembeded-core} was higher than the version in \shell{meta-openembedded},
164 unless \shell{PREFERRED\_VERSION\_libmad} was set to the version in \shell{openembedded-core}.
165 There is currently no way to prefer a version of a lower priority layer, if the
166 same version is present in a higher priority layer.
168 \subsubsection{openembedded-core and meta-openembedded}
169 These directories contain copies of Git repositories from git.openembedded.org, including
170 the OpenEmbedded-Core layer ("meta") and the OpenEmbedded layer ("meta-oe"). They get created
171 automatically when building the distribution for the first time.
173 Throughout this document, the combination of these directories will be
174 referred to as OpenEmbedded.
176 \subsubsection{meta-opendreambox}
177 This directory contains:
180 \item Recipes for packages written specifically for the OpenDreambox distribution
181 \item Modifications to recipes from OpenEmbedded
182 \item Recipes for software versions older than those available from OpenEmbedded
183 \item Recipes for software versions newer than those available from OpenEmbedded
186 \subsubsection{meta-bsp}
187 The directory \shell{meta-bsp} contains Board Support Packages (BSP)
188 for the supported Dreambox models. This includes:
191 \item Hardware drivers
192 \item Machine specific overrides
193 \item The Linux kernel
194 \item The boot loader
198 \section{Prerequisites}
199 \label{prerequisites}
201 \subsection{Required software}
203 The OpenEmbedded project provides a general list of prerequisites for
204 many Linux distributions and also for some other operating systems.
207 \item \url{http://www.openembedded.org/index.php/OEandYourDistro}
208 \item \url{http://www.openembedded.org/index.php/Required\_software}
211 It is highly recommended to use Linux to build OpenDreambox. In theory,
212 any recent distribution will do, but not many distributions have been
213 verified to build OpenDreambox without errors. Tested distributions
217 \item Arch Linux 2011.08.19 [amd64]
218 \item Debian 6.0 (Squeeze) [i386]
219 \item Debian "Testing" (Wheezy) [i386]
220 \item Fedora 16 [i386, amd64]
221 \item Ubuntu 10.04 LTS (Lucid Lynx) [i386]
222 \item Ubuntu 10.10 (Maverick Meerkat) [i386]
223 \item Ubuntu 11.10 (Oneiric Ocelot) [amd64]
224 \item Ubuntu 12.04 LTS (Precise Pangolin) [i386, amd64]
227 Distributions known not to work:
230 \item Debian 5.0 (Lenny): Comes with Python 2.5, which is too old.
235 \section{Major changes since previous releases}
237 \subsection{Changes since release 1.6}
239 \item Recipes were split across multiple layers and categorized.
240 \item \shell{env.source} has been replaced by two files,
241 \shell{bitbake.env} and \shell{cross-compile.env}. The former sets a minimal
242 environment that is needed to execute bitbake. The latter creates
243 machine-specific command aliases, in order to compile external software.
244 \item All machines share a common \shell{tmp} directory.
245 \item \shell{\$\{MACHINE\}/build} directories were renamed to \shell{build/\$\{MACHINE\}}.
246 \item Kernel packages were renamed from \shell{linux-\$\{MACHINE\}} to \shell{linux-dreambox}.
247 \item Support for machines based on ATI Xilleon or IBM STB was dropped.
256 \section{Building OpenDreambox}
258 In the top level directory, there is a \shell{Makefile}, which is used to
259 set up build directories and to fetch or update all used repositories.
260 The Makefile can be influenced by environment variables, either
261 by specifing them on the command-line or by storing them in a file called
262 \shell{conf/make.conf}. It is not recommended to edit the \shell{Makefile} directly
263 in order to avoid conflicts with future updates.
265 When the \shell{Makefile} is run for the first time, the following steps will
269 \item Creation of configuration files
271 \item \shell{bitbake.env}
272 \item \shell{conf/opendreambox.conf}
273 \item \shell{build/\$\{MACHINE\}/conf/bblayers.conf}
274 \item \shell{build/\$\{MACHINE\}/conf/local.conf}
276 \item Update or checkout of Git repositories
284 \subsection{Makefile targets}
285 Run \shell{make help} to get a list of targets of the top level Makefile, together with a brief description.
287 \subsection{Configuration variables}
288 \subsubsection{BB\_NUMBER\_THREADS}
289 Controls how many BitBake tasks may run at a time. Defaults to the
290 number of cores available on the build system. The number of cores is
291 obtained from \shell{/proc/cpuinfo}. If this file is unavailable, the
294 \subsubsection{MACHINE}
295 Controls the target machine to build packages for. See section \ref{products}
296 for a list of supported products.
298 \subsubsection{PARALLEL\_MAKE}
299 Controls how many processes per recipe \shell{make} may use. Defaults to
300 the number of cores available on the build system. The number of cores is
301 obtained from \shell{/proc/cpuinfo}. If this file is unavailable, the
304 NOTE: If you see seemingly random build failures, try setting this variable to 1.
306 \subsection{Adding custom layers}
307 \label{custom_layers}
308 It is possible to add custom layers to the build system. This can be done globally
309 and per machine. To add a layer globally, edit \shell{conf/bblayers-ext.conf}. To
310 add a machine-specific layer, edit \shell{conf/bblayers-\$\{MACHINE\}-ext.conf}.
311 Assuming that an additional layer is available at \shell{\$\{HOME\}/custom-layer},
312 the entry to add to the file will look like this:
314 \shell{BBLAYERS =+ "\$\{HOME\}/custom-layer"}
316 \subsection{Adding custom options}
317 It is possible to tweak a lot more options than those used by the
318 \shell{Makefile} by editing \shell{conf/local-ext.conf} or \shell{conf/local-\$\{MACHINE\}-ext.conf}.
320 For example, if the firmware shall use the package feed built on the develoment machine, which
321 happens to be 192.168.1.1 and has a webserver configured to point to \shell{tmp/deploy/ipk},
322 a line like the following may be added:
324 \shell{DISTRO\_FEED\_URI = "http://192.168.1.1/\$\{DISTRO\}/\$\{DISTRO\_VERSION\}"}
326 In general, any variable in OpenEmbedded that uses weak assignment (\shell{?=}) may be
327 overridden from these files.
329 The following sections list some commonly used options.
331 \subsubsection{DISTRO\_FEED\_PREFIX}
333 \shell{DISTRO\_FEED\_PREFIX} specifies the name of the package update feed.
334 This name may be arbitarily chosen.
336 Default: \shell{DISTRO\_FEED\_PREFIX = "remote"}
338 \subsubsection{DISTRO\_FEED\_URI}
340 \shell{DISTRO\_FEED\_URI} specifies the URI of the package update feed.
342 Default: \shell{DISTRO\_FEED\_URI = "http://my-distribution.example/remote-feed/"}
344 \subsubsection{INHERIT}
346 \shell{INHERIT} specifies bbclasses to include from a configuration file. Usually,
347 this variable gets appended to by using the \shell{+=} operator.
349 The OpenDreambox distribution automatically appends \shell{"buildhistory recipe\_sanity testlab"} to \shell{INHERIT}.
351 Default: \shell{INHERIT = ""}
353 \textbf{Some examples:}
355 Always build the latest versions of OpenDreambox-related projects from Git:
357 \shell{INHERIT += "opendreambox-autorev"}
359 Remove temporary files of previous versions of a recipe before a newer version gets built:
361 \shell{INHERIT += "rm\_old\_work"}
363 Remove temporary files of a recipe after it has been built and packaged successfully.
365 \shell{INHERIT += "rm\_work"}
367 \subsection{Setting up a build directory}
368 To set up a build directory for e.g. \textbf{DM 500 HD} run \shell{make MACHINE=dm500hd}. If
369 \shell{MACHINE=dm500hd} has been set in \shell{conf/make.conf}, you can simply run \shell{make}
370 with no arguments instead. This will create and initialize the directory \shell{build/dm500hd}.
372 \subsection{Building a firmware image}
373 To build a firmware image for e.g. \textbf{DM 500 HD} run \shell{make MACHINE=dm500hd image}.
374 If \shell{MACHINE=dm500hd} has been set in \shell{conf/make.conf}, you can simply run
375 \shell{make image} instead.
377 \subsection{Building a package}
378 To build a single package, BitBake has to be used directly. First, the environment
379 has to be set up, in order to make BitBake available to the shell. This can be done
380 with the following command:
382 \shell{source bitbake.env}
384 BitBake must be run from the machine's build directory. For \textbf{DM 500 HD} run:
386 \shell{cd build/dm500hd}
388 In order to build enigma2, run:
390 \shell{bitbake enigma2}.
392 \section{Development hints}
394 \subsection{Cross-compilation of external software}
395 OpenDreambox provides a script called \shell{cross-compile.env}. Once run, the script will create
396 the following commands (shell aliases), aiming to ease cross-compilation of external source trees:
399 \item \shell{oe\_autoreconf} - Calls OE's version of \shell{autoreconf}. Useful for projects based on GNU autotools.
400 \item \shell{oe\_runconf} - Calls \shell{./configure} with parameters suitable for OE. Useful for projects based on GNU autotools.
401 \item \shell{oe\_runmake} - Calls \shell{make} with parameters suitable for OE. Useful for projects based on GNU autotools or GNU make.
402 \item \shell{oe\_env} - Useful to execute arbitrary commands in the OE environment (e.g. \shell{oe\_env env}).
403 \item \shell{oe\_setenv} - Exports the OE environment to the currently running shell session.
406 The script needs to know the target machine, which can be one of the supported products (see \ref{products}). Because the script
407 adds aliases to your currently running shell session, it has to be invoked using \shell{source} or \shell{.} (the dot operator), e.g.:
409 \shell{source cross-compile.env dm7020hd}
411 The script may be called from any location, but must reside inside the OpenDreambox Git tree.
412 You may want to create a symlink to \shell{cross-compile.env} somewhere in your \shell{PATH}.
414 \subsection{Coding style}
415 Run \shell{scripts/do\_stylize.sh} on new recipes to ensure proper coding style.
417 \subsection {Package architecture}
418 Set \shell{PACKAGE\_ARCH = "\$\{MACHINE\_ARCH\}"} if either condition is met:
420 \item The recipe uses \shell{COMBINED\_FEATURES}, \shell{MACHINE\_FEATURES} or \shell{DREAMBOX\_FEATURES}.
421 \item The recipe is part of \shell{meta-bsp}.
424 \section{Bug reports and patches}
426 Please send bug reports and patches to the Enigma2 development mailing list \shell{<enigma2-devel@lists.elitedvb.net>}.
428 A comfortable way to create patches is to use \shell{git format-patch}, after all changes have been committed to your
429 local copy of the repository.