Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.6.bb

This file was deleted.

73 changes: 73 additions & 0 deletions meta-oe/recipes-kernel/crash/crash-cross-canadian_9.0.2.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
inherit cross-canadian

SUMMARY = "crash utility (cross-canadian crash for ${TARGET_ARCH} target)"
PN = "crash-cross-canadian-${TRANSLATED_TARGET_ARCH}"
BPN = "crash"

require crash.inc

DEPENDS:append = " \
nativesdk-ncurses \
nativesdk-expat \
nativesdk-gettext \
nativesdk-gmp \
nativesdk-mpfr \
nativesdk-readline \
nativesdk-zlib \
virtual/nativesdk-cross-cc \
virtual/nativesdk-cross-binutils \
virtual/nativesdk-compilerlibs \
virtual/nativesdk-libc \
"

RDEPENDS:${PN} = "nativesdk-liblzma"

EXTRA_OEMAKE:class-cross-canadian = ' \
RPMPKG="${PV}" \
CROSS_COMPILE="${HOST_PREFIX}" \
HOSTCC="gcc" \
CFLAGS="${CFLAGS} -fcommon --sysroot=${STAGING_DIR_HOST}" \
CXXFLAGS="${CXXFLAGS} -fcommon --sysroot=${STAGING_DIR_HOST}" \
LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_HOST}" \
GDB_TARGET="${BUILD_SYS} --target=${TARGET_SYS}" \
GDB_HOST="${HOST_SYS}" \
GDB_MAKE_JOBS="${PARALLEL_MAKE}" \
GDB_CONF_FLAGS="--host=${HOST_SYS} \
--build=${BUILD_SYS} \
--target=${TARGET_SYS} \
--disable-gdbserver \
--disable-gprofng \
--with-sysroot=${STAGING_DIR_TARGET} \
ac_cv_type_gregset_t=yes \
ac_cv_type_fpregset_t=yes \
ac_cv_header_sys_procfs_h=yes" \
'

# Force the SDK cross-compiler during the command execution phase
do_compile() {
oe_runmake ${EXTRA_OEMAKE} CC="${HOST_PREFIX}gcc ${HOST_CC_ARCH}" CXX="${HOST_PREFIX}g++ ${HOST_CC_ARCH}" RECIPE_SYSROOT=${RECIPE_SYSROOT}
}

# To ship crash into your sdk, you should create/update a packagegroup-cross-canadian.bbappend and
# add the following
# CRASH = "crash-cross-canadian-${TRANSLATED_TARGET_ARCH}"
# RDEPENDS:${PN} += "${@all_multilib_tune_values(d, 'CRASH')}"
#
# You should also add some kernel packages in your sdk, add the followng in your conf/local.conf:
#
# TOOLCHAIN_TARGET_TASK += "\
# kernel-vmlinux \
# kernel-dbg \
# kernel-dev \
# "
#
# After sourcing the sdk environment script, you can analyze a kernel panic dump with
#
# crash $OECORE_TARGET_SYSROOT/boot/<vmlinux file> $OECORE_TARGET_SYSROOT/boot/<System.map file> <your vmcore>

