added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
SUMMARY = "Proxy for UDP/TCP debug connections"
DESCRIPTION = "The agent-proxy will forward tcp or udp connections as well as allow for script multiplexing of terminal sessions."
HOMEPAGE = "http://kgdb.wiki.kernel.org/"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
SECTION = "devel"
EXTRA_OEMAKE = "'CC=${CC}'"
SRCREV = "468fe4c31e6c62c9bbb328b06ba71eaf7be0b76a"
SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git;protocol=git;branch=master \
file://0001-Makefile-Add-LDFLAGS-variable.patch \
"
BBCLASSEXTEND = "native nativesdk"
S = "${WORKDIR}/git"
do_install () {
install -d ${D}${bindir}
install -m 0755 agent-proxy ${D}${bindir}
}

View File

@@ -0,0 +1,43 @@
From 1beb0dad6f8b99eb3bf1b9982e0b49e81ff77bbc Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Wed, 23 Nov 2016 19:17:31 +0800
Subject: [PATCH] Makefile: Add LDFLAGS variable
Add LDFLAGS variable to make sure the extra linkder
flags can be passed.
Upstream-Status: Pending
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index e20918f..25d92d3 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ $(CROSS_COMPILE)agent-proxy: $(OBJS)
$(CC) -DAGENT_VER=$(AGENTVER) $(LINKFLAGS) $(CFLAGS) -o $(extpath)$@ $(OBJS) wsock32.lib
else
$(CROSS_COMPILE)agent-proxy: $(OBJS)
- $(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) -o $(extpath)$@ $(OBJS) $(LDLIBS)
+ $(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) $(LDFLAGS) -o $(extpath)$@ $(OBJS) $(LDLIBS)
endif
@@ -61,9 +61,9 @@ clean:
rm -f $(extpath)$(CROSS_COMPILE)agent-proxy $(extpath)agent-proxy $(extpath)*.o $(extpath)*.obj $(extpath)*.exp $(extpath)*.exe $(extpath)*.ilk $(extpath)*.pdb *~
$(extpath)$(CROSS_COMPILE)%.o::%.c
- $(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) -c $< -o $@
+ $(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) $(LDFLAGS) -c $< -o $@
$(extpath)%.obj:%.c
- $(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) -c -Fo$@ $(TLSPATH_INC) $<
+ $(CC) -DAGENT_VER=$(AGENTVER) $(CFLAGS) $(LDFLAGS) -c -Fo$@ $(TLSPATH_INC) $<
--
2.8.3

View File

@@ -0,0 +1,44 @@
SUMMARY = "Inspect and manipulate eBPF programs and maps"
DESCRIPTION = "bpftool is a kernel tool for inspection and simple manipulation \
of eBPF programs and maps."
LICENSE = "GPL-2.0-only"
DEPENDS = "binutils elfutils"
PROVIDES = "virtual/bpftool"
inherit bash-completion kernelsrc kernel-arch
do_populate_lic[depends] += "virtual/kernel:do_patch"
EXTRA_OEMAKE = "\
V=1 \
-C ${S}/tools/bpf/bpftool \
O=${B} \
CROSS=${TARGET_PREFIX} \
CC="${CC} ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH}" \
LD="${LD}" \
AR=${AR} \
ARCH=${ARCH} \
"
SECURITY_CFLAGS = ""
do_configure[depends] += "virtual/kernel:do_shared_workdir"
COMPATIBLE_HOST = "(x86_64|aarch64).*-linux"
COMPATIBLE_HOST:libc-musl = 'null'
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} install
}
PACKAGE_ARCH = "${MACHINE_ARCH}"
python do_package:prepend() {
d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
}
B = "${WORKDIR}/${BPN}-${PV}"

View File

@@ -0,0 +1,76 @@
# Copyright (C) 2018 Krzysztof Kozlowski <krzk@kernel.org>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "Broadcom Bluetooth firmware files"
DESCRIPTION = "Firmware for Broadcom Bluetooth devices. Note that in case of BT+WiFi devices, separate WiFi firmware might be needed."
HOMEPAGE = "https://github.com/winterheart/broadcom-bt-firmware"
LICENSE = "Firmware-Broadcom-WIDCOMM"
NO_GENERIC_LICENSE[Firmware-Broadcom-WIDCOMM] = "LICENSE.broadcom_bcm20702"
LIC_FILES_CHKSUM = "file://LICENSE.broadcom_bcm20702;md5=c0d5ea0502b00df74173d0f8a48b619d"
SRC_URI = "git://github.com/winterheart/broadcom-bt-firmware.git;branch=master;protocol=https"
SRCREV = "a0eb4805dbb232f02f156b9351a23790c1a4cec7"
PE = "1"
S = "${WORKDIR}/git"
inherit allarch
CLEANBROKEN = "1"
do_compile() {
:
}
do_install() {
install -d ${D}${nonarch_base_libdir}/firmware/brcm/
cp brcm/*.hcd ${D}${nonarch_base_libdir}/firmware/brcm/
# For license package:
install -m 0644 LICENSE.broadcom_bcm20702 ${D}${nonarch_base_libdir}/firmware/brcm/
# For main package:
install -m 0644 DEVICES.md ${D}${nonarch_base_libdir}/firmware/brcm/
}
PACKAGES =+ " \
${PN}-bcm20702a1 \
${PN}-bcm20702b0 \
${PN}-bcm20703a1 \
${PN}-bcm43142a0 \
${PN}-bcm4335c0 \
${PN}-bcm4350c5 \
${PN}-bcm4356a2 \
${PN}-bcm4371c2 \
${PN}-license \
"
RDEPENDS:${PN}-bcm20702a1 = "${PN}-license"
RDEPENDS:${PN}-bcm20702b0 = "${PN}-license"
RDEPENDS:${PN}-bcm20703a1 = "${PN}-license"
RDEPENDS:${PN}-bcm43142a0 = "${PN}-license"
RDEPENDS:${PN}-bcm4335c0 = "${PN}-license"
RDEPENDS:${PN}-bcm4350c5 = "${PN}-license"
RDEPENDS:${PN}-bcm4356a2 = "${PN}-license"
RDEPENDS:${PN}-bcm4371c2 = "${PN}-license"
FILES:${PN}-bcm20702a1 = "${nonarch_base_libdir}/firmware/brcm/BCM20702A1*hcd"
FILES:${PN}-bcm20702b0 = "${nonarch_base_libdir}/firmware/brcm/BCM20702B0*hcd"
FILES:${PN}-bcm20703a1 = "${nonarch_base_libdir}/firmware/brcm/BCM20703A1*hcd"
FILES:${PN}-bcm43142a0 = "${nonarch_base_libdir}/firmware/brcm/BCM43142A0*hcd"
FILES:${PN}-bcm4335c0 = "${nonarch_base_libdir}/firmware/brcm/BCM4335C0*hcd"
FILES:${PN}-bcm4350c5 = "${nonarch_base_libdir}/firmware/brcm/BCM4350C5*hcd"
FILES:${PN}-bcm4356a2 = "${nonarch_base_libdir}/firmware/brcm/BCM4356A2*hcd"
FILES:${PN}-bcm4371c2 = "${nonarch_base_libdir}/firmware/brcm/BCM4371C2*hcd"
FILES:${PN}-license += "${nonarch_base_libdir}/firmware/brcm/LICENSE.broadcom_bcm20702"
FILES:${PN} += "${nonarch_base_libdir}/firmware/brcm/*"
RDEPENDS:${PN} += "${PN}-license"
# Make broadcom-bt-firmware depend on all of the split-out packages.
python populate_packages:prepend () {
firmware_pkgs = oe.utils.packages_filter_out_system(d)
d.appendVar('RDEPENDS:broadcom-bt-firmware', ' ' + ' '.join(firmware_pkgs))
}

View File

@@ -0,0 +1,35 @@
SUMMARY = "Shows and sets processor power related values"
DESCRIPTION = "cpupower is a collection of tools to examine and tune power \
saving related features of your processor."
LICENSE = "GPL-2.0-only"
DEPENDS = "pciutils gettext-native"
PROVIDES = "virtual/cpupower"
inherit kernelsrc kernel-arch bash-completion
do_populate_lic[depends] += "virtual/kernel:do_patch"
EXTRA_OEMAKE = "-C ${S}/tools/power/cpupower O=${B} CROSS=${TARGET_PREFIX} CC="${CC}" LD="${LD}" AR=${AR} ARCH=${ARCH}"
do_configure[depends] += "virtual/kernel:do_shared_workdir"
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} install
# Do not ship headers
rm -rf ${D}${includedir}
chown -R root:root ${D}
}
PACKAGE_ARCH = "${MACHINE_ARCH}"
RDEPENDS:${PN} = "bash"
python do_package:prepend() {
d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
}
B = "${WORKDIR}/${BPN}-${PV}"

View File

@@ -0,0 +1,32 @@
From e3ba432243d9be4e845daabc78a0ae7c03c680f5 Mon Sep 17 00:00:00 2001
From: Lei Maohui <leimaohui@cn.fujitsu.com>
Date: Fri, 9 Jan 2015 11:51:18 +0900
Subject: [PATCH] cross_add_configure_option
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 7266e305..390fc0ef 100644
--- a/Makefile
+++ b/Makefile
@@ -260,7 +260,7 @@ gdb_merge: force
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@rm -f ${PROGRAM}
@if [ ! -f ${GDB}/config.status ]; then \
- (cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
+ (cd ${GDB}; ./configure --host=${GDB_TARGET} --build=${GDB_HOST} --with-separate-debug-dir=/usr/lib/debug \
--with-bugurl="" --with-expat=no --with-python=no --disable-sim; \
$(MAKE) CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
else $(MAKE) rebuild; fi
@@ -306,7 +306,7 @@ force:
make_configure: force
@rm -f configure
- @${CC} ${CONF_FLAGS} -o configure configure.c ${WARNING_ERROR} ${WARNING_OPTIONS}
+ @${BUILD_CC} ${CONF_FLAGS} -o configure configure.c ${WARNING_ERROR} ${WARNING_OPTIONS}
clean: make_configure
@./configure ${CONF_TARGET_FLAG} -q -b

View File

@@ -0,0 +1,13 @@
diff -uprN crash-5.1.8.org/configure.c crash-5.1.8/configure.c
--- crash-5.1.8.org/configure.c 2011-09-17 04:01:12.000000000 +0900
+++ crash-5.1.8/configure.c 2012-09-13 13:28:45.393344108 +0900
@@ -391,6 +391,9 @@ get_current_configuration(struct support
arch_mismatch(sp);
}
+ /** Force define archtecture */
+ target_data.target = FORCE_DEFINE_ARCH;
+
if ((fp = fopen("Makefile", "r")) == NULL) {
perror("Makefile");
goto get_release;

View File

@@ -0,0 +1,21 @@
From 2f200ceed289f935b5e7ec230454a22dd76e42b0 Mon Sep 17 00:00:00 2001
From: leimaohui <leimaohui@cn.fujitsu.com>
Date: Mon, 12 Jan 2015 11:52:35 +0800
Subject: [PATCH] crash: add new recipe
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 79aef176..7266e305 100644
--- a/Makefile
+++ b/Makefile
@@ -295,6 +295,7 @@ gdb_patch:
library: ${OBJECT_FILES}
ar -rs ${PROGRAM}lib.a ${OBJECT_FILES}
+ ${RANLIB} ${PROGRAM}lib.a
gdb: force
rm -f ${GDB_OFILES}

View File

@@ -0,0 +1 @@
bash_cv_have_mbstate_t=yes

View File

@@ -0,0 +1,45 @@
From 8b882650b730cb6e025d47d65574f43549b7a1a3 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Thu, 9 Mar 2023 10:28:28 +0800
Subject: [PATCH] Makefile: Put gdb source tarball in SRC_URI
Put gdb source tarball in SRC_URI and don't fetch and extract it during
do_compile.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
Makefile | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 79aef17..146da6a 100644
--- a/Makefile
+++ b/Makefile
@@ -254,7 +254,7 @@ all: make_configure
# @$(MAKE) extensions
gdb_merge: force
- @if [ ! -f ${GDB}/README ]; then \
+ @if [ ! -f ${GDB}/${GDB}.patch ]; then \
$(MAKE) gdb_unzip; fi
@echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
@@ -281,12 +281,6 @@ gdb_unzip:
@rm -f gdb.files
@for FILE in ${GDB_FILES} dummy; do\
echo $$FILE >> gdb.files; done
- @if [ ! -f ${GDB}.tar.gz ] && [ ! -f /usr/bin/wget ]; then \
- echo /usr/bin/wget is required to download ${GDB}.tar.gz; echo; exit 1; fi
- @if [ ! -f ${GDB}.tar.gz ] && [ -f /usr/bin/wget ]; then \
- [ ! -t 2 ] && WGET_OPTS="--progress=dot:mega"; \
- wget $$WGET_OPTS http://ftp.gnu.org/gnu/gdb/${GDB}.tar.gz; fi
- @tar --exclude-from gdb.files -xzmf ${GDB}.tar.gz
@$(MAKE) gdb_patch
gdb_patch:
--
2.25.1

View File

@@ -0,0 +1,38 @@
From af49d8df559aa18f97d14ab7971f211238a16041 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Thu, 9 Mar 2023 10:50:10 +0800
Subject: [PATCH] Makefile: Don't write ${TARGET} to crash.target
This enables parallel building (multiple jobs in gdb) by reading the
value from GDB_MAKE_JOBS.
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Upstream-Status: Pending
Don't write ${TARGET} to crash.target which causes rebuild fails.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index cd25c7d..d61c4c5 100644
--- a/Makefile
+++ b/Makefile
@@ -262,8 +262,8 @@ gdb_merge: force
@if [ ! -f ${GDB}/config.status ]; then \
(cd ${GDB}; ./configure --host=${GDB_TARGET} --build=${GDB_HOST} --with-separate-debug-dir=/usr/lib/debug \
--with-bugurl="" --with-expat=no --with-python=no --disable-sim; \
- $(MAKE) CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
- else $(MAKE) rebuild; fi
+ $(MAKE) CRASH_TARGET=${TARGET} ${GDB_MAKE_JOBS}; ) \
+ else $(MAKE) ${GDB_MAKE_JOBS} rebuild; fi
@if [ ! -f ${PROGRAM} ]; then \
echo; echo "${PROGRAM} build failed"; \
echo; exit 1; fi
--
2.25.1

View File

@@ -0,0 +1,113 @@
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"
SECTION = "devel"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING3;md5=d32239bcb673463ab874e80d47fae504"
DEPENDS = "zlib readline coreutils-native ncurses-native"
S = "${WORKDIR}/git"
SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=https \
${GNU_MIRROR}/gdb/gdb-10.2.tar.gz;name=gdb;subdir=git \
file://7001force_define_architecture.patch \
file://7003cross_ranlib.patch \
file://0001-cross_add_configure_option.patch \
file://donnot-extract-gdb-during-do-compile.patch \
file://gdb_build_jobs_and_not_write_crash_target.patch \
"
SRCREV = "f1cd581d1c4afa5b8ffdfaa6a3ea9f545fe4ec91"
SRC_URI[gdb.sha256sum] = "b33ad58d687487a821ec8d878daab0f716be60d0936f2e3ac5cf08419ce70350"
UPSTREAM_CHECK_URI = "https://github.com/crash-utility/crash/releases"
inherit gettext
BBCLASSEXTEND = "native cross"
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"
EXTRA_OEMAKE = 'RPMPKG="${PV}" \
GDB_TARGET="${TARGET_SYS}" \
GDB_HOST="${BUILD_SYS}" \
GDB_MAKE_JOBS="${PARALLEL_MAKE}" \
LDFLAGS="${LDFLAGS}" \
'
EXTRA_OEMAKE:class-cross = 'RPMPKG="${PV}" \
GDB_TARGET="${BUILD_SYS} --target=${TARGET_SYS}" \
GDB_HOST="${BUILD_SYS}" \
GDB_MAKE_JOBS="${PARALLEL_MAKE}" \
'
EXTRA_OEMAKE:append:class-native = " LDFLAGS='${BUILD_LDFLAGS}'"
EXTRA_OEMAKE:append:class-cross = " LDFLAGS='${BUILD_LDFLAGS}'"
do_configure() {
:
}
do_compile:prepend() {
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 ;;
esac
sed -i s/FORCE_DEFINE_ARCH/"${ARCH}"/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
}
do_compile() {
oe_runmake ${EXTRA_OEMAKE} RECIPE_SYSROOT=${RECIPE_SYSROOT}
}
do_install:prepend () {
install -d ${D}${bindir}
install -d ${D}/${mandir}/man8
install -d ${D}${includedir}/crash
install -m 0644 ${S}/crash.8 ${D}/${mandir}/man8/
install -m 0644 ${S}/defs.h ${D}${includedir}/crash
}
do_install:class-target () {
oe_runmake DESTDIR=${D} install
}
do_install:class-native () {
oe_runmake DESTDIR=${D}${STAGING_DIR_NATIVE} install
}
do_install:class-cross () {
install -m 0755 ${S}/crash ${D}/${bindir}
}
RDEPENDS:${PN} += "liblzma"
RDEPENDS:${PN}:class-native = ""
RDEPENDS:${PN}:class-cross = ""
# 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'

View File

@@ -0,0 +1,33 @@
SUMMARY = "A tool to validate Intel Speed Select commands"
DESCRIPTION = "The Intel Speed Select Technology (Intel SST) is a powerful new \
collection of features giving you more granular control over CPU performance \
for optimized total cost of ownership."
LICENSE = "GPL-2.0-only"
inherit kernelsrc
COMPATIBLE_HOST = '(x86_64|i.86).*-linux'
COMPATIBLE_HOST:libc-musl = 'null'
DEPENDS = "libnl"
do_populate_lic[depends] += "virtual/kernel:do_patch"
B = "${WORKDIR}/${BPN}-${PV}"
CFLAGS += "-I${STAGING_INCDIR}/libnl3"
EXTRA_OEMAKE = "-C ${S}/tools/power/x86/intel-speed-select O=${B} CROSS=${TARGET_PREFIX} CC="${CC}" LD="${LD}" AR=${AR} ARCH=${ARCH}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
do_configure[depends] += "virtual/kernel:do_shared_workdir"
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} install
}

View File

