17aafb12eSNagaraju Goruganti# phosphor-logging 27aafb12eSNagaraju Gorugantiphosphor logging provides mechanism for common event and logging creation based 37aafb12eSNagaraju Gorugantion information from the journal log. 47aafb12eSNagaraju Goruganti 57aafb12eSNagaraju Goruganti## To Build 67aafb12eSNagaraju Goruganti``` 77aafb12eSNagaraju GorugantiTo build this package, do the following steps: 87aafb12eSNagaraju Goruganti 97aafb12eSNagaraju Goruganti 1. ./bootstrap.sh 107aafb12eSNagaraju Goruganti 2. ./configure ${CONFIGURE_FLAGS} 117aafb12eSNagaraju Goruganti 3. make 127aafb12eSNagaraju Goruganti 137aafb12eSNagaraju GorugantiTo clean the repository run `./bootstrap.sh clean`. 147aafb12eSNagaraju Goruganti``` 15*9067c077SDeepak Kodihalli 16*9067c077SDeepak Kodihalli## Adding application specific error YAML 174e5f521aSMarri Devender Rao* This document captures steps for adding application specific error YAML files 184e5f521aSMarri Devender Rao and generating local elog-errors.hpp header file for application use. 194e5f521aSMarri Devender Rao* Should cater for continuous integration (CI) build, bitbake image build, and 204e5f521aSMarri Devender Rao local repository build. 217aafb12eSNagaraju Goruganti 22*9067c077SDeepak Kodihalli#### Continuous Integration (CI) build 234e5f521aSMarri Devender Rao * Make is called on the repository that is modified. 244e5f521aSMarri Devender Rao * Dependent packages are pulled based on the dependency list specified in the 254e5f521aSMarri Devender Rao configure.ac script. 267aafb12eSNagaraju Goruganti 27*9067c077SDeepak Kodihalli#### Recipe build 284e5f521aSMarri Devender Rao * Native recipes copy error YAML files to shared location. 294e5f521aSMarri Devender Rao * phosphor-logging builds elog-errors.hpp by parsing the error YAML files from 304e5f521aSMarri Devender Rao the shared location. 317aafb12eSNagaraju Goruganti 32*9067c077SDeepak Kodihalli#### Local repository build 334e5f521aSMarri Devender Rao * Copies local error YAML files to the shared location in SDK 344e5f521aSMarri Devender Rao * Make generates elog-errors.hpp by parsing the error YAML files from the 354e5f521aSMarri Devender Rao shared location. 367aafb12eSNagaraju Goruganti 37*9067c077SDeepak Kodihalli#### Makefile changes 384e5f521aSMarri Devender Rao**Reference** 394e5f521aSMarri Devender Rao * https://github.com/openbmc/openpower-debug-collector/blob/master/Makefile.am 40*9067c077SDeepak Kodihalli 41*9067c077SDeepak Kodihalli###### Export error YAML to shared location 424e5f521aSMarri Devender Rao*Modify Makefile.am to export newly added error YAML to shared location* 434e5f521aSMarri Devender Rao``` 444e5f521aSMarri Devender Raoyamldir = ${datadir}/phosphor-dbus-yaml/yaml 454e5f521aSMarri Devender Raonobase_yaml_DATA = \ 464e5f521aSMarri Devender Rao org/open_power/Host.errors.yaml 474e5f521aSMarri Devender Rao``` 48*9067c077SDeepak Kodihalli 49*9067c077SDeepak Kodihalli###### Generate elog-errors.hpp using elog parser from SDK location 504e5f521aSMarri Devender Rao * Add a conditional check "GEN_ERRORS" 514e5f521aSMarri Devender Rao * Disable the check for recipe bitbake image build 524e5f521aSMarri Devender Rao * Enable it for local repository build 534e5f521aSMarri Devender Rao * If "GEN_ERRORS" is enabled, build generates elog-errors.hpp header file. 544e5f521aSMarri Devender Rao``` 554e5f521aSMarri Devender Rao # Generate phosphor-logging/elog-errors.hpp 564e5f521aSMarri Devender Rao if GEN_ERRORS 574e5f521aSMarri Devender Rao ELOG_MAKO ?= elog-gen-template.mako.hpp 584e5f521aSMarri Devender Rao ELOG_DIR ?= ${OECORE_NATIVE_SYSROOT}${datadir}/phosphor-logging/elog 594e5f521aSMarri Devender Rao ELOG_GEN_DIR ?= ${ELOG_DIR}/tools/ 604e5f521aSMarri Devender Rao ELOG_MAKO_DIR ?= ${ELOG_DIR}/tools/phosphor-logging/templates/ 614e5f521aSMarri Devender Rao YAML_DIR ?= ${OECORE_NATIVE_SYSROOT}${datadir}/phosphor-dbus-yaml/yaml 624e5f521aSMarri Devender Rao phosphor-logging/elog-errors.hpp: 634e5f521aSMarri Devender Rao @mkdir -p ${YAML_DIR}/org/open_power/ 644e5f521aSMarri Devender Rao @cp ${top_srcdir}/org/open_power/Host.errors.yaml \ 654e5f521aSMarri Devender Rao ${YAML_DIR}/org/open_power/Host.errors.yaml 664e5f521aSMarri Devender Rao @mkdir -p `dirname $@` 674e5f521aSMarri Devender Rao @chmod 777 $(ELOG_GEN_DIR)/elog-gen.py 684e5f521aSMarri Devender Rao $(AM_V_at)$(PYTHON) $(ELOG_GEN_DIR)/elog-gen.py -y ${YAML_DIR} \ 694e5f521aSMarri Devender Rao -t ${ELOG_MAKO_DIR} -m ${ELOG_MAKO} -o $@ 704e5f521aSMarri Devender Rao endif 714e5f521aSMarri Devender Rao``` 727aafb12eSNagaraju Goruganti 73*9067c077SDeepak Kodihalli###### Update BUILT_SOURCES 744e5f521aSMarri Devender Rao * Append elog-errors.hpp to BUILT_SOURCES list and put it in conditional check 754e5f521aSMarri Devender Rao GEN_ERRORS so that the elog-errors.hpp is generated only during local 764e5f521aSMarri Devender Rao repository build. 774e5f521aSMarri Devender Rao``` 784e5f521aSMarri Devender Rao if GEN_ERRORS 794e5f521aSMarri Devender Rao nobase_nodist_include_HEADERS += \ 804e5f521aSMarri Devender Rao phosphor-logging/elog-errors.hpp 814e5f521aSMarri Devender Rao endif 824e5f521aSMarri Devender Rao if GEN_ERRORS 834e5f521aSMarri Devender Rao BUILT_SOURCES += phosphor-logging/elog-errors.hpp 844e5f521aSMarri Devender Rao endif 854e5f521aSMarri Devender Rao``` 86*9067c077SDeepak Kodihalli 87*9067c077SDeepak Kodihalli###### Conditional check for native build 884e5f521aSMarri Devender Rao * As the same Makefile is used both for recipe image build and native recipe 894e5f521aSMarri Devender Rao build, add a conditional to ensure that only installation of error yaml files 904e5f521aSMarri Devender Rao happens during native build. It is not required to build repository during 914e5f521aSMarri Devender Rao native build. 924e5f521aSMarri Devender Rao``` 934e5f521aSMarri Devender Rao if !INSTALL_ERROR_YAML 944e5f521aSMarri Devender Rao endif 954e5f521aSMarri Devender Rao``` 96*9067c077SDeepak Kodihalli 97*9067c077SDeepak Kodihalli#### Autotools changes 984e5f521aSMarri Devender Rao**Reference** 994e5f521aSMarri Devender Rao * https://github.com/openbmc/openpower-debug-collector/blob/master/configure.ac 1007aafb12eSNagaraju Goruganti 101*9067c077SDeepak Kodihalli###### Add option(argument) to enable/disable installing error yaml file 1024e5f521aSMarri Devender Rao * Install error yaml option(argument) is enabled for native recipe build 1034e5f521aSMarri Devender Rao and disabled for bitbake build. 1044e5f521aSMarri Devender Rao 1054e5f521aSMarri Devender Rao * When install error yaml option is disabled do not check for target specific 1064e5f521aSMarri Devender Rao packages in autotools configure script. 1074e5f521aSMarri Devender Rao 108*9067c077SDeepak Kodihalli###### Add option(argument) to install error yaml files 1094e5f521aSMarri Devender Rao``` 1104e5f521aSMarri Devender RaoAC_ARG_ENABLE([install_error_yaml], 1114e5f521aSMarri Devender Rao AS_HELP_STRING([--enable-install_error_yaml], 1124e5f521aSMarri Devender Rao [Enable installing error yaml file]),[], [install_error_yaml=no]) 1134e5f521aSMarri Devender RaoAM_CONDITIONAL([INSTALL_ERROR_YAML], 1144e5f521aSMarri Devender Rao [test "x$enable_install_error_yaml" = "xyes"]) 1154e5f521aSMarri Devender RaoAS_IF([test "x$enable_install_error_yaml" != "xyes"], [ 1164e5f521aSMarri Devender Rao.. 1174e5f521aSMarri Devender Rao.. 1184e5f521aSMarri Devender Rao]) 1194e5f521aSMarri Devender Rao``` 120*9067c077SDeepak Kodihalli 121*9067c077SDeepak Kodihalli###### Add option(argument) to enable/disable generating elog-errors header file 1224e5f521aSMarri Devender Rao``` 1234e5f521aSMarri Devender RaoAC_ARG_ENABLE([gen_errors], 1244e5f521aSMarri Devender Rao AS_HELP_STRING([--enable-gen_errors], [Enable elog-errors.hpp generation ]), 1254e5f521aSMarri Devender Rao [],[gen_errors=yes]) 1264e5f521aSMarri Devender RaoAM_CONDITIONAL([GEN_ERRORS], [test "x$enable_gen_errors" != "xno"]) 1274e5f521aSMarri Devender Rao``` 1284e5f521aSMarri Devender Rao 129*9067c077SDeepak Kodihalli#### Recipe changes 1304e5f521aSMarri Devender Rao**Reference** 1314e5f521aSMarri Devender Rao* https://github.com/openbmc/openbmc/blob/master/meta-openbmc-machines\ 1324e5f521aSMarri Devender Rao/meta-openpower/common/recipes-phosphor/debug/openpower-debug-collector.bb 1334e5f521aSMarri Devender Rao 134*9067c077SDeepak Kodihalli###### Extend recipe for native and nativesdk 1354e5f521aSMarri Devender Rao* Extend the recipe for native and native SDK builds 1364e5f521aSMarri Devender Rao``` 1374e5f521aSMarri Devender RaoBBCLASSEXTEND += "native nativesdk" 1384e5f521aSMarri Devender Rao``` 139*9067c077SDeepak Kodihalli###### Remove dependencies for native and native SDK build 1404e5f521aSMarri Devender Rao* Native recipe caters only for copying error yaml files to shared location. 1414e5f521aSMarri Devender Rao* For native and native SDK build remove dependency on packages that recipe 1424e5f521aSMarri Devender Rao build depends 1434e5f521aSMarri Devender Rao 144*9067c077SDeepak Kodihalli###### Remove dependency on phosphor-logging for native build 1454e5f521aSMarri Devender Rao``` 1464e5f521aSMarri Devender RaoDEPENDS_remove_class-native = "phosphor-logging" 1474e5f521aSMarri Devender Rao``` 148*9067c077SDeepak Kodihalli 149*9067c077SDeepak Kodihalli###### Remove dependency on phosphor-logging for native SDK build 1504e5f521aSMarri Devender Rao``` 1514e5f521aSMarri Devender RaoDEPENDS_remove_class-nativesdk = "phosphor-logging" 1524e5f521aSMarri Devender Rao``` 153*9067c077SDeepak Kodihalli 154*9067c077SDeepak Kodihalli###### Add install_error_yaml argument during native build 1554e5f521aSMarri Devender Rao* Add package config to enable/disable install_error_yaml feature. 156*9067c077SDeepak Kodihalli 157*9067c077SDeepak Kodihalli###### Add package config to enable/disable install_error_yaml feature 1584e5f521aSMarri Devender Rao``` 1594e5f521aSMarri Devender RaoPACKAGECONFIG ??= "install_error_yaml" 1604e5f521aSMarri Devender RaoPACKAGECONFIG[install_error_yaml] = " \ 1614e5f521aSMarri Devender Rao --enable-install_error_yaml, \ 1624e5f521aSMarri Devender Rao --disable-install_error_yaml, ,\ 1634e5f521aSMarri Devender Rao " 1644e5f521aSMarri Devender Rao``` 165*9067c077SDeepak Kodihalli###### Enable install_error_yaml check for native build 1664e5f521aSMarri Devender Rao``` 1674e5f521aSMarri Devender RaoPACKAGECONFIG_add_class-native = "install_error_yaml" 1684e5f521aSMarri Devender RaoPACKAGECONFIG_add_class-nativesdk = "install_error_yaml" 1694e5f521aSMarri Devender Rao``` 170*9067c077SDeepak Kodihalli###### Disable install_error_yaml during target build 1714e5f521aSMarri Devender Rao``` 1724e5f521aSMarri Devender RaoPACKAGECONFIG_remove_class-target = "install_error_yaml" 1734e5f521aSMarri Devender Rao``` 1744e5f521aSMarri Devender Rao 175*9067c077SDeepak Kodihalli###### Disable generating elog-errors.hpp for bitbake build 1764e5f521aSMarri Devender Rao* Disable gen_errors argument for bitbake image build as the application uses 1774e5f521aSMarri Devender Rao the elog-errors.hpp generated by phosphor-logging 1784e5f521aSMarri Devender Rao* Argument is enabled by default for local repository build in the configure 1794e5f521aSMarri Devender Rao script of the local repository. 1804e5f521aSMarri Devender Rao``` 1814e5f521aSMarri Devender Rao XTRA_OECONF += "--disable-gen_errors" 1824e5f521aSMarri Devender Rao``` 1834e5f521aSMarri Devender Rao 184*9067c077SDeepak Kodihalli#### Local build 1854e5f521aSMarri Devender Rao* During local build use --prefix=/usr for the configure script. 1864e5f521aSMarri Devender Rao 1874e5f521aSMarri Devender Rao**Reference** 1884e5f521aSMarri Devender Rao* https://github.com/openbmc/openpower-debug-collector/blob/master/README.md 189