Add a new pldm verbosity option
- The intent behind this commit is to add a new
compile time meson option to control the pldm verbosity.
- The value that is given for meson option goes into the
default systemd environment file which is picked by the
pldmd service unit before it starts.
- As the pldmd consumes the default pldmd file at runtime,
we should be able to alter the verbosity by changing the
content in /etc/default/pldm_verbosity file.
Tested By:
1. meson buildir
check the pldmd file (make sure verbosity is 0 by default)
2. meson builddir -Dverbosity=1
check the generated pldm_verbosity file (make sure verbosity is 1)
3. Flash the image & check if the pldm is loaded with the right verbosity
that is set during compilation.
4. Change the verbosity in the /etc/default/pldm_verbosity file & restart
pldmd.service, and check if the daemon picks up the change.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: Ica5607b801143b2806d343e3b82b043f078fcd22
diff --git a/meson.build b/meson.build
index aee4c5e..93c31cf 100644
--- a/meson.build
+++ b/meson.build
@@ -28,6 +28,7 @@
conf_data.set_quoted('FRU_JSONS_DIR', '/usr/share/pldm/fru')
conf_data.set_quoted('HOST_JSONS_DIR', '/usr/share/pldm/host')
conf_data.set_quoted('EVENTS_JSONS_DIR', '/usr/share/pldm/events')
+conf_data.set('PLDM_VERBOSITY',get_option('verbosity'))
if get_option('softoff').enabled()
conf_data.set('SOFTOFF_TIMEOUT_SECONDS', get_option('softoff-timeout-seconds'))
endif
@@ -109,6 +110,13 @@
output: 'pldmd.service',
)
+configure_file(
+ input: 'pldmd/verbosity/verbosity',
+ output: 'pldm_verbosity',
+ configuration: conf_data,
+ install: true,
+ install_dir: '/etc/default')
+
if get_option('oem-ibm').enabled()
subdir('oem/ibm/service_files')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 636d8cd..e1f6d43 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,5 @@
option('tests', type: 'feature', description: 'Build tests', value: 'enabled')
+option('verbosity',type:'integer',min:0, max:1, description: 'Enables/Disables pldm verbosity',value: 0)
option('oe-sdk', type: 'feature', description: 'Enable OE SDK')
option('oem-ibm', type: 'feature', description: 'Enable IBM OEM PLDM')
option('requester-api', type: 'feature', description: 'Enable libpldm requester API', value: 'enabled')
diff --git a/pldmd/service_files/pldmd.service b/pldmd/service_files/pldmd.service
index ec54e61..f0b981e 100644
--- a/pldmd/service_files/pldmd.service
+++ b/pldmd/service_files/pldmd.service
@@ -9,7 +9,7 @@
[Service]
Restart=always
-EnvironmentFile=/etc/default/pldmd
+EnvironmentFile=/etc/default/pldm_verbosity
ExecStart=/usr/bin/pldmd --verbose $VERBOSE
[Install]
diff --git a/pldmd/verbosity/verbosity b/pldmd/verbosity/verbosity
new file mode 100644
index 0000000..45cf9bf
--- /dev/null
+++ b/pldmd/verbosity/verbosity
@@ -0,0 +1 @@
+VERBOSE=@PLDM_VERBOSITY@