do_install:class-cross-canadian () {
rm -rf ${D}
install -d ${D}${bindir}
install -m 0755 ${S}/crash ${D}${bindir}/crash
cross_canadian_bindirlinks
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 4e33b3183f7ec903f73479600cfcb9014de1780e Mon Sep 17 00:00:00 2001
From: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Date: Wed, 5 Mar 2025 06:28:02 +0000
Subject: [PATCH] hacked Makefile for module.bbclass

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
---
memory_driver/Makefile | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/memory_driver/Makefile b/memory_driver/Makefile
index 61ee7c0..d8dd3b5 100644
--- a/memory_driver/Makefile
+++ b/memory_driver/Makefile
@@ -7,15 +7,23 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
-ifneq ($(KERNELRELEASE),)
+
obj-m := crash.o
-else
-PWD := $(shell pwd)
-KVER ?= $(shell uname -r)
-KDIR ?= /lib/modules/${KVER}/build
+
+SRC := $(shell pwd)
+
all:
- ${MAKE} -C ${KDIR} M=${PWD} SUBDIRS=${PWD} modules
+ $(MAKE) -C $(KERNEL_SRC) M=$(SRC)
+
+# if you would like to invoke sparse:
+#
+# all:
+# $(MAKE) KBUILD_CHECKSRC=1 -C $(KERNEL_SRC) M=$(SRC)
+
+modules_install:
+ $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
+
clean:
- test -e ${KDIR}/Makefile && ${MAKE} -C ${KDIR} M=${PWD} SUBDIRS=${PWD} clean || ${RM} *.mod.c *.ko *.o Module.*
-endif
+ rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
+ rm -f Module.markers Module.symvers modules.order
+ rm -rf .tmp_versions Modules.symvers
--
2.34.1

26 changes: 26 additions & 0 deletions meta-oe/recipes-kernel/crash/crash-memory-driver_9.0.2.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
DESCRIPTION = "Once installed, the /dev/crash driver will be used by default for live system crash sessions."
SECTION = "devel"
SUMMARY = "/dev/crash driver"
HOMEPAGE = "https://github.com/crash-utility/crash/tree/master/memory_driver"
RECIPE_MAINTAINER = "Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://crash.c;beginline=1;endline=25;md5=c278eae78e2bf99783849a90f03d0e43"

inherit module

SRCREV = "61fe107ff96a22e7df0029877529b7ce6da36850"
SRC_URI = "git://github.com/crash-utility/crash;protocol=https;branch=master;subpath=memory_driver;destsuffix=${BP} \
file://0001-hacked-Makefile-for-module.bbclass.patch;striplevel=2 \
"
PV = "9.0.2+git"

# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.

RPROVIDES:${PN} += "kernel-module-crash-memory-driver"

# to local.conf add:
# to add the kernel module to the rootfs:
# MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-crash-memory-driver"
# to autoload it:
# KERNEL_MODULE_AUTOLOAD += "crash"
133 changes: 89 additions & 44 deletions meta-oe/recipes-kernel/crash/crash.inc
Original file line number Diff line number Diff line change
@@ -1,80 +1,123 @@
SUMMARY = "Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles"
DESCRIPTION = "The core analysis suite is a self-contained tool that can be used to\
investigate either live systems, kernel core dumps created from the\
netdump, diskdump and kdump packages from Red Hat Linux, the mcore kernel patch\
offered by Mission Critical Linux, or the LKCD kernel patch."

HOMEPAGE = "http://people.redhat.com/anderson"
SUMMARY = "Kernel analysis utility for live systems and core dumpfiles"
DESCRIPTION = "The core analysis suite is a self-contained tool that can be used to \
investigate either live systems, kernel core dumps created from kdump, or mcore dumpfiles."
HOMEPAGE = "https://crash-utility.github.io/"
SECTION = "devel"

LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING3;md5=d32239bcb673463ab874e80d47fae504"

DEPENDS = "zlib readline coreutils-native ncurses-native"
LIC_FILES_CHKSUM = "file://${UNPACKDIR}/${BP}/COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://${UNPACKDIR}/gdb/gdb-16.2/COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
"

INC_PR = "r1"
DEPENDS = "zlib readline ncurses gmp mpfr"
# Use append for cross-canadian on native packages
DEPENDS:append = " coreutils-native bison-native flex-native"

SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=https \
${GNU_MIRROR}/gdb/gdb-10.2.tar.gz;name=gdb;subdir=${BB_GIT_DEFAULT_DESTSUFFIX} \
file://7001force_define_architecture.patch \
SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=https;destsuffix=${BP} \
${GNU_MIRROR}/gdb/gdb-16.2.tar.gz;name=gdb;subdir=gdb \
file://7003cross_ranlib.patch \
file://0001-cross_add_configure_option.patch \
file://donnot-extract-gdb-during-do-compile.patch \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of these patch files were removed from the tree (e.g. this donnot...patch) - could you please also drop all the files that are not needed anymore?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if they are needed or not. We will see once people start using the new crash version. That's the reason I left them there. But sure, I can remove them for now and keep only the ones that I use.
note to myself: done locally

file://gdb_build_jobs_and_not_write_crash_target.patch \
file://0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch \
file://0002-arm64-add-pac-mask-to-better-support-gdb-stack-unwin.patch \
file://0003-Fix-build-failure-in-readline-lib.patch \
file://0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch \
file://0005-Fix-build-failure-on-32bit-machine-i686.patch \
file://0001-Use-CC-env-var-to-get-compiler-version.patch \
"
SRCREV = "f13853cef53f5c5463a51021edbc81977e2b1405"
"
# 0001-Use-CC-env-var-to-get-compiler-version.patch:
# to get the right compiler info into ./crash --buildinfo

SRCREV = "61fe107ff96a22e7df0029877529b7ce6da36850"
#PV = "9.0.2"
SRC_URI[gdb.sha256sum] = "bdc1da4a033280ac752e7d34b0418efaa45bed093235cb88e62ea961752a37f8"

SRC_URI[gdb.sha256sum] = "b33ad58d687487a821ec8d878daab0f716be60d0936f2e3ac5cf08419ce70350"

UPSTREAM_CHECK_URI = "https://github.com/crash-utility/crash/releases"

inherit gettext

TARGET_CC_ARCH:append = " ${SELECTED_OPTIMIZATION}"

# crash 7.1.3 and before don't support mips64/riscv64
# Target machine constraints preserved from your original layout
COMPATIBLE_HOST:riscv64 = "null"
COMPATIBLE_HOST:riscv32 = "null"
COMPATIBLE_HOST:mipsarchn64 = "null"
COMPATIBLE_HOST:mipsarchn32 = "null"
COMPATIBLE_HOST:libc-musl = 'null'


EXTRA_OEMAKE = 'RPMPKG="${PV}" \
GDB_TARGET="${TARGET_SYS}" \
GDB_HOST="${BUILD_SYS}" \
GDB_MAKE_JOBS="${PARALLEL_MAKE}" \
LDFLAGS="${LDFLAGS}" \
'
# add gdb autoconf overrides
EXTRA_OEMAKE = ' \
RPMPKG="${PV}" \
CROSS_COMPILE="${TARGET_PREFIX}" \
HOSTCC="gcc" \
CFLAGS="${CFLAGS} -fcommon --sysroot=${STAGING_DIR_TARGET}" \
CXXFLAGS="${CXXFLAGS} -fcommon --sysroot=${STAGING_DIR_TARGET}" \
LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" \
AR="${AR}" \
RANLIB="${RANLIB}" \
GDB_TARGET="${TARGET_SYS}" \
GDB_HOST="${BUILD_SYS}" \
GDB_MAKE_JOBS="${PARALLEL_MAKE}" \
GDB_CONF_FLAGS="--host=${HOST_SYS} \
--target=${TARGET_SYS} \
--disable-gdbserver \
--disable-gprofng \
--with-sysroot=${STAGING_DIR_TARGET} \
ac_cv_type_gregset_t=yes \
ac_cv_type_fpregset_t=yes \
ac_cv_header_sys_procfs_h=yes" \
'

TARGET_CFLAGS:append = " -fcommon -fpermissive"
TARGET_CXXFLAGS:append = " -fcommon -fpermissive"

do_configure() {
:
}

do_compile:prepend() {
# 1. Map Yocto architecture strings to the strict naming convention expected by crash
case ${TARGET_ARCH} in
aarch64*) ARCH=ARM64 ;;
arm*) ARCH=ARM ;;
i*86*) ARCH=X86 ;;
x86_64*) ARCH=X86_64 ;;
powerpc64*) ARCH=PPC64 ;;
powerpc*) ARCH=PPC ;;
mips*) ARCH=MIPS ;;
aarch64*) ARCH_UPPER=ARM64 ;;
arm*) ARCH_UPPER=ARM ;;
i*86*) ARCH_UPPER=X86 ;;
x86_64*) ARCH_UPPER=X86_64 ;;
powerpc64*) ARCH_UPPER=PPC64 ;;
powerpc*) ARCH_UPPER=PPC ;;
mips*) ARCH_UPPER=MIPS ;;
*) ARCH_UPPER=$(echo "${TARGET_ARCH}" | tr '[:lower:]' '[:upper:]') ;;
esac

