47 lines
2.1 KiB
Markdown
47 lines
2.1 KiB
Markdown
## Docker Build
|
|
|
|
Docker can be used to perform the build inside a container. This partially isolates
|
|
the build from the host system, and allows using the script on non-debian based
|
|
systems (e.g. Fedora Linux). The isolation is not complete due to the need to use
|
|
some kernel level services for arm emulation (binfmt) and loop devices (losetup).
|
|
|
|
To build:
|
|
|
|
```bash
|
|
vi config # Edit your config file. See above.
|
|
./build-docker.sh
|
|
```
|
|
|
|
If everything goes well, your finished image will be in the `deploy/` folder.
|
|
You can then remove the build container with `docker rm -v pigen_work`
|
|
|
|
If you encounter errors during the build, you can edit the corresponding scripts, and
|
|
continue:
|
|
|
|
```bash
|
|
CONTINUE=1 ./build-docker.sh
|
|
```
|
|
|
|
To examine the container after a failure you can enter a shell within it using:
|
|
|
|
```bash
|
|
sudo docker run -it --privileged --volumes-from=pigen_work pi-gen /bin/bash
|
|
```
|
|
|
|
After successful build, the build container is by default removed. This may be undesired when making incremental changes to a customized build. To prevent the build script from remove the container add
|
|
|
|
```bash
|
|
PRESERVE_CONTAINER=1 ./build-docker.sh
|
|
```
|
|
|
|
There is a possibility that even when running from a docker container, the
|
|
installation of `qemu-user-static` will silently fail when building the image
|
|
because `binfmt-support` _must be enabled on the underlying kernel_. An easy
|
|
fix is to ensure `binfmt-support` is installed on the host machine before
|
|
starting the `./build-docker.sh` script (or using your own docker build
|
|
solution).
|
|
|
|
### Passing arguments to Docker
|
|
|
|
When the docker image is run various required command line arguments are provided. For example the system mounts the `/dev` directory to the `/dev` directory within the docker container. If other arguments are required they may be specified in the PIGEN_DOCKER_OPTS environment variable. For example setting `PIGEN_DOCKER_OPTS="--add-host foo:192.168.0.23"` will add '192.168.0.23 foo' to the `/etc/hosts` file in the container. The `--name`
|
|
and `--privileged` options are already set by the script and should not be redefined. |