Reducing size of libqmi

Aleksander Morgado aleksander at aleksander.es
Tue Feb 2 08:58:07 UTC 2021


Hey

>
> I have a QMI device, which I am able to control using libqmi. But looks like it loads may services that I do not need. Is there a way to disable a set of APIs that are not required, within libqmi, to reduce the size of the library loaded into my build?
>

Yes! That can be done in the latest libqmi 1.26.x branch or git
master. The way to do this is by writing your own "collection" of
messages to include in the library. By default we provide 3
collections in the default build:
 * minimal: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/master/data/qmi-collection-minimal.json
 * basic:  https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/master/data/qmi-collection-basic.json
 * full: all messages include, the default if nothing specified.

If you need a custom set of messages, you should probably check if
"basic" is enough for you (e.g. "basic" is the minimum set of messages
required by ModemManager) and otherwise check the "minimal"
collection. If none of these suits your needs, you can create your own
collection file, you just need to place it as
/data/qmi-collection-SOMETHING.json in the sources, and then use the
--enable-collection=SOMETHING in the ./configure call.

The available qmicli commands will depend on what messages you have selected.

-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list