File Mappings

File mappings are used to do local development and testing on a device.

For example, adapters are native programs and must be built and tested directly on the device in the target KOS environment. Using file mappings, an adapter can be run and tested on the device without first creating a KAB.

In addition, KOS allows customization and manipulation of the root filesystem. For example, you may want to create a new user account or modify system-level files. Normally these changes require building a layer KAB, however you can first test and validate these changes using file mappings. 

Essentially, file mappings allow you to preview and experiment with filesystem changes that would eventually go into a layer.

Because these kinds of changes involve directly manipulating the filesystem, file mappings are considered an advanced Studio feature and should be used with care.

How to use File Mappings

To use file mappings, navigate to the “File Mappings” tab of your image settings in KOS Studio. File mappings are added using gensquashfs commands to create files and directories on the device filesystem.

For example, this command maps a local file to a specific path on the device, including permissions and ownership.

file device/path_to_app.jar 0644 0 0 local/path_to_app.jar

For additional gensquashfs commands and options, refer to the official documentation here

KOS Studio also provides UI that makes it easy to inspect paths, permissions, and ownership as shown in the screenshot below:

Moving to Production

Once development and testing using file mappings is complete, production deployments must not rely on file mappings. Instead, the changes should be packaged into a layer KAB using the “Layers” tab of your image settings.