From e712b34212b6e0f03ec4843531ae2df03c53ec7d Mon Sep 17 00:00:00 2001 From: Lutz Helwing Date: Wed, 20 Jan 2016 15:09:27 +0100 Subject: Fixed core pattern to use correct dlt-cdh install path - 50-coredump.conf is now generated and installed by cmake and uses @CMAKE_INSTALL_PREFIX@ for setting path to dlt-cdh - README updated Signed-off-by: Lutz Helwing --- src/core_dump_handler/50-coredump.conf | 1 - src/core_dump_handler/50-coredump.conf.cmake | 18 +++++++++++++ src/core_dump_handler/CMakeLists.txt | 39 +++++++++++++++------------- src/core_dump_handler/README | 9 ++++--- 4 files changed, 44 insertions(+), 23 deletions(-) delete mode 100644 src/core_dump_handler/50-coredump.conf create mode 100644 src/core_dump_handler/50-coredump.conf.cmake diff --git a/src/core_dump_handler/50-coredump.conf b/src/core_dump_handler/50-coredump.conf deleted file mode 100644 index a9c12d9..0000000 --- a/src/core_dump_handler/50-coredump.conf +++ /dev/null @@ -1 +0,0 @@ -kernel.core_pattern=|/usr/local/bin/dlt-cdh %t %p %s %e diff --git a/src/core_dump_handler/50-coredump.conf.cmake b/src/core_dump_handler/50-coredump.conf.cmake new file mode 100644 index 0000000..9a0201f --- /dev/null +++ b/src/core_dump_handler/50-coredump.conf.cmake @@ -0,0 +1,18 @@ +####### +# @licence make begin@ +# SPDX license identifier: MPL-2.0 +# +# Copyright (C) 2011-2015, BMW AG +# +# This file is part of GENIVI Project DLT - Diagnostic Log and Trace. +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License (MPL), v. 2.0. +# If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# For further information see http://www.genivi.org/. +# @licence end@ +####### + +kernel.core_pattern=|@CMAKE_INSTALL_PREFIX@/bin/dlt-cdh %t %p %s %e diff --git a/src/core_dump_handler/CMakeLists.txt b/src/core_dump_handler/CMakeLists.txt index 99cf31a..4545e93 100644 --- a/src/core_dump_handler/CMakeLists.txt +++ b/src/core_dump_handler/CMakeLists.txt @@ -15,28 +15,31 @@ # @licence end@ ####### -set( PLATFORM_DIR ${CMAKE_SOURCE_DIR}/src/core_dump_handler/${TARGET_CPU_NAME} ) -set(dlt_cdh_SRCS dlt_cdh.c dlt_cdh_context.c dlt_cdh_coredump.c ${PLATFORM_DIR}/dlt_cdh_cpuinfo.c dlt_cdh_crashid.c dlt_cdh_streamer.c) +if(WITH_DLT_COREDUMPHANDLER) -#set(COREDUMP_CONF_DIR "/usr/lib/sysctl.d/") + set( PLATFORM_DIR ${CMAKE_SOURCE_DIR}/src/core_dump_handler/${TARGET_CPU_NAME} ) + set(dlt_cdh_SRCS dlt_cdh.c dlt_cdh_context.c dlt_cdh_coredump.c ${PLATFORM_DIR}/dlt_cdh_cpuinfo.c dlt_cdh_crashid.c dlt_cdh_streamer.c) -#add_definitions( -fno-strict-aliasing ) + set(COREDUMP_CONF_DIR "/usr/lib/sysctl.d/") -if(WITH_CITYHASH) - set( CITYHASH_DIR ${CMAKE_SOURCE_DIR}/src/core_dump_handler/cityhash_c ) - add_definitions( -DHAS_CITYHASH_C ) - set(dlt_cdh_SRCS ${CITYHASH_DIR}/city_c.c ${dlt_cdh_SRCS} ) -endif(WITH_CITYHASH) + #add_definitions( -fno-strict-aliasing ) -add_executable(dlt-cdh ${dlt_cdh_SRCS}) -target_link_libraries(dlt-cdh z) -set_target_properties(dlt-cdh PROPERTIES LINKER_LANGUAGE C) + if(WITH_CITYHASH) + set( CITYHASH_DIR ${CMAKE_SOURCE_DIR}/src/core_dump_handler/cityhash_c ) + add_definitions( -DHAS_CITYHASH_C ) + set(dlt_cdh_SRCS ${CITYHASH_DIR}/city_c.c ${dlt_cdh_SRCS} ) + endif(WITH_CITYHASH) + add_executable(dlt-cdh ${dlt_cdh_SRCS}) + target_link_libraries(dlt-cdh z) + set_target_properties(dlt-cdh PROPERTIES LINKER_LANGUAGE C) -install(TARGETS dlt-cdh - RUNTIME DESTINATION bin - COMPONENT base) + configure_file(${CMAKE_SOURCE_DIR}/src/core_dump_handler/50-coredump.conf.cmake ${PROJECT_BINARY_DIR}/core_dump_handler/50-coredump.conf) -#install(FILES 50-coredump.conf -# DESTINATION ${COREDUMP_CONF_DIR} -# COMPONENT base) + install(TARGETS dlt-cdh + RUNTIME DESTINATION bin + COMPONENT base) + + install(FILES ${PROJECT_BINARY_DIR}/core_dump_handler/50-coredump.conf DESTINATION ${COREDUMP_CONF_DIR} ) + +endif(WITH_DLT_COREDUMPHANDLER) diff --git a/src/core_dump_handler/README b/src/core_dump_handler/README index a1a9d88..ce0a35e 100644 --- a/src/core_dump_handler/README +++ b/src/core_dump_handler/README @@ -3,11 +3,12 @@ To build use cmake with -DWITH_DLT_COREDUMPHANDLER=ON -DTARGET_CPU_NAME={i686|x8 Temporary replacement of default crash handler: If you don't want to make the change persistent just become root (not sudo) and execute the following ("man core" for details): -echo "|/usr/local/bin/dlt-cdh %t %p %s %e" > /proc/sys/kernel/core_pattern +echo "|/usr/local/bin/dlt-cdh %t %p %s %e" > /proc/sys/kernel/core_pattern (replace /usr/local/bin with the path dlt-cdh has +been installed to) Persistent replacement of default crash handler: -We have to install "50-coredump.conf" to "/usr/lib/sysctl.d/" which is done automatically by "make install". -Unfortunately we also have to remove abrt with "yum remove abrtd*" because this ruthlessly overwrites our change at -every boot. This must be done when installing this stuff as Debian package. +We have to generate "50-coredump.conf" in "/usr/lib/sysctl.d/" which is done automatically by "make install". +Unfortunately at least on Fedora systems we also have to remove abrt with "yum remove abrtd*" because this ruthlessly overwrites +our change at every boot. This must be done when installing this stuff as Debian package. To enable the core dump handler without rebooting we have to execute "sysctl -p /usr/lib/sysctl.d/50-coredump.conf" -- cgit v1.2.1