anbox-platform-sdk  1.21.0
Anbox Platform SDK API documentation
Package and deploy a platform plugin

Platform plugins must be installed within the containers that Anbox Cloud is running. Generally, all plugins are installed into /usr/lib/\<target_triple\>/anbox/platforms/\<plugin_name\> from where Anbox will load them.

The recommended way of packaging and deploying a platform plugin is by using an addon package in AMS. An addon lets you package the platform plugin and install it into the right location during container bootstrap time.

Package as AMS addon

For the following example it is expected that the platform plugin is already built and you have the platform_<name>.so file ready. In this example, we will use a platform named foo.

In case that your platform has external dependencies you will have to install them as part of pre-start hook as well.

First we have to create the directory structure for the addon as follows:

mkdir -p foo/hooks
cp /path/to/platform_foo.so foo/
cat << EOF > foo/hooks/pre-start
#!/bin/bash -ex
if [ "$CONTAINER_TYPE" != base ]; then
exit 0
fi
triplet=x86_64-linux-gnu
if [ $(uname -m) = aarch64 ]; then
triplet=aarch64-linux-gnu
fi
mkdir -p /usr/lib/\${triplet}/anbox/platforms/foo
cp \${ADDON_DIR}/platform_foo.so /usr/lib/\${triplet}/anbox/platforms/foo
EOF
chmod +x foo/hooks/pre-start

As next step we have to upload the addon to AMS:

amc addon create foo ./foo

Once the addon is uploaded it's available for any container. It can be referenced by applications managed by AMS or used by raw containers.

Use platform in a container

To let a raw container use the addon and start Anbox with the foo platform plugin, run the following command:

amc launch -p foo -a foo -r

This will create a raw container with the default image, install the foo addon and afterwards start Anbox with the foo platform plugin.