53 lines
2.5 KiB
Markdown
53 lines
2.5 KiB
Markdown
|
+++
|
||
|
title = "Using OS containers for OpenEmbedded build"
|
||
|
date = 2015-06-02
|
||
|
+++
|
||
|
|
||
|
As a user of Arch Linux on laptop and on the server which gets used for OpenEmbedded builds, OpenEmbedded doesn't exactly like rolling release distros. Somehow for whatever reason, current builds just fail. Remember facing the problem when using Arch and learning OpenEmbedded iin the early days which lead to the first OpenEmbedded post. Why? Not having the time to debug such a thing, there was another solution at hand.
|
||
|
|
||
|
The solution is to use a `chroot` jail or when having systemd as init, that would be resorting to the use of `systemd-nspawn`. So lets get on how to set up an environment which can be used for builds. Assuming one has yaourt installed,
|
||
|
|
||
|
```bash
|
||
|
yaourt -S debootstrap
|
||
|
mkdir ~/debian-root
|
||
|
sudo debootstrap --arch=amd64 --variant=minbase jessie ~/debian-root
|
||
|
sudo systemd-nspawn -D debian-root
|
||
|
```
|
||
|
|
||
|
The third command is gonna take a while. After running the last command, one would be inside the `chroot` jail as a root user. After that run the following.
|
||
|
|
||
|
```bash
|
||
|
apt-get install update
|
||
|
apt-get install sudo
|
||
|
adduser -uid 1000 -gid 100 username
|
||
|
visudo
|
||
|
su username
|
||
|
```
|
||
|
|
||
|
Assume you know what to add after running `visudo`, basically add yourself to the `sudoers` file. To get the user id and group id for the `adduser` command, run "id" on host. The last command drops you in the home directory for the newly created user. Whenever wanting to work on OpenEmbedded, just use `systemd-nspawn` to log in to the Debian environment. This environment can be kept for as long one likes to maintain the build setup while the normal user space can be updated without fear of breaking the build. One can replicate the exact Debian environment by just copying the complete Debian root directory using something like `rsync` to any number of your machines.
|
||
|
|
||
|
Also do note that Debian isn't the only one you can use. One can do this for Fedora, Arch, and probably other distros too.
|
||
|
|
||
|
Output from the Debian root environment.
|
||
|
|
||
|
```bash
|
||
|
sanchayan@debian-root:~/oe-core/build$ uname -a
|
||
|
Linux debian-root 4.0.0-ck1-bfs-ck+ #8 SMP PREEMPT Wed Apr 29 11:35:34 IST 2015 x86_64 GNU/Linux
|
||
|
sanchayan@debian-root:~/oe-core/build$ pwd
|
||
|
/home/sanchayan/oe-core/build
|
||
|
```
|
||
|
|
||
|
Output of `machinectl` from the host.
|
||
|
|
||
|
```bash
|
||
|
machinectl
|
||
|
MACHINE CLASS SERVICE
|
||
|
debian-root container nspawn
|
||
|
|
||
|
1 machines listed.
|
||
|
```
|
||
|
|
||
|
[systemd for Administrators](http://0pointer.net/blog/archives.html) series should be interesting to you.
|
||
|
|
||
|
Do have a look at the man pages for `systemd-nspawn` and `machinectl`.
|