how can I modify the config at runtime?

Norman Feske norman.feske at ...1...
Thu May 23 12:00:54 CEST 2013


Hi Keqin,

>     When I read the source code in os/src/init/main.cc I noticed that
> Genode could respond to config changes at runtime. I wonder how I can
> modify the config at runtime? Are there any interfaces to do that? 

in order to change the configuration of init (or any other process that
is able to respond to dynamic reconfigurations) you will need to let
this process fetch its configuration from a ROM service that allows
updates of ROM modules at runtime. This is not the case for core's ROM
service. The ROM modules provided by core are just the boot modules,
which will stay the same during the whole runtime.

This is where the 'fs_rom' service (see 'os/src/server/fs_rom') comes
into play. It provides a ROM service by fetching data from a file
system. By combining 'fs_rom' with the RAM file system (see
'os/src/server/ram_fs'), arbitrary files stored in a RAM file system can
be used as ROM modules. Naturally, files stored in a 'ram_fs' can be
changed dynamically (e.g., by mounting the 'ram_fs' in an instance of
Noux and modifying a file using vim). The 'fs_rom' service is able to
detect file modifications on the used file system. If such a
modification is detected for a file that is provided as ROM module, the
ROM-session client will receive a signal. Hence, if init obtained its
configuration from 'fs_rom', it will reload its configuration and
replace the currently running scenario by the one described in the new
configuration.

To see how to route the request for a config file to a dedicated ROM
service, you may find the example at 'os/run/dynamic_config.run' useful.
In this example, the 'test-dynamic_config' program fetches its
configuration from a ROM service provided by 'test-dynamic_config_server'.

Another way to use Genode's dynamic configuration feature is by the use
of the 'Slave' API. In this scenario, the parent process updates the
configuration of a child process using the runtime of the child. We use
this for the 'qt_avplay' program to update the audio volume during the
playback of a video. Our backend of libSDL will pick up such
configuration changes and modify the audio parameters of avplay
accordingly. A simpler example can be found at
'os/run/dynamic_config_slave.run'.

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list