2 % Copyright (c) 2010-2014 Dream Property 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 Property GmbH}.
59 OpenDreambox is based on the \href{http://www.openembedded.org/}{OpenEmbedded} build framework, which
60 uses BitBake to transform build instructions into
61 distributable firmare images and software packages.
63 The current version, OpenDreambox 2.2, is based on the \href{http://www.yoctoproject.org}{Yocto Project}, release
64 1.5 "Dora", an umbrella project for OpenEmbedded and related tools.
67 \subsection{Target audience}
69 Developers familiar with previous versions of OpenDreambox or OpenEmbedded
73 \subsection{Supported products}
76 The current version includes support for the following machines:
78 \begin{tabular}{ | l | l | }
80 \textbf{Product name} & \textbf{Environment variable} \\ \hline
82 DM 500 HD & \shell{MACHINE=dm500hd} \\
83 DM 800 HD SE & \shell{MACHINE=dm800se} \\
84 DM 7020 HD & \shell{MACHINE=dm7020hd} \\
85 DM 8000 HD PVR & \shell{MACHINE=dm8000} \\
94 Copyright (c) 2010-2014 Dream Property GmbH, Germany
95 http://www.dream-multimedia-tv.de/
97 Andreas Frisch <fraxinas@opendreambox.org>
98 Andreas Monzner <ghost@opendreambox.org>
99 Andreas Oberritter <obi@opendreambox.org>
100 Mladen Horvat <acid-burn@opendreambox.org>
101 Stefan Pluecken <thedoc@opendreambox.org>
102 Stephan Reichholf <reichi@opendreambox.org>
104 Permission is hereby granted, free of charge, to any person obtaining a copy
105 of this software and associated documentation files (the "Software"), to deal
106 in the Software without restriction, including without limitation the rights
107 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
108 copies of the Software, and to permit persons to whom the Software is
109 furnished to do so, subject to the following conditions:
111 The above copyright notice and this permission notice shall be included in
112 all copies or substantial portions of the Software.
114 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
115 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
116 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
117 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
118 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
119 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
123 \subsection{Obtaining the source code}
124 OpenDreambox uses the Git version control system. To obtain the source
125 code, it is required to install Git. See \url{http://git-scm.com/}.
127 To initially download the source into the current directory, issue the
130 \shell{git clone -b dora git://git.opendreambox.org/git/opendreambox.git}
132 The Git repository can be viewed online at:
134 \url{http://cgit.opendreambox.org/opendreambox.git}
136 \subsection{Quick start}
139 \shell{make -C opendreambox image}
141 If this command fails, prerequisites my be missing. See section \ref{prerequisites}.
143 \subsection{Directory structure}
144 OpenDreambox consists of a set of layers containing build instructions.
145 This meta data is used by BitBake to download and compile source code
146 and to assemble installable software packages and firmware images.
148 Currently, there are eight layers, ordered by priority from highest to
152 \item \shell{meta-bsp/\$\{MACHINE\}}
153 \item \shell{meta-bsp/common}
154 \item \shell{meta-opendreambox}
155 \item \shell{meta-openembedded/meta-oe}
156 \item \shell{meta-openembedded/meta-filesystems}
157 \item \shell{meta-openembedded/meta-multimedia}
158 \item \shell{meta-openembedded/meta-networking}
159 \item \shell{openembedded-core/meta}
162 If a recipe for the same package exists in multiple layers,
163 then the higher priority layer takes precedence over the lower priority
166 For example, if \shell{libmad\_0.15.1b.bb} existed in both
167 \shell{meta-openembedded} and \shell{openembedded-core}, the recipe in
168 \shell{meta-openembedded} would be used, because \shell{openembedded-core}
171 \textbf{NOTE:} This would still be true even if the version of \shell{libmad} in
172 \shell{openembeded-core} was higher than the version in \shell{meta-openembedded},
173 unless \shell{PREFERRED\_VERSION\_libmad} was set to the version in \shell{openembedded-core}.
174 There is currently no way to prefer a version of a lower priority layer, if the
175 same version is present in a higher priority layer.
177 \subsubsection{openembedded-core and meta-openembedded}
178 These directories contain copies of Git repositories from git.openembedded.org,
179 including the OpenEmbedded-Core layer and the (Meta-)OpenEmbedded layers. They
180 get created automatically when building the distribution for the first time.
182 Throughout this document, the combination of these directories will be
183 referred to as OpenEmbedded.
185 The latest changes to these Git repositories can be seen at:
187 \url{http://git.openembedded.org/openembedded-core-contrib/log/?h=obi/dora}
189 \url{http://git.openembedded.org/meta-openembedded-contrib/log/?h=obi/dora}
191 \subsubsection{meta-opendreambox}
192 This directory contains:
195 \item Recipes for packages written specifically for the OpenDreambox distribution
196 \item Modifications to recipes from OpenEmbedded
197 \item Recipes for software versions older than those available from OpenEmbedded
198 \item Recipes for software versions newer than those available from OpenEmbedded
201 \subsubsection{meta-bsp}
202 The directory \shell{meta-bsp} contains Board Support Packages (BSP)
203 for the supported Dreambox models. This includes:
206 \item Hardware drivers
207 \item Machine specific overrides
208 \item The Linux kernel
209 \item The boot loader
213 \section{Prerequisites}
214 \label{prerequisites}
216 \subsection{Required software}
218 The OpenEmbedded project provides a general list of prerequisites for
219 many Linux distributions and also for some other operating systems.
222 \item \url{http://www.openembedded.org/wiki/Getting\_started#Required\_software}
225 It is highly recommended to use Linux to build OpenDreambox. In theory,
226 any recent distribution will do, but not many distributions have been
227 verified to build OpenDreambox without errors. Tested distributions
231 \item Debian 7.2 "Wheezy" [amd64]
232 \item Ubuntu 13.04 "Raring Ringtail" [amd64]
235 Distributions known not to work:
238 \item Debian 5.0 (Lenny): Comes with Python 2.5, which is too old.
243 \section{Major changes since previous public releases}
245 \subsection{Changes since release 1.6}
247 \item Recipes were split across multiple layers and categorized.
248 \item \shell{env.source} has been replaced by two files,
249 \shell{bitbake.env} and \shell{cross-compile.env}. The former sets a minimal
250 environment that is needed to execute bitbake. The latter creates
251 machine-specific command aliases, in order to compile external software.
252 \item All machines share a common \shell{tmp} directory.
253 \item \shell{\$\{MACHINE\}/build} directories were renamed to \shell{build/\$\{MACHINE\}}.
254 \item Kernel packages were renamed from \shell{linux-\$\{MACHINE\}} to \shell{linux-dreambox}.
255 \item Support for machines based on ATI Xilleon or IBM STB was dropped.
258 \subsection{Changes since release 2.0}
260 \item If a recipe changes, the corresponding packages will be rebuilt automatically,
261 in contrast to required manual PR bumps in the past.
262 \item Each machine uses its own tmp directory again, like before 2.0. However,
263 there is a shared \shell{sstate-cache}, which allows to share already compiled
264 data between compatible machines. This impacts performance and size of the
265 build system, but improves reliability and consistency across builds.
266 \item Support for machines without FPU and kernel versions below 3.x was dropped (DM800).
269 \section{Known Issues}
272 \item \textbf{Problem:} qt4-native may fail to build with
274 \shell{error: one or more PCH files were found, but they were invalid}
276 \textbf{Solution:} \shell{bitbake -ccleansstate qt4-native}
281 \section{Building OpenDreambox}
283 In the top level directory, there is a \shell{Makefile}, which is used to
284 set up build directories and to fetch or update all used repositories.
285 The Makefile can be influenced by environment variables, either
286 by specifing them on the command-line or by storing them in a file called
287 \shell{conf/make.conf}. It is not recommended to edit the \shell{Makefile} directly
288 in order to avoid conflicts with future updates.
290 When the \shell{Makefile} is run for the first time, the following steps will
294 \item Creation of configuration files
296 \item \shell{bitbake.env}
297 \item \shell{conf/opendreambox.conf}
298 \item \shell{build/\$\{MACHINE\}/conf/bblayers.conf}
299 \item \shell{build/\$\{MACHINE\}/conf/local.conf}
301 \item Update or checkout of Git repositories
309 \subsection{Makefile targets}
310 Run \shell{make help} to get a list of targets of the top level Makefile, together with a brief description.
312 \subsection{Configuration variables}
313 \subsubsection{BB\_NUMBER\_THREADS}
314 Controls how many BitBake tasks may run at a time. Defaults to the
315 number of cores available on the build system. The number of cores is
316 obtained from \shell{/proc/cpuinfo}. If this file is unavailable, the
319 \subsubsection{MACHINE}
320 Controls the target machine to build packages for. See section \ref{products}
321 for a list of supported products.
323 \subsubsection{PARALLEL\_MAKE}
324 Controls how many processes per recipe \shell{make} may use. Defaults to
325 the number of cores available on the build system. The number of cores is
326 obtained from \shell{/proc/cpuinfo}. If this file is unavailable, the
329 NOTE: If you see seemingly random build failures, try setting this variable to 1.
331 \subsection{Adding custom layers}
332 \label{custom_layers}
333 It is possible to add custom layers to the build system. This can be done globally
334 and per machine. To add a layer globally, edit \shell{conf/bblayers-ext.conf}. To
335 add a machine-specific layer, edit \shell{conf/bblayers-\$\{MACHINE\}-ext.conf}.
336 Assuming that an additional layer is available at \shell{\$\{HOME\}/custom-layer},
337 the entry to add to the file will look like this:
339 \shell{BBLAYERS =+ "\$\{HOME\}/custom-layer"}
341 \subsection{Adding custom options}
342 It is possible to tweak a lot more options than those used by the
343 \shell{Makefile} by editing \shell{conf/local-ext.conf} or \shell{conf/local-\$\{MACHINE\}-ext.conf}.
345 For example, if the firmware shall use the package feed built on the develoment machine, which
346 happens to be 192.168.1.1 and has a webserver configured to point to \shell{tmp/deploy/ipk},
347 a line like the following may be added:
349 \shell{DISTRO\_FEED\_URI = "http://192.168.1.1/\$\{DISTRO\}/\$\{DISTRO\_VERSION\}"}
351 In general, any variable in OpenEmbedded that uses weak assignment (\shell{?=}) may be
352 overridden from these files.
354 The following sections list some commonly used options.
356 \subsubsection{DISTRO\_FEED\_PREFIX}
358 \shell{DISTRO\_FEED\_PREFIX} specifies the name of the package update feed.
359 This name may be arbitarily chosen.
361 Default: \shell{DISTRO\_FEED\_PREFIX = "remote"}
363 \subsubsection{DISTRO\_FEED\_URI}
365 \shell{DISTRO\_FEED\_URI} specifies the URI of the package update feed.
367 Default: \shell{DISTRO\_FEED\_URI = "http://my-distribution.example/remote-feed/"}
369 \subsubsection{INHERIT}
371 \shell{INHERIT} specifies bbclasses to include from a configuration file. Usually,
372 this variable gets appended to by using the \shell{+=} operator.
374 The OpenDreambox distribution automatically appends \shell{"buildhistory recipe\_sanity"} to \shell{INHERIT}.
376 Default: \shell{INHERIT = ""}
378 \textbf{Some examples:}
380 Always build the latest versions of OpenDreambox-related projects from Git:
382 \shell{INHERIT += "opendreambox-autorev"}
384 Remove temporary files of previous versions of a recipe before a newer version gets built:
386 \shell{INHERIT += "rm\_old\_work"}
388 \subsection{Setting up a build directory}
389 To set up a build directory for e.g. \textbf{DM 7020 HD} run \shell{make MACHINE=dm7020hd}. If
390 \shell{MACHINE=dm7020hd} has been set in \shell{conf/make.conf} (default), you can simply run \shell{make}
391 with no arguments instead. This will create and initialize the directory \shell{build/dm7020hd}.
393 \subsection{Building a firmware image}
394 To build a firmware image for e.g. \textbf{DM 7020 HD} run \shell{make MACHINE=dm7020hd image}.
395 If \shell{MACHINE=dm7020hd} has been set in \shell{conf/make.conf} (default), you can simply run
396 \shell{make image} instead.
398 \subsection{Building a package}
399 To build a single package, BitBake has to be used directly. First, the environment
400 has to be set up, in order to make BitBake available to the shell. This can be done
401 with the following command:
403 \shell{source bitbake.env}
405 BitBake must be run from the machine's build directory. For \textbf{DM 7020 HD} run:
407 \shell{cd build/dm7020hd}
409 In order to build enigma2, run:
411 \shell{bitbake enigma2}.
413 \section{Development hints}
415 \subsection{Cross-compilation of external software}
416 OpenDreambox provides a script called \shell{cross-compile.env}. Once run, the script will create
417 the following commands (shell aliases), aiming to ease cross-compilation of external source trees:
420 \item \shell{oe\_autoreconf} - Calls OE's version of \shell{autoreconf}. Useful for projects based on GNU autotools.
421 \item \shell{oe\_runconf} - Calls \shell{./configure} with parameters suitable for OE. Useful for projects based on GNU autotools.
422 \item \shell{oe\_runmake} - Calls \shell{make} with parameters suitable for OE. Useful for projects based on GNU autotools or GNU make.
423 \item \shell{oe\_env} - Useful to execute arbitrary commands in the OE environment (e.g. \shell{oe\_env env}).
424 \item \shell{oe\_setenv} - Exports the OE environment to the currently running shell session.
427 The script needs to know the target machine, which can be one of the supported products (see \ref{products}). Because the script
428 adds aliases to your currently running shell session, it has to be invoked using \shell{source} or \shell{.} (the dot operator), e.g.:
430 \shell{source cross-compile.env dm7020hd}
432 The script may be called from any location, but must reside inside the OpenDreambox Git tree.
433 You may want to create a symlink to \shell{cross-compile.env} somewhere in your \shell{PATH}.
435 \subsection{Coding style}
436 Run \shell{scripts/do\_stylize.sh} on new recipes to ensure proper coding style.
438 \subsection {Package architecture}
439 Set \shell{PACKAGE\_ARCH = "\$\{MACHINE\_ARCH\}"} if either condition is met:
441 \item The recipe uses \shell{COMBINED\_FEATURES}, \shell{MACHINE\_FEATURES} or \shell{DREAMBOX\_FEATURES}.
442 \item The recipe is part of \shell{meta-bsp}.
445 \section{Bug reports and patches}
447 Please send bug reports and patches to the Enigma2 development mailing list \shell{<enigma2-devel@lists.elitedvb.net>}.
449 A comfortable way to create patches is to use \shell{git format-patch}, after all changes have been committed to your
450 local copy of the repository.