@@ -0,0 +1,41 @@
From 63d72f97bd106dd2101cd7fdac6df4f7a053d67c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 2 Sep 2022 08:27:39 -0700
Subject: [PATCH] configure: Remove the logic to download IANA PEN database
during configure
OE will do all downloading before it starts to configure therefore this
step is moved out into bitbake recipe, so we can make it immutable build
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -56,21 +56,7 @@ if test "x$exec_prefix" = "xNONE"; then
exec_prefix="$prefix"
fi
-if test "x$WGET" = "x"; then
- if test "x$CURL" = "x"; then
- AC_MSG_WARN([** Neither wget nor curl could be found.])
- AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !])
- else
- DOWNLOAD="$CURL --location --progress-bar"
- AM_CONDITIONAL([DOWNLOAD], [true])
- fi
-else
- DOWNLOAD="$WGET -c -nd -O -"
- AM_CONDITIONAL([DOWNLOAD], [true])
-fi
-
-AC_MSG_WARN([** Download is:])
-AC_MSG_WARN($DOWNLOAD)
+AM_CONDITIONAL([DOWNLOAD], [false])
AC_SUBST(DOWNLOAD, $DOWNLOAD)
dnl

View File

@@ -0,0 +1,54 @@
SUMMARY = "Utility for IPMI control"
DESCRIPTION = "This package contains a utility for interfacing with devices that support \
the Intelligent Platform Management Interface specification. IPMI is \
an open standard for machine health, inventory, and remote power control. \
\
This utility can communicate with IPMI-enabled devices through either a \
kernel driver such as OpenIPMI or over the RMCP LAN protocol defined in \
the IPMI specification. IPMIv2 adds support for encrypted LAN \
communications and remote Serial-over-LAN functionality. \
\
It provides commands for reading the Sensor Data Repository (SDR) and \
displaying sensor values, displaying the contents of the System Event \
Log (SEL), printing Field Replaceable Unit (FRU) information, reading and \
setting LAN configuration, and chassis power control. \
"
HOMEPAGE = "http://codeberg.org/IPMITool/ipmitool"
SECTION = "kernel/userland"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=9aa91e13d644326bf281924212862184"
DEPENDS = "openssl readline ncurses"
SRCREV = "19d78782d795d0cf4ceefe655f616210c9143e62"
SRC_URI = "git://codeberg.org/ipmitool/ipmitool;protocol=https;branch=master \
${IANA_ENTERPRISE_NUMBERS} \
file://0001-configure-Remove-the-logic-to-download-IANA-PEN-data.patch \
"
IANA_ENTERPRISE_NUMBERS ?= ""
# Add these via bbappend if this database is needed by the system
#IANA_ENTERPRISE_NUMBERS = "http://www.iana.org/assignments/enterprise-numbers.txt;name=iana-enterprise-numbers;downloadfilename=iana-enterprise-numbers"
#SRC_URI[iana-enterprise-numbers.sha256sum] = "cdd97fc08325667434b805eb589104ae63f7a9eb720ecea73cb55110b383934c"
S = "${WORKDIR}/git"
inherit autotools
do_install:append() {
if [ -e ${WORKDIR}/iana-enterprise-numbers ]; then
install -Dm 0755 ${WORKDIR}/iana-enterprise-numbers ${D}${datadir}/misc/enterprise-numbers
fi
}
PACKAGES =+ "${PN}-ipmievd"
FILES:${PN}-ipmievd += "${sbindir}/ipmievd"
FILES:${PN} += "${datadir}/misc"
# --disable-dependency-tracking speeds up the build
# --enable-file-security adds some security checks
# --disable-intf-free disables FreeIPMI support - we don't want to depend on
# FreeIPMI libraries, FreeIPMI has its own ipmitoool-like utility.
#
EXTRA_OECONF = "--disable-dependency-tracking --enable-file-security --disable-intf-free"

View File

@@ -0,0 +1,25 @@
From da668e5bf1a721797361ab866d09913ee8e157c4 Mon Sep 17 00:00:00 2001
From: Jeremy Puhlman <jpuhlman@mvista.com>
Date: Sat, 22 Feb 2020 04:37:04 +0000
Subject: [PATCH] Prevent access times from changing resulting gzip md5sum
Upstream-Status: Pending
https://github.com/ipmitool/ipmitool/pull/186
---
doc/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index b792762..2c52ce6 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -59,5 +59,5 @@ install:
${INSTALL_DATA_SH} iuser.8 ${manto}
${INSTALL_DATA_SH} iseltime.8 ${manto}
${INSTALL_DATA_SH} bmclanpet.mib ${datato}
- cd ${manto}; gzip -f *.8
+ cd ${manto}; gzip -nf *.8
--
2.13.3

View File

@@ -0,0 +1,26 @@
From 097e108b81f2571c4c51871044adf409b6954649 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 3 Sep 2022 00:44:52 -0700
Subject: [PATCH] ihpm: Include stdlib.h for malloc/free/atoi functions
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
util/ihpm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/ihpm.c b/util/ihpm.c
index 740ab74..5ad9ef6 100644
--- a/util/ihpm.c
+++ b/util/ihpm.c
@@ -68,6 +68,7 @@ typedef uint32_t socklen_t;
#endif
#include <stdio.h>
#include <stdarg.h>
+#include <stdlib.h> /* malloc/free/atoi */
#include <string.h>
#include <time.h>
--
2.37.3

View File

@@ -0,0 +1,127 @@
allow systemd path to be defined by configure option.
The configure probes the host for systemd path information.
Upstream-Status: Inappropriate [Embedded]
Signed-off-by: Armin Kuster <akuster@mvista.com>
Index: ipmiutil-3.0.5/configure.ac
===================================================================
--- ipmiutil-3.0.5.orig/configure.ac
+++ ipmiutil-3.0.5/configure.ac
@@ -149,7 +149,6 @@ CROSS_LFLAGS=""
CROSS_CFLAGS=""
LIBSENSORS=""
SAM2OBJ="isensor2.o ievents2.o"
-SYSTEMD_DIR=/usr/share/ipmiutil
AC_ARG_ENABLE([useflags],
[ --enable-useflags include environment CFLAGS and LDFLAGS.],
@@ -200,29 +199,42 @@ AC_ARG_ENABLE([gpl],
dnl Does this Linux have systemd enabled? Otherwise use sysv init.
AC_ARG_ENABLE([systemd],
- [ --enable-systemd enable systemd service type=notify support and %_unitdir [[default=disabled]]],)
-if test "x$enable_systemd" = "xyes"; then
- GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
- # if systemd enabled, install service scripts in unitdir
- which rpm >/dev/null 2>&1
- if test $? -eq 0 ; then
- SYSTEMD_DIR=`rpm --eval "%{_unitdir}"`
- else
- SYSTEMD_DIR=/usr/share/ipmiutil
- fi
+ [ --enable-systemd[=systemddir] install systemd unit file. If 'yes'
+ probe the system for unit directory.
+ If a path is specified, assume that
+ is a valid install path. [[default=disabled]]],)
+# Check whether --enable-systemd was given.
+if test "${enable_systemd+set}" = set; then :
+ withval=$enable_systemd; if test "$withval" = yes; then
+ GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
+ if test -z "$systemddir"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
+ $as_echo_n "checking location of the systemd unit files directory... " >&6; }
+ _rpmdir = ""
+ which rpm >/dev/null 2>&1
+ if test $? -eq 0 ; then
+ _rpmdir = `rpm --eval "%{_unitdir}"`
+ fi
+ for systemd_d in ${datadir}/usr/share/ipmiutil ${_rpmdir} /usr/share/ipmiutil; do
+ if test -z "$systemddir"; then
+ if test -d "$systemd_d"; then
+ systemddir="$systemd_d"
+ fi
+ fi
+ done
+ fi
+ if test -n "$systemddir"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
+ $as_echo "$systemddir" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ $as_echo "not found" >&6; }
+ fi
else
- # otherwise install the systemd service scripts in the data dir
- SYSTEMD_DIR=/usr/share/ipmiutil
- if test "x$sysname" != "xDarwin" ; then
- if test "x$os" != "xhpux" ; then
- # MacOS and HP-UX: 'which' command returns 0 always
- which rpm >/dev/null 2>&1
- if test $? -eq 0 ; then
- datad=`rpm --eval "%{_datadir}"`
- SYSTEMD_DIR=${datad}/ipmiutil
- fi
- fi
- fi
+ if test "$withval" != no; then
+ systemddir=$withval
+ fi
+fi
fi
dnl start main logic
@@ -528,7 +540,7 @@ AC_SUBST(INS_LIB)
AC_SUBST(SUBDIR_S)
AC_SUBST(CROSS_CFLAGS)
AC_SUBST(CROSS_LFLAGS)
-AC_SUBST(SYSTEMD_DIR)
+AC_SUBST(systemddir)
AC_SUBST(SHR_LINK)
AC_SUBST(pkgconfigdir)
Index: ipmiutil-3.0.5/scripts/Makefile.am
===================================================================
--- ipmiutil-3.0.5.orig/scripts/Makefile.am
+++ ipmiutil-3.0.5/scripts/Makefile.am
@@ -17,7 +17,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily
sbinto = ${DESTDIR}${sbindir}
varto = ${DESTDIR}/var/lib/ipmiutil
initto = ${DESTDIR}@INIT_DIR@
-sysdto = ${DESTDIR}@SYSTEMD_DIR@
+sysdto = ${DESTDIR}@systemddir@
+systemddir = @systemddir@
sysvinit = ${datato}
sbinfls = ialarms ihealth ifru igetevent ireset icmd isol ilan isensor isel iserial iwdt iconfig ipicmg ifirewall ifwum ihpm iuser
@@ -47,10 +48,14 @@ install:
${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port
${INSTALL_SCRIPT_SH} ipmi_info ${sysvinit}/ipmi_info
${INSTALL_SCRIPT_SH} checksel ${datato}
- ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}
- ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}
- ${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}
- ${INSTALL_DATA_SH} ipmi_port.service ${sysdto}
+
+ if [ ! -z "${systemddir}" ]; then \
+ $(MKDIR) ${sysdto}; \
+ ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}; \
+ ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}; \
+ ${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}; \
+ ${INSTALL_DATA_SH} ipmi_port.service ${sysdto}; \
+ fi
${INSTALL_SCRIPT_SH} ipmiutil.env ${datato}
${INSTALL_SCRIPT_SH} ipmiutil.pre ${datato}
${INSTALL_SCRIPT_SH} ipmiutil.setup ${datato}

View File

@@ -0,0 +1,48 @@
SUMMARY = "ipmiutil is an easy-to-use set of IPMI server management utilities.\
It can get/set sensor thresholds, automate SEL management, do SOL console, etc."
DESCRIPTION = "The IPMI Management Utilities currently work with platforms that \
support the IPMI 1.5 or 2.0 specification. IPMI servers can be managed\
locally, or remotely via IPMI LAN, even when the OS or main CPU is not\
functional.\n \
The ipmiutil utilities will use an IPMI Driver, either the Intel IPMI package \
(ipmidrvr, /dev/imb), MontaVista OpenIPMI (/dev/ipmi0), the valinux IPMI \
Driver (/dev/ipmikcs), or the LANDesk ldipmi daemon. The ipmiutil utilities \
can also use direct user-space I/Os in Linux or FreeBSD if no IPMI driver \
is detected."
HOMEPAGE = "http://ipmiutil.sourceforge.net"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=626a5970304daa1fcb87f757fb42b795"
DEPENDS += "openssl"
PARALLEL_MAKE = ""
SRC_URI = "${SOURCEFORGE_MIRROR}/ipmiutil/ipmiutil-${PV}.tar.gz \
file://fix_systemd_path.patch \
file://0001-Prevent-access-times-from-changing-resulting-gzip-md.patch \
file://0001-ihpm-Include-stdlib.h-for-malloc-free-atoi-functions.patch \
"
SRC_URI[md5sum] = "292d6df25cad678bb27e5c8cdc6748f9"
SRC_URI[sha256sum] = "58ccdbd5755d7dd72478756715af09e9c73330dfad2b91dbf03d2ac504b301a3"
inherit autotools-brokensep pkgconfig systemd
PACKAGECONFIG ?= "lanplus gpl"
PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
PACKAGECONFIG[systemd] = "--enable-systemd=${datadir}/${BPN}, --enable-systemd=no"
PACKAGECONFIG[sha256] = "--enable-sha256, --enable-sha256=no, openssl-native, openssl"
PACKAGECONFIG[lanplus] = "--enable-lanplus, --enable-lanplus=no, openssl-native, openssl"
PACKAGECONFIG[landesk] = "--enable-landesk, --enable-landesk=no"
PACKAGECONFIG[sensors] = "--enable-libsensors, --enable-libsensors=no"
#build with some GPL code
PACKAGECONFIG[gpl] = "--enable-gpl, --enable-gpl=no"
#no GPL or LanPlus libs
PACKAGECONFIG[standalone] = "--enable-standalone, --enable-standalone=no"
CFLAGS += "-I${STAGING_INCDIR}"
LDFLAGS += "-L${STAGING_LIBDIR}"
COMPATIBLE_HOST = '(x86_64|i.86).*-linux'

View File

@@ -0,0 +1,145 @@
SUMMARY = "Kernel selftest for Linux"
DESCRIPTION = "Kernel selftest for Linux"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://../COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
DEPENDS = "rsync-native llvm-native"
# for musl libc
SRC_URI:append:libc-musl = "\
file://userfaultfd.patch \
"
SRC_URI += "file://run-ptest \
file://COPYING \
"
# now we just test bpf and vm
# we will append other kernel selftest in the future
# bpf was added in 4.10 with: https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d
# if you have older kernel than that you need to remove it from PACKAGECONFIG
PACKAGECONFIG ??= "firmware"
PACKAGECONFIG:remove:x86 = "bpf"
PACKAGECONFIG:remove:arm = "bpf vm"
# host ptrace.h is used to compile BPF target but mips ptrace.h is needed
# progs/loop1.c:21:9: error: incomplete definition of type 'struct user_pt_regs'
# m = PT_REGS_RC(ctx);
# vm tests need libhugetlbfs starting 5.8+ (https://lkml.org/lkml/2020/4/22/1654)
PACKAGECONFIG:remove:qemumips = "bpf vm"
# riscv does not support libhugetlbfs yet
PACKAGECONFIG:remove:riscv64 = "vm"
PACKAGECONFIG:remove:riscv32 = "vm"
PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native,"
PACKAGECONFIG[firmware] = ",,libcap, bash"
PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash"
do_patch[depends] += "virtual/kernel:do_shared_workdir"
inherit linux-kernel-base kernel-arch ptest
S = "${WORKDIR}/${BP}"
TEST_LIST = "\
${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \
rtc \
"
EXTRA_OEMAKE = '\
CROSS_COMPILE=${TARGET_PREFIX} \
ARCH=${ARCH} \
CC="${CC}" \
CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS}" \
AR="${AR}" \
LD="${LD}" \
DESTDIR="${D}" \
MACHINE="${ARCH}" \
'
KERNEL_SELFTEST_SRC ?= "Makefile \
include \
kernel \
lib \
tools \
scripts \
arch \
LICENSES \
"
do_compile() {
if [ ${@bb.utils.contains('PACKAGECONFIG', 'bpf', 'True', 'False', d)} = 'True' ]; then
if [ ${@bb.utils.contains('DEPENDS', 'clang-native', 'True', 'False', d)} = 'False' ]; then
bbwarn "clang >= 6.0 with bpf support is needed with kernel 4.18+ so
either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency"
fi
fi
for i in ${TEST_LIST}
do
oe_runmake -C ${S}/tools/testing/selftests/${i}
done
}
do_install() {
for i in ${TEST_LIST}
do
oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
# Install kselftest-list.txt that required by kselftest runner.
oe_runmake -s --no-print-directory COLLECTION=${i} -C ${S}/tools/testing/selftests/${i} emit_tests \
>> ${D}/usr/kernel-selftest/kselftest-list.txt
done
# Install kselftest runner.
install -m 0755 ${S}/tools/testing/selftests/run_kselftest.sh ${D}/usr/kernel-selftest/
cp -R --no-dereference --preserve=mode,links -v ${S}/tools/testing/selftests/kselftest ${D}/usr/kernel-selftest/
if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then
sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
fi
chown root:root -R ${D}/usr/kernel-selftest
}
do_configure() {
install -D -m 0644 ${WORKDIR}/COPYING ${S}/COPYING
}
do_patch[prefuncs] += "copy_kselftest_source_from_kernel remove_unrelated"
python copy_kselftest_source_from_kernel() {
sources = (d.getVar("KERNEL_SELFTEST_SRC") or "").split()
src_dir = d.getVar("STAGING_KERNEL_DIR")
dest_dir = d.getVar("S")
bb.utils.mkdirhier(dest_dir)
for s in sources:
src = oe.path.join(src_dir, s)
dest = oe.path.join(dest_dir, s)
if os.path.isdir(src):
oe.path.copytree(src, dest)
else:
bb.utils.copyfile(src, dest)
}
remove_unrelated() {
if ${@bb.utils.contains('PACKAGECONFIG','bpf','true','false',d)} ; then
test -f ${S}/tools/testing/selftests/bpf/Makefile && \
sed -i -e 's/test_pkt_access.*$/\\/' \
-e 's/test_pkt_md_access.*$/\\/' \
-e 's/sockmap_verdict_prog.*$/\\/' \
${S}/tools/testing/selftests/bpf/Makefile || \
bberror "Your kernel is probably older than 4.10 and doesn't have tools/testing/selftests/bpf/Makefile file from https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d, disable bpf PACKAGECONFIG"
fi
}
PACKAGE_ARCH = "${MACHINE_ARCH}"
INHIBIT_PACKAGE_DEBUG_SPLIT="1"
FILES:${PN} += "/usr/kernel-selftest"
RDEPENDS:${PN} += "python3 perl"
# tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty
INSANE_SKIP:${PN} += "ldflags"
SECURITY_CFLAGS = ""
COMPATIBLE_HOST:libc-musl = 'null'
# It has native clang/llvm dependency, poky distro is reluctant to include them as deps
# this helps with world builds on AB
EXCLUDE_FROM_WORLD = "1"

View File

@@ -0,0 +1,18 @@
The Linux Kernel is provided under:
SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
Being under the terms of the GNU General Public License version 2 only,
according with:
LICENSES/preferred/GPL-2.0
With an explicit syscall exception, as stated at:
LICENSES/exceptions/Linux-syscall-note
In addition, other licenses may also apply. Please see:
Documentation/process/license-rules.rst
for more details.

