Skip to main content

Pantavisor Development

Use kas/with-workspace.yaml to develop pantavisor source locally while rebuilding through the Yocto layer.

Initial Setup

The first build with the workspace overlay creates the devtool workspace:

./kas-container build kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml

Workspace sources:

build/workspace/sources/pantavisor/ # Pantavisor runtime
build/workspace/sources/lxc-pv/ # LXC with pantavisor patches

Workspace bbappend files (redirect recipes to local sources):

build/workspace/appends/pantavisor_git.bbappend
build/workspace/appends/lxc-pv_git.bbappend # create manually if needed

Development Cycle

  1. Edit source code:

    cd build/workspace/sources/pantavisor
    # Make changes to C files, headers, etc.
  2. Rebuild:

    cd /path/to/meta-pantavisor
    ./kas-container build kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml
  3. Test — see ../testing/development-workflow.md

  4. Commit when ready:

    cd build/workspace/sources/pantavisor
    git add -A && git commit -m "feat: description" && git push

Building Specific Targets

Build only pantavisor (faster iteration):

./kas-container build kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml \
--target pantavisor

Build pantavisor and appengine image:

./kas-container build kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml \
--target pantavisor-appengine

Common Workflows

Quick Pantavisor Change Test

# 1. Edit pantavisor source
cd build/workspace/sources/pantavisor
vim xconnect/plugins/drm.c

# 2. Rebuild (from meta-pantavisor root)
cd /path/to/meta-pantavisor
./kas-container build kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml

# 3. Reload docker image
docker load < build/tmp-scarthgap/deploy/images/docker-x86_64/pantavisor-appengine-docker.tar

# 4. Test (fresh storage)
docker rm -f pva-test; docker volume rm storage-test
docker run --name pva-test -d --privileged \
-v $(pwd)/pvtx.d:/usr/lib/pantavisor/pvtx.d \
-v storage-test:/var/pantavisor/storage \
--entrypoint /bin/sh pantavisor-appengine:latest -c "sleep infinity"
docker exec pva-test sh -c 'pv-appengine &'
sleep 15
docker exec pva-test lxc-ls -f

Testing xconnect Plugin Changes

# 1. Edit plugin
cd build/workspace/sources/pantavisor
vim xconnect/plugins/unix.c

# 2. Build appengine
cd /path/to/meta-pantavisor
./kas-container build kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml

# 3. Reload and test
docker load < build/tmp-scarthgap/deploy/images/docker-x86_64/pantavisor-appengine-docker.tar
docker rm -f pva-test; docker volume rm storage-test
docker run --name pva-test -d --privileged \
-v $(pwd)/pvtx.d:/usr/lib/pantavisor/pvtx.d \
-v storage-test:/var/pantavisor/storage \
--entrypoint /bin/sh pantavisor-appengine:latest -c "sleep infinity"
docker exec pva-test sh -c 'pv-appengine &'
sleep 15
docker exec pva-test pvcontrol graph ls

Bumping pantavisor SRCREV

When bumping the pantavisor commit:

  1. Update PANTAVISOR_SRCREV in recipes-pv/pantavisor/pantavisor.inc — the actual hash lives there; pantavisor_git.bb just forwards it via SRCREV = "${PANTAVISOR_SRCREV}"
  2. Verify the hash against the actual remote — squash merges rewrite hashes, so a branch SHA won't match the merged master SHA
  3. Update PKGV in pantavisor_git.bb to match the latest tag reachable from the new SRCREV (e.g. if latest tag is 026, set PKGV = "026+git0+${GITPKGV}")

Adding Workspace Packages

To use a local source for a package not yet in the workspace (e.g., lxc-pv):

# Create bbappend
cat > build/workspace/appends/lxc-pv_git.bbappend << 'EOF'
inherit externalsrc
EXTERNALSRC = "${TOPDIR}/workspace/sources/lxc-pv"
EXTERNALSRC_BUILD = "${WORKDIR}/build"
EOF

# Clone the source
cd build/workspace/sources
git clone https://github.com/pantavisor/lxc.git lxc-pv
cd lxc-pv && git checkout <branch>

Troubleshooting Build Issues

Stale Build Artifacts

./kas-container shell kas/build-configs/release/docker-x86_64-scarthgap.yaml:kas/with-workspace.yaml \
-c "bitbake -c cleansstate <recipe-name>"

Stale Configure Artifacts in Workspace Source

cd build/workspace/sources/<package>
git clean -fdx

Docker Image Not Updated

After rebuilding, always reload the docker image before testing:

docker load < build/tmp-scarthgap/deploy/images/docker-x86_64/pantavisor-appengine-docker.tar