From Nothing To Hello World
This page describes the quickest way to test a program on Redox. This tutorial doesn't build Redox from source.
In this example we will use a "Hello World" program written in Rust.
-
Create the
tryredoxfolder.mkdir -p ~/tryredox -
Navigate to the
tryredoxfolder.cd ~/tryredox -
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 in the current shell.
source ~/.cargo/env -
Navigate to the Redox build system directory.
cd ~/tryredox/redox -
Create the
.configfile and add theREPO_BINARYenvironment variable to enable the binary-mode.echo "REPO_BINARY?=1 \n CONFIG_NAME?=my_config" >> .config -
Create the
hello-worldrecipe folder.mkdir cookbook/recipes/other/hello-world -
Create the
sourcefolder for the recipe.mkdir cookbook/recipes/other/hello-world/source -
Navigate to the recipe's
sourcefolder.cd cookbook/recipes/other/hello-world/source -
Initialize a Cargo project with the "Hello World" string.
cargo init --name="hello-world" -
Create the
hello-worldrecipe configuration.cd ~/tryredox/redoxnano cookbook/recipes/other/hello-world/recipe.toml -
Add the following to the recipe configuration:
[build] template = "cargo" -
Create the
my_configfilesystem configuration.cp config/x86_64/desktop.toml config/x86_64/my_config.toml -
Open the
my_configfilesystem configuration file (i.e.,config/x86_64/my_config.toml) and add thehello-worldpackage to it.[packages] # Add the item below hello-world = "source" -
Build the Hello World program and the Redox image.
time make prefix r.hello-world image -
Start the Redox virtual machine without a GUI.
make qemu gpu=no -
At the Redox login screen, write "user" for the user name and press Enter.
-
Run the "Hello World" program.
helloworld -
Shut down the Redox virtual machine.
sudo shutdown