# Configure `property-vault` properties

Properties (`property-vault`) provide functionality to store and share
key-value pairs stored as strings across the system. Any software
component can share any value for a particular key and any other process
can access the value by using the same key. `property-vault` allows you
to define persistent properties across reboots. Components can use
`property-vault` to share specific information, which might be
relevant to any other modules on the device. These key-value pairs can be
accessed using the command-line interface (CLI).

Note

`property-vault` is supported only in `custom` variant.

## Configure properties using CLI on Qualcomm device

- To set a property using the CLI on the Qualcomm device, use the following command:

setprop "my-key" "my-value"
        Copy to clipboard
- To access a property using the CLI, use the following command:

getprop "my-key"
        Copy to clipboard

    Output of the previous command:

my-value
        Copy to clipboard
- To set a property using the CLI and make it persistent across reboots on the device, use the following command:

setprop "persist.my-key" "my-value"
        Copy to clipboard

Note

For a property to persist across reboots, the property key must start with `persist`.

## Use Properties in Qualcomm Linux C/C++ source files

To use the properties in C/C++ source code modules, do the following:

1. To use properties in a program,
for example, in `example-recipe.bb`, add a dependency on
`property-vault`:

DEPENDS += "glib-2.0 property-vault"
        RDEPENDS:${PN} += "property-vault"
        Copy to clipboard
2. Change build configuration files:

    1. If you are using `autotools`:

        `configure.ac`

...
            
            PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, AC_MSG_ERROR(GLib >= 2.16 is required))
            GLIB_CFLAGS="$GLIB_CFLAGS"
            GLIB_LIBS="$GLIB_LIBS"
            AC_SUBST(GLIB_CFLAGS)
            AC_SUBST(GLIB_LIBS)
            
            AC_CONFIG_FILES([Makefile])
            ...
            Copy to clipboard

        `Makefile.am`

root_sbindir       = "/sbin"
            root_sbin_PROGRAMS = property-test
            
            property_test_SOURCES  = source.c
            property_test_CFLAGS = @GLIB_CFLAGS@
            property_test_LDFLAGS = @GLIB_LIBS@ -lpropertyvault
            Copy to clipboard
    2. If you are using `cmake`:

        `CMakeList.txt`

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -lpthread -lrt -lm -lglib-2.0 -ldl -latomic")
            target_link_libraries (your-lib-name propertyvault)
            Copy to clipboard
3. Modify the source code files to `get` and `set` properties:

    `source.c`

#include "properties.h"
        
        int main() {
              // set a property
              property_set("my-key", "my-value");
        
              // get a property
              char paramstr[PROP_VALUE_MAX];
              // value gets stored in paramstr
              property_get("my-key", paramstr, "default-val");

              // set a property which has to persist across reboots
              property_set("persist.my-key", "my-value");
        
              // get a persisted property
              property_get("my-key", paramstr, "default-val");
        
              return 0;
        }
        Copy to clipboard

Note

The property key name can be up to 64 characters long, and the property value can be up to 92 characters long, as defined by `PROP_NAME_MAX` and `PROP_VALUE_MAX` in `properties.h`.
4. Build the recipe on the host computer and include it as part of the image to be flashed on the device.

Last Published: Jul 02, 2025

[Previous Topic
Set up Kubernetes with Qualcomm Linux](https://docs.qualcomm.com/bundle/publicresource/80-70020-27/topics/setup_kubernetes_with_qualcomm_linux.md) [Next Topic
Persist partition](https://docs.qualcomm.com/bundle/publicresource/80-70020-27/topics/persist_partition.md)