Getting Started
Get up and running with the Avocado Linux SDK in minutes.
Prerequisites
- A Mac (macOS 10.12+) or Linux (Ubuntu 22.04+, Fedora 39+) development machine
- Docker installed
- 3GB+ available disk space
Installing and running the SDK
- Install the Avocado CLI:
wget https://github.com/avocado-linux/avocado-cli/releases/download/0.5.0/avocado-0.5.0_<machine>.tar.gz
tar -xf avocado-0.5.0_<machine>.tar.gz
mkdir ~/bin
mv avocado ~/bin/.
Replace <machine>
with x86_64-unknown-linux-gnu
or x86_64-apple-darwin
depending on whether you are developing on x86-64 Linux or an Intel-based Mac.
-
Add
$HOME/bin
to yourPATH
environment variable if it is not already there. -
Create your project workspace:
mkdir foo
- Initialize a new project:
cd foo
avocado init
- Install all components (SDK, extensions, and runtime dependencies):
avocado install -f
Building an extension image
Let's build a simple hello-world
extension image.
- Add a
hello-world
extension under[runtime.default.dependencies]
inavocado.toml
:
[runtime.default.dependencies]
avocado-img-bootfiles = "*"
avocado-img-rootfs = "*"
avocado-img-initramfs = "*"
avocado-dev = { ext = "avocado-dev" }
hello-world = { ext = "hello-world" }
- Append the following to
avocado.toml
:
[ext.hello-world]
types = ["sysext", "confext"]
version = "1.0.0"
scopes = ["system"]
[ext.hello-world.dependencies]
hello-world = { compile = "hello-world" }
- Install dependencies into extension sysroots:
avocado ext install
- Populate
hello-world
extension contents:
sudo mkdir _avocado/qemux86-64/extensions/hello-world/usr
sudo mkdir _avocado/qemux86-64/extensions/hello-world/etc
sudo sh -c 'echo "hello from /etc" > _avocado/qemux86-64/extensions/hello-world/etc/hello-world'
sudo sh -c 'echo "hello from /usr" > _avocado/qemux86-64/extensions/hello-world/usr/hello-world'
- Build the
hello-world
extension:
avocado ext build --extension hello-world
Building a bootable image
- Build all components (SDK compile, extensions, and runtime images):
avocado build
- Provision a runtime:
avocado provision --runtime dev
Booting an image with QEMU
- Run image on a QEMU virtual machine:
avocado sdk run -ie vm dev
- Log in as
root
with no password:
avocado-qemux86-64 login: root
- Enter
Ctrl-a
thenx
when you are ready to exit the QEMU virtual machine.