tree: d155e51288ff4f9a1fed227a9257a0236602aca7 [path history] [tgz]
  1. meta/
  2. BUILD.gn
  3. hello_aarch64.S
  4. hello_riscv64.S
  5. hello_x64.S
  6. README.md
  7. test.rs
src/starnix/examples/hello_starnix/README.md

Hello Starnix

This directory contains a simple Linux binary that runs in Starnix.

How to run hello_starnix

Build and run Fuchsia

Build the workbench_eng.x64 product with this example and its container:

fx set workbench_eng.x64 \
    --with //src/starnix/examples/hello_starnix \
    --with //src/starnix/containers/empty_container
fx build

Run this product as usual. For example, by running fx serve in one terminal and ffx emu start --headless --console --net tap in another terminal.

Boot a container

To run the hello_starnix component, we first need to boot a container. We use empty_container.cm, which does not have a disk image. Instead, the empty container mounts its own package as its root file system. This container is useful for running self-contained binaries (e.g., that do not require libc):

ffx component resolve core/starnix_runner
ffx component run core/starnix_runner/playground:starless fuchsia-pkg://fuchsia.com/starless#meta/empty_container.cm

You can confirm that this container is running using ffx component list. If everything has gone well, you should see core/starnix_runner/playground:starless running in the system.

Run hello_starnix

Create the hello_starnix component inside this container:

ffx component create core/starnix_runner/playground:starless/daemons:hello_starnix fuchsia-pkg://fuchsia.com/hello_starnix#meta/hello_starnix.cm

You should see some output similar to the following in ffx log:

[00203.847301][kernels:empty_container.cm_3cT3bre][9:9[hello_starnix],stdio,starnix] INFO: hello starnix