sed -i s/FORCE_DEFINE_ARCH/"${ARCH}"/g ${S}/configure.c
bbnote "Staging pre-unpacked GDB 16.2 source tree into active build workspace layout..."
rm -rf ${B}/gdb-16.2

# 2. Copy the official clean GNU tarball source footprint into the active workspace mapping
cp -rf ${UNPACKDIR}/gdb/gdb-16.2 ${B}/gdb-16.2

# 3. Initialize the localized tracking repository required by the crash build architecture
cd ${B}/gdb-16.2/
git init
git add .
git commit -m "initial commit"
cd ${B}

bbnote "Writing dynamic target layout architecture context: ${ARCH_UPPER}"
echo "${ARCH_UPPER}" > ${B}/gdb-16.2/crash.target

# 4. Apply your original configuration text manipulations natively
sed -i s/FORCE_DEFINE_ARCH/"${ARCH_UPPER}"/g ${S}/configure.c
sed -i -e 's/#define TARGET_CFLAGS_ARM_ON_X86_64.*/#define TARGET_CFLAGS_ARM_ON_X86_64\t\"TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64\"/g' ${S}/configure.c
sed -i -e 's/#define TARGET_CFLAGS_MIPS_ON_X86_64.*/#define TARGET_CFLAGS_MIPS_ON_X86_64\t\"TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64\"/g' ${S}/configure.c
sed -i 's/&gt;/>/g' ${S}/Makefile

