To make the Redox build process more consistent across platforms, we are using Rootless Podman for major parts of the build. Podman is invoked automatically and transparently within the Makefiles.
You can find out more about Podman here.
By default, Podman Build is disabled. The variable
mk/config.mk defaults to zero, so that Podman will not be invoked. If you find that it is enabled but you want it disabled, set
PODMAN_BUILD?=0 in .config, and ensure it is not set in your environment,
Podman is a virtual machine manager that creates containers to execute a virtual machine image. In our case, we are creating an Ubuntu image, with a Rust installation and all the packages needed to build the system.
The build process is performed in your normal working directory, e.g.
~/tryredox/redox. Compilation of the Redox components is performed in the container, but the final Redox image (
build/$ARCH/$CONFIG/livedisk.iso) is constructed using FUSE running directly on your host machine.
PODMAN_BUILD to 1 in .config, on the
make command line (e.g.
make PODMAN_BUILD=1 all) or in the environment (e.g.
export PODMAN_BUILD=1; make all) will cause Podman to be invoked when building.
First, a base image called
redox_base will be constructed, with all the necessary packages for the build. A "home" directory will also be created in
build/podman. This is the home directory of your container alter ego,
poduser. It will contain the
rustup install, and the
.bashrc. This takes some time, but is only done when necessary. The tag file build/container.tag is also created at this time to prevent unnecessary image builds.
make commands are executed in containers built from the base image. The files are constructed in your working directory tree, just as they would for a non-Podman build. In fact, if all necessary packages are installed on your host system, you can switch Podman on and off relatively seamlessly, although there is no benefit to doing so.
The build process is using Podman's
keep-id feature, which allows your regular User ID to be mapped to
poduser in the container. The first time a container is built, it takes some time to set up this mapping. After the first container is built, new containers can be built almost instantly.
If you have already read the Building Redox instructions, but you wish to use Podman Build, follow these steps.
- Make sure you have the
curlcommand. e.g. for Pop!_OS/Ubuntu/Debian:
which curl || sudo apt-get install curl
- Make a directory, get a copy of
podman_bootstrap.shand run it. This will clone the repository and install Podman.
mkdir -p ~/tryredox
curl -sf https://gitlab.redox-os.org/redox-os/redox/raw/master/podman_bootstrap.sh -o podman_bootstrap.sh
time bash -e podman_bootstrap.sh
- Change to the
- Check that the file .config was created in the
redoxbase directory, and contains the line
- Build the system. This will take some time.
time make all
If you already have the source tree, you can use these steps.
- Change to your working directory and get the updates to the build files.
git fetch upstream master
git rebase upstream/master
- Install Podman. Many distros require additional packages. Check the Minimum Installation instructions to see what is needed for your distro. Or, run the following in your
PODMAN_BUILDto 1 and run
make. The first container setup can take 15 minutes or more, but it is comparable in speed to native build after that.
PODMAN_BUILD is properly set for future builds, edit .config in your base
redox directory and change its value.