View File

@@ -0,0 +1,11 @@
#!/bin/sh
export PATH=$PATH:/usr/kernel-selftest/bpf
# test_align
test_align | grep "12 pass" &> /dev/null
if [ $? == 0 ]; then
echo "[PASS]: test_align"
else
echo "[FAIL]: test_align"
fi

View File

@@ -0,0 +1,322 @@
From c7b375747cffb627d02543d946b28525455d7d46 Mon Sep 17 00:00:00 2001
From: "Hongzhi.Song" <hongzhi.song@windriver.com>
Date: Fri, 13 Jul 2018 06:06:19 -0700
Subject: [PATCH] vm: add some funtions to support musl libc
Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
tools/testing/selftests/vm/userfaultfd.c | 298 +++++++++++++++++++++++++++++++
1 file changed, 298 insertions(+)
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index de2f9ec..dc73021 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -71,6 +71,304 @@
#ifdef __NR_userfaultfd
+/* Linear congruential. */
+#define TYPE_0 0
+#define BREAK_0 8
+#define DEG_0 0
+#define SEP_0 0
+
+/* x**7 + x**3 + 1. */
+#define TYPE_1 1
+#define BREAK_1 32
+#define DEG_1 7
+#define SEP_1 3
+
+/* x**15 + x + 1. */
+#define TYPE_2 2
+#define BREAK_2 64
+#define DEG_2 15
+#define SEP_2 1
+
+/* x**31 + x**3 + 1. */
+#define TYPE_3 3
+#define BREAK_3 128
+#define DEG_3 31
+#define SEP_3 3
+
+/* x**63 + x + 1. */
+#define TYPE_4 4
+#define BREAK_4 256
+#define DEG_4 63
+#define SEP_4 1
+
+/* Array versions of the above information to make code run faster.
+ Relies on fact that TYPE_i == i. */
+
+#define MAX_TYPES 5 /* Max number of types above. */
+
+#define __set_errno(val) (errno = (val))
+
+struct random_data
+ {
+ int32_t *fptr; /* Front pointer. */
+ int32_t *rptr; /* Rear pointer. */
+ int32_t *state; /* Array of state values. */
+ int rand_type; /* Type of random number generator. */
+ int rand_deg; /* Degree of random number generator. */
+ int rand_sep; /* Distance between front and rear. */
+ int32_t *end_ptr; /* Pointer behind state table. */
+ };
+
+struct random_poly_info
+{
+ int seps[MAX_TYPES];
+ int degrees[MAX_TYPES];
+};
+
+static const struct random_poly_info random_poly_info =
+{
+ { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 },
+ { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }
+};
+
+/* If we are using the trivial TYPE_0 R.N.G., just do the old linear
+ congruential bit. Otherwise, we do our fancy trinomial stuff, which is the
+ same in all the other cases due to all the global variables that have been
+ set up. The basic operation is to add the number at the rear pointer into
+ the one at the front pointer. Then both pointers are advanced to the next
+ location cyclically in the table. The value returned is the sum generated,
+ reduced to 31 bits by throwing away the "least random" low bit.
+ Note: The code takes advantage of the fact that both the front and
+ rear pointers can't wrap on the same call by not testing the rear
+ pointer if the front one has wrapped. Returns a 31-bit random number. */
+
+int random_r (struct random_data *buf, int32_t *result)
+{
+ int32_t *state;
+
+ if (buf == NULL || result == NULL)
+ goto fail;
+
+ state = buf->state;
+
+ if (buf->rand_type == TYPE_0)
+ {
+ int32_t val = ((state[0] * 1103515245U) + 12345U) & 0x7fffffff;
+ state[0] = val;
+ *result = val;
+ }
+ else
+ {
+ int32_t *fptr = buf->fptr;
+ int32_t *rptr = buf->rptr;
+ int32_t *end_ptr = buf->end_ptr;
+ uint32_t val;
+
+ val = *fptr += (uint32_t) *rptr;
+ /* Chucking least random bit. */
+ *result = val >> 1;
+ ++fptr;
+ if (fptr >= end_ptr)
+ {
+ fptr = state;
+ ++rptr;
+ }
+ else
+ {
+ ++rptr;
+ if (rptr >= end_ptr)
+ rptr = state;
+ }
+ buf->fptr = fptr;
+ buf->rptr = rptr;
+ }
+ return 0;
+
+ fail:
+ __set_errno (EINVAL);
+ return -1;
+}
+
+/* Initialize the random number generator based on the given seed. If the
+ type is the trivial no-state-information type, just remember the seed.
+ Otherwise, initializes state[] based on the given "seed" via a linear
+ congruential generator. Then, the pointers are set to known locations
+ that are exactly rand_sep places apart. Lastly, it cycles the state
+ information a given number of times to get rid of any initial dependencies
+ introduced by the L.C.R.N.G. Note that the initialization of randtbl[]
+ for default usage relies on values produced by this routine. */
+int srandom_r (unsigned int seed, struct random_data *buf)
+{
+ int type;
+ int32_t *state;
+ long int i;
+ int32_t word;
+ int32_t *dst;
+ int kc;
+
+ if (buf == NULL)
+ goto fail;
+ type = buf->rand_type;
+ if ((unsigned int) type >= MAX_TYPES)
+ goto fail;
+
+ state = buf->state;
+ /* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */
+ if (seed == 0)
+ seed = 1;
+ state[0] = seed;
+ if (type == TYPE_0)
+ goto done;
+
+ dst = state;
+ word = seed;
+ kc = buf->rand_deg;
+ for (i = 1; i < kc; ++i)
+ {
+ /* This does:
+ state[i] = (16807 * state[i - 1]) % 2147483647;
+ but avoids overflowing 31 bits. */
+ long int hi = word / 127773;
+ long int lo = word % 127773;
+ word = 16807 * lo - 2836 * hi;
+ if (word < 0)
+ word += 2147483647;
+ *++dst = word;
+ }
+
+ buf->fptr = &state[buf->rand_sep];
+ buf->rptr = &state[0];
+ kc *= 10;
+ while (--kc >= 0)
+ {
+ int32_t discard;
+ (void) random_r (buf, &discard);
+ }
+
+ done:
+ return 0;
+
+ fail:
+ return -1;
+}
+
+/* Initialize the state information in the given array of N bytes for
+ future random number generation. Based on the number of bytes we
+ are given, and the break values for the different R.N.G.'s, we choose
+ the best (largest) one we can and set things up for it. srandom is
+ then called to initialize the state information. Note that on return
+ from srandom, we set state[-1] to be the type multiplexed with the current
+ value of the rear pointer; this is so successive calls to initstate won't
+ lose this information and will be able to restart with setstate.
+ Note: The first thing we do is save the current state, if any, just like
+ setstate so that it doesn't matter when initstate is called.
+ Returns 0 on success, non-zero on failure. */
+int initstate_r (unsigned int seed, char *arg_state, size_t n,
+ struct random_data *buf)
+{
+ if (buf == NULL)
+ goto fail;
+
+ int32_t *old_state = buf->state;
+ if (old_state != NULL)
+ {
+ int old_type = buf->rand_type;
+ if (old_type == TYPE_0)
+ old_state[-1] = TYPE_0;
+ else
+ old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+ }
+
+ int type;
+ if (n >= BREAK_3)
+ type = n < BREAK_4 ? TYPE_3 : TYPE_4;
+ else if (n < BREAK_1)
+ {
+ if (n < BREAK_0)
+ goto fail;
+
+ type = TYPE_0;
+ }
+ else
+ type = n < BREAK_2 ? TYPE_1 : TYPE_2;
+
+ int degree = random_poly_info.degrees[type];
+ int separation = random_poly_info.seps[type];
+
+ buf->rand_type = type;
+ buf->rand_sep = separation;
+ buf->rand_deg = degree;
+ int32_t *state = &((int32_t *) arg_state)[1]; /* First location. */
+ /* Must set END_PTR before srandom. */
+ buf->end_ptr = &state[degree];
+
+ buf->state = state;
+
+ srandom_r (seed, buf);
+
+ state[-1] = TYPE_0;
+ if (type != TYPE_0)
+ state[-1] = (buf->rptr - state) * MAX_TYPES + type;
+
+ return 0;
+
+ fail:
+ __set_errno (EINVAL);
+ return -1;
+}
+
+/* Restore the state from the given state array.
+ Note: It is important that we also remember the locations of the pointers
+ in the current state information, and restore the locations of the pointers
+ from the old state information. This is done by multiplexing the pointer
+ location into the zeroth word of the state information. Note that due
+ to the order in which things are done, it is OK to call setstate with the
+ same state as the current state
+ Returns 0 on success, non-zero on failure. */
+int setstate_r (char *arg_state, struct random_data *buf)
+{
+ int32_t *new_state = 1 + (int32_t *) arg_state;
+ int type;
+ int old_type;
+ int32_t *old_state;
+ int degree;
+ int separation;
+
+ if (arg_state == NULL || buf == NULL)
+ goto fail;
+
+ old_type = buf->rand_type;
+ old_state = buf->state;
+ if (old_type == TYPE_0)
+ old_state[-1] = TYPE_0;
+ else
+ old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+
+ type = new_state[-1] % MAX_TYPES;
+ if (type < TYPE_0 || type > TYPE_4)
+ goto fail;
+
+ buf->rand_deg = degree = random_poly_info.degrees[type];
+ buf->rand_sep = separation = random_poly_info.seps[type];
+ buf->rand_type = type;
+
+ if (type != TYPE_0)
+ {
+ int rear = new_state[-1] / MAX_TYPES;
+ buf->rptr = &new_state[rear];
+ buf->fptr = &new_state[(rear + separation) % degree];
+ }
+ buf->state = new_state;
+ /* Set end_ptr too. */
+ buf->end_ptr = &new_state[degree];
+
+ return 0;
+
+ fail:
+ __set_errno (EINVAL);
+ return -1;
+}
+
static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
#define BOUNCE_RANDOM (1<<0)
--
2.11.0

View File

@@ -0,0 +1,53 @@
SUMMARY = "Linux dynamic kernel patching infrastructure"
DESCRIPTION = "kpatch is a Linux dynamic kernel patching infrastructure which allows you to patch a running kernel without rebooting or restarting any processes."
LICENSE = "GPL-2.0-only & LGPL-2.0-only"
DEPENDS = "elfutils bash"
SRC_URI = "git://github.com/dynup/kpatch.git;protocol=https;branch=master \
file://0001-kpatch-build-add-cross-compilation-support.patch \
file://0002-kpatch-build-allow-overriding-of-distro-name.patch \
"
EXTRA_OEMAKE = " \
PREFIX=${prefix} \
BINDIR=${D}${bindir} \
SBINDIR=${D}${sbindir} \
LIBDIR=${D}${libdir} \
MANDIR=${D}${mandir}/man1 \
SYSTEMDDIR=${D}${systemd_system_unitdir} \
UPSTARTDIR=${D}${sysconfdir}/init \
DESTDIR=${D} \
ARCH=${TARGET_ARCH} \
BUILDMOD=no \
CC='${CC}' \
"
S = "${WORKDIR}/git"
do_install () {
oe_runmake install
}
PACKAGES =+ "kpatch-build"
PROVIDES += "kpatch-build"
COMPATIBLE_HOST = "(x86_64).*-linux"
COMPATIBLE_HOST:libc-musl = "null"
RDEPENDS:${PN} = "bash binutils"
RDEPENDS:kpatch-build = "bash glibc-utils"
FILES:${PN} = " \
${sbindir}/kpatch \
${systemd_system_unitdir}/kpatch.service \
${mandir}/man1/kpatch.1.gz \
${sysconfdir}/init/kpatch.conf \
"
FILES:kpatch-build = " \
${bindir}/kpatch-build \
${libexecdir}/* \
${datadir}/kpatch \
${mandir}/man1/kpatch-build.1.gz \
"
SYSTEMD_SERVICE:${PN} = "kpatch.service"

View File