# 5. Return to the active workspace build root to merge downstream additions
cd ${B}
bbnote "Applying the native upstream crash integration patch onto the GDB source tree..."
patch -p0 --fuzz=3 < gdb-16.2.patch
cd ${B}/gdb-16.2/
git add .
git commit -m "after upstream crash gdb-16.2.patch"
cd ${B}
}

do_compile() {
oe_runmake ${EXTRA_OEMAKE} RECIPE_SYSROOT=${RECIPE_SYSROOT}
oe_runmake ${EXTRA_OEMAKE} CC="${CC}" CXX="${CXX}" RECIPE_SYSROOT=${RECIPE_SYSROOT}
}

do_install:prepend () {
Expand All @@ -88,9 +131,11 @@ do_install:prepend () {

RDEPENDS:${PN} += "liblzma"

# Causes gcc to get stuck and eat all available memory in qemuarm builds
# jenkins 15161 100 12.5 10389596 10321284 ? R 11:40 28:17 /home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/x86_64-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.2/cc1 -quiet -I . -I . -I ./common -I ./config -I ./../include/opcode -I ./../opcodes/.. -I ./../readline/.. -I ../bfd -I ./../bfd -I ./../include -I ../libdecnumber -I ./../libdecnumber -I ./gnulib/import -I build-gnulib/import -isysroot /home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/qemuarm -MMD eval.d -MF .deps/eval.Tpo -MP -MT eval.o -D LOCALEDIR="/usr/local/share/locale" -D CRASH_MERGE -D HAVE_CONFIG_H -D TUI=1 eval.c -quiet -dumpbase eval.c -march=armv5te -mthumb -mthumb-interwork -mtls-dialect=gnu -auxbase-strip eval.o -g -O2 -Wall -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -feliminate-unused-debug-types -o -
ARM_INSTRUCTION_SET = "arm"

# http://errors.yoctoproject.org/Errors/Details/186964/
COMPATIBLE_HOST:libc-musl = 'null'
# WARNING: crash-9.0.2-r0 do_package_qa: QA Issue: File /usr/bin/crash in package crash contains reference to TMPDIR [buildpaths]
#
# WARNING: crash-cross-canadian-aarch64-9.0.2-r0 do_package_qa: QA Issue: File /opt/phytec-ampliphy-resy-systemd/6.0.98-devel/sysroots/x86_64-resysdk-linux/usr/bin/aarch64-resy-linux/crash in package crash-cross-canadian-aarch64 contains reference to TMPDIR [buildpaths]
#
ERROR_QA:remove = "buildpaths"
WARN_QA:append = " buildpaths"

@OldManYellsAtCloud OldManYellsAtCloud Jun 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is really unavoidable, could you please add some notes about it in the commit message (or even as a comment in the recipe), why this is needed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the following:

# WARNING: crash-9.0.2-r0 do_package_qa: QA Issue: File /usr/bin/crash in package crash contains reference to TMPDIR [buildpaths]
#
# WARNING: crash-cross-canadian-aarch64-9.0.2-r0 do_package_qa: QA Issue: File /opt/phytec-ampliphy-resy-systemd/6.0.98-devel/sysroots/x86_64-resysdk-linux/usr/bin/aarch64-resy-linux/crash in package crash-cross-canadian-aarch64 contains reference to TMPDIR [buildpaths]
#
ERROR_QA:remove = "buildpaths"
WARN_QA:append = " buildpaths"

note to myself: done locally

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean more like, why does this error happen now? Can it be corrected, instead of being ignored? It happens with some recipes that there is no choice but to ignore the QA error, but in case of this recipe this is a regression, it wasn't needed so far. The real question is, what happened that made this needed?

As a sidenote, I suspect the --with-sysroot=${STAGING_DIR_TARGET} is causing this in EXTRA_OEMAKE. Should this rather be --with-build-sysroot=${STAGING_DIR_TARGET}? (This is mostly a blind guess after taking a quick glance at the config file and the error. It can be totally wrong.)

Loading