[oe] [meta-oe] [PATCH] crash-trace: add recipe for crash trace extension module

Wang Mingyu < [email protected]>
Newsgroups org.openembedded.lists.openembedded-devel
Message-ID <[email protected]>
From: Wang Mingyu <[email protected]>

Add a new recipe for crash-trace, a crash utility extension that
displays kernel tracing data and traced events prior to a panic.

Signed-off-by: Wang Mingyu <[email protected]>
---
 .../recipes-kernel/crash/crash-trace_git.bb   | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/crash/crash-trace_git.bb

diff --git a/meta-oe/recipes-kernel/crash/crash-trace_git.bb b/meta-oe/recipes-kernel/crash/crash-trace_git.bb
new file mode 100644
index 0000000000..b54ef79ab5
--- /dev/null
+++ b/meta-oe/recipes-kernel/crash/crash-trace_git.bb
@@ -0,0 +1,65 @@
+SUMMARY = "trace extension module for crash"
+DESCRIPTION = "Displays kernel tracing data and traced events that occurred prior to a panic."
+
+HOMEPAGE = "https://github.com/fujitsu/crash-trace"
+SECTION = "devel"
+
+LICENSE = "GPL-2.0-or-later"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS = "crash zlib readline ncurses"
+RDEPENDS:${PN} = "crash"
+
+SRC_URI = "git://github.com/fujitsu/crash-trace.git;branch=master;protocol=https"
+SRCREV = "2106a9d04020192f6f286171a060c4d2300059b7"
+PV = "3.0+git"
+
+TARGET_CC_ARCH:append = " ${SELECTED_OPTIMIZATION}"
+
+# crash 7.1.3 and before don't support mips64/riscv64
+COMPATIBLE_HOST:riscv64 = "null"
+COMPATIBLE_HOST:riscv32 = "null"
+COMPATIBLE_HOST:mipsarchn64 = "null"
+COMPATIBLE_HOST:mipsarchn32 = "null"
+
+python () {
+    arch = d.getVar('TARGET_ARCH')
+    makefile_arch = ""
+    if arch.startswith('x86_64'):
+        makefile_arch = "X86_64"
+    elif arch == 'aarch64':
+        makefile_arch = "ARM64"
+    elif arch == 'i686':
+        makefile_arch = "i686"
+    elif arch == 'i586':
+        makefile_arch = "X86"
+
+    d.setVar('TARGET_ARCH_FOR_MAKEFILE', makefile_arch)
+}
+
+EXTRA_OEMAKE = 'TARGET=${TARGET_ARCH_FOR_MAKEFILE}'
+
+do_configure() {
+    :
+}
+
+do_compile:prepend() {
+    sed -i -E 's,^([ \t]*)gcc ,\1${CC} ${CFLAGS} ,' ${S}/Makefile
+    sed -i 's,INCDIR=/usr/include/crash,INCDIR=${STAGING_INCDIR}/crash,' ${S}/Makefile
+    sed -i 's|-o trace.so|${LDFLAGS} -o trace.so|' ${S}/Makefile
+}
+
+ARM_INSTRUCTION_SET = "arm"
+
+COMPATIBLE_HOST:libc-musl = 'null'
+
+do_install () {
+    install -d ${D}${libdir}/crash/extensions/
+
+    install -m 0644 ${S}/trace.so ${D}/${libdir}/crash/extensions/
+}
+
+FILES:${PN} += " \
+    ${libdir}/crash/extensions/ \
+"
+
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.