@@ -0,0 +1,105 @@
From 21909e3f9096fa8e4825df8c65114ee92ab3d532 Mon Sep 17 00:00:00 2001
From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
Date: Wed, 7 Aug 2019 02:57:35 +0900
Subject: [PATCH] kpatch-build: add cross-compilation support
This patch introduces new option for kpatch-build
script "--cross-compile" which can be used for
specifying cross-complier prefix.
It allows to build live patches not only on
target system, but also on hosts for a target other
than the one on which the compiler is running
Also removed quotes in exec lines, so it is
possible to pass multy-component strings like
"ccache x86_64-xelinux-linux-" as cross-compiler
Upstream-Status: Pending
Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
---
kpatch-build/kpatch-build | 13 +++++++++++--
kpatch-build/kpatch-gcc | 4 ++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
index 9ef3809..463dab1 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
@@ -198,7 +198,7 @@ gcc_version_check() {
# gcc --version varies between distributions therefore extract version
# by compiling a test file and compare it to vmlinux's version.
echo 'void main(void) {}' > "$c"
- out="$(gcc -c -pg -ffunction-sections -o "$o" "$c" 2>&1)"
+ out="$(${KPATCH_CROSS_COMPILE}gcc -c -pg -ffunction-sections -o "$o" "$c" 2>&1)"
gccver="$(gcc_version_from_file "$o")"
if [[ -n "$OOT_MODULE" ]]; then
kgccver="$(gcc_version_from_file "$OOT_MODULE")"
@@ -411,6 +411,8 @@ usage() {
echo " (can be specified multiple times)" >&2
echo " -e, --oot-module Enable patching out-of-tree module," >&2
echo " specify current version of module" >&2
+ echo " --cross-compile Specify the prefix used for all executables" >&2
+ echo " used during compilation" >&2
echo " --skip-cleanup Skip post-build cleanup" >&2
echo " --skip-gcc-check Skip gcc version matching check" >&2
echo " (not recommended)" >&2
@@ -416,7 +418,7 @@ usage() {
echo " (not recommended)" >&2
}
-options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
+options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
eval set -- "$options"
@@ -479,6 +481,10 @@ while [[ $# -gt 0 ]]; do
OOT_MODULE="$(readlink -f "$2")"
shift
;;
+ --cross-compile)
+ KPATCH_CROSS_COMPILE="$2"
+ shift
+ ;;
--skip-cleanup)
echo "Skipping cleanup"
SKIPCLEANUP=1
@@ -757,6 +763,8 @@ if [[ $DEBUG -ge 4 ]]; then
export KPATCH_GCC_DEBUG=1
fi
+export KPATCH_CROSS_COMPILE
+
echo "Building original source"
[[ -n "$OOT_MODULE" ]] || ./scripts/setlocalversion --save-scmversion || die
unset KPATCH_GCC_TEMPDIR
@@ -940,6 +948,7 @@ fi
KPATCH_BUILD="$KPATCH_BUILD" KPATCH_NAME="$MODNAME" \
KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS" \
KPATCH_LDFLAGS="$KPATCH_LDFLAGS" \
+CROSS_COMPILE="$KPATCH_CROSS_COMPILE" \
make 2>&1 | logger || die
if ! "$KPATCH_MODULE"; then
diff --git a/kpatch-build/kpatch-gcc b/kpatch-build/kpatch-gcc
index 9663290..56e6c8f 100755
--- a/kpatch-build/kpatch-gcc
+++ b/kpatch-build/kpatch-gcc
@@ -8,7 +8,7 @@ TOOLCHAINCMD="$1"
shift
if [[ -z "$KPATCH_GCC_TEMPDIR" ]]; then
- exec "$TOOLCHAINCMD" "$@"
+ exec ${KPATCH_CROSS_COMPILE}${TOOLCHAINCMD} "$@"
fi
declare -a args=("$@")
@@ -84,4 +84,4 @@ elif [[ "$TOOLCHAINCMD" = "ld" ]] ; then
done
fi
-exec "$TOOLCHAINCMD" "${args[@]}"
+exec ${KPATCH_CROSS_COMPILE}${TOOLCHAINCMD} "${args[@]}"
--
2.7.4

View File

@@ -0,0 +1,62 @@
From 4143fa0092fe4cafee10b24a97d3ad0b41ab7a30 Mon Sep 17 00:00:00 2001
From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
Date: Wed, 7 Aug 2019 03:24:39 +0900
Subject: [PATCH] kpatch-build: allow overriding of distro name
It is sometimes useful to have ability to override
distro name, for example during cross-compilation
build when livepatch modules will be ran on the
target which differs from host.
This patch adds a new --distro option which
implements all needed functionality
Upstream-Status: Pending
Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
---
kpatch-build/kpatch-build | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
index 39933fc..c0258a2 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
@@ -413,12 +413,13 @@ usage() {
echo " specify current version of module" >&2
echo " --cross-compile Specify the prefix used for all executables" >&2
echo " used during compilation" >&2
+ echo " --distro Override distro name" >&2
echo " --skip-cleanup Skip post-build cleanup" >&2
echo " --skip-gcc-check Skip gcc version matching check" >&2
echo " (not recommended)" >&2
}
-options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
+options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,distro:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
eval set -- "$options"
@@ -485,6 +486,10 @@ while [[ $# -gt 0 ]]; do
KPATCH_CROSS_COMPILE="$2"
shift
;;
+ --distro)
+ DISTRO="$2"
+ shift
+ ;;
--skip-cleanup)
echo "Skipping cleanup"
SKIPCLEANUP=1
@@ -613,7 +613,7 @@ fi
# Don't check external file.
# shellcheck disable=SC1090
[[ -f "$RELEASE_FILE" ]] && source "$RELEASE_FILE"
-DISTRO="$ID"
+DISTRO="${DISTRO:-${ID}}"
if [[ "$DISTRO" = fedora ]] || [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = ol ]] || [[ "$DISTRO" = centos ]]; then
[[ -z "$VMLINUX" ]] && VMLINUX="/usr/lib/debug/lib/modules/$ARCHVERSION/vmlinux"
[[ -e "$VMLINUX" ]] || die "kernel-debuginfo-$ARCHVERSION not installed"
--
2.7.4

View File

@@ -0,0 +1,11 @@
require kpatch.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRCREV = "0c3c21930895f6582a5c9d9d797f7e11ff41ffb2"
PV = "0.9.1"
S = "${WORKDIR}/git"
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,36 @@
SUMMARY = "Library for BPF handling"
DESCRIPTION = "Library for BPF handling"
HOMEPAGE = "https://github.com/libbpf/libbpf"
SECTION = "libs"
LICENSE = "LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://../LICENSE.LGPL-2.1;md5=b370887980db5dd40659b50909238dbd"
DEPENDS = "zlib elfutils"
SRC_URI = "git://github.com/libbpf/libbpf.git;protocol=https;branch=master"
SRCREV = "6597330c45d185381900037f0130712cd326ae59"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_HOST = "(x86_64|i.86|aarch64|riscv64|powerpc64).*-linux"
S = "${WORKDIR}/git/src"
EXTRA_OEMAKE += "DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir}"
EXTRA_OEMAKE:append:class-native = " UAPIDIR=${includedir}"
inherit pkgconfig
do_compile() {
oe_runmake
}
do_install() {
oe_runmake install
}
do_install:append:class-native() {
oe_runmake install_uapi_headers
}
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,86 @@
From f62b629c1e1e968f90aafbc0cf9116b49eea9d8e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 15 Dec 2019 16:24:37 -0800
Subject: [PATCH] Include poll.h instead of sys/poll.h
Fixes
error: redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror,-W#warnings]
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
perf_examples/branch_smpl.c | 2 +-
perf_examples/syst_smpl.c | 2 +-
perf_examples/task_attach_timeout.c | 2 +-
perf_examples/task_smpl.c | 2 +-
perf_examples/x86/bts_smpl.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/perf_examples/branch_smpl.c b/perf_examples/branch_smpl.c
index 87cd303..4d16b04 100644
--- a/perf_examples/branch_smpl.c
+++ b/perf_examples/branch_smpl.c
@@ -32,7 +32,7 @@
#include <getopt.h>
#include <setjmp.h>
#include <sys/wait.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/mman.h>
#include <locale.h>
#include <sys/ioctl.h>
diff --git a/perf_examples/syst_smpl.c b/perf_examples/syst_smpl.c
index 04580fd..d059c08 100755
--- a/perf_examples/syst_smpl.c
+++ b/perf_examples/syst_smpl.c
@@ -33,7 +33,7 @@
#include <setjmp.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
diff --git a/perf_examples/task_attach_timeout.c b/perf_examples/task_attach_timeout.c
index 7fc5524..a0367c8 100644
--- a/perf_examples/task_attach_timeout.c
+++ b/perf_examples/task_attach_timeout.c
@@ -36,7 +36,7 @@
#include <stdarg.h>
#include <sys/wait.h>
#include <err.h>
-#include <sys/poll.h>
+#include <poll.h>
#include "perf_util.h"
diff --git a/perf_examples/task_smpl.c b/perf_examples/task_smpl.c
index dcb7481..95c432c 100644
--- a/perf_examples/task_smpl.c
+++ b/perf_examples/task_smpl.c
@@ -37,7 +37,7 @@
#include <getopt.h>
#include <setjmp.h>
#include <sys/wait.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/mman.h>
#include <locale.h>
#include <sys/ioctl.h>
diff --git a/perf_examples/x86/bts_smpl.c b/perf_examples/x86/bts_smpl.c
index 6498776..d66d5e6 100644
--- a/perf_examples/x86/bts_smpl.c
+++ b/perf_examples/x86/bts_smpl.c
@@ -41,7 +41,7 @@
#include <sys/time.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <err.h>
--
2.24.1

View File

@@ -0,0 +1,44 @@
From 0b2f611a95f3c93454453892bbe021ad2815925d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 15 Jun 2021 17:35:26 -0700
Subject: [PATCH] perf_examples: Remove unused 'sum' variable
Fixes
self_smpl_multi.c:144:19: error: variable 'sum' set but not used [-Werror,-Wunused-but-set-variable]
unsigned long x, sum;
^
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
perf_examples/self_smpl_multi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/perf_examples/self_smpl_multi.c b/perf_examples/self_smpl_multi.c
index 391fa61..75b45e0 100644
--- a/perf_examples/self_smpl_multi.c
+++ b/perf_examples/self_smpl_multi.c
@@ -141,7 +141,7 @@ void
do_cycles(void)
{
struct timeval start, last, now;
- unsigned long x, sum;
+ unsigned long x;
gettimeofday(&start, NULL);
last = start;
@@ -150,15 +150,12 @@ do_cycles(void)
iter[myid] = 0;
do {
-
- sum = 1;
for (x = 1; x < 250000; x++) {
/* signal pending to private queue because of
* pthread_kill(), i.e., tkill()
*/
if ((x % 5000) == 0)
pthread_kill(pthread_self(), SIGUSR1);
- sum += x;
}
iter[myid]++;

View File

@@ -0,0 +1,33 @@
SUMMARY = "Monitoring tools exploiting the performance monitoring events"
DESCRIPTION = "This package provides a library, called libpfm4 which is used to develop \
monitoring tools exploiting the performance monitoring events such as those \
provided by the Performance Monitoring Unit (PMU) of modern processors."
HOMEPAGE = "http://perfmon2.sourceforge.net/"
BUGTRACKER = "http://sourceforge.net/tracker/?group_id=144822&atid=759953&source=navbar"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=0de488f3bd4424e308e2e399cb99c788"
SECTION = "devel"
COMPATIBLE_HOST = "powerpc64|aarch64"
SRC_URI = "${SOURCEFORGE_MIRROR}/perfmon2/${BPN}/libpfm-${PV}.tar.gz \
file://0001-Include-poll.h-instead-of-sys-poll.h.patch \
file://0002-perf_examples-Remove-unused-sum-variable.patch \
"
SRC_URI[sha256sum] = "d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1"
UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/perfmon2/files/libpfm4/"
EXTRA_OEMAKE = "DESTDIR=\"${D}\" PREFIX=\"${prefix}\" LIBDIR=\"${libdir}\" LDCONFIG=\"true\" DBG='-g -Wall -Wextra -Wno-unused-parameter'"
EXTRA_OEMAKE:append:powerpc = " ARCH=\"powerpc\""
EXTRA_OEMAKE:append:powerpc64 = " ARCH=\"powerpc\" BITMODE=\"64\""
EXTRA_OEMAKE:append:powerpc64le = " ARCH=\"powerpc\" BITMODE=\"64\""
EXTRA_OEMAKE:append:aarch64 = " ARCH=\"arm64\""
S = "${WORKDIR}/libpfm-${PV}"
do_install () {
oe_runmake install
}

View File

@@ -0,0 +1,40 @@
From ed0a31000305d937abe47c44d705b5b52bb36f79 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 22 Dec 2022 18:32:17 -0800
Subject: [PATCH] makefile: Do not preserve ownership in cp command
Fixes
ERROR: libtraceevent-1.7.0-r0 do_package_qa: QA Issue: libtraceevent: /usr/lib/libtraceevent.a is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 965ff47..0e782cb 100644
--- a/Makefile
+++ b/Makefile
@@ -287,7 +287,7 @@ $(BUILD_PREFIX): force
$(Q)$(call build_prefix,$(prefix))
define do_make_pkgconfig_file
- cp -f ${PKG_CONFIG_SOURCE_FILE}.template ${PKG_CONFIG_FILE}; \
+ install -m 0644 ${PKG_CONFIG_SOURCE_FILE}.template ${PKG_CONFIG_FILE}; \
sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; \
sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
sed -i "s|LIB_DIR|${libdir_relative}|g" ${PKG_CONFIG_FILE}; \
@@ -335,7 +335,7 @@ install: install_libs install_plugins
install_libs: libs install_headers install_pkgconfig
$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)); \
- cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
+ cp --no-preserve=ownership --recursive $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
$(Q)$(call install_ld_config)
install_pkgconfig: $(PKG_CONFIG_FILE)
--
2.39.0

View File

@@ -0,0 +1,25 @@
# Copyright (C) 2022 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "API to access the kernel tracefs directory"
HOMEPAGE = "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/"
LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0;md5=e6a75371ba4d16749254a51215d13f97 \
file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd"
SECTION = "libs"
SRCREV = "1c6f0f3b2bb47571fc455dc565dc343152517d98"
SRC_URI = "git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git;branch=${BPN};protocol=https \
file://0001-makefile-Do-not-preserve-ownership-in-cp-command.patch"
S = "${WORKDIR}/git"
inherit pkgconfig
do_install() {
oe_runmake install DESTDIR=${D} pkgconfig_dir=${libdir}/pkgconfig
}
PACKAGES += "${PN}-plugins"
FILES:${PN}-plugins += "${libdir}/traceevent/plugins"

View File

@@ -0,0 +1,31 @@
From 6650d0e79eea330b53635574885208a138fef97e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 21 Dec 2022 22:50:56 -0800
Subject: [PATCH] makefile: Do not preserve ownership in cp command
Fixes
ERROR: libtracefs-1.6.3-r0 do_package_qa: QA Issue: libtracefs: /usr/lib/libtracefs.so is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 27d425c..3aea142 100644
--- a/Makefile
+++ b/Makefile
@@ -273,7 +273,7 @@ endif # DESTDIR = ""
install_libs: libs install_pkgconfig
$(Q)$(call do_install,$(LIBTRACEFS_SHARED),$(libdir_SQ)); \
- cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
+ cp --no-preserve=ownership --recursive $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
$(Q)$(call do_install,$(src)/include/tracefs.h,$(includedir_SQ),644)
$(Q)$(call install_ld_config)
--
2.39.0

View File

@@ -0,0 +1,22 @@
# Copyright (C) 2022 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "Library to parse raw trace event formats "
HOMEPAGE = "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0;md5=e6a75371ba4d16749254a51215d13f97 \
file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd"
SECTION = "libs"
DEPENDS = "libtraceevent bison-native flex-native"
SRCREV = "af49d832f46631597e0aabb2302bd0f56a9cad29"
SRC_URI = "git://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git;branch=${BPN};protocol=https \
file://0001-makefile-Do-not-preserve-ownership-in-cp-command.patch \
"
S = "${WORKDIR}/git"
inherit pkgconfig
do_install() {
oe_runmake install DESTDIR=${D} pkgconfig_dir=${libdir}/pkgconfig
}

View File

@@ -0,0 +1,131 @@
DESCRIPTION = "Linux Kernel"
SECTION = "kernel"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
INC_PR = "r0"
inherit kernel siteinfo
# Enable OABI compat for people stuck with obsolete userspace
ARM_KEEP_OABI ?= "0"
# Set the verbosity of kernel messages during runtime
# You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour
CMDLINE_DEBUG ?= "loglevel=3"
# Kernel bootlogo is distro-specific (default is OE logo).
# Logo resolution (qvga, vga, ...) is machine-specific.
LOGO_SIZE ?= '${@oe.utils.conditional("MACHINE_GUI_CLASS", "bigscreen", "vga", "qvga", d)}'
# To use this, add file://${LOGO_SIZE}/logo_linux_clut224.ppm.bz2 or similar
# to your kernel recipe, and then structure your logos for each resolution
# accordingly.
LOCALVERSION ?= ""
#kernel_conf_variable CMDLINE "\"${CMDLINE} ${CMDLINE_DEBUG}\""
kernel_conf_variable() {
CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
if test "$2" = "n"
then
echo "# CONFIG_$1 is not set" >> ${B}/.config
else
echo "CONFIG_$1=$2" >> ${B}/.config
fi
}
do_configure:prepend() {
echo "" > ${B}/.config
CONF_SED_SCRIPT=""
#
# logo support, if you supply logo_linux_clut224.ppm in SRC_URI, then it's going to be used
#
if [ -e ${WORKDIR}/logo_linux_clut224.ppm ]; then
install -m 0644 ${WORKDIR}/logo_linux_clut224.ppm drivers/video/logo/logo_linux_clut224.ppm
kernel_conf_variable LOGO y
kernel_conf_variable LOGO_LINUX_CLUT224 y
fi
#
# oabi / eabi support
#
kernel_conf_variable AEABI y
if [ "${ARM_KEEP_OABI}" = "1" ] ; then
kernel_conf_variable OABI_COMPAT y
else
kernel_conf_variable OABI_COMPAT n
fi
# When enabling thumb for userspace we also need thumb support in the kernel
if [ "${ARM_INSTRUCTION_SET}" = "thumb" ] ; then
kernel_conf_variable ARM_THUMB y
fi
kernel_conf_variable CMDLINE "\"${CMDLINE} ${CMDLINE_DEBUG}\""
kernel_conf_variable LOCALVERSION "\"${LOCALVERSION}\""
kernel_conf_variable LOCALVERSION_AUTO n
kernel_conf_variable SYSFS_DEPRECATED n
kernel_conf_variable SYSFS_DEPRECATED_V2 n
kernel_conf_variable HOTPLUG y
kernel_conf_variable UEVENT_HELPER_PATH \"\"
kernel_conf_variable UNIX y
kernel_conf_variable SYSFS y
kernel_conf_variable PROC_FS y
kernel_conf_variable TMPFS y
kernel_conf_variable INOTIFY_USER y
kernel_conf_variable SIGNALFD y
kernel_conf_variable TMPFS_POSIX_ACL y
kernel_conf_variable BLK_DEV_BSG y
kernel_conf_variable DEVTMPFS y
kernel_conf_variable DEVTMPFS_MOUNT y
# Newer inits like systemd need cgroup support
if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then
kernel_conf_variable CGROUP_SCHED y
kernel_conf_variable CGROUPS y
kernel_conf_variable CGROUP_NS y
kernel_conf_variable CGROUP_FREEZER y
kernel_conf_variable CGROUP_DEVICE y
kernel_conf_variable CPUSETS y
kernel_conf_variable PROC_PID_CPUSET y
kernel_conf_variable CGROUP_CPUACCT y
kernel_conf_variable RESOURCE_COUNTERS y
fi
#
# root-over-nfs-over-usb-eth support. Limited, but should cover some cases.
# Enable this by setting a proper CMDLINE_NFSROOT_USB.
#
if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then
bbnote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}"
kernel_conf_variable INET y
kernel_conf_variable IP_PNP y
kernel_conf_variable USB_GADGET y
kernel_conf_variable USB_GADGET_SELECTED y
kernel_conf_variable USB_ETH y
kernel_conf_variable NFS_FS y
kernel_conf_variable ROOT_NFS y
kernel_conf_variable CMDLINE \"${CMDLINE_NFSROOT_USB} ${CMDLINE_DEBUG}\"
fi
sed -e "${CONF_SED_SCRIPT}" \
< '${WORKDIR}/defconfig' >>'${B}/.config'
yes '' | oe_runmake -C ${S} O=${B} oldconfig
}
do_configure:append() {
if test -e scripts/Makefile.fwinst ; then
sed -i -e "s:-m0644:-m 0644:g" scripts/Makefile.fwinst
fi
}
do_install:append() {
oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix}/src/linux-${KERNEL_VERSION} ARCH=$ARCH
}
PACKAGES =+ "kernel-headers"
FILES:kernel-headers = "${exec_prefix}/src/linux*"

View File

