From Nothing To Hello World
This page explains the most quick way to test a program on Redox, this tutorial don't build Redox from source.
In this example we will use a "Hello World" program written in Rust.
- Download the script to bootstrap Podman and download the Redox build system
curl -sf https://gitlab.redox-os.org/redox-os/redox/raw/master/podman_bootstrap.sh -o podman_bootstrap.sh
- Execute the downloaded script
time bash -e podman_bootstrap.sh
- Enable the Rust toolchain on the current shell
source ~/.cargo/env
- Change the active directory to the Redox build system directory
cd ~/tryredox/redox
- Create the
.config
file and add theREPO_BINARY
environment variable to enable the binary-mode
echo "REPO_BINARY?=1" >> .config
- Create the
hello-world
recipe folder
mkdir cookbook/recipes/other/hello-world
- Create the
source
folder of the recipe
mkdir cookbook/recipes/other/hello-world/source
- Change the active directory to the
source
folder
cd cookbook/recipes/other/hello-world/source
- Create a Cargo project with the "Hello World" string
cargo init --name="hello-world"
- Create the
hello-world
recipe configuration
nano cookbook/recipes/other/hello-world/recipe.toml
- Add the recipe configuration text
[source]
path = "/source"
[build]
template = "cargo"
- Open the default filesystem configuration file at
config/x86_64/desktop.toml
with your text editor and add thehello-world
recipe, the following code block show where you need to edit.
[packages]
# Add the item below
hello-world = {}
- Build the Hello World program and the Redox image
time make r.hello-world image
- Start the Redox VM without a GUI
make qemu gpu=no
In the "redox login" screen write "user" as user name and press Enter.
- Run the "Hello World" program
helloworld
- Power off the Redox VM
sudo shutdown