2017-08-23 17:46:14 +02:00
|
|
|
## Building Redox using a Docker image with the pre-built toolchain
|
2017-06-24 11:45:21 +02:00
|
|
|
|
2017-08-23 17:46:14 +02:00
|
|
|
*All you need is `git`, `make`, `qemu`, `fuse` and `docker`. The method requires
|
|
|
|
a non-privileged user able to run the `docker` command, which is usually achieved
|
|
|
|
by adding the user to the `docker` group.*
|
2017-06-24 11:45:21 +02:00
|
|
|
|
2017-09-03 16:31:57 +02:00
|
|
|
It's a three-steps process with variations depending on the platform.
|
|
|
|
On the first execution of one of the following docker commands, the
|
|
|
|
official container image will be pulled from dockerhub and stored
|
|
|
|
locally.
|
|
|
|
|
|
|
|
The image includes the required dependencies and the pre-built
|
|
|
|
toolchain. As long as you rely on this particular dependencies and
|
|
|
|
toolchain versions, you don't need to update the container.
|
2017-08-23 17:46:14 +02:00
|
|
|
|
|
|
|
### <a name='get_the_sources'></a>Get the sources
|
|
|
|
```
|
|
|
|
git clone https://github.com/redox-os/redox.git ; cd redox
|
|
|
|
```
|
|
|
|
|
|
|
|
### Upate the source tree
|
|
|
|
Note: if you use the container on a different host or
|
|
|
|
with a different user, [get the sources first](#get_the_sources).
|
|
|
|
```shell
|
2017-08-12 01:53:51 +02:00
|
|
|
git pull --rebase --recurse-submodules && git submodule sync \
|
2017-08-23 17:46:14 +02:00
|
|
|
&& git submodule update --recursive --init
|
|
|
|
```
|
2017-07-24 00:29:33 +02:00
|
|
|
|
2017-08-23 17:46:14 +02:00
|
|
|
### Run the container to build Redox
|
|
|
|
```shell
|
|
|
|
docker run --cap-add MKNOD --cap-add SYS_ADMIN --device /dev/fuse \
|
|
|
|
-e LOCAL_UID="$(id -u)" -e LOCAL_GID="$(id -g)" \
|
2017-09-02 21:51:46 +02:00
|
|
|
-v redox-"$(id -u)-$(id -g)"-cargo:/usr/local/cargo \
|
|
|
|
-v redox-"$(id -u)-$(id -g)"-rustup:/usr/local/rustup \
|
2017-09-03 16:31:57 +02:00
|
|
|
-v "$(pwd):$(pwd)" -w "$(pwd)" --rm redoxos/redox make fetch all
|
2017-08-23 22:09:24 +02:00
|
|
|
```
|
2017-09-03 16:31:57 +02:00
|
|
|
#### Linux with security modules
|
2017-08-23 17:46:14 +02:00
|
|
|
Add the following options depending on the security modules activated on your system:
|
|
|
|
```shell
|
2017-08-23 22:09:24 +02:00
|
|
|
--security-opt label=disable // disable SELinux
|
|
|
|
--security-opt seccomp=unconfined // disable seccomp
|
|
|
|
--security-opt apparmor=unconfined // disable AppArmor
|
|
|
|
```
|
2017-08-23 17:46:14 +02:00
|
|
|
Ex.: for a SELinux only system such as Fedora or CentOS
|
|
|
|
```shell
|
|
|
|
docker run --cap-add MKNOD --cap-add SYS_ADMIN --device /dev/fuse \
|
2017-07-24 17:15:45 +02:00
|
|
|
-e LOCAL_UID="$(id -u)" -e LOCAL_GID="$(id -g)" \
|
2017-08-29 18:08:52 +02:00
|
|
|
--security-opt label=disable \
|
2017-09-02 21:51:46 +02:00
|
|
|
-v redox-"$(id -u)-$(id -g)"-cargo:/usr/local/cargo \
|
|
|
|
-v redox-"$(id -u)-$(id -g)"-rustup:/usr/local/rustup \
|
2017-09-03 16:31:57 +02:00
|
|
|
-v "$(pwd):$(pwd)" -w "$(pwd)" --rm redoxos/redox make fetch all
|
2017-07-24 00:29:33 +02:00
|
|
|
```
|
2017-09-02 22:17:17 +02:00
|
|
|
### Run the container interactively
|
|
|
|
```shell
|
|
|
|
docker run --cap-add MKNOD --cap-add SYS_ADMIN --device /dev/fuse \
|
|
|
|
-e LOCAL_UID="$(id -u)" -e LOCAL_GID="$(id -g)" \
|
|
|
|
-v redox-"$(id -u)-$(id -g)"-cargo:/usr/local/cargo \
|
|
|
|
-v redox-"$(id -u)-$(id -g)"-rustup:/usr/local/rustup \
|
2017-09-03 16:31:57 +02:00
|
|
|
-v "$(pwd):$(pwd)" -w "$(pwd)" --rm -it redoxos/redox
|
2017-09-02 22:17:17 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Demo
|
|
|
|

|
2017-08-29 18:08:52 +02:00
|
|
|
|
2017-09-03 16:31:57 +02:00
|
|
|
### Clear the named volumes containing the toolchain caches
|
2017-08-29 18:08:52 +02:00
|
|
|
```shell
|
2017-09-02 21:51:46 +02:00
|
|
|
docker volume rm redox-"$(id -u)-$(id -g)"-cargo \
|
|
|
|
redox-"$(id -u)-$(id -g)"-rustup
|
2017-08-29 18:08:52 +02:00
|
|
|
```
|
2017-09-03 16:31:57 +02:00
|
|
|
|
|
|
|
### Build the container manually
|
|
|
|
If you cannot access dockerhub for whatever reason, you can also build
|
|
|
|
the container image manually.
|
|
|
|
```shell
|
|
|
|
docker build -t redoxos/redox docker/
|
|
|
|
```
|