ELBE Overview: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
First part of rework done, the rework is currently inside a comment
No edit summary
Line 1: Line 1:
<div id="header">
<div id="header">
<!-- <big>'''This site is being reworked at the moment!'''</big>
<big>'''This site is being reworked at the moment!'''</big>


ELBE (Embedded Linux Build Environment) is a system to generate root-filesystems for embedded devices.
ELBE (Embedded Linux Build Environment) is a system to generate root-filesystems for embedded devices. This is only a short explanation what ELBE is and a brief tutorial for using ELBE, '''please go to the [https://elbe-rfs.org/docs/sphinx/index.html official documentation of ELBE] for a detailed documentation'''. This article was made when version 12.4 was the current version of ELBE.


==Overview==
==Overview==
ELBE uses a virtual machine to create root-filesystems, this VM is called "initvm". At the first time of running ELBE the initvm has to be initialized (a complete automatic installation of Debian is made), subsequent runs of ELBE can reuse that initvm.
ELBE uses a virtual machine to create root-filesystems, this VM is called "initvm". At the first time of running ELBE the initvm has to be initialized (a complete automatic installation of Debian is made), subsequent runs of ELBE can reuse that initvm.


Recepies what a built root-filesystem should contain are supplied in form of a xml-file. ELBE doesn't build the software for the root-filesystem, it does instead use pre-built software from the official Debian repository. Resulting root-filesystems are customized Debian installations, which can be maintained through Debian's tools like APT. This is the biggest difference of ELBE to other buildsystems like Yocto or Buildroot.
[[File:ELBE Build schema.png|frame|none|Basic structure of ELBE building a root-filesystem (as of version 12.4). Orange are inputs for ELBE, green are things that the result of ELBE. "<tt>buildenv.img</tt>" is a special case because the initvm is created at "elbe initvm create" and it is reused by "elbe initvm submit". Loosely based on both diagrams at https://elbe-rfs.org/docs/sphinx/releases_v12.4/article-elbeoverview-en.html#overview]]
 
Recepies what a built root-filesystem should contain are supplied in form of a xml-file. ELBE doesn't build the software for the root-filesystem, it does instead use pre-built software in form of Debian packages (.deb). Usually the official Debian repositories are used, but it is possible to use custom repositories to get special packages into the root-filesystem. Resulting root-filesystems are basicly customized Debian installations, which can be maintained through Debian's tools like APT. This is the biggest difference of ELBE to other buildsystems like Yocto or Buildroot.


It is possible to define "finetuning"-commands in the xml-file, which are executed when the creation of the root-filesystem is completed. With this it is possible to remove files, add additional users and much more ...
It is possible to define "finetuning"-commands in the xml-file, which are executed when the creation of the root-filesystem is completed. With this it is possible to remove files, add additional users and much more ...
Xml-files can be appended with a bzip2 compressed archive. At the end of the buildprocess, the content of the archive will be extracted into the root-filesystem.
The form of the finished root-filesystem is customizeable. The following variants are possible:
* Tarball: The root-filesystem can be packed as a tarball (usually compressed with gzip). The tarball can be extracted onto an empty partition.
* Disk-/SD-card-image: An image with full partition table can be created. This can be a image of a hard disk or a sd-card. The size, type, label and mountpoint of each partition can be customized via the xml-file.
* UBIFS-Image: ELBE can output images for "Unsorted Block Image"-devices (UBI). In the case of our DHSOM modules this can be raw NAND-Flash. More information about that type of filesystem can be found under [[UBI/UBIFS Filesystem]].
As an addition ELBE is able to create a cdrom image which can be used as a input to reconstruct the exact root-filesystem that was created.
ELBE can also create a Software Development Kit (SDK) for the built root-filesystem. The SDK contains the toolchain with the cross compiler and other tools and the corresponding sysroot with needed headers. These can be used to create software for the spefific root-filesystem. The SDK is very similar to Yocto's Standard-SDK and can be used in the same way. An explanation how to use the SDK with some IDEs/buildsystems can be found here: ''Link following''
==Installation==
There are multiple ways to install ELBE:
===Debian Package===
The developers of ELBE have their own package repository which can be used to install ELBE.
To add the repository to the <tt>/etc/apt/sources.list.d</tt> directory and install the public key for the repo:
<tt>echo 'deb http://debian.linutronix.de/elbe buster main' >> /etc/apt/sources.list.d/elbe.list
wget http://debian.linutronix.de/elbe/elbe-repo.pub && apt-key add elbe-repo.pub</tt>
Now you can install ELBE with:
<tt>apt update
apt install elbe</tt>
'''Important''': You have to add your user to the libvirt groups if you want to use ELBE without root:
<tt>adduser <user> libvirt && adduser <user> libvirt-qemu</tt>
===Cloning the git repository of ELBE===
There is also the possibility to clone the git repository of ELBE. To do this the following packages have to be installed on the system:
<tt>apt install python python-debian python-mako python-lxml python-apt python-gpg python-suds python-libvirt qemu-utils qemu-kvm p7zip-full make libvirt-daemon libvirt-daemon-system libvirt-clients</tt>
Then you can clone the repo with:
<tt>git clone https://github.com/Linutronix/elbe</tt>
'''Important''': You have to add your user to the libvirt groups if you want to use ELBE without root:
<tt>adduser <user> libvirt && adduser <user> libvirt-qemu</tt>
==Usage==
The ELBE system consists of the program elbe which is implemented in Python. Similar to git, it can be called with several sub commands. If you installed ELBE through the Debian package, the program is inside your PATH environment and can be called by "<tt>elbe</tt>", else you have to call it by the complete path. The most important commands are:
<tt>elbe initvm create --directory /example example.xml</tt>
This command initializes a new initvm in the directory "/example" and builds a new root-filesystem based on "example.xml" . This command can only be used if there isn't any initvm defined yet. If you cloned ELBE from git, you can add the switch "<tt>--devel</tt>", then ELBE copies the local ELBE version into the initvm (instead of downloading ELBE from their repository).
<tt>elbe initvm submit --directory /example example.xml</tt>
This command builds a new root-filesystem based on "example.xml" and reuses an existing initvm at the directory "/example".
<tt>elbe chg_archive example.xml example-archive.tar.bz2</tt>
This command appends the xml-file "example.xml" with the archive "example-archive.tar.bz2". The binary content of the archive is stored in BASE64 encoding inside a xml tag.
If you add  <tt>--build-sdk</tt> at the "<tt>intvm create/submit</tt>"-command then as an addition to creating the root-filesystem, the SDK (for developing software for the root-filesystem) is created too.
==XML-Example==
This is a simple example for a xml file. If you start the build process a root-filesystem for a device of the "ARM EABI with hard float"-architecture (usually ARMv7) based on Debian 10 is built. In extra to the main mirror, the security and buster-updates mirror is also configured, so that the root-filesystem can get security updates. After the package installation is finished, the cached Debian package files are removed to slim down the image. At the end, the finished root-filesystem is packed into gzip-compressed tarball "<tt>rootfs.tar.gz</tt>". Note that the resulting root-filesystem has no kernel, bootloader and device tree, these have to be supplied externally.
<tt>'''<font color="#0000FF"><ns0:RootFileSystem</font>''' <font color="#009900">xmlns:ns0</font><font color="#990000"><nowiki>=</nowiki></font><font color="#FF0000">"https://www.linutronix.de/projects/Elbe"</font>
        <font color="#009900">xmlns:xsi</font><font color="#990000"><nowiki>=</nowiki></font><font color="#FF0000">"http://www.w3.org/2001/XMLSchema-instance"</font>
        <font color="#009900">created</font><font color="#990000"><nowiki>=</nowiki></font><font color="#FF0000">"2009-05-20T08:50:56"</font> <font color="#009900">revision</font><font color="#990000"><nowiki>=</nowiki></font><font color="#FF0000">"4"</font>
        <font color="#009900">xsi:schemaLocation</font><font color="#990000"><nowiki>=</nowiki></font><font color="#FF0000">"https://www.linutronix.de/projects/Elbe dbsfed.xsd"</font>'''<font color="#0000FF">></font>'''
        '''<font color="#0000FF"><project></font>'''
                '''<font color="#0000FF"><name></font>'''armhf-example'''<font color="#0000FF"></name></font>'''
                '''<font color="#0000FF"><version></font>'''1.0'''<font color="#0000FF"></version></font>'''
                '''<font color="#0000FF"><buildtype></font>'''armhf'''<font color="#0000FF"></buildtype></font>'''
                '''<font color="#0000FF"><mirror></font>'''
                        '''<font color="#0000FF"><primary_host></font>'''ftp.de.debian.org'''<font color="#0000FF"></primary_host></font>'''
                        '''<font color="#0000FF"><primary_path></font>'''/debian'''<font color="#0000FF"></primary_path></font>'''
                        '''<font color="#0000FF"><primary_proto></font>'''http'''<font color="#0000FF"></primary_proto></font>'''
                        '''<font color="#0000FF"><url_list></font>'''
                                '''<font color="#0000FF"><url></font>'''
                                        '''<font color="#0000FF"><<nowiki />source></font>'''http://security.debian.org/debian-security buster/updates main'''<font color="#0000FF"></source></font>'''
                                        '''<font color="#0000FF"><binary></font>'''http://security.debian.org/debian-security buster/updates main'''<font color="#0000FF"></binary></font>'''
                                '''<font color="#0000FF"></url></font>'''
                                '''<font color="#0000FF"><url></font>'''
                                        '''<font color="#0000FF"><<nowiki />source></font>'''http://ftp.de.debian.org/debian buster-updates main'''<font color="#0000FF"></source></font>'''
                                        '''<font color="#0000FF"><binary></font>'''http://ftp.de.debian.org/debian buster-updates main'''<font color="#0000FF"></binary></font>'''
                                '''<font color="#0000FF"></url></font>'''
                        '''<font color="#0000FF"></url_list></font>'''
                '''<font color="#0000FF"></mirror></font>'''
                '''<font color="#0000FF"><suite></font>'''buster'''<font color="#0000FF"></suite></font>'''
        '''<font color="#0000FF"></project></font>'''
        '''<font color="#0000FF"><target></font>'''
                '''<font color="#0000FF"><hostname></font>'''armhf-example'''<font color="#0000FF"></hostname></font>'''
                '''<font color="#0000FF"><passwd></font>'''foo'''<font color="#0000FF"></passwd></font>'''
                '''<font color="#0000FF"><console></font>'''ttyS0,115200'''<font color="#0000FF"></console></font>'''
                '''<font color="#0000FF"><package></font>'''
                        '''<font color="#0000FF"><tar></font>'''
                                '''<font color="#0000FF"><name></font>'''rootfs.tar.gz'''<font color="#0000FF"></name></font>'''
                        '''<font color="#0000FF"></tar></font>'''
                '''<font color="#0000FF"></package></font>'''
                '''<font color="#0000FF"><finetuning></font>'''
                        '''<font color="#0000FF"><rm></font>'''/var/cache/apt/archives/*.deb'''<font color="#0000FF"></rm></font>'''
                '''<font color="#0000FF"></finetuning></font>'''
                '''<font color="#0000FF"><pkg-list></font>'''
                        '''<font color="#0000FF"><pkg></font>'''bash'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''less'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''git'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''openssh-server'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''nfs-common'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''curl'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''vim'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''iperf3'''<font color="#0000FF"></pkg></font>'''
                        '''<font color="#0000FF"><pkg></font>'''i2c-tools'''<font color="#0000FF"></pkg></font>'''
                '''<font color="#0000FF"></pkg-list></font>'''
        '''<font color="#0000FF"></target></font>'''
'''<font color="#0000FF"></ns0:RootFileSystem></font>'''</tt>


==Further Reading==
==Further Reading==
* [https://elbe-rfs.org/ ELBE homepage]
* [https://elbe-rfs.org/ ELBE homepage]
* [https://elbe-rfs.org/docs/sphinx/index.html Documentation of the ELBE version]
* [https://elbe-rfs.org/docs/sphinx/index.html Official documentation of the current ELBE version]
* [https://github.com/Linutronix/elbe ELBE repository at Github] -->
* [https://github.com/Linutronix/elbe ELBE repository at Github]
 
<!--
The Embedded Linux Build Environment (elbe) is a system to generate root-filesystems for embedded devices. For the latest documentation and version please have a look at [https://github.com/Linutronix/elbe https://github.com/Linutronix/elbe]. The following tutorial was made to get started with elbe 0.3.1 which was used to build debian '''''squeeze'''''
The Embedded Linux Build Environment (elbe) is a system to generate root-filesystems for embedded devices. For the latest documentation and version please have a look at [https://github.com/Linutronix/elbe https://github.com/Linutronix/elbe]. The following tutorial was made to get started with elbe 0.3.1 which was used to build debian '''''squeeze'''''


Line 773: Line 882:
|}
|}


</div></div></div></div>
</div></div></div>
-->
</div>

Revision as of 14:06, 25 June 2020