@@ -0,0 +1,137 @@
From 71b5a3905d5cd0feca88a0d61d7657ba5296a052 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Sun, 24 Apr 2022 17:25:33 +0800
Subject: [PATCH] makedumpfile: replace hardcode CFLAGS
* Create alias for target such as powerpc as powerpc32
* Remove hardcode CFLAGS
* Add CFLAGS_COMMON to instead of CFLAGS so can flexibly
customize CFLAGS and not hardcode the CFLAGS as previously
* Forcibly to link dynamic library as the poky build
system doesn't build static library by default
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
[2021-11-18] Patch updated to use CFLAGS_COMMON for zstd
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Rebase to 1.7.1
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
Makefile | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -8,12 +8,6 @@ ifeq ($(strip $CC),)
CC = gcc
endif
-CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
- -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
-CFLAGS_ARCH := $(CFLAGS_BASE)
-# LDFLAGS = -L/usr/local/lib -I/usr/local/include
-
HOST_ARCH := $(shell uname -m)
# Use TARGET as the target architecture if specified.
# Defaults to uname -m
@@ -24,26 +18,34 @@ endif
ARCH := $(shell echo ${TARGET} | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ \
-e s/s390x/s390/ -e s/parisc64/parisc/ \
- -e s/ppc64/powerpc64/ -e s/ppc/powerpc32/)
+ -e s/ppc64/powerpc64/ -e s/ppc/powerpc32/ \
+ -e s/_powerpc_/_powerpc32_/)
CROSS :=
ifneq ($(TARGET), $(HOST_ARCH))
CROSS := -U__$(HOST_ARCH)__
endif
-CFLAGS += -D__$(ARCH)__ $(CROSS)
CFLAGS_ARCH += -D__$(ARCH)__ $(CROSS)
-ifeq ($(ARCH), powerpc64)
-CFLAGS += -m64
+ifeq ($(ARCH), __powerpc64__)
CFLAGS_ARCH += -m64
endif
-ifeq ($(ARCH), powerpc32)
-CFLAGS += -m32
+ifeq ($(ARCH), __powerpc32__)
CFLAGS_ARCH += -m32
endif
+CFLAGS_ARCH += $(CFLAGS) \
+ -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE_SOURCE \
+ -D_LARGEFILE64_SOURCE
+
+CFLAGS_COMMON = $(CFLAGS_ARCH) \
+ -DVERSION='"$(VERSION)"' \
+ -DRELEASE_DATE='"$(DATE)"'
+
+
SRC_BASE = makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h
SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c tools.c printk.c detect_cycle.c
OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART))
@@ -52,12 +54,12 @@ OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH))
LIBS = -ldw -lbz2 -ldl -lelf -lz
ifneq ($(LINKTYPE), dynamic)
-LIBS := -static $(LIBS) -llzma
+LIBS := $(LIBS) -llzma
endif
ifeq ($(USELZO), on)
LIBS := -llzo2 $(LIBS)
-CFLAGS += -DUSELZO
+CFLAGS_COMMON += -DUSELZO
endif
ifeq ($(USESNAPPY), on)
@@ -65,12 +67,12 @@ LIBS := -lsnappy $(LIBS)
ifneq ($(LINKTYPE), dynamic)
LIBS := $(LIBS) -lstdc++
endif
-CFLAGS += -DUSESNAPPY
+CFLAGS_COMMON += -DUSESNAPPY
endif
ifeq ($(USEZSTD), on)
LIBS := -lzstd $(LIBS)
-CFLAGS += -DUSEZSTD
+CFLAGS_COMMON += -DUSEZSTD
endif
ifeq ($(DEBUG), on)
@@ -104,14 +106,14 @@ LIBS := $(LIBS) $(call try-run,\
all: makedumpfile
$(OBJ_PART): $(SRC_PART)
- $(CC) $(CFLAGS) -c -o ./$@ $(VPATH)$(@:.o=.c)
+ $(CC) $(CFLAGS_COMMON) -c -o ./$@ $(VPATH)$(@:.o=.c)
$(OBJ_ARCH): $(SRC_ARCH)
@mkdir -p $(@D)
$(CC) $(CFLAGS_ARCH) -c -o ./$@ $(VPATH)$(@:.o=.c)
makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH)
- $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -o $@ $< $(LIBS)
+ $(CC) $(CFLAGS_COMMON) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -o $@ $< $(LIBS)
@sed -e "s/@DATE@/$(DATE)/" \
-e "s/@VERSION@/$(VERSION)/" \
$(VPATH)makedumpfile.8.in > $(VPATH)makedumpfile.8
@@ -120,7 +122,7 @@ makedumpfile: $(SRC_BASE) $(OBJ_PART) $(
$(VPATH)makedumpfile.conf.5.in > $(VPATH)makedumpfile.conf.5
eppic_makedumpfile.so: extension_eppic.c
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo
+ $(CC) $(CFLAGS_COMMON) $(LDFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo
clean:
rm -f $(OBJ) $(OBJ_PART) $(OBJ_ARCH) makedumpfile makedumpfile.8 makedumpfile.conf.5

View File

@@ -0,0 +1,61 @@
SUMMARY = "VMcore extraction tool"
DESCRIPTION = "\
This program is used to extract a subset of the memory available either \
via /dev/mem or /proc/vmcore (for crashdumps). It is used to get memory \
images without extra uneeded information (zero pages, userspace programs, \
etc). \
"
HOMEPAGE = "https://github.com/makedumpfile/makedumpfile"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
LICENSE = "GPL-2.0-only"
SRCBRANCH ?= "master"
SRCREV = "9fefc6848d0b3765760e709cfe92fb9d76d5d452"
DEPENDS = "bzip2 zlib elfutils xz"
RDEPENDS:${PN}-tools = "perl ${PN}"
# mips would not compile.
COMPATIBLE_HOST = "(x86_64|i.86|powerpc|arm|aarch64).*-linux"
PACKAGES =+ "${PN}-tools"
FILES:${PN}-tools = "${bindir}/*.pl"
SRC_URI = "\
git://github.com/makedumpfile/makedumpfile;branch=${SRCBRANCH};protocol=https \
file://0001-makedumpfile-replace-hardcode-CFLAGS.patch \
"
S = "${WORKDIR}/git"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
SECTION = "base"
# If we do not specify TARGET, makedumpfile will build for the host but use the
# target gcc.
#
MAKEDUMPFILE_TARGET ?= "${TARGET_ARCH}"
MAKEDUMPFILE_TARGET:powerpc = "ppc"
EXTRA_OEMAKE = "\
LINKTYPE=static \
TARGET=${MAKEDUMPFILE_TARGET} \
${PACKAGECONFIG_CONFARGS} \
"
PACKAGECONFIG ??= ""
PACKAGECONFIG[lzo] = "USELZO=on,USELZO=off,lzo"
PACKAGECONFIG[snappy] = "USESNAPPY=on,USESNAPPY=off,snappy"
PACKAGECONFIG[zstd] = "USEZSTD=on,USEZSTD=off,zstd"
do_install () {
mkdir -p ${D}/usr/bin
install -m 755 ${S}/makedumpfile ${D}/usr/bin
install -m 755 ${S}/makedumpfile-R.pl ${D}/usr/bin
mkdir -p ${D}/etc/
install -m 644 ${S}/makedumpfile.conf ${D}/etc/makedumpfile.conf.sample
}

View File

@@ -0,0 +1,40 @@
#!/bin/sh
#
# minicoredumper This shell script takes care of starting and stopping minicoredumper.
#
# chkconfig: 2345 24 89
# description: minicoredumper.
#
# processname:
# config: /etc/minicoredumper/
### BEGIN INIT INFO
# Provides: minicoredumper
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: $syslog $network
# Should-Stop: $syslog $network
# Short-Description:
# Description:
### END INIT INFO
. /etc/init.d/functions
case "$1" in
start)
echo "|/usr/sbin/minicoredumper %p %u %g %s %t %h %e" > /proc/sys/kernel/core_pattern
;;
stop)
echo "core" > /proc/sys/kernel/core_pattern
;;
status)
if grep -q minicoredumper /proc/sys/kernel/core_pattern ; then
echo "minicoredumper is running"
else
echo "minicoredumper is stopped"
fi
;;
*)
echo $"Usage: $0 {start|stop|status}"
exit 2
esac

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Enable minicoredumper.
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c '/bin/echo "|/usr/sbin/minicoredumper %%p %%u %%g %%s %%t %%h %%e" > /proc/sys/kernel/core_pattern'
ExecStop=/bin/sh -c '/bin/echo "core" > /proc/sys/kernel/core_pattern'
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
#!/bin/sh
echo minicoredumper_demo
echo expecting Segmentation fault with core dump ...
minicoredumper_demo 6 & sleep 3 && minicoredumper_demo
if ls /var/crash/ | grep minicoredumper; then
echo SUCCESS
else
echo FAIL
fi

View File

@@ -0,0 +1,48 @@
SUMMARY = "minicoredumper provides an alternate core dump facility for Linux \
to allow minimal and customized crash dumps"
LICENSE = " LGPL-2.1-only & BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=71827c617ec7b45a0dd23658347cc1e9 \
file://COPYING.BSD;md5=b915ac80d5236d6aa659cb986daf00e5 \
file://COPYING.LGPLv2.1;md5=321bf41f280cf805086dd5a720b37785 \
"
DEPENDS = "elfutils dbus dbus-glib-native glib-2.0 dbus-glib util-linux json-c"
inherit autotools pkgconfig ptest systemd update-rc.d
SRCREV = "e4706bf28a0699094add5d77a4b97145c2292c47"
SRC_URI = "git://github.com/diamon/minicoredumper;protocol=https;branch=master \
file://minicoredumper.service \
file://minicoredumper.init \
file://run-ptest \
"
S = "${WORKDIR}/git"
SYSTEMD_SERVICE:${PN} = "minicoredumper.service"
SYSTEMD_AUTO_ENABLE = "enable"
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME:${PN} = "minicoredumper"
INITSCRIPT_PARAMS:${PN} = "defaults 89"
EXTRA_OECONF:append = " \
${@bb.utils.contains('PTEST_ENABLED', '1', '--with-minicoredumper_demo', '--without-libminicoredumper', d)} \
"
do_install:append() {
rmdir ${D}${localstatedir}/run
install -d ${D}/${sysconfdir}/minicoredumper
cp -rf ${S}/etc/* ${D}/${sysconfdir}/
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/minicoredumper.service ${D}${systemd_system_unitdir}
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/minicoredumper.init ${D}${sysconfdir}/init.d/minicoredumper
# correct path of minicoredumper
sed -i -e s:/usr/bin/minicoredumper:${sbindir}/minicoredumper:g ${D}${sysconfdir}/init.d/minicoredumper
sed -i -e s:/usr/bin/minicoredumper:${sbindir}/minicoredumper:g ${D}${systemd_system_unitdir}/minicoredumper.service
}
# http://errors.yoctoproject.org/Errors/Details/186966/
COMPATIBLE_HOST:libc-musl = 'null'

View File

@@ -0,0 +1,55 @@
From 5ed9bda8baf7465172a99ff86ed7f46397b06c7f Mon Sep 17 00:00:00 2001
From: Andrew Savchenko <bircoph@gmail.com>
Date: Sat, 5 Sep 2020 14:41:30 +0300
Subject: [PATCH 01/10] Fix build with musl
--Signature=_Sat__5_Sep_2020_14_41_30_+0300_B.qpPPwu83bbA.32
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
When musl is used instead of glibc, oprofile build fails because it
uses glibc-specific FTW extension: FTW_ACTIONRETVAL for custom
__delete_old_previous_sample_data return codes and FTW_STOP,
FTW_CONTINUE for such return codes. Musl supports only POSIX ftw, so
build fails.
However, this extension is not really needed by oprofile, because
FTW_SKIP_* are not used and {FTW_STOP,FTW_CONTINUE} can be handled
by standard return codes {1,0} (more precisely standard defines
{!0,0}, but in glibc FTW_STOP = 1, so I keep this value).
Upstream-Status: Backport [https://sourceforge.net/p/oprofile/oprofile/ci/5ed9bda8baf7465172a99ff86ed7f46397b06c7f/]
Signed-off-by: Andrew Savchenko <bircoph@gmail.com>
---
pe_profiling/operf.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
index 06a0ea3c..00834409 100644
--- a/pe_profiling/operf.cpp
+++ b/pe_profiling/operf.cpp
@@ -860,9 +860,9 @@ static int __delete_old_previous_sample_data(const char *fpath,
{
if (remove(fpath)) {
perror("sample data removal error");
- return FTW_STOP;
+ return 1;
} else {
- return FTW_CONTINUE;
+ return 0;
}
}
@@ -897,7 +897,7 @@ static void convert_sample_data(void)
return;
if (!operf_options::append) {
- int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
+ int flags = FTW_DEPTH;
errno = 0;
if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
errno != ENOENT) {
--
2.31.0

View File

@@ -0,0 +1,34 @@
From 5d879cb4f23c613e16b3f479ab09bbb5ff340201 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Feb 2023 17:02:41 -0800
Subject: [PATCH] Replace std::bind2nd with generic lambda
std::bind2nd is gone in c++17, therefore stop using it and replace it
with generic lambda from c++14 onwards
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libutil++/growable_vector.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libutil++/growable_vector.h b/libutil++/growable_vector.h
index 350246a..9846e1e 100644
--- a/libutil++/growable_vector.h
+++ b/libutil++/growable_vector.h
@@ -93,9 +93,9 @@ public:
/// return true if all elements have the default constructed value
bool zero() const {
- return std::find_if(container.begin(), container.end(),
- std::bind2nd(std::not_equal_to<T>(), T()))
- == container.end();
+ return std::find_if(begin(container), end(container),
+ [&](auto const& elem) {return elem != T();})
+ == end(container);
}
private:
--
2.39.1

View File

@@ -0,0 +1,28 @@
From 46f0aadf80d5e28f587149b6e90c3ba005971f6e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 2 Sep 2022 19:22:17 -0700
Subject: [PATCH] configure: Include unistd.h for getpid API
This fixes the check for perf events support in configure
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index e4f4024..3384628 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,7 @@ if test "$kernel_may_have_perf_events_support" = "yes"; then
#include <asm/unistd.h>
#include <sys/types.h>
#include <string.h>
+ #include <unistd.h>
]],
[[struct perf_event_attr attr;
pid_t pid;
--
2.37.3

View File

@@ -0,0 +1,40 @@
From 91bedd280b8a3fb4665db627559abba960be4212 Mon Sep 17 00:00:00 2001
From: Andrew Savchenko <bircoph@gmail.com>
Date: Sat, 5 Sep 2020 14:40:07 +0300
Subject: [PATCH 02/10] Fix configure when /bin/sh is not bash
--Signature=_Sat__5_Sep_2020_14_40_08_+0300_w+XY/NnD8_G.Kd1s
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
When /bin/sh used by autoconf is not bash, e.g. dash, configure
fails because it uses bash-specific equality operator "==".
Fix this problem by replacing "==" with POSIX "=" which is
sufficient for test where it is being used.
Upstream-Status: Backport [https://sourceforge.net/p/oprofile/oprofile/ci/91bedd280b8a3fb4665db627559abba960be4212/]
Signed-off-by: Andrew Savchenko <bircoph@gmail.com>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 05609f6e..f5fcd17d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -466,8 +466,8 @@ AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml)
if ! test "x$enable_account_check" = "xyes"; then
:
-elif test "`getent passwd oprofile 2>/dev/null`" == "" || \
- test "`getent group oprofile 2>/dev/null`" == ""; then
+elif test "`getent passwd oprofile 2>/dev/null`" = "" || \
+ test "`getent group oprofile 2>/dev/null`" = ""; then
if test `id -u` != "0"; then
echo "Warning: The user account 'oprofile:oprofile' does not exist on the system."
echo " To profile JITed code, this special user account must exist."
--
2.31.0

View File

@@ -0,0 +1,30 @@
From 864e02eab12cdc523b2dcd3f7b87a27abc16eefc Mon Sep 17 00:00:00 2001
From: Viktor Kleinik <vkleinik@cisco.com>
Date: Sun, 7 Mar 2021 17:07:44 +0000
Subject: [PATCH 03/10] Define the C preprocessor variable to improve reproducibility
Define the C preprocessor variable BUILD_DATE, which can be used
as source for reproducible build date in case when
SOURCE_DATE_EPOCH environment variable is set.
Upstream-Status: Backport [https://sourceforge.net/p/oprofile/oprofile/ci/864e02eab12cdc523b2dcd3f7b87a27abc16eefc/]
Signed-off-by: Viktor Kleinik <vkleinik@cisco.com>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index f5fcd17d..dc447f89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,7 @@ if test -n "$SOURCE_DATE_EPOCH" ; then
fi
dnl for the man page
DATE="`date $dateopt '+%a %d %B %Y'`"
+AC_DEFINE_UNQUOTED([BUILD_DATE], ["$DATE"], [Use reproducible build date])
AC_SUBST(DATE)
# Since we should not permanently alter user environment variables, we'll
--
2.31.0

View File

@@ -0,0 +1,63 @@
From 7bef5b905abe36adfd4e4cc16bc830376f50e8f6 Mon Sep 17 00:00:00 2001
From: Viktor Kleinik <vkleinik@cisco.com>
Date: Sun, 7 Mar 2021 17:22:26 +0000
Subject: [PATCH 04/10] Use BUILD_DATE to improve reproducibility
The C preprocessor variable BUILD_DATE contains the actual
build date or some reproducible value. It depends on whether
SOURCE_DATE_EPOCH environment variable was set previously or not.
In this way, reproducibility can be improved when needed.
Upstream-Status: Backport [https://sourceforge.net/p/oprofile/oprofile/ci/864e02eab12cdc523b2dcd3f7b87a27abc16eefc/]
Signed-off-by: Viktor Kleinik <vkleinik@cisco.com>
---
libutil/op_version.c | 2 +-
pe_counting/ocount.cpp | 4 ++--
pe_profiling/operf.cpp | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libutil/op_version.c b/libutil/op_version.c
index 99a844e4..a257e9c4 100644
--- a/libutil/op_version.c
+++ b/libutil/op_version.c
@@ -19,6 +19,6 @@ void show_version(char const * app_name)
{
/* Do not change the version format: it is documented in html doc */
printf("%s: " PACKAGE " " VERSION " compiled on "
- __DATE__ " " __TIME__ "\n", app_name);
+ BUILD_DATE "\n", app_name);
exit(EXIT_SUCCESS);
}
diff --git a/pe_counting/ocount.cpp b/pe_counting/ocount.cpp
index 2470745d..ae89fe61 100644
--- a/pe_counting/ocount.cpp
+++ b/pe_counting/ocount.cpp
@@ -660,8 +660,8 @@ static int _process_ocount_and_app_args(int argc, char * const argv[])
__print_usage_and_exit(NULL);
break;
case 'v':
- cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on " << __DATE__
- << " " << __TIME__ << endl;
+ cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on "
+ << BUILD_DATE << endl;
exit(EXIT_SUCCESS);
break;
default:
diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
index 00834409..f0f9c209 100644
--- a/pe_profiling/operf.cpp
+++ b/pe_profiling/operf.cpp
@@ -1342,8 +1342,8 @@ static int _process_operf_and_app_args(int argc, char * const argv[])
__print_usage_and_exit(NULL);
break;
case 'v':
- cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on " << __DATE__
- << " " << __TIME__ << endl;
+ cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on "
+ << BUILD_DATE << endl;
exit(EXIT_SUCCESS);
break;
default:
--
2.31.0

View File

@@ -0,0 +1,31 @@
From 3539d2ab392d3a3eecffeddac989016063b23713 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marex@denx.de>
Date: Tue, 9 Feb 2016 02:00:29 +0100
Subject: [PATCH 05/10] Add rmb() definition for NIOS2 architecture
Signed-off-by: Marek Vasut <marex@denx.de>
Upstream-Status: Submitted [ http://marc.info/?l=oprofile-list&m=145501915931874&w=2 ]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libperf_events/operf_utils.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libperf_events/operf_utils.h b/libperf_events/operf_utils.h
index 8afdbc22..8e17213e 100644
--- a/libperf_events/operf_utils.h
+++ b/libperf_events/operf_utils.h
@@ -173,6 +173,11 @@ void op_release_resources(void);
#define cpu_relax() asm volatile("" ::: "memory")
#endif
+#ifdef __nios2__
+#define rmb() asm volatile("" ::: "memory")
+#define cpu_relax() asm volatile("" ::: "memory")
+#endif
+
#ifdef __tile__
#include <asm/unistd.h>
#define rmb() __insn_mf()
--
2.31.0

View File

@@ -0,0 +1,131 @@
From b126134f68f4a5bd826141be68337ac15a7c2c04 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 12 Feb 2019 11:58:34 -0800
Subject: [PATCH 06/10] replace (sym_iterator)0 with sym_iterator()
clang/libc++ find this error
libpp/xml_utils.cpp:409:43: error: calling a private constructor of class 'std::__1::__wrap_iter<const sym
bol_entry *const *>'
| { lo = hi = 0; name = ""; begin = end = (sym_iterator)0;}
| ^
|
default constructed iterator isn't supposed to be used for anything
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libpp/xml_utils.cpp | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/libpp/xml_utils.cpp b/libpp/xml_utils.cpp
index 3de41e58..f45d3ae2 100644
--- a/libpp/xml_utils.cpp
+++ b/libpp/xml_utils.cpp
@@ -73,7 +73,7 @@ void dump_symbol(string const & prefix, sym_iterator it, bool want_nl = true)
void dump_symbols(string const & prefix, sym_iterator b, sym_iterator e)
{
- if (b == (sym_iterator)0)
+ if (b == sym_iterator())
return;
for (sym_iterator it = b; it != e; ++it)
@@ -167,7 +167,7 @@ string xml_utils::get_profile_header(string cpu_name, double const speed)
}
str << init_attr(CPU_NAME, cpu_type) << endl;
- if (processor.size() > 0)
+ if (processor.size() > 0)
str << init_attr(PROCESSOR, string(processor)) << endl;
if (nr_cpus > 1) str << init_attr(SEPARATED_CPUS, nr_cpus) << endl;
str << init_attr(MHZ, speed) << endl;
@@ -320,11 +320,11 @@ void xml_utils::build_subclasses(ostream & out)
(*sc_ptr)[new_index].subclass_name = subclass_name;
out << open_element(CLASS, true);
out << init_attr(NAME, subclass_name);
- if (nr_cpus > 1)
+ if (nr_cpus > 1)
out << init_attr(CPU_NUM, pclass.ptemplate.cpu);
- if (nr_events > 1)
+ if (nr_events > 1)
out << init_attr(EVENT_NUM, event);
- if (has_nonzero_masks)
+ if (has_nonzero_masks)
out << init_attr(EVENT_MASK, pclass.ptemplate.unitmask);
out << close_element();
}
@@ -406,7 +406,7 @@ xml_utils::output_summary_data(ostream & out, count_array_t const & summary, siz
class module_info {
public:
module_info()
- { lo = hi = 0; name = ""; begin = end = (sym_iterator)0;}
+ { lo = hi = 0; name = ""; begin = end = sym_iterator();}
void dump();
void build_module(string const & n, sym_iterator it,
size_t l, size_t h);
@@ -540,21 +540,21 @@ void module_info::add_to_summary(count_array_t const & counts)
void module_info::set_begin(sym_iterator b)
{
- if (begin == (sym_iterator)0)
+ if (begin == sym_iterator())
begin = b;
}
void module_info::set_end(sym_iterator e)
{
- if (end == (sym_iterator)0)
+ if (end == sym_iterator())
end = e;
}
bool module_info::is_closed(string const & n)
{
- return (name == n) && end != (sym_iterator)0;
+ return (name == n) && end != sym_iterator();
}
@@ -585,7 +585,7 @@ void module_info::output_summary(ostream & out)
void module_info::output_symbols(ostream & out, bool is_module)
{
- if (begin == (sym_iterator)0)
+ if (begin == sym_iterator())
return;
for (sym_iterator it = begin; it != end; ++it)
@@ -606,7 +606,7 @@ void binary_info::close_binary(sym_iterator it)
void binary_info::dump()
{
cverb << vxml << "app_name=" << name << endl;
- if (begin != (sym_iterator)0)
+ if (begin != sym_iterator())
dump_symbols(" ", begin, end);
for (size_t i = 0; i < nr_modules; ++i)
@@ -648,7 +648,7 @@ add_module_symbol(string const & module, string const & app,
// mark end of enclosing binary symbols if there have been any
// NOTE: it is possible for the binary's symbols to follow its
// module symbols
- if (begin != (sym_iterator)0 && end == (sym_iterator)0)
+ if (begin != sym_iterator() && end == sym_iterator())
set_end(it);
// build the new module
@@ -718,7 +718,7 @@ summarize_processes(extra_images const & extra_found_images)
{
// add modules to the appropriate threads in the process hierarchy
for (sym_iterator it = symbols_begin ; it != symbols_end; ++it) {
- string binary = get_image_name((*it)->app_name,
+ string binary = get_image_name((*it)->app_name,
image_name_storage::int_filename, extra_found_images);
string module = get_image_name((*it)->image_name,
image_name_storage::int_filename, extra_found_images);
--
2.31.0

View File

@@ -0,0 +1,23 @@
From fd35c343e67ca47f76d0769fce2881d5f7a027a9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 18 Mar 2021 00:48:34 -0700
Subject: [PATCH 07/10] oprofile doesn't want GNU-levels of automake strictness
so tell it to be "foreign".
Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ AC_PREREQ(2.13)
AC_INIT([OProfile], [1.4.0])
AC_CONFIG_SRCDIR([libop/op_config.h])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS(config.h)
AC_CHECK_DECLS([basename], [], [], [[#include <libgen.h>]])

View File

@@ -0,0 +1,30 @@
From 33e945f31fee2d74a392eb79025c9477e12b590d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 18 Mar 2021 00:49:48 -0700
Subject: [PATCH 08/10] include linux/limits.h for MAX_INPUT
Fixes
op_pe_utils.cpp:533:19: error: 'MAX_INPUT' was not declared in this scope
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libpe_utils/op_pe_utils.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp
index 1ca4ce3a..c5d16a56 100644
--- a/libpe_utils/op_pe_utils.cpp
+++ b/libpe_utils/op_pe_utils.cpp
@@ -11,6 +11,7 @@
*
*/
+#include <linux/limits.h>
#include <linux/perf_event.h>
#include <dirent.h>
#include <stdio.h>
--
2.31.0

View File

@@ -0,0 +1,113 @@
From 3a942cfd7d2e92667313e189930f7d1733cf40d4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 18 Mar 2021 00:59:20 -0700
Subject: [PATCH 09/10] Prevent running check tests on host if cross compiling
This patch enables running the 'make check' tests on the target
in a cross-compiled environment. If not cross-compiling, then 'make
check' builds and executes the tests; no change from this patch.
In a cross-compiling environment, the make variable CROSS_COMPILE is
set which bypasses assiging tests to the makekfile variable TESTS.
Since TESTS is empty, the 'make check' process never tries to run the
tests on the hosts. On the target, the tests must be run manually.
Also, in the libutil++ tests, a makefile variable SRCDIR is passed into
the compilation phase, pointing to the runtime location of the test
'file-manip-tests'. The mechanism used for a host test, based on
'topdir' doesn't work. Instead, if CROSS_COMPILE is set, the
makefile takes the path of SRCDIR from the build environment and not
from an expression based on the host path 'topdir'.
Upstream-Status: Pending
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 1 +
libdb/tests/Makefile.am | 2 ++
libop/tests/Makefile.am | 2 ++
libregex/tests/Makefile.am | 2 ++
libutil++/tests/Makefile.am | 4 ++++
libutil/tests/Makefile.am | 2 ++
6 files changed, 13 insertions(+)
diff --git a/configure.ac b/configure.ac
index 520b18ed..108a84e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -386,6 +386,7 @@ AC_ARG_ENABLE(account-check,
enable_account_check=$enableval, enable_account_check=yes)
AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes")
+AM_CONDITIONAL(CROSS_COMPILE, test "x$cross_compiling" = "xyes")
AC_SUBST(OP_CFLAGS)
AC_SUBST(OP_CXXFLAGS)
diff --git a/libdb/tests/Makefile.am b/libdb/tests/Makefile.am
index 8a69003f..c933baf6 100644
--- a/libdb/tests/Makefile.am
+++ b/libdb/tests/Makefile.am
@@ -13,4 +13,6 @@ check_PROGRAMS = db_test
db_test_SOURCES = db_test.c
db_test_LDADD = ../libodb.a ../../libutil/libutil.a
+if ! CROSS_COMPILE
TESTS = ${check_PROGRAMS}
+endif
diff --git a/libop/tests/Makefile.am b/libop/tests/Makefile.am
index 8a79eb5d..6b90e997 100644
--- a/libop/tests/Makefile.am
+++ b/libop/tests/Makefile.am
@@ -33,4 +33,6 @@ load_events_files_tests_LDADD = ${COMMON_LIBS}
mangle_tests_SOURCES = mangle_tests.c
mangle_tests_LDADD = ${COMMON_LIBS}
+if ! CROSS_COMPILE
TESTS = ${check_PROGRAMS} utf8_checker.sh
+endif
diff --git a/libregex/tests/Makefile.am b/libregex/tests/Makefile.am
index 6f19838f..43e84946 100644
--- a/libregex/tests/Makefile.am
+++ b/libregex/tests/Makefile.am
@@ -18,4 +18,6 @@ java_test_LDADD = \
EXTRA_DIST = mangled-name.in
+if ! CROSS_COMPILE
TESTS = ${check_PROGRAMS}
+endif
diff --git a/libutil++/tests/Makefile.am b/libutil++/tests/Makefile.am
index 51af0313..dd63fbe2 100644
--- a/libutil++/tests/Makefile.am
+++ b/libutil++/tests/Makefile.am
@@ -1,7 +1,9 @@
REALPATH= readlink -f
+if ! CROSS_COMPILE
SRCDIR := $(shell $(REALPATH) $(topdir)/libutil++/tests/ )
+endif
AM_CPPFLAGS = \
-I ${top_srcdir}/libutil++ -D SRCDIR="\"$(SRCDIR)/\"" @OP_CPPFLAGS@
@@ -46,4 +48,6 @@ cached_value_tests_LDADD = ${COMMON_LIBS}
utility_tests_SOURCES = utility_tests.cpp
utility_tests_LDADD = ${COMMON_LIBS}
+if ! CROSS_COMPILE
TESTS = ${check_PROGRAMS}
+endif
diff --git a/libutil/tests/Makefile.am b/libutil/tests/Makefile.am
index dfcd6eca..d8b51892 100644
--- a/libutil/tests/Makefile.am
+++ b/libutil/tests/Makefile.am
@@ -12,4 +12,6 @@ file_tests_LDADD = ../libutil.a
string_tests_SOURCES = string_tests.c
string_tests_LDADD = ../libutil.a
+if ! CROSS_COMPILE
TESTS = ${check_PROGRAMS}
+endif
--
2.31.0

View File

@@ -0,0 +1,46 @@
From 60fb7579bac738809b1776dbcd95ccacf7413c57 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 18 Mar 2021 01:02:49 -0700
Subject: [PATCH 10/10] oprofile: Determine the root home directory dynamically
This commit detects the root home directory dynamically with changes to
the oprofile gui app source.
The commit replaces an earlier fix that detected and adjusted a
'non-standard' root home directory at build time. The advantage of this
patch is that the oprofile tools are adjusted to the current run-time
path to ~root, not the build time path.
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
---
doc/oprofile.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/doc/oprofile.xml
+++ b/doc/oprofile.xml
@@ -647,8 +647,8 @@ Following is a description of the <comma
<emphasis>must</emphasis> stop it in a controlled manner in order to process
the profile data it has collected. Use <code>kill -SIGINT &lt;operf-PID&gt;</code>
for this purpose. It is recommended that when running <command>operf</command>
- with this option, your current working directory should be <filename>/root</filename> or a subdirectory
- of <filename>/root</filename> to avoid storing sample data files in locations accessible by regular users.
+ with this option, your current working directory should be <filename>~root</filename> or a subdirectory
+ of <filename>~root</filename> to avoid storing sample data files in locations accessible by regular users.
</para></listitem>
</varlistentry>
<varlistentry>
--- a/doc/oprofile.html
+++ b/doc/oprofile.html
@@ -1552,8 +1552,8 @@ Following is a description of the <span
<span class="emphasis"><em>must</em></span> stop it in a controlled manner in order to process
the profile data it has collected. Use <code class="code">kill -SIGINT &lt;operf-PID&gt;</code>
for this purpose. It is recommended that when running <span class="command"><strong>operf</strong></span>
- with this option, your current working directory should be <code class="filename">/root</code> or a subdirectory
- of <code class="filename">/root</code> to avoid storing sample data files in locations accessible by regular users.
+ with this option, your current working directory should be <code class="filename">~root</code> or a subdirectory
+ of <code class="filename">~root</code> to avoid storing sample data files in locations accessible by regular users.
</p>
</dd>
<dt>

View File

@@ -0,0 +1,581 @@
dnl AX_KERNEL_OPTION(option, action-if-found, action-if-not-found)
dnl see if autoconf.h defines the option
AC_DEFUN([AX_KERNEL_OPTION], [
SAVE_CFLAGS=$CFLAGS
CFLAGS="-I$KINC -O2 -D__KERNEL__"
AC_TRY_COMPILE( [#include <linux/config.h>],
[
#ifndef $1
break_me_hard(\\\);
#endif
],[$2],[$3],)
CFLAGS=$SAVE_CFLAGS
])
dnl Handle the 2.4 module inside module/
AC_DEFUN([AX_CONFIG_MODULE],
[
if test ! -f $KINC/linux/autoconf.h; then
AC_MSG_ERROR([no suitably configured kernel include tree found])
fi
dnl --- Get Linux kernel version and compile parameters ---
AC_SUBST(KVERS)
AC_MSG_CHECKING([for kernel version])
dnl it's like this to handle mandrake's fubar version.h - bug #471448
eval KVERS=`gcc -I$KINC -E -dM $KINC/linux/version.h | grep -w UTS_RELEASE | awk '{print $[]3}'`
AC_MSG_RESULT([$KVERS])
case "$KVERS" in
2.2.*|2.4.*) ;;
*) AC_MSG_ERROR([Unsupported kernel version])
esac
dnl Check for the minimal kernel version supported
AC_MSG_CHECKING([kernel version])
AX_KERNEL_VERSION(2, 2, 10, <=, AC_MSG_RESULT([ok]), AC_MSG_ERROR([check html documentation install section]))
dnl linux/spinlock.h added at some point in past
AC_MSG_CHECKING([for $KINC/linux/spinlock.h])
if test -f $KINC/linux/spinlock.h; then
EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DHAVE_LINUX_SPINLOCK_HEADER"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for rtc_lock])
gcc -I$KINC -E $KINC/linux/mc146818rtc.h | grep rtc_lock >/dev/null
if test "$?" -eq 0; then
EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DRTC_LOCK"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
arch="unknown"
AC_MSG_CHECKING(for x86-64 architecture)
AX_KERNEL_OPTION(CONFIG_X86_64, x8664=1, x8664=0)
AX_MSG_RESULT_YN($x8664)
BUILD_HAMMER=no
if test "$x8664" -eq 1; then
arch="x86"
BUILD_HAMMER=yes
else
AC_MSG_CHECKING(for x86 architecture)
AX_KERNEL_OPTION(CONFIG_X86, x86=1, x86=0)
AX_KERNEL_OPTION(CONFIG_X86_WP_WORKS_OK, x86=1, x86=$x86)
AX_MSG_RESULT_YN($x86)
test "$x86" = 1 && arch="x86"
if test "$arch" = "unknown"; then
AC_MSG_CHECKING(for ia64 architecture)
AX_KERNEL_OPTION(CONFIG_IA64, ia64=1, ia64=0)
AX_MSG_RESULT_YN($ia64)
test "$ia64" = 1 && arch="ia64"
fi
fi
AC_SUBST(BUILD_HAMMER)
test "$arch" = "unknown" && AC_MSG_ERROR(Unsupported architecture)
dnl check to see if kernel verion appropriate for arch
AC_MSG_CHECKING(arch/kernel version combination)
case "$arch" in
ia64)
AX_KERNEL_VERSION(2, 4, 18, <, AC_MSG_RESULT([ok]),
AC_MSG_ERROR([unsupported arch/kernel])) ;;
*) AC_MSG_RESULT([ok])
esac
dnl for now we do not support PREEMPT patch
AC_MSG_CHECKING([for preempt patch])
AX_KERNEL_OPTION(CONFIG_PREEMPT,preempt=1,preempt=0)
AX_MSG_RESULT_YN([$preempt])
test "$preempt" = 0 || AC_MSG_ERROR([unsupported kernel configuration : CONFIG_PREEMPT])
AC_SUBST(KINC)
MODINSTALLDIR=/lib/modules/$KVERS
OPROFILE_MODULE_ARCH=$arch
AC_SUBST(OPROFILE_MODULE_ARCH)
]
)
dnl AX_MSG_RESULT_YN(a)
dnl results "yes" iff a==1, "no" else
AC_DEFUN([AX_MSG_RESULT_YN], [x=no
test "x$1" = "x1" && x=yes
AC_MSG_RESULT($x)])
dnl AX_MALLOC_ATTRIBUTE - see if gcc will take __attribute__((malloc))
AC_DEFUN([AX_MALLOC_ATTRIBUTE],
[
AC_MSG_CHECKING([whether malloc attribute is understood])
SAVE_CFLAGS=$CFLAGS
CFLAGS="-Werror $CFLAGS"
AC_TRY_COMPILE(,[
void monkey() __attribute__((malloc));
],AC_MSG_RESULT([yes]); AC_DEFINE(MALLOC_ATTRIBUTE_OK, 1, [whether malloc attribute is understood]), AC_MSG_RESULT([no]))
CFLAGS=$SAVE_CFLAGS
]
)
dnl builtin_expect is used in module we can't add that in config.h
AC_DEFUN([AX_BUILTIN_EXPECT],
[
AC_MSG_CHECKING([whether __builtin_expect is understood])
SAVE_CFLAGS=$CFLAGS
CFLAGS="-Werror $CFLAGS"
AC_TRY_LINK(,[
int i;
if (__builtin_expect(i, 0)) { }
],
AC_MSG_RESULT([yes]); EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DEXPECT_OK",
AC_MSG_RESULT([no]);)
CFLAGS=$SAVE_CFLAGS
]
)
dnl AX_EXTRA_DIRS - Let user specify extra dirs for include/libs
AC_DEFUN([AX_EXTRA_DIRS],
[
AC_ARG_WITH(extra-includes,
[ --with-extra-includes=DIR add extra include paths],
use_extra_includes="$withval",
use_extra_includes=NO
)
if test -n "$use_extra_includes" && \
test "$use_extra_includes" != "NO"; then
ac_save_ifs=$IFS
IFS=':'
for dir in $use_extra_includes; do
extra_includes="$extra_includes -I$dir"
done
IFS=$ac_save_ifs
CPPFLAGS="$CPPFLAGS $extra_includes"
fi
AC_ARG_WITH(extra-libs,
[ --with-extra-libs=DIR add extra library paths],
use_extra_libs=$withval,
use_extra_libs=NO
)
if test -n "$use_extra_libs" && \
test "$use_extra_libs" != "NO"; then
ac_save_ifs=$IFS
IFS=':'
for dir in $use_extra_libs; do
extra_libraries="$extra_libraries -L$dir"
done
IFS=$ac_save_ifs
LDFLAGS="$LDFLAGS $extra_libraries"
fi
]
)
dnl AX_POPT_CONST - check popt prototype
AC_DEFUN([AX_POPT_CONST],
[
AC_MSG_CHECKING([popt prototype])
SAVE_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-Werror $CXXFLAGS"
AC_TRY_COMPILE([#include <popt.h>],
[
int c; char **v;
poptGetContext(0, c, v, 0, 0);
],
AC_MSG_RESULT([takes char **]);,
AC_MSG_RESULT([takes const char **]); AC_DEFINE(CONST_POPT, 1, [whether popt prototype takes a const char **]))
CXXFLAGS="$SAVE_CXXFLAGS"
]
)
dnl AX_CHECK_SSTREAM - check if local sstream is needed to compile OK
AC_DEFUN([AX_CHECK_SSTREAM],
[
AC_MSG_CHECKING([whether to use included sstream])
AC_TRY_COMPILE([#include <sstream>], [],
AC_MSG_RESULT([no]);,
AC_MSG_RESULT([yes]); OP_CXXFLAGS="$OP_CXXFLAGS -I\${top_srcdir}/include")
]
)
dnl AX_CHECK_TYPEDEF(typedef_name, type, action-if-true, action-if-false)
dnl exec action-if-true if typedef_name is a typedef to type else exec
dnl action-if-false
dnl currently work only with type typedef'ed in stddef.h
AC_DEFUN([AX_CHECK_TYPEDEF], [
dnl AC_LANG_PUSH(C) not in autoconf 2.13
AC_LANG_SAVE
AC_LANG_C
SAVE_CFLAGS=$CFLAGS
CFLAGS="-Werror $CFLAGS"
AC_TRY_COMPILE(
[
#include <stddef.h>
],
[
typedef void (*fct1)($1);
typedef void (*fct2)($2);
fct1 f1 = 0;
fct2 f2 = 0;
if (f1 == f2) {}
],
[$3],[$4])
CFLAGS=$SAVE_CFLAGS
AC_LANG_RESTORE
])
dnl AX_TYPEDEFED_NAME(typedef_name, candidate_list, var_name)
dnl set var_name to the typedef name of $1 which must be in canditate_list
dnl else produce a fatal error
AC_DEFUN([AX_TYPEDEFED_NAME], [
AC_MSG_CHECKING([type of $1])
for f in $2; do
AX_CHECK_TYPEDEF($1, $f, $3="$f", $3="")
if test -n "${$3}"; then
break
fi
done
if test -n "${$3}"; then
AC_MSG_RESULT([${$3}])
else
AC_MSG_ERROR([not found])
fi
])
dnl find a binary in the path
AC_DEFUN([QT_FIND_PATH],
[
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(qt_cv_path_$1,
[
qt_cv_path_$1="NONE"
if test -n "$$2"; then
qt_cv_path_$1="$$2";
else
dirs="$3"
qt_save_IFS=$IFS
IFS=':'
for dir in $PATH; do
dirs="$dirs $dir"
done
IFS=$qt_save_IFS
for dir in $dirs; do
if test -x "$dir/$1"; then
if test -n "$5"; then
evalstr="$dir/$1 $5 2>&1 "
if eval $evalstr; then
qt_cv_path_$1="$dir/$1"
break
fi
else
qt_cv_path_$1="$dir/$1"
break
fi
fi
done
fi
])
if test -z "$qt_cv_path_$1" || test "$qt_cv_path_$1" = "NONE"; then
AC_MSG_RESULT(not found)
$4
else
AC_MSG_RESULT($qt_cv_path_$1)
$2=$qt_cv_path_$1
fi
])
dnl Find the uic compiler on the path or in qt_cv_dir
AC_DEFUN([QT_FIND_UIC],
[
QT_FIND_PATH(uic, ac_uic, $qt_cv_dir/bin)
if test -z "$ac_uic" -a "$FATAL" = 1; then
AC_MSG_ERROR([uic binary not found in \$PATH or $qt_cv_dir/bin !])
fi
])
dnl Find the right moc in path/qt_cv_dir
AC_DEFUN([QT_FIND_MOC],
[
QT_FIND_PATH(moc2, ac_moc2, $qt_cv_dir/bin)
QT_FIND_PATH(moc, ac_moc1, $qt_cv_dir/bin)
if test -n "$ac_moc1" -a -n "$ac_moc2"; then
dnl found both. Prefer Qt3's if it exists else moc2
$ac_moc1 -v 2>&1 | grep "Qt 3" >/dev/null
if test "$?" = 0; then
ac_moc=$ac_moc1;
else
ac_moc=$ac_moc2;
fi
else
if test -n "$ac_moc1"; then
ac_moc=$ac_moc1;
else
ac_moc=$ac_moc2;
fi
fi
if test -z "$ac_moc" -a "$FATAL" = 1; then
AC_MSG_ERROR([moc binary not found in \$PATH or $qt_cv_dir/bin !])
fi
])
dnl check a particular libname
AC_DEFUN([QT_TRY_LINK],
[
SAVE_LIBS="$LIBS"
LIBS="$LIBS $1"
AC_TRY_LINK([
#include <qglobal.h>
#include <qstring.h>
],
[
QString s("mangle_failure");
#if (QT_VERSION < 221)
break_me_(\\\);
#endif
],
qt_cv_libname=$1,
)
LIBS="$SAVE_LIBS"
])
dnl check we can do a compile
AC_DEFUN([QT_CHECK_COMPILE],
[
AC_MSG_CHECKING([for Qt library name])
AC_CACHE_VAL(qt_cv_libname,
[
AC_LANG_CPLUSPLUS
SAVE_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS"
for libname in -lqt-mt -lqt3 -lqt2 -lqt;
do
QT_TRY_LINK($libname)
if test -n "$qt_cv_libname"; then
break;
fi
done
CXXFLAGS=$SAVE_CXXFLAGS
])
if test -z "$qt_cv_libname"; then
AC_MSG_RESULT([failed])
if test "$FATAL" = 1 ; then
AC_MSG_ERROR([Cannot compile a simple Qt executable. Check you have the right \$QTDIR !])
fi
else
AC_MSG_RESULT([$qt_cv_libname])
fi
])
dnl get Qt version we're using
AC_DEFUN([QT_GET_VERSION],
[
AC_CACHE_CHECK([Qt version],lyx_cv_qtversion,
[
AC_LANG_CPLUSPLUS
SAVE_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
cat > conftest.$ac_ext <<EOF
#line __oline__ "configure"
#include "confdefs.h"
#include <qglobal.h>
"%%%"QT_VERSION_STR"%%%"
EOF
lyx_cv_qtversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
grep '^"%%%"' 2>/dev/null | \
sed -e 's/"%%%"//g' -e 's/"//g'`
rm -f conftest.$ac_ext
CPPFLAGS=$SAVE_CPPFLAGS
])
QT_VERSION=$lyx_cv_qtversion
AC_SUBST(QT_VERSION)
])
dnl start here
AC_DEFUN([QT_DO_IT_ALL],
[
dnl Please leave this alone. I use this file in
dnl oprofile.
FATAL=0
AC_ARG_WITH(qt-dir, [ --with-qt-dir where the root of Qt is installed ],
[ qt_cv_dir=`eval echo "$withval"/` ])
AC_ARG_WITH(qt-includes, [ --with-qt-includes where the Qt includes are. ],
[ qt_cv_includes=`eval echo "$withval"` ])
AC_ARG_WITH(qt-libraries, [ --with-qt-libraries where the Qt library is installed.],
[ qt_cv_libraries=`eval echo "$withval"` ])
dnl pay attention to $QTDIR unless overridden
if test -z "$qt_cv_dir"; then
qt_cv_dir=$QTDIR
fi
dnl derive inc/lib if needed
if test -n "$qt_cv_dir"; then
if test -z "$qt_cv_includes"; then
qt_cv_includes=$qt_cv_dir/include
fi
if test -z "$qt_cv_libraries"; then
qt_cv_libraries=$qt_cv_dir/lib
fi
fi
dnl flags for compilation
QT_INCLUDES=
QT_LDFLAGS=
if test -n "$qt_cv_includes"; then
QT_INCLUDES="-I$qt_cv_includes"
fi
if test -n "$qt_cv_libraries"; then
QT_LDFLAGS="-L$qt_cv_libraries"
fi
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LDFLAGS)
QT_FIND_MOC
MOC=$ac_moc
AC_SUBST(MOC)
QT_FIND_UIC
UIC=$ac_uic
AC_SUBST(UIC)
QT_CHECK_COMPILE
QT_LIB=$qt_cv_libname;
AC_SUBST(QT_LIB)
if test -n "$qt_cv_libname"; then
QT_GET_VERSION
fi
])
dnl AX_CXXFLAGS_OPTIONS(var-name, option)
dnl add option to var-name if $CXX support it.
AC_DEFUN([AX_CHECK_PRECOMPILED_HEADER], [
AC_MSG_CHECKING([whether ${CXX} support precompiled header])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
SAVE_CXXFLAGS=$CXXFLAGS
dnl we consider than if -Winvalid-pch is accepted pch will works ...
CXXFLAGS=-Winvalid-pch
dnl but we don't want -Winvalid-pch else compilation will fail due -Werror and
dnl the fact than some pch will be invalid for the given compilation option
AC_TRY_COMPILE(,[;],AC_MSG_RESULT([yes]); $1="${$1} -include bits/stdc++.h", AC_MSG_RESULT([no]))
CXXFLAGS=$SAVE_CXXFLAGS
AC_LANG_RESTORE
])
dnl AX_CHECK_DOCBOOK
AC_DEFUN([AX_CHECK_DOCBOOK], [
# It's just rude to go over the net to build
XSLTPROC_FLAGS=--nonet
DOCBOOK_ROOT=
if test ! -f /etc/xml/catalog; then
for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/;
do
if test -d "$i"; then
DOCBOOK_ROOT=$i
fi
done
# Last resort - try net
if test -z "$DOCBOOK_ROOT"; then
XSLTPROC_FLAGS=
fi
else
XML_CATALOG=/etc/xml/catalog
CAT_ENTRY_START='<!--'
CAT_ENTRY_END='-->'
fi
AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
XSLTPROC_WORKS=no
if test -n "$XSLTPROC"; then
AC_MSG_CHECKING([whether xsltproc works])
if test -n "$XML_CATALOG"; then
DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
else
DB_FILE="$DOCBOOK_ROOT/docbook.xsl"
fi
$XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book id="test">
</book>
END
if test "$?" = 0; then
XSLTPROC_WORKS=yes
fi
AC_MSG_RESULT($XSLTPROC_WORKS)
fi
AM_CONDITIONAL(have_xsltproc, test "$XSLTPROC_WORKS" = "yes")
AC_SUBST(XML_CATALOG)
AC_SUBST(XSLTPROC_FLAGS)
AC_SUBST(DOCBOOK_ROOT)
AC_SUBST(CAT_ENTRY_START)
AC_SUBST(CAT_ENTRY_END)
])
dnl AX_CFLAGS_OPTIONS(var-name, option)
dnl add option to var-name if $CC support it.
AC_DEFUN([AX_CFLAGS_OPTION], [
AC_MSG_CHECKING([whether ${CC} $2 is understood])
AC_LANG_SAVE
AC_LANG_C
SAVE_CFLAGS=$CFLAGS
CFLAGS=$2
AC_TRY_COMPILE(,[;],AC_MSG_RESULT([yes]); $1="${$1} $2",AC_MSG_RESULT([no]))
CFLAGS=$SAVE_CFLAGS
AC_LANG_RESTORE
])
dnl AX_CXXFLAGS_OPTIONS(var-name, option)
dnl add option to var-name if $CXX support it.
AC_DEFUN([AX_CXXFLAGS_OPTION], [
AC_MSG_CHECKING([whether ${CXX} $2 is understood])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
SAVE_CXXFLAGS=$CXXFLAGS
CXXFLAGS=$2
AC_TRY_COMPILE(,[;],AC_MSG_RESULT([yes]); $1="${$1} $2",AC_MSG_RESULT([no]))
CXXFLAGS=$SAVE_CXXFLAGS
AC_LANG_RESTORE
])
dnl AX_COPY_IF_CHANGE(source, dest)
dnl copy source to dest if they don't compare equally or if dest doesn't exist
AC_DEFUN([AX_COPY_IF_CHANGE], [
if test -r $2; then
if cmp $1 $2 > /dev/null; then
echo $2 is unchanged
else
cp -f $1 $2
fi
else
cp -f $1 $2
fi
])

View File

@@ -0,0 +1,19 @@
#!/bin/sh
saved_dir=$PWD
for dir in */tests ; do
cd $dir
for atest in * ; do
if [ \( -x $atest \) -a \( -f $atest \) ] ; then
./$atest > ${atest}.stdout 2> ${atest}.stderr
if [ $? = 0 ] ; then
echo "PASS: $dir $atest"
rm ${atest}.stdout ${atest}.stderr
else
echo "FAIL: ${dir}/${atest}"
fi
fi
done
cd $saved_dir
done

View File

@@ -0,0 +1,77 @@
SUMMARY = "System-Wide Profiler"
DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \
of profiling all running code at low overhead."
HOMEPAGE = "http://oprofile.sourceforge.net/news/"
BUGTRACKER = "http://sourceforge.net/tracker/?group_id=16191&atid=116191"
LICENSE = "LGPL-2.1-or-later & GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
file://libopagent/opagent.h;beginline=5;endline=26;md5=4f16f72c7a493d8a4704aa18d03d15c6 \
"
SECTION = "devel"
DEPENDS = "popt binutils"
DEPENDS:append:powerpc64 = " libpfm4"
DEPENDS:append:powerpc64le = " libpfm4"
COMPATIBLE_HOST:riscv64 = "null"
COMPATIBLE_HOST:riscv32 = "null"
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
file://acinclude.m4 \
file://run-ptest \
file://0001-Fix-build-with-musl.patch \
file://0002-Fix-configure-when-bin-sh-is-not-bash.patch \
file://0003-Define-the-C-preprocessor-variable-to-improve-reprod.patch \
file://0004-Use-BUILD_DATE-to-improve-reproducibility.patch \
file://0005-Add-rmb-definition-for-NIOS2-architecture.patch \
file://0006-replace-sym_iterator-0-with-sym_iterator.patch \
file://0007-oprofile-doesn-t-want-GNU-levels-of-automake-strictn.patch \
file://0008-include-linux-limits.h-for-MAX_INPUT.patch \
file://0009-Prevent-running-check-tests-on-host-if-cross-compili.patch \
file://0010-oprofile-Determine-the-root-home-directory-dynamical.patch \
file://0001-configure-Include-unistd.h-for-getpid-API.patch \
file://0001-Replace-std-bind2nd-with-generic-lambda.patch \
"
SRC_URI[sha256sum] = "7ba06f99d7c188389d20d1d5e53ee690c7733f87aa9af62bd664fa0ca235a412"
UPSTREAM_CHECK_REGEX = "oprofile-(?P<pver>\d+(\.\d+)+)/"
UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/oprofile/files/oprofile/"
inherit autotools pkgconfig ptest
EXTRA_OECONF = "--with-kernel=${STAGING_DIR_HOST}${prefix} --without-x ac_cv_prog_XSLTPROC="
do_configure () {
cp ${WORKDIR}/acinclude.m4 ${S}/
autotools_do_configure
}
EXTRA_OEMAKE = "SRCDIR=${PTEST_PATH}/libutil++/tests"
do_compile_ptest() {
oe_runmake check
}
do_install_ptest() {
subdirs="libdb/tests libutil++/tests libregex/tests libutil/tests libop/tests libdb/tests "
for tooltest in ${subdirs}
do
find ${tooltest} -perm /u=x -type f| cpio -pvdu ${D}${PTEST_PATH}
done
# needed by some libop tests
cp -r events ${D}${PTEST_PATH}
# needed by libregex regex_test
cp libregex/stl.pat ${D}${PTEST_PATH}/libregex
cp libregex/tests/mangled-name ${D}${PTEST_PATH}/libregex/tests
# needed by litutil++ file_manip_tests
cp ${S}/libutil++/tests/file_manip_tests.cpp \
libutil++/tests/file_manip_tests.o ${D}${PTEST_PATH}/libutil++/tests
}
RDEPENDS:${PN} = "binutils-symlinks"
FILES:${PN} = "${bindir} ${libdir}/${BPN}/lib*${SOLIBS} ${datadir}/${BPN}"
FILES:${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/lib*.la"
FILES:${PN}-staticdev += "${libdir}/${BPN}/lib*.a"

View File

@@ -0,0 +1,89 @@
From 50cea8fd3c07ab27da6edce865a49339f16f3b57 Mon Sep 17 00:00:00 2001
From: Naveen Saini <naveen.kumar.saini@intel.com>
Date: Tue, 18 Jun 2019 17:10:15 +0800
Subject: [PATCH] Makefile: fix multilib build failure
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
Makefile | 50 +++++++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile
index 8455415..4aa0786 100644
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,34 @@
# SPDX-License-Identifier: GPL-2.0
PREFIX ?= /usr
DESTDIR ?=
+BASELIB ?=
all:
@echo "Nothing to build"
+clean:
+ @echo "Nothing to clean"
+
install : uninstall
- install -d $(DESTDIR)$(PREFIX)/lib/pm-graph
- install sleepgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
- install bootgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
- install -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/cgskip.txt $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/freeze-callgraph.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/freeze.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/freeze-dev.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/standby-callgraph.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/standby.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/standby-dev.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend-callgraph.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend-dev.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend-x2-proc.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
+ install -d $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph
+ install sleepgraph.py $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph
+ install bootgraph.py $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph
+ install -d $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/cgskip.txt $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/freeze-callgraph.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/freeze.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/freeze-dev.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/standby-callgraph.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/standby.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/standby-dev.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/suspend-callgraph.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/suspend.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/suspend-dev.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
+ install -m 644 config/suspend-x2-proc.cfg $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config
install -d $(DESTDIR)$(PREFIX)/bin
- ln -s ../lib/pm-graph/bootgraph.py $(DESTDIR)$(PREFIX)/bin/bootgraph
- ln -s ../lib/pm-graph/sleepgraph.py $(DESTDIR)$(PREFIX)/bin/sleepgraph
+ ln -s ../$(BASELIB)/pm-graph/bootgraph.py $(DESTDIR)$(PREFIX)/bin/bootgraph
+ ln -s ../$(BASELIB)/pm-graph/sleepgraph.py $(DESTDIR)$(PREFIX)/bin/sleepgraph
install -d $(DESTDIR)$(PREFIX)/share/man/man8
install bootgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
@@ -37,11 +41,11 @@ uninstall :
rm -f $(DESTDIR)$(PREFIX)/bin/bootgraph
rm -f $(DESTDIR)$(PREFIX)/bin/sleepgraph
- rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/config/*
- if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
- rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
+ rm -f $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config/*
+ if [ -d $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config ] ; then \
+ rmdir $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/config; \
fi;
- rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
- if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
- rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
+ rm -f $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph/*
+ if [ -d $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph ] ; then \
+ rmdir $(DESTDIR)$(PREFIX)/$(BASELIB)/pm-graph; \
fi;
--
2.17.1

View File

@@ -0,0 +1,42 @@
From 47a1db21f6c5d17c94c58c3fe0dcce35c623dbf4 Mon Sep 17 00:00:00 2001
From: Liwei Song <liwei.song@windriver.com>
Date: Tue, 23 Jun 2020 04:47:20 +0000
Subject: [PATCH] sleepgraph: add support for RT kernel ftrace flags
with PREEMPT_RT enabled in kernel, ftrace have a different
flags format:
_-----=> irqs-off
/ _----=> need-resched
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
||||/ delay
TASK-PID CPU# ||||| TIMESTAMP FUNCTION
| | | ||||| | |
add support for this.
Upstream-Status: Submitted [https://github.com/intel/pm-graph/pull/18]
Signed-off-by: Liwei Song <liwei.song@windriver.com>
---
sleepgraph.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sleepgraph.py b/sleepgraph.py
index cfed8e09e0e6..561f165cf9be 100755
--- a/sleepgraph.py
+++ b/sleepgraph.py
@@ -2689,7 +2689,7 @@ class TestProps:
'[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)'
ftrace_line_fmt_nop = \
' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\
- '(?P<flags>.{4}) *(?P<time>[0-9\.]*): *'+\
+ '(?P<flags>.{4,7}) *(?P<time>[0-9\.]*): *'+\
'(?P<msg>.*)'
def __init__(self):
self.stamp = ''
--
2.24.1

View File

@@ -0,0 +1,51 @@
From 9bbc991a927722439cad38c892fc9f57207089d3 Mon Sep 17 00:00:00 2001
From: Liwei Song <liwei.song@windriver.com>
Date: Mon, 24 May 2021 08:27:28 +0000
Subject: [PATCH] sleepgraph.py: parse unfished cpu exec line
exist the below case in ftrace file:
sleepgraph-6508 [003] .... 18197.824037: tracing_mark_write: ps - xxx..., lock_torture_wr-94 169,lock_torture_wr-95 143,lock_tort
sleepgraph-6508 [003] .... 18197.824043: tracing_mark_write: ure_wr-96 189,lock_torture_wr-97 174,lock_torture_wr-98 160,lock_torture_st-99 1
lock_torture_wr-96 was split to different line due to limited buffer
size(1k) set in kernel, check this case and re-parse the unfinished
line.
Upstream-Status: Submitted [https://github.com/intel/pm-graph/pull/20]
Signed-off-by: Liwei Song <liwei.song@windriver.com>
---
sleepgraph.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/sleepgraph.py b/sleepgraph.py
index e340d5b3f03b..38b4439db8eb 100755
--- a/sleepgraph.py
+++ b/sleepgraph.py
@@ -3365,8 +3365,21 @@ def parseTraceLog(live=False):
val = ps.split()
if not val:
continue
- name = val[0].replace('--', '-')
- proclist[name] = int(val[1])
+ if not len(val) < 2:
+ name = val[0].replace('--', '-')
+ proclist[name] = int(val[1])
+ else:
+ proclist = dict()
+ nextline = next(tf)
+ mcont = re.match(tp.ftrace_line_fmt, nextline)
+ n = m.group('ps') + mcont.group('msg').split(': ')[1]
+ for pscont in n.split(','):
+ val = pscont.split()
+ if not val:
+ continue
+ if not len(val) < 2:
+ name = val[0].replace('--', '-')
+ proclist[name] = int(val[1])
data.pstl[t.time] = proclist
continue
# find the end of resume
--
2.29.2

View File

@@ -0,0 +1,39 @@
From 22ce65d997f99606a3bb9d2a660ead42eecc234a Mon Sep 17 00:00:00 2001
From: Naveen Saini <naveen.kumar.saini@intel.com>
Date: Wed, 11 Sep 2019 11:31:07 +0800
Subject: [PATCH] sleepgraph.py: use python3
Already compatible with Python 3.
Same goes for bootgraph.py
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
bootgraph.py | 2 +-
sleepgraph.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bootgraph.py b/bootgraph.py
index d3b99a1..efb5714 100755
--- a/bootgraph.py
+++ b/bootgraph.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-only
#
# Tool for analyzing boot timing
diff --git a/sleepgraph.py b/sleepgraph.py
index 1794c79..cfed8e0 100755
--- a/sleepgraph.py
+++ b/sleepgraph.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-only
#
# Tool for analyzing suspend/resume timing
--
2.17.1

View File

@@ -0,0 +1,35 @@
SUMMARY = "Timing analysis tools for suspend/resume/boot"
DESCRIPTION = "This tool suite is designed to assist kernel and OS developers \
in optimizing their linux stack's suspend/resume & boot time."
HOMEPAGE = "https://01.org/pm-graph"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
SRCREV = "cf59527dc24fdd2f314ae4dcaeb3d68a117988f6"
SRC_URI = "git://github.com/intel/pm-graph.git;branch=master;protocol=https \
file://0001-Makefile-fix-multilib-build-failure.patch \
file://0001-sleepgraph.py-use-python3.patch \
file://0001-sleepgraph-add-support-for-RT-kernel-ftrace-flags.patch \
file://0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch \
"
S = "${WORKDIR}/git"
# Apart from the listed RDEPENDS, analyze-suspend depends on some features
# provided by the kernel. These options are:
# - CONFIG_PM_DEBUG=y
# - CONFIG_PM_SLEEP_DEBUG=y
# - CONFIG_FTRACE=y
# - CONFIG_FUNCTION_TRACER=y
# - CONFIG_FUNCTION_GRAPH_TRACER=y
COMPATIBLE_HOST='(i.86|x86_64).*'
EXTRA_OEMAKE = "PREFIX=${prefix} DESTDIR=${D} BASELIB=${baselib}"
do_install() {
oe_runmake install
install -Dm 0755 ${S}/analyze_suspend.py ${D}${bindir}/analyze_suspend.py
}
RDEPENDS:${PN} += "python3-core python3-threading python3-datetime python3-compression"
RPROVIDES:${PN} = "analyze-suspend"
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,29 @@
SUMMARY = "Test SPI devices"
DESCRIPTION = "SPI testing utility using the spidev driver"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
PROVIDES = "virtual/spidev-test"
inherit bash-completion kernelsrc kernel-arch
do_populate_lic[depends] += "virtual/kernel:do_patch"
EXTRA_OEMAKE = "-C ${S}/tools/spi O=${B} CROSS=${TARGET_PREFIX} CC="${CC}" LD="${LD}" AR=${AR} ARCH=${ARCH}"
do_configure[depends] += "virtual/kernel:do_shared_workdir"
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} install
}
PACKAGE_ARCH = "${MACHINE_ARCH}"
python do_package:prepend() {
d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
}
B = "${WORKDIR}/${BPN}-${PV}"

View File

@@ -0,0 +1,34 @@
From 90fbc3423b5ccdbd54b5851c32b9f92c6658d634 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 6 Jan 2023 17:30:24 -0800
Subject: [PATCH] Do not emit useless rpath
rpath is pointing to standard libdir which is un-used and yocto build QA
flag it, there is no need to set rpaths when building in this
environment
Fixes
do_package_qa: QA Issue: trace-cmd: /usr/bin/trace-cmd contains probably-redundant RPATH /usr/lib [useless-rpaths]
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
scripts/utils.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 3fc2d74f..309a8599 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -64,7 +64,7 @@ do_compile = \
do_app_build = \
($(print_app_build) \
- $(CC) $^ -rdynamic -Wl,-rpath=$(libdir) -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
+ $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
do_build_static_lib = \
($(print_static_lib_build) \
--
2.39.0

View File

@@ -0,0 +1,145 @@
From 47005e155c291ee6a2460cbf9eee604997e87063 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 9 Jan 2023 14:48:49 -0800
Subject: [PATCH 2/2] Drop using _LARGEFILE64_SOURCE
Its no longer needed since we have dropped using LF64 interfaces
Upstream-Status: Submitted [https://lore.kernel.org/linux-trace-devel/20230109225315.1284538-2-raj.khem@gmail.com/T/#u]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
lib/trace-cmd/trace-input.c | 1 -
lib/trace-cmd/trace-output.c | 1 -
lib/trace-cmd/trace-recorder.c | 1 -
tracecmd/trace-hist.c | 1 -
tracecmd/trace-listen.c | 1 -
tracecmd/trace-mem.c | 1 -
tracecmd/trace-profile.c | 1 -
tracecmd/trace-read.c | 1 -
tracecmd/trace-restore.c | 1 -
tracecmd/trace-split.c | 1 -
10 files changed, 10 deletions(-)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 9b128403..3dd13ce4 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3,7 +3,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index ad740d65..eee847e3 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -3,7 +3,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index c172ad64..70ce52e2 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -3,7 +3,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c
index efb790ac..62fe4f9b 100644
--- a/tracecmd/trace-hist.c
+++ b/tracecmd/trace-hist.c
@@ -5,7 +5,6 @@
* Several of the ideas in this file came from Arnaldo Carvalho de Melo's
* work on the perf ui.
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index 86d2b9e9..e95c5711 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -3,7 +3,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c
index 25eb0861..3e1ac9f3 100644
--- a/tracecmd/trace-mem.c
+++ b/tracecmd/trace-mem.c
@@ -11,7 +11,6 @@
* was written for the newer version. I decided to do some of it here
* in C.
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tracecmd/trace-profile.c b/tracecmd/trace-profile.c
index 6a2cc3d0..d12a0e5e 100644
--- a/tracecmd/trace-profile.c
+++ b/tracecmd/trace-profile.c
@@ -5,7 +5,6 @@
*/
/** FIXME: Convert numbers based on machine and file */
-#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index c094ad6a..52ba818e 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -3,7 +3,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tracecmd/trace-restore.c b/tracecmd/trace-restore.c
index 5bf29c52..e9ca3225 100644
--- a/tracecmd/trace-restore.c
+++ b/tracecmd/trace-restore.c
@@ -3,7 +3,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tracecmd/trace-split.c b/tracecmd/trace-split.c
index 851ec94e..1daa847d 100644
--- a/tracecmd/trace-split.c
+++ b/tracecmd/trace-split.c
@@ -3,7 +3,6 @@
* Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
*/
-#define _LARGEFILE64_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
--
2.39.0

View File

@@ -0,0 +1,32 @@
SUMMARY = "User-space front-end command-line tool for ftrace"
LICENSE = "GPL-2.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = " \
file://LICENSES/GPL-2.0;md5=e6a75371ba4d16749254a51215d13f97 \
file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd \
"
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git;branch=master \
file://0001-Replace-LFS64-interfaces-off64_t-and-lseek64.patch \
file://0002-Drop-using-_LARGEFILE64_SOURCE.patch \
file://0001-Do-not-emit-useless-rpath.patch"
SRCREV = "18233e4c32857cb7ddd4960beeec8360ed834fc5"
S = "${WORKDIR}/git"
DEPENDS += "libtraceevent libtracefs zstd xmlto-native asciidoc-native swig-native bison-native flex-native"
inherit pkgconfig bash-completion
TARGET_CC_ARCH += "${LDFLAGS}"
do_compile() {
oe_runmake libdir_relative=${BASELIB} libs
oe_runmake libdir_relative=${BASELIB} all
}
do_install() {
oe_runmake libdir_relative=${baselib} etcdir=${sysconfdir} pkgconfig_dir=${libdir}/pkgconfig DESTDIR=${D} install install_libs
# Because makefile uses cp instead of install we need to change owner of files
chown -R root:root ${D}${libdir}
}

View File

@@ -0,0 +1,18 @@
The Linux Kernel is provided under:
SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
Being under the terms of the GNU General Public License version 2 only,
according with:
LICENSES/preferred/GPL-2.0
With an explicit syscall exception, as stated at:
LICENSES/exceptions/Linux-syscall-note
In addition, other licenses may also apply. Please see:
Documentation/process/license-rules.rst
for more details.

View File

@@ -0,0 +1,75 @@
#
# Copyright (C) 2013 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
SUMMARY = "Frequency and Idle power monitoring tools for Linux"
DESCRIPTION = "The turbostat tool allows you to determine the actual \
processor frequency and idle power saving state residency on supported \
processors."
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://../COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'
COMPATIBLE_HOST:libc-musl = "null"
SRC_URI += "\
file://COPYING \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
DEPENDS = "libcap"
# This looks in S, so we better make sure there's
# something in the directory.
#
do_populate_lic[depends] = "${PN}:do_configure"
EXTRA_OEMAKE = '\
CC="${CC}" 'CFLAGS=-Wall ${LDFLAGS}' \
'
# If we build under STAGING_KERNEL_DIR, source will not be put
# into the dbg rpm. STAGING_KERNEL_DIR will exist by the time
# do_configure() is invoked so we can safely copy from it.
#
do_configure[depends] += "virtual/kernel:do_shared_workdir"
do_configure:prepend() {
mkdir -p ${S}
cp -r ${STAGING_KERNEL_DIR}/arch/x86/include/asm/msr-index.h ${S}
cp -r ${STAGING_KERNEL_DIR}/arch/x86/include/asm/intel-family.h ${S}
if [ -f "${STAGING_KERNEL_DIR}/include/vdso/bits.h" ]; then
cp -r ${STAGING_KERNEL_DIR}/include/vdso/bits.h ${S}
cp -r ${STAGING_KERNEL_DIR}/include/vdso/const.h ${S}
else
cp -r ${STAGING_KERNEL_DIR}/include/linux/bits.h ${S}
cp -r ${STAGING_KERNEL_DIR}/include/linux/const.h ${S}
fi
cp -r ${STAGING_KERNEL_DIR}/tools/power/x86/turbostat/* ${S}
cp -r ${WORKDIR}/COPYING ${S}
}
do_compile() {
sed -i 's#<linux/bits.h>#"bits.h"#' msr-index.h
'TMPCHECK='grep "<vdso/const.h>" bits.h'' || true
if [ -n $TMPCHECK ]; then
sed -i 's#<vdso/const.h>#"const.h"#' bits.h
sed -i 's#<uapi/linux/const.h>#<linux/const.h>#' const.h
else
sed -i 's#<linux/const.h>#"const.h"#' bits.h
sed -i -e 's#<uapi/linux/const.h>#<linux/const.h>#' -e 's#_LINUX_CONST_H#_LINUX_CONST_H_KERNEL#' const.h
fi
sed -i 's#MSRHEADER#"msr-index.h"#' turbostat.c
sed -i 's#INTEL_FAMILY_HEADER#"intel-family.h"#' turbostat.c
sed -i 's#\$(CC) \$(CFLAGS) \$< -o \$(BUILD_OUTPUT)/\$@#\$(CC) \$(CFLAGS) \$(LDFLAGS) \$< -o \$(BUILD_OUTPUT)/\$@#' Makefile
oe_runmake STAGING_KERNEL_DIR=${STAGING_KERNEL_DIR}
}
do_install() {
oe_runmake DESTDIR="${D}" install
}

View File

@@ -0,0 +1,69 @@
# Recipe for building userspace part of USB/IP
#
# Started with work from chuck kamas - 2021-11-05
# https://lists.yoctoproject.org/g/yocto/topic/86249103?p=,,,20,0,0,0::recentpostdate/sticky,,,20,0,0,86249103
# Though have rewritten all the logic to be much simpler
#
# SPDX-License-Identifier: MIT
#
# Author(s)
# clst@ambu.com (Claus Stovgaard)
#
SUMMARY = "userspace usbip from Linux kernel tools"
DESCRIPTION = " USB/IP protocol allows to pass USB device from server to \
client over the network. Server is a machine which provides (shares) a \
USB device. Client is a machine which uses USB device provided by server \
over the network. The USB device may be either physical device connected \
to a server or software entity created on a server using USB gadget subsystem."
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
DEPENDS = "virtual/kernel udev"
PROVIDES = "virtual/usbip-tools"
inherit kernelsrc autotools-brokensep
do_configure[depends] += "virtual/kernel:do_shared_workdir"
# We need to set S, for not being set to STAGING_KERNEL_DIR, and by that
# be wiped when we prune dest below. We just set it to usbip-tools-1.0
S = "${WORKDIR}/${BP}"
# Copy the source files from KERNEL/tools/usb/usbip to ${S}
do_configure[prefuncs] += "copy_usbip_source_from_kernel"
python copy_usbip_source_from_kernel() {
dir_in_kernel = "tools/usb/usbip"
src_dir = d.getVar("STAGING_KERNEL_DIR")
src = oe.path.join(src_dir, dir_in_kernel)
dest = d.getVar("S")
bb.utils.mkdirhier(dest)
bb.utils.prunedir(dest)
# copy src to dest folder
if not os.path.exists(src):
bb.fatal("Path does not exist: %s. Maybe dir_in_kernel does not match the kernel version." % src)
if os.path.isdir(src):
oe.path.copyhardlinktree(src, dest)
else:
src_path = os.path.dirname(src)
os.makedirs(os.path.join(dest,src_path),exist_ok=True)
bb.utils.copyfile(src, dest)
}
# Use local scripts before relying on inherited autotools
do_configure () {
# We are in ${B} - equal to ${S}, so just run the scripts
./cleanup.sh || bbnote "${PN} failed to cleanup.sh"
./autogen.sh || bbnote "${PN} failed to autogen.sh"
oe_runconf
}
# As usbip integrate with the kernel module, we set this package to be build specific for
# this machine, and not generally for the architecture
PACKAGE_ARCH = "${MACHINE_ARCH}"
# Even though the libusbip is set to version 0.0.1, set the package version to match kernel
# e.g. usbip-tools-5.14.21-r0.qemux86_64.rpm for qemu package using kernel 5.14.21
python do_package:prepend() {
d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
}