diff options
Diffstat (limited to 'meta-oe/recipes-kernel')
69 files changed, 2256 insertions, 2159 deletions
diff --git a/meta-oe/recipes-kernel/agent-proxy/agent-proxy_1.97.bb b/meta-oe/recipes-kernel/agent-proxy/agent-proxy_1.97.bb index 2eb19206d3..0e17800c4b 100644 --- a/meta-oe/recipes-kernel/agent-proxy/agent-proxy_1.97.bb +++ b/meta-oe/recipes-kernel/agent-proxy/agent-proxy_1.97.bb @@ -1,7 +1,7 @@ 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 = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" SECTION = "devel" @@ -10,7 +10,7 @@ EXTRA_OEMAKE = "'CC=${CC}'" SRCREV = "468fe4c31e6c62c9bbb328b06ba71eaf7be0b76a" -SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git;protocol=git \ +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 \ " diff --git a/meta-oe/recipes-kernel/bpftool/bpftool.bb b/meta-oe/recipes-kernel/bpftool/bpftool.bb index f0696db59b..b22334fe90 100644 --- a/meta-oe/recipes-kernel/bpftool/bpftool.bb +++ b/meta-oe/recipes-kernel/bpftool/bpftool.bb @@ -1,13 +1,13 @@ 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 = "GPLv2" -DEPENDS = "binutils elfutils" +LICENSE = "GPL-2.0-only" +DEPENDS = "binutils elfutils elfutils-native" PROVIDES = "virtual/bpftool" inherit bash-completion kernelsrc kernel-arch -do_populate_lic[depends] += "virtual/kernel:do_patch" +do_populate_lic[depends] += "virtual/kernel:do_shared_workdir" EXTRA_OEMAKE = "\ V=1 \ @@ -15,17 +15,19 @@ EXTRA_OEMAKE = "\ O=${B} \ CROSS=${TARGET_PREFIX} \ CC="${CC} ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH}" \ + HOSTCC="${BUILD_CC} ${BUILD_CFLAGS}" \ LD="${LD}" \ AR=${AR} \ ARCH=${ARCH} \ + bash_compdir=${prefix}/share/bash-completion \ " SECURITY_CFLAGS = "" do_configure[depends] += "virtual/kernel:do_shared_workdir" -COMPATIBLE_HOST = "(x86_64).*-linux" -COMPATIBLE_HOST_libc-musl = 'null' +COMPATIBLE_HOST = "(x86_64|aarch64).*-linux" +COMPATIBLE_HOST:libc-musl = 'null' do_compile() { oe_runmake @@ -37,8 +39,12 @@ do_install() { PACKAGE_ARCH = "${MACHINE_ARCH}" -python do_package_prepend() { +python do_package:prepend() { d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) } B = "${WORKDIR}/${BPN}-${PV}" + +FILES:${PN} += "${exec_prefix}/sbin/*" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-oe/recipes-kernel/broadcom-bt-firmware/broadcom-bt-firmware_12.0.1.1105_p2.bb b/meta-oe/recipes-kernel/broadcom-bt-firmware/broadcom-bt-firmware_12.0.1.1105_p3.bb index e861ddb723..4b6026ebc0 100644 --- a/meta-oe/recipes-kernel/broadcom-bt-firmware/broadcom-bt-firmware_12.0.1.1105_p2.bb +++ b/meta-oe/recipes-kernel/broadcom-bt-firmware/broadcom-bt-firmware_12.0.1.1105_p3.bb @@ -9,8 +9,8 @@ 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" -SRCREV = "1af1116f73782951bd7bbe2139928e497c3a634b" +SRC_URI = "git://github.com/winterheart/broadcom-bt-firmware.git;branch=master;protocol=https" +SRCREV = "a0eb4805dbb232f02f156b9351a23790c1a4cec7" PE = "1" @@ -47,30 +47,30 @@ PACKAGES =+ " \ ${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" +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 () { +python populate_packages:prepend () { firmware_pkgs = oe.utils.packages_filter_out_system(d) - d.appendVar('RDEPENDS_broadcom-bt-firmware', ' ' + ' '.join(firmware_pkgs)) + d.appendVar('RDEPENDS:broadcom-bt-firmware', ' ' + ' '.join(firmware_pkgs)) } diff --git a/meta-oe/recipes-kernel/cpupower/cpupower.bb b/meta-oe/recipes-kernel/cpupower/cpupower.bb index cf70eb2c87..18e3638052 100644 --- a/meta-oe/recipes-kernel/cpupower/cpupower.bb +++ b/meta-oe/recipes-kernel/cpupower/cpupower.bb @@ -1,7 +1,7 @@ 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 = "GPLv2" +LICENSE = "GPL-2.0-only" DEPENDS = "pciutils gettext-native" PROVIDES = "virtual/cpupower" @@ -26,9 +26,9 @@ do_install() { PACKAGE_ARCH = "${MACHINE_ARCH}" -RDEPENDS_${PN} = "bash" +RDEPENDS:${PN} = "bash" -python do_package_prepend() { +python do_package:prepend() { d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) } diff --git a/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.4.bb b/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.4.bb new file mode 100644 index 0000000000..54883cef38 --- /dev/null +++ b/meta-oe/recipes-kernel/crash/crash-cross-canadian_8.0.4.bb @@ -0,0 +1,52 @@ +inherit cross-canadian + +SUMMARY = "crash utility (cross-canadian crash for ${TARGET_ARCH} target)" +PN = "crash-cross-canadian-${TRANSLATED_TARGET_ARCH}" +BPN = "crash" + +require crash.inc + + +DEPENDS = "\ + nativesdk-ncurses \ + nativesdk-expat \ + nativesdk-gettext \ + nativesdk-gmp \ + nativesdk-mpfr \ + nativesdk-readline \ + nativesdk-zlib \ + virtual/${HOST_PREFIX}gcc \ + virtual/${HOST_PREFIX}binutils \ + virtual/nativesdk-${HOST_PREFIX}compilerlibs \ + virtual/nativesdk-libc" + +RDEPENDS:${PN} = "nativesdk-liblzma" + +EXTRA_OEMAKE:class-cross-canadian = 'RPMPKG="${PV}" \ + GDB_TARGET="${BUILD_SYS} --target=${TARGET_SYS}" \ + GDB_HOST="${HOST_SYS}" \ + GDB_MAKE_JOBS="${PARALLEL_MAKE}" \ + LDFLAGS="${LDFLAGS}" \ + ' + +# To ship crash into your sdk, you should create/update a packagegroup-cross-canadian.bbappend and +# add the following +# CRASH = "crash-cross-canadian-${TRANSLATED_TARGET_ARCH}" +# RDEPENDS:${PN} += "${@all_multilib_tune_values(d, 'CRASH')}" +# +# You should also add some kernel packages in your sdk, add the followng in your conf/local.conf: +# +# TOOLCHAIN_TARGET_TASK += "\ +# kernel-vmlinux \ +# kernel-dbg \ +# kernel-dev \ +# " +# +# After sourcing the sdk environment script, you can analyze a kernel panic dump with +# +# crash $OECORE_TARGET_SYSROOT/boot/<vmlinux file> $OECORE_TARGET_SYSROOT/boot/<System.map file> <your vmcore> + +do_install:class-cross-canadian () { + install -m 0755 ${S}/crash ${D}/${bindir} + cross_canadian_bindirlinks +} diff --git a/meta-oe/recipes-kernel/crash/crash_7.2.9.bb b/meta-oe/recipes-kernel/crash/crash.inc index 0b6883a49a..04318b1505 100644 --- a/meta-oe/recipes-kernel/crash/crash_7.2.9.bb +++ b/meta-oe/recipes-kernel/crash/crash.inc @@ -7,44 +7,37 @@ offered by Mission Critical Linux, or the LKCD kernel patch." HOMEPAGE = "http://people.redhat.com/anderson" SECTION = "devel" -LICENSE = "GPLv3" +LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://COPYING3;md5=d32239bcb673463ab874e80d47fae504" DEPENDS = "zlib readline coreutils-native ncurses-native" +INC_PR = "r1" + S = "${WORKDIR}/git" -SRC_URI = "git://github.com/crash-utility/${BPN}.git \ - ${GNU_MIRROR}/gdb/gdb-7.6.tar.gz;name=gdb;subdir=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://sim-ppc-drop-LIBS-from-psim-dependency.patch \ - file://sim-common-sim-arange-fix-extern-inline-handling.patch \ file://donnot-extract-gdb-during-do-compile.patch \ file://gdb_build_jobs_and_not_write_crash_target.patch \ - file://remove-unrecognized-gcc-option-m32-for-mips.patch \ - file://0002-crash-fix-build-error-unknown-type-name-gdb_fpregset.patch \ - file://0003-crash-detect-the-sysroot-s-glibc-header-file.patch \ - file://0001-printk-add-support-for-lockless-ringbuffer.patch \ - file://0002-printk-use-committed-finalized-state-values.patch \ " -SRCREV = "a25aa4b649d339dd25c20d5413d81b851a77e0b2" +SRCREV = "a6832f608cb5d473739cf33bbf84ab1df8d98fd5" -SRC_URI[gdb.md5sum] = "a9836707337e5f7bf76a009a8904f470" -SRC_URI[gdb.sha256sum] = "8070389a5dcc104eb0be483d582729f98ed4d761ad19cedd3f17b5d2502faa36" +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}" +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" +COMPATIBLE_HOST:riscv64 = "null" +COMPATIBLE_HOST:riscv32 = "null" +COMPATIBLE_HOST:mipsarchn64 = "null" +COMPATIBLE_HOST:mipsarchn32 = "null" EXTRA_OEMAKE = 'RPMPKG="${PV}" \ @@ -54,20 +47,11 @@ EXTRA_OEMAKE = 'RPMPKG="${PV}" \ 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() { +do_compile:prepend() { case ${TARGET_ARCH} in aarch64*) ARCH=ARM64 ;; arm*) ARCH=ARM ;; @@ -80,6 +64,7 @@ do_compile_prepend() { 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/>/>/g' ${S}/Makefile } @@ -87,7 +72,7 @@ do_compile() { oe_runmake ${EXTRA_OEMAKE} RECIPE_SYSROOT=${RECIPE_SYSROOT} } -do_install_prepend () { +do_install:prepend () { install -d ${D}${bindir} install -d ${D}/${mandir}/man8 install -d ${D}${includedir}/crash @@ -96,25 +81,11 @@ do_install_prepend () { 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 = "" +RDEPENDS:${PN} += "liblzma" # Causes gcc to get stuck and eat all available memory in qemuarm builds # jenkins 15161 100 12.5 10389596 10321284 ? R 11:40 28:17 /home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/x86_64-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.2/cc1 -quiet -I . -I . -I ./common -I ./config -I ./../include/opcode -I ./../opcodes/.. -I ./../readline/.. -I ../bfd -I ./../bfd -I ./../include -I ../libdecnumber -I ./../libdecnumber -I ./gnulib/import -I build-gnulib/import -isysroot /home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/qemuarm -MMD eval.d -MF .deps/eval.Tpo -MP -MT eval.o -D LOCALEDIR="/usr/local/share/locale" -D CRASH_MERGE -D HAVE_CONFIG_H -D TUI=1 eval.c -quiet -dumpbase eval.c -march=armv5te -mthumb -mthumb-interwork -mtls-dialect=gnu -auxbase-strip eval.o -g -O2 -Wall -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -feliminate-unused-debug-types -o - ARM_INSTRUCTION_SET = "arm" # http://errors.yoctoproject.org/Errors/Details/186964/ -COMPATIBLE_HOST_libc-musl = 'null' +COMPATIBLE_HOST:libc-musl = 'null' diff --git a/meta-oe/recipes-kernel/crash/crash/0001-cross_add_configure_option.patch b/meta-oe/recipes-kernel/crash/crash/0001-cross_add_configure_option.patch index 26a34e5c16..fc99ff5187 100644 --- a/meta-oe/recipes-kernel/crash/crash/0001-cross_add_configure_option.patch +++ b/meta-oe/recipes-kernel/crash/crash/0001-cross_add_configure_option.patch @@ -1,27 +1,29 @@ -From 73269df4d8196abe81112acaa2613155b308a8b8 Mon Sep 17 00:00:00 2001 +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 1/9] cross_add_configure_option +Subject: [PATCH] cross_add_configure_option + -%% original patch: 0001-cross_add_configure_option.patch --- +Upstream-Status: Pending + Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index a2baec1..f1972c8 100644 +index 7266e305..390fc0ef 100644 --- a/Makefile +++ b/Makefile -@@ -232,7 +232,7 @@ gdb_merge: force +@@ -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 --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \ - else make --no-print-directory rebuild; fi -@@ -283,7 +283,7 @@ force: + $(MAKE) CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \ + else $(MAKE) rebuild; fi +@@ -306,7 +306,7 @@ force: make_configure: force @rm -f configure @@ -30,6 +32,3 @@ index a2baec1..f1972c8 100644 clean: make_configure @./configure ${CONF_TARGET_FLAG} -q -b --- -2.8.1 - diff --git a/meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch b/meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch deleted file mode 100644 index 1aaf1e6b07..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch +++ /dev/null @@ -1,445 +0,0 @@ -From a5531b24750e7949c35640d996ea14c0587938bc Mon Sep 17 00:00:00 2001 -From: John Ogness <john.ogness@linutronix.de> -Date: Fri, 20 Nov 2020 05:56:59 +0000 -Subject: [PATCH 1/2] printk: add support for lockless ringbuffer - -Linux 5.10 introduces a new lockless ringbuffer. The new ringbuffer -is structured completely different to the previous iterations. -Add support for dumping the ringbuffer with the "log" command. -The new ringbuffer is detected based on the availability of -the "prb" symbol. - -Upstream-Status: Backport [https://github.com/crash-utility/crash/commit/a5531b24750e7949c35640d996ea14c0587938bc] - -Signed-off-by: John Ogness <john.ogness@linutronix.de> -Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com> -Signed-off-by: Mingli Yu <mingli.yu@windriver.com> ---- - Makefile | 5 ++ - defs.h | 30 +++++++ - kernel.c | 7 +- - printk.c | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - symbols.c | 27 ++++++ - 5 files changed, 324 insertions(+), 1 deletion(-) - create mode 100644 printk.c - -diff --git a/Makefile b/Makefile -index d185719..f66eba7 100644 ---- a/Makefile -+++ b/Makefile -@@ -61,6 +61,7 @@ VMWARE_HFILES=vmware_vmss.h - - CFILES=main.c tools.c global_data.c memory.c filesys.c help.c task.c \ - kernel.c test.c gdb_interface.c configure.c net.c dev.c bpf.c \ -+ printk.c \ - alpha.c x86.c ppc.c ia64.c s390.c s390x.c s390dbf.c ppc64.c x86_64.c \ - arm.c arm64.c mips.c sparc64.c \ - extensions.c remote.c va_server.c va_server_v1.c symbols.c cmdline.c \ -@@ -80,6 +81,7 @@ SOURCE_FILES=${CFILES} ${GENERIC_HFILES} ${MCORE_HFILES} \ - - OBJECT_FILES=main.o tools.o global_data.o memory.o filesys.o help.o task.o \ - build_data.o kernel.o test.o gdb_interface.o net.o dev.o bpf.o \ -+ printk.o \ - alpha.o x86.o ppc.o ia64.o s390.o s390x.o s390dbf.o ppc64.o x86_64.o \ - arm.o arm64.o mips.o sparc64.o \ - extensions.o remote.o va_server.o va_server_v1.o symbols.o cmdline.o \ -@@ -363,6 +365,9 @@ task.o: ${GENERIC_HFILES} task.c - kernel.o: ${GENERIC_HFILES} kernel.c - ${CC} -c ${CRASH_CFLAGS} kernel.c ${WARNING_OPTIONS} ${WARNING_ERROR} - -+printk.o: ${GENERIC_HFILES} printk.c -+ ${CC} -c ${CRASH_CFLAGS} printk.c ${WARNING_OPTIONS} ${WARNING_ERROR} -+ - gdb_interface.o: ${GENERIC_HFILES} gdb_interface.c - ${CC} -c ${CRASH_CFLAGS} gdb_interface.c ${WARNING_OPTIONS} ${WARNING_ERROR} - -diff --git a/defs.h b/defs.h -index 9594950..e1a18e9 100644 ---- a/defs.h -+++ b/defs.h -@@ -2106,6 +2106,28 @@ struct offset_table { /* stash of commonly-used offsets */ - long irq_common_data_affinity; - long irq_desc_irq_common_data; - long uts_namespace_name; -+ long printk_info_seq; -+ long printk_info_ts_nsec; -+ long printk_info_text_len; -+ long printk_info_level; -+ long printk_info_caller_id; -+ long printk_info_dev_info; -+ long dev_printk_info_subsystem; -+ long dev_printk_info_device; -+ long prb_desc_ring; -+ long prb_text_data_ring; -+ long prb_desc_ring_count_bits; -+ long prb_desc_ring_descs; -+ long prb_desc_ring_infos; -+ long prb_desc_ring_head_id; -+ long prb_desc_ring_tail_id; -+ long prb_desc_state_var; -+ long prb_desc_text_blk_lpos; -+ long prb_data_blk_lpos_begin; -+ long prb_data_blk_lpos_next; -+ long prb_data_ring_size_bits; -+ long prb_data_ring_data; -+ long atomic_long_t_counter; - }; - - struct size_table { /* stash of commonly-used sizes */ -@@ -2265,6 +2287,9 @@ struct size_table { /* stash of commonly-used sizes */ - long xa_node; - long zram_table_entry; - long irq_common_data; -+ long printk_info; -+ long printk_ringbuffer; -+ long prb_desc; - }; - - struct array_table { -@@ -6696,6 +6721,11 @@ int vmware_guestdump_memory_dump(FILE *); - */ - int calc_kaslr_offset(ulong *, ulong *); - -+/* -+ * printk.c -+ */ -+void dump_lockless_record_log(int); -+ - /* - * gnu_binutils.c - */ -diff --git a/kernel.c b/kernel.c -index 9871637..e722ff9 100644 ---- a/kernel.c -+++ b/kernel.c -@@ -5042,6 +5042,11 @@ dump_log(int msg_flags) - struct syment *nsp; - int log_wrap, loglevel, log_buf_len; - -+ if (kernel_symbol_exists("prb")) { -+ dump_lockless_record_log(msg_flags); -+ return; -+ } -+ - if (kernel_symbol_exists("log_first_idx") && - kernel_symbol_exists("log_next_idx")) { - dump_variable_length_record_log(msg_flags); -@@ -5289,7 +5294,7 @@ dump_log_entry(char *logptr, int msg_flags) - } - - /* -- * Handle the new variable-length-record log_buf. -+ * Handle the variable-length-record log_buf. - */ - static void - dump_variable_length_record_log(int msg_flags) -diff --git a/printk.c b/printk.c -new file mode 100644 -index 0000000..f6d54ce ---- /dev/null -+++ b/printk.c -@@ -0,0 +1,256 @@ -+#include "defs.h" -+#include <ctype.h> -+ -+#define DESC_SV_BITS (sizeof(unsigned long) * 8) -+#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1)) -+#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2)) -+#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK) -+#define DESC_ID_MASK (~DESC_FLAGS_MASK) -+ -+/* convenience struct for passing many values to helper functions */ -+struct prb_map { -+ char *prb; -+ -+ char *desc_ring; -+ unsigned long desc_ring_count; -+ char *descs; -+ char *infos; -+ -+ char *text_data_ring; -+ unsigned long text_data_ring_size; -+ char *text_data; -+}; -+ -+static void -+init_offsets(void) -+{ -+ char *n; -+ -+ n = "printk_info"; -+ STRUCT_SIZE_INIT(printk_info, n); -+ MEMBER_OFFSET_INIT(printk_info_seq, n, "seq"); -+ MEMBER_OFFSET_INIT(printk_info_ts_nsec, n, "ts_nsec"); -+ MEMBER_OFFSET_INIT(printk_info_text_len, n, "text_len"); -+ MEMBER_OFFSET_INIT(printk_info_level, n, "level"); -+ MEMBER_OFFSET_INIT(printk_info_caller_id, n, "caller_id"); -+ MEMBER_OFFSET_INIT(printk_info_dev_info, n, "dev_info"); -+ -+ n = "dev_printk_info"; -+ MEMBER_OFFSET_INIT(dev_printk_info_subsystem, n, "subsystem"); -+ MEMBER_OFFSET_INIT(dev_printk_info_device, n, "device"); -+ -+ n = "printk_ringbuffer"; -+ STRUCT_SIZE_INIT(printk_ringbuffer, n); -+ MEMBER_OFFSET_INIT(prb_desc_ring, n, "desc_ring"); -+ MEMBER_OFFSET_INIT(prb_text_data_ring, n, "text_data_ring"); -+ -+ n = "prb_desc_ring"; -+ MEMBER_OFFSET_INIT(prb_desc_ring_count_bits, n, "count_bits"); -+ MEMBER_OFFSET_INIT(prb_desc_ring_descs, n, "descs"); -+ MEMBER_OFFSET_INIT(prb_desc_ring_infos, n, "infos"); -+ MEMBER_OFFSET_INIT(prb_desc_ring_head_id, n, "head_id"); -+ MEMBER_OFFSET_INIT(prb_desc_ring_tail_id, n, "tail_id"); -+ -+ n = "prb_desc"; -+ STRUCT_SIZE_INIT(prb_desc, n); -+ MEMBER_OFFSET_INIT(prb_desc_state_var, n, "state_var"); -+ MEMBER_OFFSET_INIT(prb_desc_text_blk_lpos, n, "text_blk_lpos"); -+ -+ n = "prb_data_blk_lpos"; -+ MEMBER_OFFSET_INIT(prb_data_blk_lpos_begin, n, "begin"); -+ MEMBER_OFFSET_INIT(prb_data_blk_lpos_next, n, "next"); -+ -+ n = "prb_data_ring"; -+ MEMBER_OFFSET_INIT(prb_data_ring_size_bits, n, "size_bits"); -+ MEMBER_OFFSET_INIT(prb_data_ring_data, n, "data"); -+ -+ n = "atomic_long_t"; -+ MEMBER_OFFSET_INIT(atomic_long_t_counter, n, "counter"); -+} -+ -+static void -+dump_record(struct prb_map *m, unsigned long id, int msg_flags) -+{ -+ unsigned short text_len; -+ unsigned long state_var; -+ unsigned int caller_id; -+ unsigned char level; -+ unsigned long begin; -+ unsigned long next; -+ char buf[BUFSIZE]; -+ uint64_t ts_nsec; -+ ulonglong nanos; -+ ulonglong seq; -+ int ilen = 0, i; -+ char *desc, *info, *text, *p; -+ ulong rem; -+ -+ desc = m->descs + ((id % m->desc_ring_count) * SIZE(prb_desc)); -+ -+ /* skip non-committed record */ -+ state_var = ULONG(desc + OFFSET(prb_desc_state_var) + -+ OFFSET(atomic_long_t_counter)); -+ if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK) -+ return; -+ -+ info = m->infos + ((id % m->desc_ring_count) * SIZE(printk_info)); -+ -+ seq = ULONGLONG(info + OFFSET(printk_info_seq)); -+ caller_id = UINT(info + OFFSET(printk_info_caller_id)); -+ if (CRASHDEBUG(1)) -+ fprintf(fp, "seq: %llu caller_id: %x (%s: %u)\n", seq, caller_id, -+ caller_id & 0x80000000 ? "cpu" : "pid", caller_id & ~0x80000000); -+ -+ text_len = USHORT(info + OFFSET(printk_info_text_len)); -+ -+ begin = ULONG(desc + OFFSET(prb_desc_text_blk_lpos) + -+ OFFSET(prb_data_blk_lpos_begin)) % -+ m->text_data_ring_size; -+ next = ULONG(desc + OFFSET(prb_desc_text_blk_lpos) + -+ OFFSET(prb_data_blk_lpos_next)) % -+ m->text_data_ring_size; -+ -+ /* skip data-less text blocks */ -+ if (begin == next) -+ goto out; -+ -+ if ((msg_flags & SHOW_LOG_TEXT) == 0) { -+ ts_nsec = ULONGLONG(info + OFFSET(printk_info_ts_nsec)); -+ nanos = (ulonglong)ts_nsec / (ulonglong)1000000000; -+ rem = (ulonglong)ts_nsec % (ulonglong)1000000000; -+ if (msg_flags & SHOW_LOG_CTIME) { -+ time_t t = kt->boot_date.tv_sec + nanos; -+ sprintf(buf, "[%s] ", ctime_tz(&t)); -+ } else -+ sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000); -+ -+ ilen += strlen(buf); -+ fprintf(fp, "%s", buf); -+ } -+ -+ if (msg_flags & SHOW_LOG_LEVEL) { -+ level = UCHAR(info + OFFSET(printk_info_level)) >> 5; -+ sprintf(buf, "<%x>", level); -+ ilen += strlen(buf); -+ fprintf(fp, "%s", buf); -+ } -+ -+ /* handle wrapping data block */ -+ if (begin > next) -+ begin = 0; -+ -+ /* skip over descriptor ID */ -+ begin += sizeof(unsigned long); -+ -+ /* handle truncated messages */ -+ if (next - begin < text_len) -+ text_len = next - begin; -+ -+ text = m->text_data + begin; -+ -+ for (i = 0, p = text; i < text_len; i++, p++) { -+ if (*p == '\n') -+ fprintf(fp, "\n%s", space(ilen)); -+ else if (isprint(*p) || isspace(*p)) -+ fputc(*p, fp); -+ else -+ fputc('.', fp); -+ } -+ -+ if (msg_flags & SHOW_LOG_DICT) { -+ text = info + OFFSET(printk_info_dev_info) + -+ OFFSET(dev_printk_info_subsystem); -+ if (strlen(text)) -+ fprintf(fp, "\n%sSUBSYSTEM=%s", space(ilen), text); -+ -+ text = info + OFFSET(printk_info_dev_info) + -+ OFFSET(dev_printk_info_device); -+ if (strlen(text)) -+ fprintf(fp, "\n%sDEVICE=%s", space(ilen), text); -+ } -+out: -+ fprintf(fp, "\n"); -+} -+ -+/* -+ * Handle the lockless printk_ringbuffer. -+ */ -+void -+dump_lockless_record_log(int msg_flags) -+{ -+ unsigned long head_id; -+ unsigned long tail_id; -+ unsigned long kaddr; -+ unsigned long id; -+ struct prb_map m; -+ -+ if (INVALID_SIZE(printk_info)) -+ init_offsets(); -+ -+ /* setup printk_ringbuffer */ -+ get_symbol_data("prb", sizeof(char *), &kaddr); -+ m.prb = GETBUF(SIZE(printk_ringbuffer)); -+ if (!readmem(kaddr, KVADDR, m.prb, SIZE(printk_ringbuffer), -+ "printk_ringbuffer contents", RETURN_ON_ERROR|QUIET)) { -+ error(WARNING, "\ncannot read printk_ringbuffer contents\n"); -+ goto out_prb; -+ } -+ -+ /* setup descriptor ring */ -+ m.desc_ring = m.prb + OFFSET(prb_desc_ring); -+ m.desc_ring_count = 1 << UINT(m.desc_ring + OFFSET(prb_desc_ring_count_bits)); -+ -+ kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring_descs)); -+ m.descs = GETBUF(SIZE(prb_desc) * m.desc_ring_count); -+ if (!readmem(kaddr, KVADDR, m.descs, SIZE(prb_desc) * m.desc_ring_count, -+ "prb_desc_ring contents", RETURN_ON_ERROR|QUIET)) { -+ error(WARNING, "\ncannot read prb_desc_ring contents\n"); -+ goto out_descs; -+ } -+ -+ kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring_infos)); -+ m.infos = GETBUF(SIZE(printk_info) * m.desc_ring_count); -+ if (!readmem(kaddr, KVADDR, m.infos, SIZE(printk_info) * m.desc_ring_count, -+ "prb_info_ring contents", RETURN_ON_ERROR|QUIET)) { -+ error(WARNING, "\ncannot read prb_info_ring contents\n"); -+ goto out_infos; -+ } -+ -+ /* setup text data ring */ -+ m.text_data_ring = m.prb + OFFSET(prb_text_data_ring); -+ m.text_data_ring_size = 1 << UINT(m.text_data_ring + OFFSET(prb_data_ring_size_bits)); -+ -+ kaddr = ULONG(m.text_data_ring + OFFSET(prb_data_ring_data)); -+ m.text_data = GETBUF(m.text_data_ring_size); -+ if (!readmem(kaddr, KVADDR, m.text_data, m.text_data_ring_size, -+ "prb_text_data_ring contents", RETURN_ON_ERROR|QUIET)) { -+ error(WARNING, "\ncannot read prb_text_data_ring contents\n"); -+ goto out_text_data; -+ } -+ -+ /* ready to go */ -+ -+ tail_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring_tail_id) + -+ OFFSET(atomic_long_t_counter)); -+ head_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring_head_id) + -+ OFFSET(atomic_long_t_counter)); -+ -+ hq_open(); -+ -+ for (id = tail_id; id != head_id; id = (id + 1) & DESC_ID_MASK) -+ dump_record(&m, id, msg_flags); -+ -+ /* dump head record */ -+ dump_record(&m, id, msg_flags); -+ -+ hq_close(); -+ -+out_text_data: -+ FREEBUF(m.text_data); -+out_infos: -+ FREEBUF(m.infos); -+out_descs: -+ FREEBUF(m.descs); -+out_prb: -+ FREEBUF(m.prb); -+} -diff --git a/symbols.c b/symbols.c -index b2f4eb5..a51078d 100644 ---- a/symbols.c -+++ b/symbols.c -@@ -10426,6 +10426,30 @@ dump_offset_table(char *spec, ulong makestruct) - OFFSET(log_level)); - fprintf(fp, " log_flags_level: %ld\n", - OFFSET(log_flags_level)); -+ -+ fprintf(fp, " printk_info_seq: %ld\n", OFFSET(printk_info_seq)); -+ fprintf(fp, " printk_info_ts_nseq: %ld\n", OFFSET(printk_info_ts_nsec)); -+ fprintf(fp, " printk_info_text_len: %ld\n", OFFSET(printk_info_text_len)); -+ fprintf(fp, " printk_info_level: %ld\n", OFFSET(printk_info_level)); -+ fprintf(fp, " printk_info_caller_id: %ld\n", OFFSET(printk_info_caller_id)); -+ fprintf(fp, " printk_info_dev_info: %ld\n", OFFSET(printk_info_dev_info)); -+ fprintf(fp, " dev_printk_info_subsystem: %ld\n", OFFSET(dev_printk_info_subsystem)); -+ fprintf(fp, " dev_printk_info_device: %ld\n", OFFSET(dev_printk_info_device)); -+ fprintf(fp, " prb_desc_ring: %ld\n", OFFSET(prb_desc_ring)); -+ fprintf(fp, " prb_text_data_ring: %ld\n", OFFSET(prb_text_data_ring)); -+ fprintf(fp, " prb_desc_ring_count_bits: %ld\n", OFFSET(prb_desc_ring_count_bits)); -+ fprintf(fp, " prb_desc_ring_descs: %ld\n", OFFSET(prb_desc_ring_descs)); -+ fprintf(fp, " prb_desc_ring_infos: %ld\n", OFFSET(prb_desc_ring_infos)); -+ fprintf(fp, " prb_desc_ring_head_id: %ld\n", OFFSET(prb_desc_ring_head_id)); -+ fprintf(fp, " prb_desc_ring_tail_id: %ld\n", OFFSET(prb_desc_ring_tail_id)); -+ fprintf(fp, " prb_desc_state_var: %ld\n", OFFSET(prb_desc_state_var)); -+ fprintf(fp, " prb_desc_text_blk_lpos: %ld\n", OFFSET(prb_desc_text_blk_lpos)); -+ fprintf(fp, " prb_data_blk_lpos_begin: %ld\n", OFFSET(prb_data_blk_lpos_begin)); -+ fprintf(fp, " prb_data_blk_lpos_next: %ld\n", OFFSET(prb_data_blk_lpos_next)); -+ fprintf(fp, " prb_data_ring_size_bits: %ld\n", OFFSET(prb_data_ring_size_bits)); -+ fprintf(fp, " prb_data_ring_data: %ld\n", OFFSET(prb_data_ring_data)); -+ fprintf(fp, " atomit_long_t_counter: %ld\n", OFFSET(atomic_long_t_counter)); -+ - fprintf(fp, " sched_rt_entity_my_q: %ld\n", - OFFSET(sched_rt_entity_my_q)); - fprintf(fp, " task_group_parent: %ld\n", -@@ -10850,6 +10874,9 @@ dump_offset_table(char *spec, ulong makestruct) - SIZE(xarray)); - fprintf(fp, " xa_node: %ld\n", - SIZE(xa_node)); -+ fprintf(fp, " printk_info: %ld\n", SIZE(printk_info)); -+ fprintf(fp, " printk_ringbuffer: %ld\n", SIZE(printk_ringbuffer)); -+ fprintf(fp, " prb_desc: %ld\n", SIZE(prb_desc)); - - - fprintf(fp, "\n array_table:\n"); --- -2.17.1 - diff --git a/meta-oe/recipes-kernel/crash/crash/0002-crash-fix-build-error-unknown-type-name-gdb_fpregset.patch b/meta-oe/recipes-kernel/crash/crash/0002-crash-fix-build-error-unknown-type-name-gdb_fpregset.patch deleted file mode 100644 index 8355fe44ea..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/0002-crash-fix-build-error-unknown-type-name-gdb_fpregset.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 52fc1a7c17768fd52c3577d21dad84e8babb94b5 Mon Sep 17 00:00:00 2001 -From: Dengke Du <dengke.du@windriver.com> -Date: Thu, 6 Apr 2017 23:01:14 -0400 -Subject: [PATCH 2/3] crash: fix build error unknown type name 'gdb_fpregset_t' - -Upstream-Status: Pending - -Signed-off-by: Dengke Du <dengke.du@windriver.com> ---- - gdb-7.6/gdb/gdb_proc_service.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/gdb-7.6/gdb/gdb_proc_service.h b/gdb-7.6/gdb/gdb_proc_service.h -index 8bc6088..99c6496 100644 ---- a/gdb-7.6/gdb/gdb_proc_service.h -+++ b/gdb-7.6/gdb/gdb_proc_service.h -@@ -20,6 +20,7 @@ - #define GDB_PROC_SERVICE_H - - #include <sys/types.h> -+#include "gregset.h" - - #ifdef HAVE_PROC_SERVICE_H - #include <proc_service.h> -@@ -53,8 +54,6 @@ - #include <sys/procfs.h> - #endif - --#include "gregset.h" -- - /* Functions in this interface return one of these status codes. */ - typedef enum - { --- -2.8.1 - diff --git a/meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch b/meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch deleted file mode 100644 index 5213195c7d..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 71e159c64000467e94e08aefc144f5e1cdaa4aa0 Mon Sep 17 00:00:00 2001 -From: John Ogness <john.ogness@linutronix.de> -Date: Wed, 25 Nov 2020 05:27:53 +0106 -Subject: [PATCH 2/2] printk: use committed/finalized state values - -An addendum to the previous crash commit a5531b24750e. -The ringbuffer entries use 2 state values (committed and finalized) -rather than a single flag to represent being available for reading. -Copy the definitions and state lookup function directly from the -kernel source and use the new states. - -Upstream-Status: Backport [https://github.com/crash-utility/crash/commit/71e159c64000467e94e08aefc144f5e1cdaa4aa0] - -Signed-off-by: John Ogness <john.ogness@linutronix.de> -Signed-off-by: Nikolay Borisov <nborisov@suse.com> -Signed-off-by: Mingli Yu <mingli.yu@windriver.com> ---- - printk.c | 48 +++++++++++++++++++++++++++++++++++++++++------- - 1 file changed, 41 insertions(+), 7 deletions(-) - -diff --git a/printk.c b/printk.c -index f6d54ce..8658016 100644 ---- a/printk.c -+++ b/printk.c -@@ -1,12 +1,6 @@ - #include "defs.h" - #include <ctype.h> - --#define DESC_SV_BITS (sizeof(unsigned long) * 8) --#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1)) --#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2)) --#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK) --#define DESC_ID_MASK (~DESC_FLAGS_MASK) -- - /* convenience struct for passing many values to helper functions */ - struct prb_map { - char *prb; -@@ -21,6 +15,44 @@ struct prb_map { - char *text_data; - }; - -+/* -+ * desc_state and DESC_* definitions taken from kernel source: -+ * -+ * kernel/printk/printk_ringbuffer.h -+ */ -+ -+/* The possible responses of a descriptor state-query. */ -+enum desc_state { -+ desc_miss = -1, /* ID mismatch (pseudo state) */ -+ desc_reserved = 0x0, /* reserved, in use by writer */ -+ desc_committed = 0x1, /* committed by writer, could get reopened */ -+ desc_finalized = 0x2, /* committed, no further modification allowed */ -+ desc_reusable = 0x3, /* free, not yet used by any writer */ -+}; -+ -+#define DESC_SV_BITS (sizeof(unsigned long) * 8) -+#define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2) -+#define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) -+#define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT)) -+#define DESC_ID_MASK (~DESC_FLAGS_MASK) -+#define DESC_ID(sv) ((sv) & DESC_ID_MASK) -+ -+/* -+ * get_desc_state() taken from kernel source: -+ * -+ * kernel/printk/printk_ringbuffer.c -+ */ -+ -+/* Query the state of a descriptor. */ -+static enum desc_state get_desc_state(unsigned long id, -+ unsigned long state_val) -+{ -+ if (id != DESC_ID(state_val)) -+ return desc_miss; -+ -+ return DESC_STATE(state_val); -+} -+ - static void - init_offsets(void) - { -@@ -74,6 +106,7 @@ dump_record(struct prb_map *m, unsigned long id, int msg_flags) - unsigned short text_len; - unsigned long state_var; - unsigned int caller_id; -+ enum desc_state state; - unsigned char level; - unsigned long begin; - unsigned long next; -@@ -90,7 +123,8 @@ dump_record(struct prb_map *m, unsigned long id, int msg_flags) - /* skip non-committed record */ - state_var = ULONG(desc + OFFSET(prb_desc_state_var) + - OFFSET(atomic_long_t_counter)); -- if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK) -+ state = get_desc_state(id, state_var); -+ if (state != desc_committed && state != desc_finalized) - return; - - info = m->infos + ((id % m->desc_ring_count) * SIZE(printk_info)); --- -2.17.1 - diff --git a/meta-oe/recipes-kernel/crash/crash/0003-crash-detect-the-sysroot-s-glibc-header-file.patch b/meta-oe/recipes-kernel/crash/crash/0003-crash-detect-the-sysroot-s-glibc-header-file.patch deleted file mode 100644 index 1f4bd01da4..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/0003-crash-detect-the-sysroot-s-glibc-header-file.patch +++ /dev/null @@ -1,33 +0,0 @@ -From c7950ef5228adc52a500b4fc67d7e48c3c09c1df Mon Sep 17 00:00:00 2001 -From: Dengke Du <dengke.du@windriver.com> -Date: Thu, 6 Apr 2017 23:02:44 -0400 -Subject: [PATCH 3/3] crash: detect the sysroot's glibc header file - -This is cross compile, so let the Makefile detect the sysroot's glibc -header file, not the host's glibc header file. - -Upstream-Status: Pending - -Signed-off-by: Dengke Du <dengke.du@windriver.com> ---- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile b/Makefile -index b6b7e80..94f21a5 100644 ---- a/Makefile -+++ b/Makefile -@@ -264,8 +264,8 @@ gdb_patch: - if [ "${ARCH}" = "x86_64" ] && [ "${TARGET}" = "PPC64" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \ - patch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \ - fi -- if [ -f /usr/include/proc_service.h ]; then \ -- grep 'extern ps_err_e ps_get_thread_area (struct' /usr/include/proc_service.h; \ -+ if [ -f ${RECIPE_SYSROOT}/usr/include/proc_service.h ]; then \ -+ grep 'extern ps_err_e ps_get_thread_area (struct' ${RECIPE_SYSROOT}/usr/include/proc_service.h; \ - if [ $$? -eq 0 ]; then \ - patch -p0 < ${GDB}-proc_service.h.patch; \ - fi; \ --- -2.8.1 - diff --git a/meta-oe/recipes-kernel/crash/crash/7001force_define_architecture.patch b/meta-oe/recipes-kernel/crash/crash/7001force_define_architecture.patch index 0d44c7f176..b5f97228de 100644 --- a/meta-oe/recipes-kernel/crash/crash/7001force_define_architecture.patch +++ b/meta-oe/recipes-kernel/crash/crash/7001force_define_architecture.patch @@ -1,3 +1,5 @@ +Upstream-Status: Pending + 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 diff --git a/meta-oe/recipes-kernel/crash/crash/7003cross_ranlib.patch b/meta-oe/recipes-kernel/crash/crash/7003cross_ranlib.patch index d567fa0a82..2d01453059 100644 --- a/meta-oe/recipes-kernel/crash/crash/7003cross_ranlib.patch +++ b/meta-oe/recipes-kernel/crash/crash/7003cross_ranlib.patch @@ -1,8 +1,21 @@ ---- crash-5.1.8/Makefile.orig 2011-12-27 11:21:58.220652105 +0900 -+++ crash-5.1.8/Makefile 2011-12-27 11:22:29.563651593 +0900 -@@ -285,6 +285,7 @@ +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 + +--- +Upstream-Status: Pending + + 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: make_build_data ${OBJECT_FILES} + library: ${OBJECT_FILES} ar -rs ${PROGRAM}lib.a ${OBJECT_FILES} + ${RANLIB} ${PROGRAM}lib.a diff --git a/meta-oe/recipes-kernel/crash/crash/config-site.crash-7.0.9 b/meta-oe/recipes-kernel/crash/crash/config-site.crash-7.0.9 deleted file mode 100644 index d6fc22fb34..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/config-site.crash-7.0.9 +++ /dev/null @@ -1 +0,0 @@ -bash_cv_have_mbstate_t=yes diff --git a/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch b/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch index e254fe8772..16382877d0 100644 --- a/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch +++ b/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch @@ -1,32 +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 bb0a34e..5eb7604 100644 +index 79aef17..146da6a 100644 --- a/Makefile +++ b/Makefile -@@ -226,7 +226,7 @@ all: make_configure - # @make --no-print-directory extensions +@@ -254,7 +254,7 @@ all: make_configure + # @$(MAKE) extensions gdb_merge: force - @if [ ! -f ${GDB}/README ]; then \ + @if [ ! -f ${GDB}/${GDB}.patch ]; then \ - make --no-print-directory gdb_unzip; fi + $(MAKE) gdb_unzip; fi @echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs @echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj -@@ -253,11 +253,6 @@ gdb_unzip: +@@ -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 \ -- wget http://ftp.gnu.org/gnu/gdb/${GDB}.tar.gz; fi -- @tar --exclude-from gdb.files -xvzmf ${GDB}.tar.gz - @make --no-print-directory gdb_patch +- [ ! -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 + diff --git a/meta-oe/recipes-kernel/crash/crash/gdb_build_jobs_and_not_write_crash_target.patch b/meta-oe/recipes-kernel/crash/crash/gdb_build_jobs_and_not_write_crash_target.patch index aa5f44dd42..257b4dd2bf 100644 --- a/meta-oe/recipes-kernel/crash/crash/gdb_build_jobs_and_not_write_crash_target.patch +++ b/meta-oe/recipes-kernel/crash/crash/gdb_build_jobs_and_not_write_crash_target.patch @@ -1,3 +1,8 @@ +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. @@ -8,19 +13,26 @@ 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 27a1d47..bcf2d2f 100644 +index cd25c7d..d61c4c5 100644 --- a/Makefile +++ b/Makefile -@@ -232,8 +232,8 @@ gdb_merge: force +@@ -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 --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \ -- else make --no-print-directory rebuild; fi -+ make --no-print-directory CRASH_TARGET=${TARGET} ${GDB_MAKE_JOBS}; ) \ -+ else make --no-print-directory ${GDB_MAKE_JOBS} rebuild; fi +- $(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 + diff --git a/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch b/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch deleted file mode 100644 index 905b4c2cd0..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch +++ /dev/null @@ -1,33 +0,0 @@ -Upstream-Status: Pending - -It fails to build crash for mips with error: - -| mips-wrs-linux-gcc: error: unrecognized command line option '-m32' -| Makefile:291: recipe for target 'make_build_data' failed - -So remove the unrecognized option '-m32' for mips. - -Signed-off-by: Kai Kang <kai.kang@windriver.com> ---- -diff --git a/configure.c b/configure.c -index cf1973b..71e97b3 100644 ---- a/configure.c -+++ b/configure.c -@@ -151,7 +151,7 @@ void add_extra_lib(char *); - #define TARGET_CFLAGS_PPC64_ON_X86_64 "TARGET_CFLAGS=" - #define TARGET_CFLAGS_MIPS "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" - #define TARGET_CFLAGS_MIPS_ON_X86 "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" --#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64" -+#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" - #define TARGET_CFLAGS_SPARC64 "TARGET_CFLAGS=" - - #define GDB_TARGET_DEFAULT "GDB_CONF_FLAGS=" -@@ -162,7 +162,7 @@ void add_extra_lib(char *); - #define GDB_TARGET_ARM64_ON_X86_64 "GDB_CONF_FLAGS=--target=aarch64-elf-linux" /* TBD */ - #define GDB_TARGET_PPC64_ON_X86_64 "GDB_CONF_FLAGS=--target=powerpc64le-unknown-linux-gnu" - #define GDB_TARGET_MIPS_ON_X86 "GDB_CONF_FLAGS=--target=mipsel-elf-linux" --#define GDB_TARGET_MIPS_ON_X86_64 "GDB_CONF_FLAGS=--target=mipsel-elf-linux CFLAGS=-m32" -+#define GDB_TARGET_MIPS_ON_X86_64 "GDB_CONF_FLAGS=--target=mipsel-elf-linux" - - /* - * The original plan was to allow the use of a particular version diff --git a/meta-oe/recipes-kernel/crash/crash/sim-common-sim-arange-fix-extern-inline-handling.patch b/meta-oe/recipes-kernel/crash/crash/sim-common-sim-arange-fix-extern-inline-handling.patch deleted file mode 100644 index 0185b57045..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/sim-common-sim-arange-fix-extern-inline-handling.patch +++ /dev/null @@ -1,79 +0,0 @@ -Upstream-Status: Backport - -https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=92fc615 - -Signed-off-by: Kai Kang <kai.kang@windriver.com> --- -From 92fc6153a6fdf2a027d9780f5945712aafad4a9e Mon Sep 17 00:00:00 2001 -From: Mike Frysinger <vapier@gentoo.org> -Date: Sun, 29 Mar 2015 15:59:01 -0400 -Subject: [PATCH] sim: common: sim-arange: fix extern inline handling - -With newer versions of gcc (5.x), the extern inline we're using with the -sim-arange module no longer works. Since this code really wants the gnu -inline semantics, use that attribute explicitly. - -Reported-by: DJ Delorie <dj@redhat.com> -Reported-by: Joel Sherrill <joel.sherrill@oarcorp.com> ---- - gdb-7.6/sim/common/sim-arange.h | 20 ++++++++++++-------- - gdb-7.6/sim/common/sim-inline.h | 4 +++- - 2 files changed, 15 insertions(+), 9 deletions(-) - -diff --git a/gdb-7.6/sim/common/sim-arange.h b/gdb-7.6/sim/common/sim-arange.h -index 73117f3..de842c9 100644 ---- a/gdb-7.6/sim/common/sim-arange.h -+++ b/gdb-7.6/sim/common/sim-arange.h -@@ -60,22 +60,26 @@ extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/, - address_word /*start*/, - address_word /*end*/); - -+/* TODO: This should get moved into sim-inline.h. */ -+#ifdef HAVE_INLINE -+#ifdef SIM_ARANGE_C -+#define SIM_ARANGE_INLINE INLINE -+#else -+#define SIM_ARANGE_INLINE EXTERN_INLINE -+#endif -+#else -+#define SIM_ARANGE_INLINE EXTERN -+#endif -+ - /* Return non-zero if ADDR is in range AR, traversing the entire tree. - If no range is specified, that is defined to mean "everything". */ --extern INLINE int -+SIM_ARANGE_INLINE int - sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/); - #define ADDR_RANGE_HIT_P(ar, addr) \ - ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr))) - - #ifdef HAVE_INLINE --#ifdef SIM_ARANGE_C --#define SIM_ARANGE_INLINE INLINE --#else --#define SIM_ARANGE_INLINE EXTERN_INLINE --#endif - #include "sim-arange.c" --#else --#define SIM_ARANGE_INLINE - #endif - #define SIM_ARANGE_C_INCLUDED - -diff --git a/gdb-7.6/sim/common/sim-inline.h b/gdb-7.6/sim/common/sim-inline.h -index af75562..8a9c286 100644 ---- a/gdb-7.6/sim/common/sim-inline.h -+++ b/gdb-7.6/sim/common/sim-inline.h -@@ -303,7 +303,9 @@ - /* ??? Temporary, pending decision to always use extern inline and do a vast - cleanup of inline support. */ - #ifndef INLINE2 --#if defined (__GNUC__) -+#if defined (__GNUC_GNU_INLINE__) || defined (__GNUC_STDC_INLINE__) -+#define INLINE2 __inline__ __attribute__ ((__gnu_inline__)) -+#elif defined (__GNUC__) - #define INLINE2 __inline__ - #else - #define INLINE2 /*inline*/ --- -2.6.1 - diff --git a/meta-oe/recipes-kernel/crash/crash/sim-ppc-drop-LIBS-from-psim-dependency.patch b/meta-oe/recipes-kernel/crash/crash/sim-ppc-drop-LIBS-from-psim-dependency.patch deleted file mode 100644 index 77a287f146..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/sim-ppc-drop-LIBS-from-psim-dependency.patch +++ /dev/null @@ -1,37 +0,0 @@ -Upstream-Status: Backport - -https://sourceware.org/git/?p=binutils-gdb.git;h=0d8a6ab - -Signed-off-by: Kai Kang <kai.kang@windriver.com> ---- -From 0d8a6ab7d39d28fb1557e2a62e9e4b336341ab34 Mon Sep 17 00:00:00 2001 -From: Aaro Koskinen <aaro.koskinen@iki.fi> -Date: Mon, 17 Feb 2014 17:12:59 -0500 -Subject: [PATCH] sim: ppc: drop $(LIBS) from psim dependency - -When cross-compiling GDB for PPC, there's a prerequisite "-lz" for psim -that results in a build failure. With such prerequisite, GNU Make will -try to search the library from build machine's /usr/lib which is wrong. -On 64-bit Linux build machines the compilation will fail because of this. - -URL: https://sourceware.org/bugzilla/show_bug.cgi?id=12202 ---- - sim/ppc/Makefile.in | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/gdb-7.6/sim/ppc/Makefile.in b/gdb-7.6/sim/ppc/Makefile.in -index b811f6f..740bdb0 100644 ---- a/gdb-7.6/sim/ppc/Makefile.in -+++ b/gdb-7.6/sim/ppc/Makefile.in -@@ -552,7 +552,7 @@ PACKAGE_SRC = @sim_pk_src@ - PACKAGE_OBJ = @sim_pk_obj@ - - --psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS) $(LIBINTL_DEP) -+psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBINTL_DEP) - $(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS) - - run: psim --- -1.9.4 - diff --git a/meta-oe/recipes-kernel/crash/crash_8.0.4.bb b/meta-oe/recipes-kernel/crash/crash_8.0.4.bb new file mode 100644 index 0000000000..1af90978e0 --- /dev/null +++ b/meta-oe/recipes-kernel/crash/crash_8.0.4.bb @@ -0,0 +1,28 @@ +require crash.inc + + +BBCLASSEXTEND = "native cross" + +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_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}:class-native = "" +RDEPENDS:${PN}:class-cross = "" diff --git a/meta-oe/recipes-kernel/intel-speed-select/intel-speed-select.bb b/meta-oe/recipes-kernel/intel-speed-select/intel-speed-select.bb index 53f6de1068..23ea0d8aae 100644 --- a/meta-oe/recipes-kernel/intel-speed-select/intel-speed-select.bb +++ b/meta-oe/recipes-kernel/intel-speed-select/intel-speed-select.bb @@ -4,17 +4,20 @@ 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 = "GPLv2" +LICENSE = "GPL-2.0-only" inherit kernelsrc COMPATIBLE_HOST = '(x86_64|i.86).*-linux' -COMPATIBLE_HOST_libc-musl = 'null' +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}" diff --git a/meta-oe/recipes-kernel/ipmitool/files/0001-csv-revision-Drop-the-git-revision-info.patch b/meta-oe/recipes-kernel/ipmitool/files/0001-csv-revision-Drop-the-git-revision-info.patch new file mode 100644 index 0000000000..98a820bd9e --- /dev/null +++ b/meta-oe/recipes-kernel/ipmitool/files/0001-csv-revision-Drop-the-git-revision-info.patch @@ -0,0 +1,42 @@ +From 0a1af74ed3fae9a9a08b8b1ab89e88c02427ae06 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <mingli.yu@windriver.com> +Date: Wed, 10 Jan 2024 05:57:00 +0000 +Subject: [PATCH] csv-revision: Drop the git revision info + +The git revison info is added [1] to make the version more descriptive +to produce an incremental revision number like 1.8.18.13 or 1.8.18.14 +and etc and more clear in terms of "what codebase was used" like +`1.8.18.13.gee01aa5`. But it also introduces the below version +inconsistence. + root@qemux86-64:~# ipmitool -V + ipmitool version 1.8.19.19.gab5ce5b + root@qemux86-64:~# rpm -qa | grep ipmitool + ipmitool-1.8.19-r0.core2_64 + +Considering the version we acutally used in oe is a release version, +the git revision info as [1] is meaningness. So drop the git revsion +info to remove the above version inconsitence. + +[1] https://github.com/ipmitool/ipmitool/commit/ba01dc84b4e225c86eac3f562e629662d752040f + +Upstream-Status: Inappropriate [OE-Specific as we use a release version in oe] + +Signed-off-by: Mingli Yu <mingli.yu@windriver.com> +--- + csv-revision | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/csv-revision b/csv-revision +index 289c133..3fa9f1c 100755 +--- a/csv-revision ++++ b/csv-revision +@@ -1,5 +1,6 @@ + #!/bin/sh + ++exit 0 + git describe --first-parent --tags 2>/dev/null | ( + IFS=- read tag rev hash + if [ $? ] && [ -n "$rev" ]; then +-- +2.35.5 + diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-Migrate-to-openssl-1.1.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-Migrate-to-openssl-1.1.patch deleted file mode 100644 index 394aa16adc..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-Migrate-to-openssl-1.1.patch +++ /dev/null @@ -1,152 +0,0 @@ -From c9dcb6afef9c343d070aaff208d11a997a45a105 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 5 Sep 2018 22:19:38 -0700 -Subject: [PATCH] Migrate to openssl 1.1 - -Upstream-Status: Backport [https://sourceforge.net/p/ipmitool/source/ci/1664902525a1c3771b4d8b3ccab7ea1ba6b2bdd1/] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/plugins/lanplus/lanplus_crypt_impl.c | 50 ++++++++++++++---------- - 1 file changed, 29 insertions(+), 21 deletions(-) - -diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c -index d5fac37..9652a5e 100644 ---- a/src/plugins/lanplus/lanplus_crypt_impl.c -+++ b/src/plugins/lanplus/lanplus_crypt_impl.c -@@ -164,11 +164,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, - uint8_t * output, - uint32_t * bytes_written) - { -- EVP_CIPHER_CTX ctx; -- EVP_CIPHER_CTX_init(&ctx); -- EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv); -- EVP_CIPHER_CTX_set_padding(&ctx, 0); -- -+ EVP_CIPHER_CTX *ctx = NULL; - - *bytes_written = 0; - -@@ -182,6 +178,14 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, - printbuf(input, input_length, "encrypting this data"); - } - -+ ctx = EVP_CIPHER_CTX_new(); -+ if (ctx == NULL) { -+ lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed"); -+ return; -+ } -+ EVP_CIPHER_CTX_init(ctx); -+ EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); -+ EVP_CIPHER_CTX_set_padding(ctx, 0); - - /* - * The default implementation adds a whole block of padding if the input -@@ -191,28 +195,28 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, - assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); - - -- if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) -+ if(!EVP_EncryptUpdate(ctx, output, (int *)bytes_written, input, input_length)) - { - /* Error */ - *bytes_written = 0; -- return; - } - else - { - uint32_t tmplen; - -- if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen)) -+ if(!EVP_EncryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen)) - { -+ /* Error */ - *bytes_written = 0; -- return; /* Error */ - } - else - { - /* Success */ - *bytes_written += tmplen; -- EVP_CIPHER_CTX_cleanup(&ctx); - } - } -+ /* performs cleanup and free */ -+ EVP_CIPHER_CTX_free(ctx); - } - - -@@ -239,11 +243,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, - uint8_t * output, - uint32_t * bytes_written) - { -- EVP_CIPHER_CTX ctx; -- EVP_CIPHER_CTX_init(&ctx); -- EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv); -- EVP_CIPHER_CTX_set_padding(&ctx, 0); -- -+ EVP_CIPHER_CTX *ctx = NULL; - - if (verbose >= 5) - { -@@ -252,12 +252,20 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, - printbuf(input, input_length, "decrypting this data"); - } - -- - *bytes_written = 0; - - if (input_length == 0) - return; - -+ ctx = EVP_CIPHER_CTX_new(); -+ if (ctx == NULL) { -+ lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed"); -+ return; -+ } -+ EVP_CIPHER_CTX_init(ctx); -+ EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); -+ EVP_CIPHER_CTX_set_padding(ctx, 0); -+ - /* - * The default implementation adds a whole block of padding if the input - * data is perfectly aligned. We would like to keep that from happening. -@@ -266,33 +274,33 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, - assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); - - -- if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) -+ if (!EVP_DecryptUpdate(ctx, output, (int *)bytes_written, input, input_length)) - { - /* Error */ - lprintf(LOG_DEBUG, "ERROR: decrypt update failed"); - *bytes_written = 0; -- return; - } - else - { - uint32_t tmplen; - -- if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen)) -+ if (!EVP_DecryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen)) - { -+ /* Error */ - char buffer[1000]; - ERR_error_string(ERR_get_error(), buffer); - lprintf(LOG_DEBUG, "the ERR error %s", buffer); - lprintf(LOG_DEBUG, "ERROR: decrypt final failed"); - *bytes_written = 0; -- return; /* Error */ - } - else - { - /* Success */ - *bytes_written += tmplen; -- EVP_CIPHER_CTX_cleanup(&ctx); - } - } -+ /* performs cleanup and free */ -+ EVP_CIPHER_CTX_free(ctx); - - if (verbose >= 5) - { diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-fru-Fix-buffer-overflow-in-ipmi_spd_print_fru.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-fru-Fix-buffer-overflow-in-ipmi_spd_print_fru.patch deleted file mode 100644 index eadfb7ead3..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-fru-Fix-buffer-overflow-in-ipmi_spd_print_fru.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 24aed93efb30a8f557aedc2f03b6ccec758ccbf4 Mon Sep 17 00:00:00 2001 -From: Chrostoper Ertl <chertl@microsoft.com> -Date: Thu, 28 Nov 2019 16:44:18 +0000 -Subject: [PATCH 1/5] fru: Fix buffer overflow in ipmi_spd_print_fru - -Partial fix for CVE-2020-5208, see -https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp - -The `ipmi_spd_print_fru` function has a similar issue as the one fixed -by the previous commit in `read_fru_area_section`. An initial request is -made to get the `fru.size`, which is used as the size for the allocation -of `spd_data`. Inside a loop, further requests are performed to get the -copy sizes which are not checked before being used as the size for a -copy into the buffer. - -Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/840fb1cbb4fb365cb9797300e3374d4faefcdb10] -CVE: CVE-2020-5208 - -Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> ---- - lib/dimm_spd.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/lib/dimm_spd.c b/lib/dimm_spd.c -index 91ae117..4c9c21d 100644 ---- a/lib/dimm_spd.c -+++ b/lib/dimm_spd.c -@@ -1014,7 +1014,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id) - struct ipmi_rq req; - struct fru_info fru; - uint8_t *spd_data, msg_data[4]; -- int len, offset; -+ uint32_t len, offset; - - msg_data[0] = id; - -@@ -1091,6 +1091,13 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id) - } - - len = rsp->data[0]; -+ if(rsp->data_len < 1 -+ || len > rsp->data_len - 1 -+ || len > fru.size - offset) -+ { -+ printf(" Not enough buffer size"); -+ return -1; -+ } - memcpy(&spd_data[offset], rsp->data + 1, len); - offset += len; - } while (offset < fru.size); --- -1.9.1 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-fru-Fix-buffer-overflow-vulnerabilities.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-fru-Fix-buffer-overflow-vulnerabilities.patch deleted file mode 100644 index b65e3ef1a6..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-fru-Fix-buffer-overflow-vulnerabilities.patch +++ /dev/null @@ -1,133 +0,0 @@ -From e824c23316ae50beb7f7488f2055ac65e8b341f2 Mon Sep 17 00:00:00 2001 -From: Chrostoper Ertl <chertl@microsoft.com> -Date: Thu, 28 Nov 2019 16:33:59 +0000 -Subject: [PATCH] fru: Fix buffer overflow vulnerabilities - -Partial fix for CVE-2020-5208, see -https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp - -The `read_fru_area_section` function only performs size validation of -requested read size, and falsely assumes that the IPMI message will not -respond with more than the requested amount of data; it uses the -unvalidated response size to copy into `frubuf`. If the response is -larger than the request, this can result in overflowing the buffer. - -The same issue affects the `read_fru_area` function. - -Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/e824c23316ae50beb7f7488f2055ac65e8b341f2] -CVE: CVE-2020-5208 - -Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> ---- - lib/ipmi_fru.c | 33 +++++++++++++++++++++++++++++++-- - 1 file changed, 31 insertions(+), 2 deletions(-) - -diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c -index c2a139d..2e323ff 100644 ---- a/lib/ipmi_fru.c -+++ b/lib/ipmi_fru.c -@@ -663,7 +663,10 @@ int - read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - uint32_t offset, uint32_t length, uint8_t *frubuf) - { -- uint32_t off = offset, tmp, finish; -+ uint32_t off = offset; -+ uint32_t tmp; -+ uint32_t finish; -+ uint32_t size_left_in_buffer; - struct ipmi_rs * rsp; - struct ipmi_rq req; - uint8_t msg_data[4]; -@@ -676,10 +679,12 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - - finish = offset + length; - if (finish > fru->size) { -+ memset(frubuf + fru->size, 0, length - fru->size); - finish = fru->size; - lprintf(LOG_NOTICE, "Read FRU Area length %d too large, " - "Adjusting to %d", - offset + length, finish - offset); -+ length = finish - offset; - } - - memset(&req, 0, sizeof(req)); -@@ -715,6 +720,7 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - } - } - -+ size_left_in_buffer = length; - do { - tmp = fru->access ? off >> 1 : off; - msg_data[0] = id; -@@ -756,9 +762,18 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - } - - tmp = fru->access ? rsp->data[0] << 1 : rsp->data[0]; -+ if(rsp->data_len < 1 -+ || tmp > rsp->data_len - 1 -+ || tmp > size_left_in_buffer) -+ { -+ printf(" Not enough buffer size"); -+ return -1; -+ } -+ - memcpy(frubuf, rsp->data + 1, tmp); - off += tmp; - frubuf += tmp; -+ size_left_in_buffer -= tmp; - /* sometimes the size returned in the Info command - * is too large. return 0 so higher level function - * still attempts to parse what was returned */ -@@ -791,7 +806,9 @@ read_fru_area_section(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - uint32_t offset, uint32_t length, uint8_t *frubuf) - { - static uint32_t fru_data_rqst_size = 20; -- uint32_t off = offset, tmp, finish; -+ uint32_t off = offset; -+ uint32_t tmp, finish; -+ uint32_t size_left_in_buffer; - struct ipmi_rs * rsp; - struct ipmi_rq req; - uint8_t msg_data[4]; -@@ -804,10 +821,12 @@ read_fru_area_section(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - - finish = offset + length; - if (finish > fru->size) { -+ memset(frubuf + fru->size, 0, length - fru->size); - finish = fru->size; - lprintf(LOG_NOTICE, "Read FRU Area length %d too large, " - "Adjusting to %d", - offset + length, finish - offset); -+ length = finish - offset; - } - - memset(&req, 0, sizeof(req)); -@@ -822,6 +841,8 @@ read_fru_area_section(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - if (fru->access && fru_data_rqst_size > 16) - #endif - fru_data_rqst_size = 16; -+ -+ size_left_in_buffer = length; - do { - tmp = fru->access ? off >> 1 : off; - msg_data[0] = id; -@@ -853,8 +874,16 @@ read_fru_area_section(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, - } - - tmp = fru->access ? rsp->data[0] << 1 : rsp->data[0]; -+ if(rsp->data_len < 1 -+ || tmp > rsp->data_len - 1 -+ || tmp > size_left_in_buffer) -+ { -+ printf(" Not enough buffer size"); -+ return -1; -+ } - memcpy((frubuf + off)-offset, rsp->data + 1, tmp); - off += tmp; -+ size_left_in_buffer -= tmp; - - /* sometimes the size returned in the Info command - * is too large. return 0 so higher level function --- -2.17.1 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-hpmfwupg-move-variable-definition-to-.c-file.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-hpmfwupg-move-variable-definition-to-.c-file.patch deleted file mode 100644 index a765c3ab2f..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0001-hpmfwupg-move-variable-definition-to-.c-file.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3f7bb7218181745ca7762c1b4832cbb1c9e692f5 Mon Sep 17 00:00:00 2001 -From: Vaclav Dolezal <vdolezal@redhat.com> -Date: Thu, 23 Jan 2020 11:26:32 +0100 -Subject: [PATCH] hpmfwupg: move variable definition to .c file - -Upstream-Status: Pending -Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> ---- - include/ipmitool/ipmi_hpmfwupg.h | 2 +- - lib/ipmi_hpmfwupg.c | 2 ++ - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/include/ipmitool/ipmi_hpmfwupg.h b/include/ipmitool/ipmi_hpmfwupg.h -index de65292..07f597b 100644 ---- a/include/ipmitool/ipmi_hpmfwupg.h -+++ b/include/ipmitool/ipmi_hpmfwupg.h -@@ -800,7 +800,7 @@ typedef struct _VERSIONINFO { - char descString[HPMFWUPG_DESC_STRING_LENGTH + 1]; - }VERSIONINFO, *PVERSIONINFO; - --VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX]; -+extern VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX]; - - #define TARGET_VER (0x01) - #define ROLLBACK_VER (0x02) -diff --git a/lib/ipmi_hpmfwupg.c b/lib/ipmi_hpmfwupg.c -index bbcffc0..d7cdcd6 100644 ---- a/lib/ipmi_hpmfwupg.c -+++ b/lib/ipmi_hpmfwupg.c -@@ -58,6 +58,8 @@ ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf); - - extern int verbose; - -+VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX]; -+ - int HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename, - int activate, int, int); - int HpmfwupgValidateImageIntegrity(struct HpmfwupgUpgradeCtx *pFwupgCtx); --- -2.28.0 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0002-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0002-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch deleted file mode 100644 index b8742b1a81..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0002-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 81144cfba131b4ddbfcf9c530274b23bfc7e0ea8 Mon Sep 17 00:00:00 2001 -From: Chrostoper Ertl <chertl@microsoft.com> -Date: Thu, 28 Nov 2019 16:51:49 +0000 -Subject: [PATCH 2/5] session: Fix buffer overflow in ipmi_get_session_info - -Partial fix for CVE-2020-5208, see -https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp - -The `ipmi_get_session_info` function does not properly check the -response `data_len`, which is used as a copy size, allowing stack buffer -overflow. - -Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/41d7026946fafbd4d1ec0bcaca3ea30a6e8eed22] -CVE: CVE-2020-5208 - -Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> ---- - lib/ipmi_session.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/lib/ipmi_session.c b/lib/ipmi_session.c -index 4855bc4..71bef4c 100644 ---- a/lib/ipmi_session.c -+++ b/lib/ipmi_session.c -@@ -319,8 +319,10 @@ ipmi_get_session_info(struct ipmi_intf * intf, - } - else - { -- memcpy(&session_info, rsp->data, rsp->data_len); -- print_session_info(&session_info, rsp->data_len); -+ memcpy(&session_info, rsp->data, -+ __min(rsp->data_len, sizeof(session_info))); -+ print_session_info(&session_info, -+ __min(rsp->data_len, sizeof(session_info))); - } - break; - -@@ -351,8 +353,10 @@ ipmi_get_session_info(struct ipmi_intf * intf, - break; - } - -- memcpy(&session_info, rsp->data, rsp->data_len); -- print_session_info(&session_info, rsp->data_len); -+ memcpy(&session_info, rsp->data, -+ __min(rsp->data_len, sizeof(session_info))); -+ print_session_info(&session_info, -+ __min(rsp->data_len, sizeof(session_info))); - - } while (i <= session_info.session_slot_count); - break; --- -1.9.1 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-channel-Fix-buffer-overflow.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-channel-Fix-buffer-overflow.patch deleted file mode 100644 index deebd356a7..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0003-channel-Fix-buffer-overflow.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 5057761e30e3a7682edab60f98f631616392ddc6 Mon Sep 17 00:00:00 2001 -From: Chrostoper Ertl <chertl@microsoft.com> -Date: Thu, 28 Nov 2019 16:56:38 +0000 -Subject: [PATCH 3/3] channel: Fix buffer overflow -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Partial fix for CVE-2020-5208, see -https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp - -The `ipmi_get_channel_cipher_suites` function does not properly check -the final response’s `data_len`, which can lead to stack buffer overflow -on the final copy. - -Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/9452be87181a6e83cfcc768b3ed8321763db50e4] -CVE: CVE-2020-5208 - -[Make some changes to apply it] -Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> ---- - include/ipmitool/ipmi_channel.h | 2 ++ - lib/ipmi_channel.c | 10 ++++++++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/include/ipmitool/ipmi_channel.h b/include/ipmitool/ipmi_channel.h -index b138c26..d7cce5e 100644 ---- a/include/ipmitool/ipmi_channel.h -+++ b/include/ipmitool/ipmi_channel.h -@@ -77,6 +77,8 @@ struct channel_access_t { - uint8_t user_level_auth; - }; - -+#define MAX_CIPHER_SUITE_DATA_LEN 0x10 -+ - /* - * The Get Authentication Capabilities response structure - * From table 22-15 of the IPMI v2.0 spec -diff --git a/lib/ipmi_channel.c b/lib/ipmi_channel.c -index fab2e54..76ecdcd 100644 ---- a/lib/ipmi_channel.c -+++ b/lib/ipmi_channel.c -@@ -378,7 +378,10 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type, - lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites"); - return -1; - } -- if (rsp->ccode > 0) { -+ if (rsp->ccode -+ || rsp->data_len < 1 -+ || rsp->data_len > sizeof(uint8_t) + MAX_CIPHER_SUITE_DATA_LEN) -+ { - lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s", - val2str(rsp->ccode, completion_code_vals)); - return -1; -@@ -413,7 +416,10 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type, - lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites"); - return -1; - } -- if (rsp->ccode > 0) { -+ if (rsp->ccode -+ || rsp->data_len < 1 -+ || rsp->data_len > sizeof(uint8_t) + MAX_CIPHER_SUITE_DATA_LEN) -+ { - lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s", - val2str(rsp->ccode, completion_code_vals)); - return -1; --- -2.18.1 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0004-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0004-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch deleted file mode 100644 index b5ce9e92ec..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0004-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch +++ /dev/null @@ -1,94 +0,0 @@ -From e6aa6076f65e71544bd6450d20d943d7baaccb9f Mon Sep 17 00:00:00 2001 -From: Chrostoper Ertl <chertl@microsoft.com> -Date: Thu, 28 Nov 2019 17:06:39 +0000 -Subject: [PATCH 4/5] lanp: Fix buffer overflows in get_lan_param_select -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Partial fix for CVE-2020-5208, see -https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp - -The `get_lan_param_select` function is missing a validation check on the -response’s `data_len`, which it then returns to caller functions, where -stack buffer overflow can occur. - -Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/d45572d71e70840e0d4c50bf48218492b79c1a10] -CVE: CVE-2020-5208 - -[Make some changes to apply it] -Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> ---- - lib/ipmi_lanp.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/lib/ipmi_lanp.c b/lib/ipmi_lanp.c -index 060e753..dee21ee 100644 ---- a/lib/ipmi_lanp.c -+++ b/lib/ipmi_lanp.c -@@ -1917,7 +1917,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - /* set new ipaddr */ - memcpy(data+3, temp, 4); - printf("Setting LAN Alert %d IP Address to %d.%d.%d.%d\n", alert, -@@ -1932,7 +1932,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - /* set new macaddr */ - memcpy(data+7, temp, 6); - printf("Setting LAN Alert %d MAC Address to " -@@ -1947,7 +1947,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - - if (strncasecmp(argv[1], "def", 3) == 0 || - strncasecmp(argv[1], "default", 7) == 0) { -@@ -1973,7 +1973,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - - if (strncasecmp(argv[1], "on", 2) == 0 || - strncasecmp(argv[1], "yes", 3) == 0) { -@@ -1998,7 +1998,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - - if (strncasecmp(argv[1], "pet", 3) == 0) { - printf("Setting LAN Alert %d destination to PET Trap\n", alert); -@@ -2026,7 +2026,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - - if (str2uchar(argv[1], &data[2]) != 0) { - lprintf(LOG_ERR, "Invalid time: %s", argv[1]); -@@ -2042,7 +2042,7 @@ ipmi_lan_alert_set(struct ipmi_intf * intf, uint8_t chan, uint8_t alert, - if (p == NULL) { - return (-1); - } -- memcpy(data, p->data, p->data_len); -+ memcpy(data, p->data, __min(p->data_len, sizeof(data))); - - if (str2uchar(argv[1], &data[3]) != 0) { - lprintf(LOG_ERR, "Invalid retry: %s", argv[1]); --- -1.9.1 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool/0005-fru-sdr-Fix-id_string-buffer-overflows.patch b/meta-oe/recipes-kernel/ipmitool/ipmitool/0005-fru-sdr-Fix-id_string-buffer-overflows.patch deleted file mode 100644 index cf8b9254c8..0000000000 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool/0005-fru-sdr-Fix-id_string-buffer-overflows.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 26e64ca78ae844c5ceedde89531e2924d7d4594c Mon Sep 17 00:00:00 2001 -From: Chrostoper Ertl <chertl@microsoft.com> -Date: Thu, 28 Nov 2019 17:13:45 +0000 -Subject: [PATCH 5/5] fru, sdr: Fix id_string buffer overflows - -Final part of the fixes for CVE-2020-5208, see -https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp - -9 variants of stack buffer overflow when parsing `id_string` field of -SDR records returned from `CMD_GET_SDR` command. - -SDR record structs have an `id_code` field, and an `id_string` `char` -array. - -The length of `id_string` is calculated as `(id_code & 0x1f) + 1`, -which can be larger than expected 16 characters (if `id_code = 0xff`, -then length will be `(0xff & 0x1f) + 1 = 32`). - -In numerous places, this can cause stack buffer overflow when copying -into fixed buffer of size `17` bytes from this calculated length. - -Upstream-Status: Backport[https://github.com/ipmitool/ipmitool/commit/7ccea283dd62a05a320c1921e3d8d71a87772637] -CVE: CVE-2020-5208 - -Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> ---- - lib/ipmi_fru.c | 2 +- - lib/ipmi_sdr.c | 40 ++++++++++++++++++++++++---------------- - 2 files changed, 25 insertions(+), 17 deletions(-) - -diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c -index b71ea23..1decea2 100644 ---- a/lib/ipmi_fru.c -+++ b/lib/ipmi_fru.c -@@ -3038,7 +3038,7 @@ ipmi_fru_print(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru) - return 0; - - memset(desc, 0, sizeof(desc)); -- memcpy(desc, fru->id_string, fru->id_code & 0x01f); -+ memcpy(desc, fru->id_string, __min(fru->id_code & 0x01f, sizeof(desc))); - desc[fru->id_code & 0x01f] = 0; - printf("FRU Device Description : %s (ID %d)\n", desc, fru->device_id); - -diff --git a/lib/ipmi_sdr.c b/lib/ipmi_sdr.c -index fa7b082..175a86f 100644 ---- a/lib/ipmi_sdr.c -+++ b/lib/ipmi_sdr.c -@@ -2113,7 +2113,7 @@ ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf, - return -1; - - memset(desc, 0, sizeof (desc)); -- snprintf(desc, (sensor->id_code & 0x1f) + 1, "%s", sensor->id_string); -+ snprintf(desc, sizeof(desc), "%.*s", (sensor->id_code & 0x1f) + 1, sensor->id_string); - - if (verbose) { - printf("Sensor ID : %s (0x%x)\n", -@@ -2164,7 +2164,7 @@ ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf *intf, - return -1; - - memset(desc, 0, sizeof (desc)); -- snprintf(desc, (mc->id_code & 0x1f) + 1, "%s", mc->id_string); -+ snprintf(desc, sizeof(desc), "%.*s", (mc->id_code & 0x1f) + 1, mc->id_string); - - if (verbose == 0) { - if (csv_output) -@@ -2257,7 +2257,7 @@ ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf *intf, - char desc[17]; - - memset(desc, 0, sizeof (desc)); -- snprintf(desc, (dev->id_code & 0x1f) + 1, "%s", dev->id_string); -+ snprintf(desc, sizeof(desc), "%.*s", (dev->id_code & 0x1f) + 1, dev->id_string); - - if (!verbose) { - if (csv_output) -@@ -2314,7 +2314,7 @@ ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf *intf, - char desc[17]; - - memset(desc, 0, sizeof (desc)); -- snprintf(desc, (fru->id_code & 0x1f) + 1, "%s", fru->id_string); -+ snprintf(desc, sizeof(desc), "%.*s", (fru->id_code & 0x1f) + 1, fru->id_string); - - if (!verbose) { - if (csv_output) -@@ -2518,35 +2518,43 @@ ipmi_sdr_print_name_from_rawentry(struct ipmi_intf *intf,uint16_t id, - - int rc =0; - char desc[17]; -+ const char *id_string; -+ uint8_t id_code; - memset(desc, ' ', sizeof (desc)); - - switch ( type) { - case SDR_RECORD_TYPE_FULL_SENSOR: - record.full = (struct sdr_record_full_sensor *) raw; -- snprintf(desc, (record.full->id_code & 0x1f) +1, "%s", -- (const char *)record.full->id_string); -+ id_code = record.full->id_code; -+ id_string = record.full->id_string; - break; -+ - case SDR_RECORD_TYPE_COMPACT_SENSOR: - record.compact = (struct sdr_record_compact_sensor *) raw ; -- snprintf(desc, (record.compact->id_code & 0x1f) +1, "%s", -- (const char *)record.compact->id_string); -+ id_code = record.compact->id_code; -+ id_string = record.compact->id_string; - break; -+ - case SDR_RECORD_TYPE_EVENTONLY_SENSOR: - record.eventonly = (struct sdr_record_eventonly_sensor *) raw ; -- snprintf(desc, (record.eventonly->id_code & 0x1f) +1, "%s", -- (const char *)record.eventonly->id_string); -- break; -+ id_code = record.eventonly->id_code; -+ id_string = record.eventonly->id_string; -+ break; -+ - case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR: - record.mcloc = (struct sdr_record_mc_locator *) raw ; -- snprintf(desc, (record.mcloc->id_code & 0x1f) +1, "%s", -- (const char *)record.mcloc->id_string); -+ id_code = record.mcloc->id_code; -+ id_string = record.mcloc->id_string; - break; -+ - default: - rc = -1; -- break; -- } -+ } -+ if (!rc) { -+ snprintf(desc, sizeof(desc), "%.*s", (id_code & 0x1f) + 1, id_string); -+ } - -- lprintf(LOG_INFO, "ID: 0x%04x , NAME: %-16s", id, desc); -+ lprintf(LOG_INFO, "ID: 0x%04x , NAME: %-16s", id, desc); - return rc; - } - --- -1.9.1 - diff --git a/meta-oe/recipes-kernel/ipmitool/ipmitool_1.8.18.bb b/meta-oe/recipes-kernel/ipmitool/ipmitool_1.8.19.bb index e3c74a5162..0f1c8846b4 100644 --- a/meta-oe/recipes-kernel/ipmitool/ipmitool_1.8.18.bb +++ b/meta-oe/recipes-kernel/ipmitool/ipmitool_1.8.19.bb @@ -14,32 +14,46 @@ Log (SEL), printing Field Replaceable Unit (FRU) information, reading and \ setting LAN configuration, and chassis power control. \ " -HOMEPAGE = "http://ipmitool.sourceforge.net/" +HOMEPAGE = "http://codeberg.org/IPMITool/ipmitool" SECTION = "kernel/userland" LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://COPYING;md5=9aa91e13d644326bf281924212862184" DEPENDS = "openssl readline ncurses" - -SRC_URI = "${SOURCEFORGE_MIRROR}/ipmitool/ipmitool-${PV}.tar.bz2 \ - file://0001-Migrate-to-openssl-1.1.patch \ - file://0001-fru-Fix-buffer-overflow-vulnerabilities.patch \ - file://0001-fru-Fix-buffer-overflow-in-ipmi_spd_print_fru.patch \ - file://0002-session-Fix-buffer-overflow-in-ipmi_get_session_info.patch \ - file://0003-channel-Fix-buffer-overflow.patch \ - file://0004-lanp-Fix-buffer-overflows-in-get_lan_param_select.patch \ - file://0005-fru-sdr-Fix-id_string-buffer-overflows.patch \ - file://0001-hpmfwupg-move-variable-definition-to-.c-file.patch \ +SRCREV = "ab5ce5baff097ebb6e2a17a171858be213ee68d3" +SRC_URI = "git://codeberg.org/ipmitool/ipmitool;protocol=https;branch=master \ + ${IANA_ENTERPRISE_NUMBERS} \ + file://0001-csv-revision-Drop-the-git-revision-info.patch \ " -SRC_URI[md5sum] = "bab7ea104c7b85529c3ef65c54427aa3" -SRC_URI[sha256sum] = "0c1ba3b1555edefb7c32ae8cd6a3e04322056bc087918f07189eeedfc8b81e01" +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 +inherit autotools pkgconfig + +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. +# --disable-registry-download prevents the IANA numbers from being fetched +# at build time, as it is not repeatable. # -EXTRA_OECONF = "--disable-dependency-tracking --enable-file-security --disable-intf-free" +EXTRA_OECONF = "--disable-dependency-tracking --enable-file-security --disable-intf-free \ + --disable-registry-download \ + " + diff --git a/meta-oe/recipes-kernel/ipmiutil/ipmiutil/0001-Prevent-access-times-from-changing-resulting-gzip-md.patch b/meta-oe/recipes-kernel/ipmiutil/ipmiutil/0001-Prevent-access-times-from-changing-resulting-gzip-md.patch deleted file mode 100644 index 78c05ef32c..0000000000 --- a/meta-oe/recipes-kernel/ipmiutil/ipmiutil/0001-Prevent-access-times-from-changing-resulting-gzip-md.patch +++ /dev/null @@ -1,25 +0,0 @@ -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 - diff --git a/meta-oe/recipes-kernel/ipmiutil/ipmiutil/0001-ihpm-Include-stdlib.h-for-malloc-free-atoi-functions.patch b/meta-oe/recipes-kernel/ipmiutil/ipmiutil/0001-ihpm-Include-stdlib.h-for-malloc-free-atoi-functions.patch new file mode 100644 index 0000000000..1ed6472f6d --- /dev/null +++ b/meta-oe/recipes-kernel/ipmiutil/ipmiutil/0001-ihpm-Include-stdlib.h-for-malloc-free-atoi-functions.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/ipmiutil/ipmiutil/fix_systemd_path.patch b/meta-oe/recipes-kernel/ipmiutil/ipmiutil/fix_systemd_path.patch index 33116b3c06..2862793b05 100644 --- a/meta-oe/recipes-kernel/ipmiutil/ipmiutil/fix_systemd_path.patch +++ b/meta-oe/recipes-kernel/ipmiutil/ipmiutil/fix_systemd_path.patch @@ -2,15 +2,13 @@ allow systemd path to be defined by configure option. The configure probes the host for systemd path information. -Upstream Status: Inappropriate [Embedded] +Upstream-Status: Inappropriate [Embedded] -Signed-off-By: Armin Kuster <akuster@mvista.com> +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="" +--- a/configure.ac ++++ b/configure.ac +@@ -151,7 +151,6 @@ CROSS_LFLAGS="" CROSS_CFLAGS="" LIBSENSORS="" SAM2OBJ="isensor2.o ievents2.o" @@ -18,7 +16,7 @@ Index: ipmiutil-3.0.5/configure.ac AC_ARG_ENABLE([useflags], [ --enable-useflags include environment CFLAGS and LDFLAGS.], -@@ -200,29 +199,42 @@ AC_ARG_ENABLE([gpl], +@@ -211,29 +210,42 @@ AC_ARG_ENABLE([gpl], dnl Does this Linux have systemd enabled? Otherwise use sysv init. AC_ARG_ENABLE([systemd], @@ -83,7 +81,7 @@ Index: ipmiutil-3.0.5/configure.ac fi dnl start main logic -@@ -528,7 +540,7 @@ AC_SUBST(INS_LIB) +@@ -563,7 +575,7 @@ AC_SUBST(INS_LIB) AC_SUBST(SUBDIR_S) AC_SUBST(CROSS_CFLAGS) AC_SUBST(CROSS_LFLAGS) @@ -92,10 +90,8 @@ Index: ipmiutil-3.0.5/configure.ac 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 +--- a/scripts/Makefile.am ++++ b/scripts/Makefile.am @@ -17,7 +17,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily sbinto = ${DESTDIR}${sbindir} varto = ${DESTDIR}/var/lib/ipmiutil @@ -106,7 +102,7 @@ Index: ipmiutil-3.0.5/scripts/Makefile.am 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: +@@ -47,10 +48,13 @@ install: ${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port ${INSTALL_SCRIPT_SH} ipmi_info ${sysvinit}/ipmi_info ${INSTALL_SCRIPT_SH} checksel ${datato} @@ -114,7 +110,6 @@ Index: ipmiutil-3.0.5/scripts/Makefile.am - ${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}; \ @@ -122,6 +117,6 @@ Index: ipmiutil-3.0.5/scripts/Makefile.am + ${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.env.template ${datato} + ${INSTALL_SCRIPT_SH} ipmiutil.env.template ${datato}/ipmiutil.env ${INSTALL_SCRIPT_SH} ipmiutil.pre ${datato} - ${INSTALL_SCRIPT_SH} ipmiutil.setup ${datato} diff --git a/meta-oe/recipes-kernel/ipmiutil/ipmiutil_3.1.5.bb b/meta-oe/recipes-kernel/ipmiutil/ipmiutil_3.1.9.bb index d0f3688a25..c85bfc13af 100644 --- a/meta-oe/recipes-kernel/ipmiutil/ipmiutil_3.1.5.bb +++ b/meta-oe/recipes-kernel/ipmiutil/ipmiutil_3.1.9.bb @@ -21,10 +21,9 @@ 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" +SRC_URI[sha256sum] = "5ae99bdd1296a8e25cea839784ec39ebca57b0e3701b2d440b8e02e22dc4bc95" inherit autotools-brokensep pkgconfig systemd @@ -44,4 +43,5 @@ PACKAGECONFIG[standalone] = "--enable-standalone, --enable-standalone=no" CFLAGS += "-I${STAGING_INCDIR}" LDFLAGS += "-L${STAGING_LIBDIR}" +EXTRA_OECONF += "--enable-useflags" COMPATIBLE_HOST = '(x86_64|i.86).*-linux' diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb index 4caf217c24..01f185adba 100644 --- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb @@ -1,13 +1,13 @@ SUMMARY = "Kernel selftest for Linux" DESCRIPTION = "Kernel selftest for Linux" -LICENSE = "GPLv2" +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 = "\ +SRC_URI:append:libc-musl = "\ file://userfaultfd.patch \ " SRC_URI += "file://run-ptest \ @@ -18,44 +18,55 @@ SRC_URI += "file://run-ptest \ # 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 vm" -PACKAGECONFIG_remove_x86 = "bpf" -PACKAGECONFIG_remove_arm = "bpf vm" +PACKAGECONFIG ??= "firmware" +# bpf needs working clang compiler anyway +PACKAGECONFIG:append:toolchain-clang:x86-64 = " bpf" +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" +PACKAGECONFIG:remove:qemumips = "bpf vm" # riscv does not support libhugetlbfs yet -PACKAGECONFIG_remove_riscv64 = "vm" -PACKAGECONFIG_remove_riscv32 = "vm" +PACKAGECONFIG:remove:riscv64 = "bpf vm" +PACKAGECONFIG:remove:riscv32 = "bpf vm" -PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native," +PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," PACKAGECONFIG[firmware] = ",,libcap, bash" PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" do_patch[depends] += "virtual/kernel:do_shared_workdir" +do_compile[depends] += "virtual/kernel:do_install" -inherit linux-kernel-base kernel-arch ptest +inherit linux-kernel-base module-base kernel-arch ptest siteinfo S = "${WORKDIR}/${BP}" +DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" + TEST_LIST = "\ ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \ rtc \ + ptp \ + timers \ " - EXTRA_OEMAKE = '\ CROSS_COMPILE=${TARGET_PREFIX} \ ARCH=${ARCH} \ CC="${CC}" \ - CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS}" \ AR="${AR}" \ LD="${LD}" \ + CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \ DESTDIR="${D}" \ - MACHINE="${ARCH}" \ + V=1 \ ' +EXTRA_OEMAKE:append:toolchain-clang = "\ + LLVM=1 CONFIG_CC_IS_GCC= CONFIG_CC_IS_CLANG=y CONFIG_CC_IMPLICIT_FALLTHROUGH= \ + HOSTCC="clang -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ ${BUILD_CFLAGS} ${BUILD_LDFLAGS} -Wno-error=unused-command-line-argument" \ + HOSTLD="clang ${BUILD_LDFLAGS} -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++" \ +" KERNEL_SELFTEST_SRC ?= "Makefile \ include \ @@ -66,7 +77,6 @@ KERNEL_SELFTEST_SRC ?= "Makefile \ 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 @@ -74,7 +84,18 @@ do_compile() { either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency" fi fi - + mkdir -p ${S}/include/config ${S}/bits + install -Dm 0644 ${STAGING_KERNEL_BUILDDIR}/.config ${S}/include/config/auto.conf + if [ "${SITEINFO_BITS}" != "32" ]; then + for f in long-double endianness floatn struct_rwlock; do + cp ${RECIPE_SYSROOT}${includedir}/bits/$f-64.h ${S}/bits/$f-32.h + done + fi + oe_runmake -C ${S} headers + sed -i -e 's|^all: docs|all:|' ${S}/tools/testing/selftests/bpf/Makefile + sed -i -e '/mrecord-mcount/d' ${S}/Makefile + sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile + sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.* for i in ${TEST_LIST} do oe_runmake -C ${S}/tools/testing/selftests/${i} @@ -85,7 +106,13 @@ 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 @@ -125,16 +152,15 @@ remove_unrelated() { PACKAGE_ARCH = "${MACHINE_ARCH}" INHIBIT_PACKAGE_DEBUG_SPLIT="1" -FILES_${PN} += "/usr/kernel-selftest" +FILES:${PN} += "/usr/kernel-selftest" -RDEPENDS_${PN} += "python3" -# tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty -INSANE_SKIP_${PN} += "ldflags" +RDEPENDS:${PN} += "python3 perl perl-module-io-handle" + +INSANE_SKIP:${PN} += "libdir" SECURITY_CFLAGS = "" -COMPATIBLE_HOST_libc-musl = 'null' +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" - diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest index d40b9576d8..0903d097e1 100755 --- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest +++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest @@ -1,11 +1,7 @@ #!/bin/sh -export PATH=$PATH:/usr/kernel-selftest/bpf - -# test_align -test_align | grep "12 pass" &> /dev/null +/usr/kernel-selftest/run_kselftest.sh -s if [ $? == 0 ]; then - echo "[PASS]: test_align" + echo "PASS: kernel-selftest" else - echo "[FAIL]: test_align" + echo "[FAIL]: kernel-selftest" fi - diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/userfaultfd.patch b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/userfaultfd.patch index bed20510e8..d34c54754e 100644 --- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/userfaultfd.patch +++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/userfaultfd.patch @@ -5,6 +5,8 @@ Subject: [PATCH] vm: add some funtions to support musl libc Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> --- +Upstream-Status: Pending + tools/testing/selftests/vm/userfaultfd.c | 298 +++++++++++++++++++++++++++++++ 1 file changed, 298 insertions(+) diff --git a/meta-oe/recipes-kernel/kpatch/kpatch.inc b/meta-oe/recipes-kernel/kpatch/kpatch.inc index 1f70f72054..4d187200ec 100644 --- a/meta-oe/recipes-kernel/kpatch/kpatch.inc +++ b/meta-oe/recipes-kernel/kpatch/kpatch.inc @@ -1,9 +1,9 @@ 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 = "GPLv2 & LGPLv2" +LICENSE = "GPL-2.0-only & LGPL-2.0-only" DEPENDS = "elfutils bash" -SRC_URI = "git://github.com/dynup/kpatch.git;protocol=https \ +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 \ " @@ -32,22 +32,22 @@ PACKAGES =+ "kpatch-build" PROVIDES += "kpatch-build" COMPATIBLE_HOST = "(x86_64).*-linux" -COMPATIBLE_HOST_libc-musl = "null" +COMPATIBLE_HOST:libc-musl = "null" -RDEPENDS_${PN} = "bash binutils" -RDEPENDS_kpatch-build = "bash glibc-utils" +RDEPENDS:${PN} = "bash binutils" +RDEPENDS:kpatch-build = "bash glibc-utils" -FILES_${PN} = " \ +FILES:${PN} = " \ ${sbindir}/kpatch \ ${systemd_system_unitdir}/kpatch.service \ ${mandir}/man1/kpatch.1.gz \ ${sysconfdir}/init/kpatch.conf \ " -FILES_kpatch-build = " \ +FILES:kpatch-build = " \ ${bindir}/kpatch-build \ ${libexecdir}/* \ ${datadir}/kpatch \ ${mandir}/man1/kpatch-build.1.gz \ " -SYSTEMD_SERVICE_${PN} = "kpatch.service" +SYSTEMD_SERVICE:${PN} = "kpatch.service" diff --git a/meta-oe/recipes-kernel/libbpf/libbpf/0001-install-don-t-preserve-file-owner.patch b/meta-oe/recipes-kernel/libbpf/libbpf/0001-install-don-t-preserve-file-owner.patch deleted file mode 100644 index 9423141962..0000000000 --- a/meta-oe/recipes-kernel/libbpf/libbpf/0001-install-don-t-preserve-file-owner.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7df10d91db6f533cc0f6c09f4ae8ad92918c6160 Mon Sep 17 00:00:00 2001 -From: Matteo Croce <mcroce@microsoft.com> -Date: Tue, 26 Jan 2021 12:41:47 +0100 -Subject: [PATCH] install: don't preserve file owner - -'cp -p' preserve file ownership, this may leave files owned by the -current in user in /lib . - -Upstream-status: Submitted (0.4 release) [https://github.com/libbpf/libbpf/commit/767d82caab7e54238f2fc6f40ab1e4af285f2abe] - -Signed-off-by: Matteo Croce <mcroce@microsoft.com> ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index da33613..ab66edc 100644 ---- a/Makefile -+++ b/Makefile -@@ -130,7 +130,7 @@ define do_s_install - $(Q)if [ ! -d '$(DESTDIR)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR)$2'; \ - fi; -- $(Q)cp -fpR $1 '$(DESTDIR)$2' -+ $(Q)cp -fR $1 '$(DESTDIR)$2' - endef - - install: all install_headers install_pkgconfig --- -2.29.2 - diff --git a/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb b/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb deleted file mode 100644 index 57e8376b5e..0000000000 --- a/meta-oe/recipes-kernel/libbpf/libbpf_0.3.bb +++ /dev/null @@ -1,46 +0,0 @@ -SUMMARY = "Library for BPF handling" -DESCRIPTION = "Library for BPF handling" -HOMEPAGE = "https://github.com/libbpf/libbpf" -SECTION = "libs" -LICENSE = "LGPLv2.1+" - -# There is a typo in the filename, LPGL should really be LGPL. -# Keep this until the correct name is set upstream. -LIC_FILES_CHKSUM = "file://../LICENSE.LPGL-2.1;md5=b370887980db5dd40659b50909238dbd" - -DEPENDS = "zlib elfutils" - -do_compile[depends] += "virtual/kernel:do_shared_workdir" - -SRC_URI = "git://github.com/libbpf/libbpf.git;protocol=https" -SRCREV = "051a4009f94d5633a8f734ca4235f0a78ee90469" - -# Backported from version 0.4 -SRC_URI += "file://0001-install-don-t-preserve-file-owner.patch" - -PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_HOST = "(x86_64.*|i.86.*|aarch64).*-linux" - -S = "${WORKDIR}/git/src" - -EXTRA_OEMAKE += "DESTDIR=${D} LIBDIR=${libdir}" - -inherit pkgconfig - -do_compile() { - if grep -q "CONFIG_BPF_SYSCALL=y" ${STAGING_KERNEL_BUILDDIR}/.config - then - oe_runmake - else - bbnote "BFP syscall is not enabled" - fi -} - -do_install() { - if grep -q "CONFIG_BPF_SYSCALL=y" ${STAGING_KERNEL_BUILDDIR}/.config - then - oe_runmake install - else - bbnote "no files to install" - fi -} diff --git a/meta-oe/recipes-kernel/libbpf/libbpf_1.4.0.bb b/meta-oe/recipes-kernel/libbpf/libbpf_1.4.0.bb new file mode 100644 index 0000000000..f2ec48f390 --- /dev/null +++ b/meta-oe/recipes-kernel/libbpf/libbpf_1.4.0.bb @@ -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 = "20ea95b4505c477af3b6ff6ce9d19cee868ddc5d" + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_HOST = "(x86_64|i.86|arm|aarch64|riscv64|powerpc|powerpc64|mips64).*-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" diff --git a/meta-oe/recipes-kernel/libpfm/libpfm4/0002-perf_examples-Remove-unused-sum-variable.patch b/meta-oe/recipes-kernel/libpfm/libpfm4/0002-perf_examples-Remove-unused-sum-variable.patch new file mode 100644 index 0000000000..e85ca96fc3 --- /dev/null +++ b/meta-oe/recipes-kernel/libpfm/libpfm4/0002-perf_examples-Remove-unused-sum-variable.patch @@ -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]++; + diff --git a/meta-oe/recipes-kernel/libpfm/libpfm4_4.10.1.bb b/meta-oe/recipes-kernel/libpfm/libpfm4_4.13.0.bb index ff56d48043..be0659ad2a 100644 --- a/meta-oe/recipes-kernel/libpfm/libpfm4_4.10.1.bb +++ b/meta-oe/recipes-kernel/libpfm/libpfm4_4.13.0.bb @@ -10,20 +10,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0de488f3bd4424e308e2e399cb99c788" SECTION = "devel" -COMPATIBLE_HOST = "powerpc64" +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 \ - " -SRC_URI[md5sum] = "d8f66cb9bfa7e1434434e0de6409db5b" -SRC_URI[sha256sum] = "c61c575378b5c17ccfc5806761e4038828610de76e2e34fac9f7fa73ba844b49" + 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\"" -EXTRA_OEMAKE_append_powerpc = " ARCH=\"powerpc\"" -EXTRA_OEMAKE_append_powerpc64 = " ARCH=\"powerpc\" BITMODE=\"64\"" -EXTRA_OEMAKE_append_powerpc64le = " ARCH=\"powerpc\" BITMODE=\"64\"" +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}" diff --git a/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-makefile-Do-not-preserve-ownership-in-cp-command.patch b/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-makefile-Do-not-preserve-ownership-in-cp-command.patch new file mode 100644 index 0000000000..7ae0856f85 --- /dev/null +++ b/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-makefile-Do-not-preserve-ownership-in-cp-command.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-tracefs-perf-Add-missing-headers-for-syscall-and-SYS.patch b/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-tracefs-perf-Add-missing-headers-for-syscall-and-SYS.patch new file mode 100644 index 0000000000..a24dd1315b --- /dev/null +++ b/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-tracefs-perf-Add-missing-headers-for-syscall-and-SYS.patch @@ -0,0 +1,31 @@ +From f539d96ef4a34ad23d33c552d1770ab429b0220e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 14 Jun 2023 00:24:36 -0700 +Subject: [PATCH] tracefs-perf: Add missing headers for syscall() and SYS_* + defines + +These headers are needed to provide prototype definitions for functions +e.g. close(), syscall(), getpagesize(), getpid() + +The issue is observed with clang-16+ compiler on musl systems + +Upstream-Status: Submitted [https://lore.kernel.org/linux-trace-devel/20230614072759.316154-1-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/tracefs-perf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/tracefs-perf.c b/src/tracefs-perf.c +index 96d12cd..62c1508 100644 +--- a/src/tracefs-perf.c ++++ b/src/tracefs-perf.c +@@ -1,4 +1,5 @@ +-#include <asm/unistd.h> ++#include <unistd.h> ++#include <sys/syscall.h> + #include <sys/mman.h> + #include <signal.h> + #include <linux/perf_event.h> +-- +2.41.0 + diff --git a/meta-oe/recipes-kernel/libtracefs/libtracefs_1.7.0.bb b/meta-oe/recipes-kernel/libtracefs/libtracefs_1.7.0.bb new file mode 100644 index 0000000000..9a408ba13c --- /dev/null +++ b/meta-oe/recipes-kernel/libtracefs/libtracefs_1.7.0.bb @@ -0,0 +1,23 @@ +# 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 = "aebab37379d0fbadc702d64aca0fe5cf18676404" +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 \ + file://0001-tracefs-perf-Add-missing-headers-for-syscall-and-SYS.patch \ + " +S = "${WORKDIR}/git" + +inherit pkgconfig + +do_install() { + oe_runmake install DESTDIR=${D} pkgconfig_dir=${libdir}/pkgconfig +} diff --git a/meta-oe/recipes-kernel/linux/linux.inc b/meta-oe/recipes-kernel/linux/linux.inc index 9f14370cd8..b4b0661225 100644 --- a/meta-oe/recipes-kernel/linux/linux.inc +++ b/meta-oe/recipes-kernel/linux/linux.inc @@ -1,6 +1,6 @@ DESCRIPTION = "Linux Kernel" SECTION = "kernel" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" INC_PR = "r0" @@ -34,7 +34,7 @@ kernel_conf_variable() { fi } -do_configure_prepend() { +do_configure:prepend() { echo "" > ${B}/.config CONF_SED_SCRIPT="" @@ -117,15 +117,15 @@ do_configure_prepend() { yes '' | oe_runmake -C ${S} O=${B} oldconfig } -do_configure_append() { +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() { +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*" +FILES:kernel-headers = "${exec_prefix}/src/linux*" diff --git a/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0001-makedumpfile-replace-hardcode-CFLAGS.patch b/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0001-makedumpfile-replace-hardcode-CFLAGS.patch index 270cc35625..96a996f616 100644 --- a/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0001-makedumpfile-replace-hardcode-CFLAGS.patch +++ b/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0001-makedumpfile-replace-hardcode-CFLAGS.patch @@ -1,6 +1,6 @@ -From af97e2ad643334b4c7c3d66f971ce9ebb2b596af Mon Sep 17 00:00:00 2001 +From 6d16911316cb576db0239f607e60918a222e4436 Mon Sep 17 00:00:00 2001 From: Mingli Yu <mingli.yu@windriver.com> -Date: Thu, 21 Jul 2016 18:06:21 +0800 +Date: Sun, 24 Apr 2022 17:25:33 +0800 Subject: [PATCH] makedumpfile: replace hardcode CFLAGS * Create alias for target such as powerpc as powerpc32 @@ -10,17 +10,23 @@ Subject: [PATCH] makedumpfile: replace hardcode CFLAGS * Forcibly to link dynamic library as the poky build system doesn't build static library by default -Upstream-Status: Inappropriate[oe specific] +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 | 45 +++++++++++++++++++++++---------------------- - 1 file changed, 23 insertions(+), 22 deletions(-) + Makefile | 40 +++++++++++++++++++++------------------- + 1 file changed, 21 insertions(+), 19 deletions(-) -Index: git/Makefile -=================================================================== ---- git.orig/Makefile -+++ git/Makefile +diff --git a/Makefile b/Makefile +index 71d8548..22acdd5 100644 +--- a/Makefile ++++ b/Makefile @@ -8,12 +8,6 @@ ifeq ($(strip $CC),) CC = gcc endif @@ -34,19 +40,13 @@ Index: git/Makefile HOST_ARCH := $(shell uname -m) # Use TARGET as the target architecture if specified. # Defaults to uname -m -@@ -21,29 +15,36 @@ ifeq ($(strip($TARGET)),) - TARGET := $(HOST_ARCH) - 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/ \ +@@ -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/) -+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/_powerpc_/_powerpc32_/) ++ -e s/ppc64/powerpc64/ -e s/ppc/powerpc32/ \ ++ -e s/_powerpc_/_powerpc32_/) CROSS := ifneq ($(TARGET), $(HOST_ARCH)) @@ -54,8 +54,7 @@ Index: git/Makefile endif -CFLAGS += -D__$(ARCH)__ $(CROSS) --CFLAGS_ARCH += -D__$(ARCH)__ $(CROSS) -+CFLAGS_ARCH += -D$(ARCH) $(CROSS) + CFLAGS_ARCH += -D__$(ARCH)__ $(CROSS) -ifeq ($(ARCH), powerpc64) -CFLAGS += -m64 @@ -78,10 +77,11 @@ Index: git/Makefile + -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 + 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 +53,12 @@ OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH)) +@@ -52,12 +54,12 @@ OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH)) LIBS = -ldw -lbz2 -ldl -lelf -lz ifneq ($(LINKTYPE), dynamic) @@ -96,7 +96,7 @@ Index: git/Makefile endif ifeq ($(USESNAPPY), on) -@@ -65,7 +66,7 @@ LIBS := -lsnappy $(LIBS) +@@ -65,12 +67,12 @@ LIBS := -lsnappy $(LIBS) ifneq ($(LINKTYPE), dynamic) LIBS := $(LIBS) -lstdc++ endif @@ -104,8 +104,14 @@ Index: git/Makefile +CFLAGS_COMMON += -DUSESNAPPY endif - LIBS := -lpthread $(LIBS) -@@ -90,14 +91,14 @@ LIBS := $(LIBS) $(call try-run,\ + 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) @@ -119,15 +125,15 @@ Index: git/Makefile 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) - echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\" \"Linux System Administrator\'s Manual\" > temp.8 - grep -v "^.TH MAKEDUMPFILE 8" $(VPATH)makedumpfile.8 >> temp.8 - mv temp.8 makedumpfile.8 -@@ -108,7 +109,7 @@ makedumpfile: $(SRC_BASE) $(OBJ_PART) $( - gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz + @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) $(OBJ_ARCH) + $(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.gz makedumpfile.conf.5.gz + rm -f $(OBJ) $(OBJ_PART) $(OBJ_ARCH) makedumpfile makedumpfile.8 makedumpfile.conf.5 diff --git a/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0002-mem_section-Support-only-46-bit-for-MAX_PHYSMEM_BITS.patch b/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0002-mem_section-Support-only-46-bit-for-MAX_PHYSMEM_BITS.patch deleted file mode 100644 index 85d8833657..0000000000 --- a/meta-oe/recipes-kernel/makedumpfile/makedumpfile/0002-mem_section-Support-only-46-bit-for-MAX_PHYSMEM_BITS.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 9045b72bdb703bf58a6586d77461eea8f59f50f7 Mon Sep 17 00:00:00 2001 -From: Alexandru Moise <alexandru.moise@windriver.com> -Date: Fri, 29 Apr 2016 07:40:46 +0000 -Subject: [PATCH] mem_section: Support only 46 bit for MAX_PHYSMEM_BITS on - PPC64 - -Related to change: -http://lists.infradead.org/pipermail/kexec/2013-January/007849.html - -Linux on PPC64 has supported only 46 bit MAX_PHYSMEM_BITS since commit: -048ee0993ec8360abb0b51bdf8f8721e9ed62ec4 - -Also remove set_ppc64_max_physmem_bits and set info->max_physmem_bits in -get_machdep_info_ppc64 instead. set_ppc64_max_physmem_bits is broken -for all kernels compiled with CONFIG_SPARSEMEM=n. makedumpfile is -unable to get mem_section field from powerpc kernel since commit: -fd59d231f81cb02870b9cf15f456a897f3669b4e - -Upstream-Status: Pending - -Signed-off-by: Alexandru Moise <alexandru.moise@windriver.com> -Signed-off-by: Yi Zhao <yi.zhao@windriver.com> - -[hqBai: adjusted patch for context, no logical change] -Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com> -Signed-off-by: Mingli Yu <mingli.yu@windriver.com> ---- - arch/ppc64.c | 38 ++------------------------------------ - 1 file changed, 2 insertions(+), 36 deletions(-) - -Index: git/arch/ppc64.c -=================================================================== ---- git.orig/arch/ppc64.c -+++ git/arch/ppc64.c -@@ -462,44 +462,6 @@ ppc64_vtop_level4(unsigned long vaddr) - return paddr; - } - --int --set_ppc64_max_physmem_bits(void) --{ -- long array_len = ARRAY_LENGTH(mem_section); -- -- /* Check if we can get MAX_PHYSMEM_BITS from vmcoreinfo */ -- if (NUMBER(MAX_PHYSMEM_BITS) != NOT_FOUND_NUMBER) { -- info->max_physmem_bits = NUMBER(MAX_PHYSMEM_BITS); -- return TRUE; -- } -- -- /* -- * The older ppc64 kernels uses _MAX_PHYSMEM_BITS as 42 and the -- * newer kernels 3.7 onwards uses 46 bits. -- */ -- -- info->max_physmem_bits = _MAX_PHYSMEM_BITS_ORIG ; -- if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME())) -- || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT()))) -- return TRUE; -- -- info->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7; -- if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME())) -- || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT()))) -- return TRUE; -- -- info->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19; -- if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME())) -- || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT()))) -- return TRUE; -- -- info->max_physmem_bits = _MAX_PHYSMEM_BITS_4_20; -- if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME())) -- || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT()))) -- return TRUE; -- -- return FALSE; --} - - int - get_machdep_info_ppc64(void) -@@ -507,10 +469,8 @@ get_machdep_info_ppc64(void) - unsigned long vmlist, vmap_area_list, vmalloc_start; - - info->section_size_bits = _SECTION_SIZE_BITS; -- if (!set_ppc64_max_physmem_bits()) { -- ERRMSG("Can't detect max_physmem_bits.\n"); -- return FALSE; -- } -+ info->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7; -+ - info->page_offset = __PAGE_OFFSET; - - if (SYMBOL(_stext) == NOT_FOUND_SYMBOL) { diff --git a/meta-oe/recipes-kernel/makedumpfile/makedumpfile_1.6.8.bb b/meta-oe/recipes-kernel/makedumpfile/makedumpfile_1.7.5.bb index 4754651247..85b44c4941 100644 --- a/meta-oe/recipes-kernel/makedumpfile/makedumpfile_1.6.8.bb +++ b/meta-oe/recipes-kernel/makedumpfile/makedumpfile_1.7.5.bb @@ -8,25 +8,24 @@ DESCRIPTION = "\ HOMEPAGE = "https://github.com/makedumpfile/makedumpfile" LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" -LICENSE = "GPLv2.0" +LICENSE = "GPL-2.0-only" SRCBRANCH ?= "master" -SRCREV = "18e0cdba48feeccea2429b3b0b2691f4314d1062" +SRCREV = "c266469347d49287be38059d45e7aaa454db9cb2" DEPENDS = "bzip2 zlib elfutils xz" -RDEPENDS_${PN}-tools = "perl ${PN}" +RDEPENDS:${PN}-tools = "perl ${PN}" -# arm and aarch64 would compile but has never been tested upstream. mips would not compile. -# -COMPATIBLE_HOST = "(x86_64|i.86|powerpc|arm|aarch64).*-linux" +# mips/rv32 would not compile. +COMPATIBLE_HOST:mipsarcho32 = "null" +COMPATIBLE_HOST:riscv32 = "null" PACKAGES =+ "${PN}-tools" -FILES_${PN}-tools = "${bindir}/*.pl" +FILES:${PN}-tools = "${bindir}/*.pl" SRC_URI = "\ - git://github.com/makedumpfile/makedumpfile;branch=${SRCBRANCH} \ + git://github.com/makedumpfile/makedumpfile;branch=${SRCBRANCH};protocol=https \ file://0001-makedumpfile-replace-hardcode-CFLAGS.patch \ - file://0002-mem_section-Support-only-46-bit-for-MAX_PHYSMEM_BITS.patch \ " S = "${WORKDIR}/git" @@ -38,27 +37,26 @@ 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=${TARGET_ARCH} \ + 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}/usr/share/man/man8 - install -m 644 ${S}/makedumpfile.8.gz ${D}/usr/share/man/man8 - - mkdir -p ${D}/usr/share/man/man5 - install -m 644 ${S}/makedumpfile.conf.5.gz ${D}/usr/share/man/man5 - mkdir -p ${D}/etc/ install -m 644 ${S}/makedumpfile.conf ${D}/etc/makedumpfile.conf.sample } diff --git a/meta-oe/recipes-kernel/minicoredumper/files/0001-corestripper-Fix-uninitialized-warning.patch b/meta-oe/recipes-kernel/minicoredumper/files/0001-corestripper-Fix-uninitialized-warning.patch new file mode 100644 index 0000000000..8b90d33e1b --- /dev/null +++ b/meta-oe/recipes-kernel/minicoredumper/files/0001-corestripper-Fix-uninitialized-warning.patch @@ -0,0 +1,53 @@ +From bb44bb643cd2a2f937331b4d1a76b03556b718a2 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 23 Jan 2024 11:36:41 -0800 +Subject: [PATCH] corestripper: Fix uninitialized warning + +Clang finds more open paths where ret can be uninitialized + +Fixes +| ../../../git/src/minicoredumper/corestripper.c:2768:13: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] +| 2768 | } else if (di->core_fd >= 0) { +| | ^~~~~~~~~~~~~~~~ +| ../../../git/src/minicoredumper/corestripper.c:2773:9: note: uninitialized use occurs here +| 2773 | return ret; +| | ^~~ +| ../../../git/src/minicoredumper/corestripper.c:2768:9: note: remove the 'if' if its condition is always true +| 2768 | } else if (di->core_fd >= 0) { +| | ^~~~~~~~~~~~~~~~~~~~~ +| ../../../git/src/minicoredumper/corestripper.c:2763:9: note: initialize the variable 'ret' to silence this warning +| 2763 | int ret; +| | ^ +| | = 0 + +Upstream-Status: Submitted [https://github.com/diamon/minicoredumper/pull/15] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/minicoredumper/corestripper.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/minicoredumper/corestripper.c b/src/minicoredumper/corestripper.c +index 3eb9089..e9e3936 100644 +--- a/src/minicoredumper/corestripper.c ++++ b/src/minicoredumper/corestripper.c +@@ -2707,7 +2707,7 @@ static int dump_data_content_file(struct dump_info *di, + char *tmp_path; + FILE *file; + int len; +- int ret; ++ int ret = -1; + + len = strlen(di->dst_dir) + strlen("/dumps/") + 32 + + strlen(dd->ident) + 1; +@@ -2760,7 +2760,7 @@ out: + static int dump_data_content(struct dump_info *di, struct mcd_dump_data *dd, + const char *symname) + { +- int ret; ++ int ret = -1; + + if (dd->ident) { + /* dump to external file */ +-- +2.43.0 + diff --git a/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-Initialize-pointer-to-config-struct-t.patch b/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-Initialize-pointer-to-config-struct-t.patch deleted file mode 100644 index ad255fae06..0000000000 --- a/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-Initialize-pointer-to-config-struct-t.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 6181d9c3c407ee030b4c3a94045318b9e3a3cc89 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 25 Jul 2017 14:08:54 -0700 -Subject: [PATCH] minicoredumper: Initialize pointer to config struct to null - -Fixes -corestripper.c:3632:13: error: variable 'cfg' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/minicoredumper/corestripper.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/minicoredumper/corestripper.c b/src/minicoredumper/corestripper.c -index a764073..ddb0d25 100644 ---- a/src/minicoredumper/corestripper.c -+++ b/src/minicoredumper/corestripper.c -@@ -3605,7 +3605,7 @@ out: - - static int do_all_dumps(struct dump_info *di, int argc, char *argv[]) - { -- struct config *cfg; -+ struct config *cfg = 0; - const char *recept; - bool live_dumper; - char *comm_base; --- -2.13.3 - diff --git a/meta-oe/recipes-kernel/minicoredumper/files/run-ptest b/meta-oe/recipes-kernel/minicoredumper/files/run-ptest new file mode 100644 index 0000000000..6746132ce6 --- /dev/null +++ b/meta-oe/recipes-kernel/minicoredumper/files/run-ptest @@ -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 "PASS: minicoredumper" +else + echo "FAIL: minicoredumper" +fi diff --git a/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.1.bb b/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb index d381c83ae8..726aa60ce7 100644 --- a/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.1.bb +++ b/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb @@ -1,33 +1,36 @@ SUMMARY = "minicoredumper provides an alternate core dump facility for Linux \ to allow minimal and customized crash dumps" -LICENSE = " LGPLv2.1 & BSD-2-Clause" +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 systemd update-rc.d +inherit autotools pkgconfig ptest systemd update-rc.d -SRCREV = "16a0d44f1725eaa93096eaa0e086f42ef4c2712c" +SRCREV = "ca6e7ad62b4cf984de84aa081024c4e45632cecb" -PR .= "+git${SRCPV}" - -SRC_URI = "git://github.com/diamon/minicoredumper;protocol=https \ +SRC_URI = "git://github.com/diamon/minicoredumper;protocol=https;branch=master \ file://minicoredumper.service \ file://minicoredumper.init \ + file://run-ptest \ + file://0001-corestripper-Fix-uninitialized-warning.patch \ " S = "${WORKDIR}/git" -SYSTEMD_SERVICE_${PN} = "minicoredumper.service" +SYSTEMD_SERVICE:${PN} = "minicoredumper.service" SYSTEMD_AUTO_ENABLE = "enable" INITSCRIPT_PACKAGES = "${PN}" -INITSCRIPT_NAME_${PN} = "minicoredumper" -INITSCRIPT_PARAMS_${PN} = "defaults 89" +INITSCRIPT_NAME:${PN} = "minicoredumper" +INITSCRIPT_PARAMS:${PN} = "defaults 89" -do_install_append() { +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}/ @@ -35,7 +38,7 @@ do_install_append() { install -d ${D}${systemd_system_unitdir} install -m 0644 ${WORKDIR}/minicoredumper.service ${D}${systemd_system_unitdir} install -d ${D}${sysconfdir}/init.d - install -m 0644 ${WORKDIR}/minicoredumper.init ${D}${sysconfdir}/init.d/minicoredumper + 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 @@ -43,4 +46,4 @@ do_install_append() { } # http://errors.yoctoproject.org/Errors/Details/186966/ -COMPATIBLE_HOST_libc-musl = 'null' +COMPATIBLE_HOST:libc-musl = 'null' diff --git a/meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch b/meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch new file mode 100644 index 0000000000..930b90e289 --- /dev/null +++ b/meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/oprofile/oprofile/0001-configure-Include-unistd.h-for-getpid-API.patch b/meta-oe/recipes-kernel/oprofile/oprofile/0001-configure-Include-unistd.h-for-getpid-API.patch new file mode 100644 index 0000000000..0ac03bde50 --- /dev/null +++ b/meta-oe/recipes-kernel/oprofile/oprofile/0001-configure-Include-unistd.h-for-getpid-API.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb b/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb index 7a18446823..092d22746a 100644 --- a/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb +++ b/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb @@ -4,18 +4,18 @@ 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 = "LGPLv2.1+ & GPLv2" +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" +DEPENDS:append:powerpc64 = " libpfm4" +DEPENDS:append:powerpc64le = " libpfm4" -COMPATIBLE_HOST_riscv64 = "null" -COMPATIBLE_HOST_riscv32 = "null" +COMPATIBLE_HOST:riscv64 = "null" +COMPATIBLE_HOST:riscv32 = "null" SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \ file://acinclude.m4 \ @@ -30,6 +30,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \ 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" @@ -56,20 +58,23 @@ do_install_ptest() { find ${tooltest} -perm /u=x -type f| cpio -pvdu ${D}${PTEST_PATH} done - # needed by some libop tests - cp -r events ${D}${PTEST_PATH} - + install -d ${D}${PTEST_PATH}/../${BP}/events ${D}${PTEST_PATH}/../${BP}/libutil++/tests # 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}/../${BP}/libutil++/tests + cp ${S}/libutil++/tests/file_manip_tests.cpp \ libutil++/tests/file_manip_tests.o ${D}${PTEST_PATH}/libutil++/tests + # needed by some libop tests + cp -R --no-dereference --preserve=mode,links -v ${S}/events ${D}${PTEST_PATH}/../${BP} } -RDEPENDS_${PN} = "binutils-symlinks" +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" +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" +FILES:${PN}-ptest += "${libdir}/${BPN}/${BP}" diff --git a/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch b/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch new file mode 100644 index 0000000000..fc5991d464 --- /dev/null +++ b/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb b/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb index 4526eeed3f..6e52a58de5 100644 --- a/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb +++ b/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb @@ -2,14 +2,15 @@ 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" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" SRCREV = "cf59527dc24fdd2f314ae4dcaeb3d68a117988f6" -SRC_URI = "git://github.com/intel/pm-graph.git \ +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" @@ -29,6 +30,6 @@ do_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" +RDEPENDS:${PN} += "python3-core python3-threading python3-datetime python3-compression" +RPROVIDES:${PN} = "analyze-suspend" BBCLASSEXTEND = "native nativesdk" diff --git a/meta-oe/recipes-kernel/spidev-test/spidev-test.bb b/meta-oe/recipes-kernel/spidev-test/spidev-test.bb index 6626302919..2e8c5cbb8d 100644 --- a/meta-oe/recipes-kernel/spidev-test/spidev-test.bb +++ b/meta-oe/recipes-kernel/spidev-test/spidev-test.bb @@ -1,7 +1,7 @@ SUMMARY = "Test SPI devices" DESCRIPTION = "SPI testing utility using the spidev driver" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +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 @@ -22,8 +22,8 @@ do_install() { PACKAGE_ARCH = "${MACHINE_ARCH}" -python do_package_prepend() { - d.setVar('PKGV', d.getVar("KERNEL_VERSION", True).split("-")[0]) +python do_package:prepend() { + d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) } B = "${WORKDIR}/${BPN}-${PV}" diff --git a/meta-oe/recipes-kernel/trace-cmd/files/0001-Do-not-emit-useless-rpath.patch b/meta-oe/recipes-kernel/trace-cmd/files/0001-Do-not-emit-useless-rpath.patch new file mode 100644 index 0000000000..13a86e65d1 --- /dev/null +++ b/meta-oe/recipes-kernel/trace-cmd/files/0001-Do-not-emit-useless-rpath.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/trace-cmd/files/0001-Replace-LFS64-interfaces-off64_t-and-lseek64.patch b/meta-oe/recipes-kernel/trace-cmd/files/0001-Replace-LFS64-interfaces-off64_t-and-lseek64.patch new file mode 100644 index 0000000000..1e5415ef6a --- /dev/null +++ b/meta-oe/recipes-kernel/trace-cmd/files/0001-Replace-LFS64-interfaces-off64_t-and-lseek64.patch @@ -0,0 +1,1136 @@ +From 9c3213a3b64e049c1aa065300b01ee751699b01f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 6 Jan 2023 16:53:06 -0800 +Subject: [PATCH 1/2] Replace LFS64 interfaces off64_t and lseek64 + +Musl does not define these interfaces unless -D_LARGEFILE64_SOURCE is +defined and that too it is transitional until apps switch to using 64-bit +off_t. We pass -D_FILE_OFFSET_BITS=64 in makefiles already therefore +original lseek and off_t are already 64bit + +This fixes build with latest musl which has dropped LFS64 interfaces [1] + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4i + +Upstream-Status: Submitted [https://lore.kernel.org/linux-trace-devel/20230109225315.1284538-1-raj.khem@gmail.com/] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../include/private/trace-cmd-private.h | 12 +- + lib/trace-cmd/include/trace-cmd-local.h | 4 +- + lib/trace-cmd/trace-compress.c | 30 ++--- + lib/trace-cmd/trace-input.c | 110 +++++++++--------- + lib/trace-cmd/trace-msg.c | 20 ++-- + lib/trace-cmd/trace-output.c | 64 +++++----- + lib/trace-cmd/trace-recorder.c | 8 +- + tracecmd/trace-dump.c | 34 +++--- + tracecmd/trace-read.c | 2 +- + 9 files changed, 142 insertions(+), 142 deletions(-) + +diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h +index 05c084ce..f2cf8dc8 100644 +--- a/lib/trace-cmd/include/private/trace-cmd-private.h ++++ b/lib/trace-cmd/include/private/trace-cmd-private.h +@@ -106,7 +106,7 @@ const char *tracecmd_get_trace_clock(struct tracecmd_input *handle); + const char *tracecmd_get_cpustats(struct tracecmd_input *handle); + const char *tracecmd_get_uname(struct tracecmd_input *handle); + const char *tracecmd_get_version(struct tracecmd_input *handle); +-off64_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu); ++off_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu); + + static inline int tracecmd_host_bigendian(void) + { +@@ -336,7 +336,7 @@ int tracecmd_write_buffer_info(struct tracecmd_output *handle); + + int tracecmd_write_cpus(struct tracecmd_output *handle, int cpus); + int tracecmd_write_cmdlines(struct tracecmd_output *handle); +-int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int whence); ++int tracecmd_prepare_options(struct tracecmd_output *handle, off_t offset, int whence); + int tracecmd_write_options(struct tracecmd_output *handle); + int tracecmd_write_meta_strings(struct tracecmd_output *handle); + int tracecmd_append_options(struct tracecmd_output *handle); +@@ -394,7 +394,7 @@ struct tracecmd_msg_handle { + short cpu_count; + short version; /* Current protocol version */ + unsigned long flags; +- off64_t cache_start_offset; ++ off_t cache_start_offset; + bool done; + bool cache; + int cfd; +@@ -543,8 +543,8 @@ int tracecmd_write_guest_time_shift(struct tracecmd_output *handle, + struct tracecmd_compress_chunk { + unsigned int size; + unsigned int zsize; +- off64_t zoffset; +- off64_t offset; ++ off_t zoffset; ++ off_t offset; + }; + struct tracecmd_compression; + struct tracecmd_compression_proto { +@@ -570,7 +570,7 @@ int tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst + int tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, int len, off_t offset); + int tracecmd_compress_buffer_write(struct tracecmd_compression *handle, + const void *data, unsigned long long size); +-off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t offset, int whence); ++off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence); + int tracecmd_compress_proto_get_name(struct tracecmd_compression *compress, + const char **name, const char **version); + bool tracecmd_compress_is_supported(const char *name, const char *version); +diff --git a/lib/trace-cmd/include/trace-cmd-local.h b/lib/trace-cmd/include/trace-cmd-local.h +index db0b2c21..ebd6f152 100644 +--- a/lib/trace-cmd/include/trace-cmd-local.h ++++ b/lib/trace-cmd/include/trace-cmd-local.h +@@ -94,13 +94,13 @@ out_add_buffer_option(struct tracecmd_output *handle, const char *name, + struct cpu_data_source { + int fd; + int size; +- off64_t offset; ++ off_t offset; + }; + + int out_write_cpu_data(struct tracecmd_output *handle, int cpus, + struct cpu_data_source *data, const char *buff_name); + int out_write_emty_cpu_data(struct tracecmd_output *handle, int cpus); +-off64_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off64_t offset, int whence); ++off_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off_t offset, int whence); + unsigned long long get_last_option_offset(struct tracecmd_input *handle); + unsigned int get_meta_strings_size(struct tracecmd_input *handle); + int trace_append_options(struct tracecmd_output *handle, void *buf, size_t len); +diff --git a/lib/trace-cmd/trace-compress.c b/lib/trace-cmd/trace-compress.c +index 461de8d0..1b852f18 100644 +--- a/lib/trace-cmd/trace-compress.c ++++ b/lib/trace-cmd/trace-compress.c +@@ -117,12 +117,12 @@ static inline int buffer_extend(struct tracecmd_compression *handle, unsigned in + * + * Returns the new file pointer on success, or -1 in case of an error. + */ +-off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t offset, int whence) ++off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence) + { + unsigned long p; + + if (!handle || !handle->buffer) +- return (off64_t)-1; ++ return (off_t)-1; + + switch (whence) { + case SEEK_CUR: +@@ -135,11 +135,11 @@ off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t off + p = offset; + break; + default: +- return (off64_t)-1; ++ return (off_t)-1; + } + + if (buffer_extend(handle, p)) +- return (off64_t)-1; ++ return (off_t)-1; + + handle->pointer = p; + +@@ -678,7 +678,7 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int + unsigned int size; + unsigned int all; + unsigned int r; +- off64_t offset; ++ off_t offset; + char *buf_from; + char *buf_to; + int endian4; +@@ -700,7 +700,7 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int + return -1; + + /* save the initial offset and write 0 as initial chunk count */ +- offset = lseek64(handle->fd, 0, SEEK_CUR); ++ offset = lseek(handle->fd, 0, SEEK_CUR); + write_fd(handle->fd, &chunks, 4); + + do { +@@ -760,13 +760,13 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int + if (all) + return -1; + +- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1) + return -1; + + endian4 = tep_read_number(handle->tep, &chunks, 4); + /* write chunks count*/ + write_fd(handle->fd, &chunks, 4); +- if (lseek64(handle->fd, 0, SEEK_END) == (off_t)-1) ++ if (lseek(handle->fd, 0, SEEK_END) == (off_t)-1) + return -1; + + if (read_size) +@@ -796,7 +796,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle, + struct tracecmd_compress_chunk *chunks = NULL; + unsigned long long size = 0; + unsigned int count = 0; +- off64_t offset; ++ off_t offset; + int ret = -1; + char buf[4]; + int i; +@@ -804,8 +804,8 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle, + if (!handle) + return -1; + +- offset = lseek64(handle->fd, 0, SEEK_CUR); +- if (offset == (off64_t)-1) ++ offset = lseek(handle->fd, 0, SEEK_CUR); ++ if (offset == (off_t)-1) + return -1; + + if (read(handle->fd, buf, 4) != 4) +@@ -822,7 +822,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle, + goto out; + + for (i = 0; i < count; i++) { +- chunks[i].zoffset = lseek64(handle->fd, 0, SEEK_CUR); ++ chunks[i].zoffset = lseek(handle->fd, 0, SEEK_CUR); + if (chunks[i].zoffset == (off_t)-1) + goto out; + if (read(handle->fd, buf, 4) != 4) +@@ -833,13 +833,13 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle, + goto out; + chunks[i].size = tep_read_number(handle->tep, buf, 4); + size += chunks[i].size; +- if (lseek64(handle->fd, chunks[i].zsize, SEEK_CUR) == (off64_t)-1) ++ if (lseek(handle->fd, chunks[i].zsize, SEEK_CUR) == (off_t)-1) + goto out; + } + + ret = count; + out: +- if (lseek64(handle->fd, offset, SEEK_SET) == (off64_t)-1) ++ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1) + ret = -1; + + if (ret > 0 && chunks_info) +@@ -872,7 +872,7 @@ int tracecmd_uncompress_chunk(struct tracecmd_compression *handle, + if (!handle || !handle->proto || !handle->proto->uncompress_block || !chunk || !data) + return -1; + +- if (lseek64(handle->fd, chunk->zoffset + 8, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, chunk->zoffset + 8, SEEK_SET) == (off_t)-1) + return -1; + + bytes_in = malloc(chunk->zsize); +diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c +index 594eb74a..9b128403 100644 +--- a/lib/trace-cmd/trace-input.c ++++ b/lib/trace-cmd/trace-input.c +@@ -37,8 +37,8 @@ static int force_read = 0; + + struct page_map { + struct list_head list; +- off64_t offset; +- off64_t size; ++ off_t offset; ++ off_t size; + void *map; + int ref_count; + }; +@@ -54,7 +54,7 @@ struct follow_event { + + struct page { + struct list_head list; +- off64_t offset; ++ off_t offset; + struct tracecmd_input *handle; + struct page_map *page_map; + void *map; +@@ -541,7 +541,7 @@ static struct file_section *section_open(struct tracecmd_input *handle, int id) + if (!sec) + return NULL; + +- if (lseek64(handle->fd, sec->data_offset, SEEK_SET) == (off64_t)-1) ++ if (lseek(handle->fd, sec->data_offset, SEEK_SET) == (off_t)-1) + return NULL; + + if ((sec->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle)) +@@ -593,7 +593,7 @@ static int read_header_files(struct tracecmd_input *handle) + + if (!HAS_SECTIONS(handle)) + section_add_or_update(handle, TRACECMD_OPTION_HEADER_INFO, 0, 0, +- lseek64(handle->fd, 0, SEEK_CUR)); ++ lseek(handle->fd, 0, SEEK_CUR)); + + if (do_read_check(handle, buf, 12)) + return -1; +@@ -800,7 +800,7 @@ static int read_ftrace_files(struct tracecmd_input *handle, const char *regex) + + if (!HAS_SECTIONS(handle)) + section_add_or_update(handle, TRACECMD_OPTION_FTRACE_EVENTS, 0, 0, +- lseek64(handle->fd, 0, SEEK_CUR)); ++ lseek(handle->fd, 0, SEEK_CUR)); + + if (regex) { + sreg = &spreg; +@@ -875,7 +875,7 @@ static int read_event_files(struct tracecmd_input *handle, const char *regex) + + if (!HAS_SECTIONS(handle)) + section_add_or_update(handle, TRACECMD_OPTION_EVENT_FORMATS, 0, 0, +- lseek64(handle->fd, 0, SEEK_CUR)); ++ lseek(handle->fd, 0, SEEK_CUR)); + + if (regex) { + sreg = &spreg; +@@ -962,7 +962,7 @@ static int read_proc_kallsyms(struct tracecmd_input *handle) + return 0; + if (!HAS_SECTIONS(handle)) + section_add_or_update(handle, TRACECMD_OPTION_KALLSYMS, 0, 0, +- lseek64(handle->fd, 0, SEEK_CUR)); ++ lseek(handle->fd, 0, SEEK_CUR)); + + if (read4(handle, &size) < 0) + return -1; +@@ -999,7 +999,7 @@ static int read_ftrace_printk(struct tracecmd_input *handle) + + if (!HAS_SECTIONS(handle)) + section_add_or_update(handle, TRACECMD_OPTION_PRINTK, 0, 0, +- lseek64(handle->fd, 0, SEEK_CUR)); ++ lseek(handle->fd, 0, SEEK_CUR)); + + if (read4(handle, &size) < 0) + return -1; +@@ -1173,7 +1173,7 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se + unsigned long long size; + int ret; + +- if (lseek64(handle->fd, section->section_offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, section->section_offset, SEEK_SET) == (off_t)-1) + return -1; + if (read_section_header(handle, &id, &flags, &size, NULL)) + return -1; +@@ -1181,7 +1181,7 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se + if (id != section->id) + return -1; + +- section->data_offset = lseek64(handle->fd, 0, SEEK_CUR); ++ section->data_offset = lseek(handle->fd, 0, SEEK_CUR); + if ((section->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle)) + return -1; + +@@ -1225,7 +1225,7 @@ static int read_headers(struct tracecmd_input *handle, const char *regex) + if (!handle->options_start) + return -1; + +- if (lseek64(handle->fd, handle->options_start, SEEK_SET) == (off64_t)-1) { ++ if (lseek(handle->fd, handle->options_start, SEEK_SET) == (off_t)-1) { + tracecmd_warning("Filed to goto options offset %lld", handle->options_start); + return -1; + } +@@ -1269,11 +1269,11 @@ static unsigned long long calc_page_offset(struct tracecmd_input *handle, + return offset & ~(handle->page_size - 1); + } + +-static int read_page(struct tracecmd_input *handle, off64_t offset, ++static int read_page(struct tracecmd_input *handle, off_t offset, + int cpu, void *map) + { +- off64_t save_seek; +- off64_t ret; ++ off_t save_seek; ++ off_t ret; + + if (handle->use_pipe) { + ret = read(handle->cpu_data[cpu].pipe_fd, map, handle->page_size); +@@ -1291,9 +1291,9 @@ static int read_page(struct tracecmd_input *handle, off64_t offset, + } + + /* other parts of the code may expect the pointer to not move */ +- save_seek = lseek64(handle->fd, 0, SEEK_CUR); ++ save_seek = lseek(handle->fd, 0, SEEK_CUR); + +- ret = lseek64(handle->fd, offset, SEEK_SET); ++ ret = lseek(handle->fd, offset, SEEK_SET); + if (ret < 0) + return -1; + ret = read(handle->fd, map, handle->page_size); +@@ -1301,7 +1301,7 @@ static int read_page(struct tracecmd_input *handle, off64_t offset, + return -1; + + /* reset the file pointer back */ +- lseek64(handle->fd, save_seek, SEEK_SET); ++ lseek(handle->fd, save_seek, SEEK_SET); + + return 0; + } +@@ -1348,7 +1348,7 @@ static int chunk_cmp(const void *A, const void *B) + return 1; + } + +-static struct tracecmd_compress_chunk *get_zchunk(struct cpu_data *cpu, off64_t offset) ++static struct tracecmd_compress_chunk *get_zchunk(struct cpu_data *cpu, off_t offset) + { + struct cpu_zdata *cpuz = &cpu->compress; + struct tracecmd_compress_chunk *chunk; +@@ -1398,7 +1398,7 @@ found: + free(cache); + } + +-static void *read_zpage(struct tracecmd_input *handle, int cpu, off64_t offset) ++static void *read_zpage(struct tracecmd_input *handle, int cpu, off_t offset) + { + struct cpu_data *cpu_data = &handle->cpu_data[cpu]; + struct tracecmd_compress_chunk *chunk; +@@ -1448,12 +1448,12 @@ error: + } + + static void *allocate_page_map(struct tracecmd_input *handle, +- struct page *page, int cpu, off64_t offset) ++ struct page *page, int cpu, off_t offset) + { + struct cpu_data *cpu_data = &handle->cpu_data[cpu]; + struct page_map *page_map; +- off64_t map_size; +- off64_t map_offset; ++ off_t map_size; ++ off_t map_offset; + void *map; + int ret; + int fd; +@@ -1544,7 +1544,7 @@ static void *allocate_page_map(struct tracecmd_input *handle, + } + + static struct page *allocate_page(struct tracecmd_input *handle, +- int cpu, off64_t offset) ++ int cpu, off_t offset) + { + struct cpu_data *cpu_data = &handle->cpu_data[cpu]; + struct page **pages; +@@ -1851,7 +1851,7 @@ static int update_page_info(struct tracecmd_input *handle, int cpu) + * -1 on error + */ + static int get_page(struct tracecmd_input *handle, int cpu, +- off64_t offset) ++ off_t offset) + { + /* Don't map if the page is already where we want */ + if (handle->cpu_data[cpu].offset == offset && +@@ -1895,7 +1895,7 @@ static int get_page(struct tracecmd_input *handle, int cpu, + + static int get_next_page(struct tracecmd_input *handle, int cpu) + { +- off64_t offset; ++ off_t offset; + + if (!handle->cpu_data[cpu].page && !handle->use_pipe) + return 0; +@@ -2122,7 +2122,7 @@ struct tep_record * + tracecmd_read_cpu_last(struct tracecmd_input *handle, int cpu) + { + struct tep_record *record = NULL; +- off64_t offset, page_offset; ++ off_t offset, page_offset; + + offset = handle->cpu_data[cpu].file_offset + + handle->cpu_data[cpu].file_size; +@@ -2183,7 +2183,7 @@ tracecmd_set_cpu_to_timestamp(struct tracecmd_input *handle, int cpu, + unsigned long long ts) + { + struct cpu_data *cpu_data = &handle->cpu_data[cpu]; +- off64_t start, end, next; ++ off_t start, end, next; + + if (cpu < 0 || cpu >= handle->cpus) { + errno = -EINVAL; +@@ -3064,11 +3064,11 @@ static int init_cpu_zfile(struct tracecmd_input *handle, int cpu) + { + struct cpu_data *cpu_data; + unsigned long long size; +- off64_t offset; ++ off_t offset; + + cpu_data = &handle->cpu_data[cpu]; +- offset = lseek64(handle->fd, 0, SEEK_CUR); +- if (lseek64(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1) ++ offset = lseek(handle->fd, 0, SEEK_CUR); ++ if (lseek(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1) + return -1; + + strcpy(cpu_data->compress.file, COMPR_TEMP_FILE); +@@ -3079,7 +3079,7 @@ static int init_cpu_zfile(struct tracecmd_input *handle, int cpu) + if (tracecmd_uncompress_copy_to(handle->compress, cpu_data->compress.fd, NULL, &size)) + return -1; + +- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1) + return -1; + + cpu_data->file_offset = handle->next_offset; +@@ -3098,7 +3098,7 @@ static int init_cpu_zpage(struct tracecmd_input *handle, int cpu) + int count; + int i; + +- if (lseek64(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1) + return -1; + + count = tracecmd_load_chunks_info(handle->compress, &cpu_data->compress.chunks); +@@ -3576,7 +3576,7 @@ static int handle_option_done(struct tracecmd_input *handle, char *buf, int size + if (size < 8) + return -1; + +- offset = lseek64(handle->fd, 0, SEEK_CUR); ++ offset = lseek(handle->fd, 0, SEEK_CUR); + if (offset >= size) + handle->options_last_offset = offset - size; + +@@ -3584,7 +3584,7 @@ static int handle_option_done(struct tracecmd_input *handle, char *buf, int size + if (!offset) + return 0; + +- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1) + return -1; + + return handle_options(handle); +@@ -3741,7 +3741,7 @@ static int handle_options(struct tracecmd_input *handle) + int ret; + + if (!HAS_SECTIONS(handle)) { +- handle->options_start = lseek64(handle->fd, 0, SEEK_CUR); ++ handle->options_start = lseek(handle->fd, 0, SEEK_CUR); + } else { + if (read_section_header(handle, &id, &flags, NULL, NULL)) + return -1; +@@ -4102,7 +4102,7 @@ int init_latency_data(struct tracecmd_input *handle) + if (ret) + return -1; + +- lseek64(handle->latz.fd, 0, SEEK_SET); ++ lseek(handle->latz.fd, 0, SEEK_SET); + } + + return 0; +@@ -4118,7 +4118,7 @@ static int init_buffer_cpu_data(struct tracecmd_input *handle, struct input_buff + if (handle->cpu_data) + return -1; + +- if (lseek64(handle->fd, buffer->offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, buffer->offset, SEEK_SET) == (off_t)-1) + return -1; + if (read_section_header(handle, &id, &flags, NULL, NULL)) + return -1; +@@ -4246,7 +4246,7 @@ static int read_and_parse_cmdlines(struct tracecmd_input *handle) + + if (!HAS_SECTIONS(handle)) + section_add_or_update(handle, TRACECMD_OPTION_CMDLINES, 0, 0, +- lseek64(handle->fd, 0, SEEK_CUR)); ++ lseek(handle->fd, 0, SEEK_CUR)); + + + if (read_data_and_size(handle, &cmdlines, &size) < 0) +@@ -4554,9 +4554,9 @@ static int read_metadata_strings(struct tracecmd_input *handle) + unsigned short id; + unsigned int csize, rsize; + unsigned long long size; +- off64_t offset; ++ off_t offset; + +- offset = lseek64(handle->fd, 0, SEEK_CUR); ++ offset = lseek(handle->fd, 0, SEEK_CUR); + do { + if (read_section_header(handle, &id, &flags, &size, NULL)) + break; +@@ -4575,12 +4575,12 @@ static int read_metadata_strings(struct tracecmd_input *handle) + if (flags & TRACECMD_SEC_FL_COMPRESS) + in_uncompress_reset(handle); + } else { +- if (lseek64(handle->fd, size, SEEK_CUR) == (off_t)-1) ++ if (lseek(handle->fd, size, SEEK_CUR) == (off_t)-1) + break; + } + } while (1); + +- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1) + return -1; + + return found ? 0 : -1; +@@ -4683,9 +4683,9 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags) + handle->page_size = page_size; + handle->next_offset = page_size; + +- offset = lseek64(handle->fd, 0, SEEK_CUR); +- handle->total_file_size = lseek64(handle->fd, 0, SEEK_END); +- lseek64(handle->fd, offset, SEEK_SET); ++ offset = lseek(handle->fd, 0, SEEK_CUR); ++ handle->total_file_size = lseek(handle->fd, 0, SEEK_END); ++ lseek(handle->fd, offset, SEEK_SET); + + if (HAS_COMPRESSION(handle)) { + zname = read_string(handle); +@@ -5533,7 +5533,7 @@ static int copy_options_recursive(struct tracecmd_input *in_handle, + if (!next) + break; + +- if (do_lseek(in_handle, next, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(in_handle, next, SEEK_SET) == (off_t)-1) + return -1; + + if (read_section_header(in_handle, &id, &flags, NULL, NULL)) +@@ -5648,7 +5648,7 @@ int tracecmd_copy_options(struct tracecmd_input *in_handle, + if (!in_handle->options_start) + return 0; + +- if (lseek64(in_handle->fd, in_handle->options_start, SEEK_SET) == (off64_t)-1) ++ if (lseek(in_handle->fd, in_handle->options_start, SEEK_SET) == (off_t)-1) + return -1; + + if (copy_options(in_handle, out_handle) < 0) +@@ -5980,10 +5980,10 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx) + new_handle->pid_maps = NULL; + if (!HAS_SECTIONS(handle)) { + /* Save where we currently are */ +- offset = lseek64(handle->fd, 0, SEEK_CUR); ++ offset = lseek(handle->fd, 0, SEEK_CUR); + +- ret = lseek64(handle->fd, buffer->offset, SEEK_SET); +- if (ret == (off64_t)-1) { ++ ret = lseek(handle->fd, buffer->offset, SEEK_SET); ++ if (ret == (off_t)-1) { + tracecmd_warning("could not seek to buffer %s offset %ld", + buffer->name, buffer->offset); + goto error; +@@ -6001,7 +6001,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx) + tracecmd_warning("failed to read sub buffer %s", buffer->name); + goto error; + } +- ret = lseek64(handle->fd, offset, SEEK_SET); ++ ret = lseek(handle->fd, offset, SEEK_SET); + if (ret < 0) { + tracecmd_warning("could not seek to back to offset %ld", offset); + goto error; +@@ -6171,13 +6171,13 @@ const char *tracecmd_get_version(struct tracecmd_input *handle) + * + * Provides a method to extract the cpu file size saved in @handle. + * +- * Returns the cpu file size saved in trace.dat file or (off64_t)-1 for ++ * Returns the cpu file size saved in trace.dat file or (off_t)-1 for + * invalid cpu index. + */ +-off64_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu) ++off_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu) + { + if (cpu < 0 || cpu >= handle->cpus) +- return (off64_t)-1; ++ return (off_t)-1; + return handle->cpu_data[cpu].file_size; + } + +diff --git a/lib/trace-cmd/trace-msg.c b/lib/trace-cmd/trace-msg.c +index 0b2de710..3a555c36 100644 +--- a/lib/trace-cmd/trace-msg.c ++++ b/lib/trace-cmd/trace-msg.c +@@ -183,26 +183,26 @@ static int __msg_write(int fd, struct tracecmd_msg *msg, bool network) + return __do_write_check(fd, msg->buf, data_size); + } + +-__hidden off64_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off64_t offset, int whence) ++__hidden off_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off_t offset, int whence) + { +- off64_t cache_offset = msg_handle->cache_start_offset; +- off64_t ret; ++ off_t cache_offset = msg_handle->cache_start_offset; ++ off_t ret; + + /* + * lseek works only if the handle is in cache mode, + * cannot seek on a network socket + */ + if (!msg_handle->cache || msg_handle->cfd < 0) +- return (off64_t)-1; ++ return (off_t)-1; + + if (whence == SEEK_SET) { + if (offset < cache_offset) +- return (off64_t)-1; ++ return (off_t)-1; + offset -= cache_offset; + } + +- ret = lseek64(msg_handle->cfd, offset, whence); +- if (ret == (off64_t)-1) ++ ret = lseek(msg_handle->cfd, offset, whence); ++ if (ret == (off_t)-1) + return ret; + + return ret + cache_offset; +@@ -639,7 +639,7 @@ static int flush_cache(struct tracecmd_msg_handle *msg_handle) + if (!msg_handle->cache || fd < 0) + return 0; + msg_handle->cache = false; +- if (lseek64(fd, 0, SEEK_SET) == (off64_t)-1) ++ if (lseek(fd, 0, SEEK_SET) == (off_t)-1) + return -1; + do { + ret = read(fd, buf, MSG_MAX_DATA_LEN); +@@ -650,8 +650,8 @@ static int flush_cache(struct tracecmd_msg_handle *msg_handle) + break; + } while (ret >= 0); + +- msg_handle->cache_start_offset = lseek64(fd, 0, SEEK_CUR); +- if (msg_handle->cache_start_offset == (off64_t)-1) ++ msg_handle->cache_start_offset = lseek(fd, 0, SEEK_CUR); ++ if (msg_handle->cache_start_offset == (off_t)-1) + return -1; + + close(fd); +diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c +index 1c0f7b77..ad740d65 100644 +--- a/lib/trace-cmd/trace-output.c ++++ b/lib/trace-cmd/trace-output.c +@@ -112,7 +112,7 @@ do_write_check(struct tracecmd_output *handle, const void *data, long long size) + return __do_write_check(handle->fd, data, size); + } + +-static inline off64_t do_lseek(struct tracecmd_output *handle, off_t offset, int whence) ++static inline off_t do_lseek(struct tracecmd_output *handle, off_t offset, int whence) + { + if (handle->do_compress) + return tracecmd_compress_lseek(handle->compress, offset, whence); +@@ -120,7 +120,7 @@ static inline off64_t do_lseek(struct tracecmd_output *handle, off_t offset, int + if (handle->msg_handle) + return msg_lseek(handle->msg_handle, offset, whence); + +- return lseek64(handle->fd, offset, whence); ++ return lseek(handle->fd, offset, whence); + } + + static inline int do_preed(struct tracecmd_output *handle, void *dst, int len, off_t offset) +@@ -526,12 +526,12 @@ out_write_section_header(struct tracecmd_output *handle, unsigned short header_i + /* Section ID */ + endian2 = convert_endian_2(handle, header_id); + if (do_write_check(handle, &endian2, 2)) +- return (off64_t)-1; ++ return (off_t)-1; + + /* Section flags */ + endian2 = convert_endian_2(handle, flags); + if (do_write_check(handle, &endian2, 2)) +- return (off64_t)-1; ++ return (off_t)-1; + + /* Section description */ + if (description) +@@ -540,13 +540,13 @@ out_write_section_header(struct tracecmd_output *handle, unsigned short header_i + desc = -1; + endian4 = convert_endian_4(handle, desc); + if (do_write_check(handle, &endian4, 4)) +- return (off64_t)-1; ++ return (off_t)-1; + + offset = do_lseek(handle, 0, SEEK_CUR); + size = 0; + /* Reserve for section size */ + if (do_write_check(handle, &size, 8)) +- return (off64_t)-1; ++ return (off_t)-1; + return offset; + } + +@@ -567,13 +567,13 @@ __hidden int out_update_section_header(struct tracecmd_output *handle, tsize_t o + if (size < 8) + return -1; + size -= 8; +- if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, offset, SEEK_SET) == (off_t)-1) + return -1; + + endian8 = convert_endian_8(handle, size); + if (do_write_check(handle, &endian8, 8)) + return -1; +- if (do_lseek(handle, current, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, current, SEEK_SET) == (off_t)-1) + return -1; + return 0; + } +@@ -595,7 +595,7 @@ static int save_string_section(struct tracecmd_output *handle, bool compress) + if (compress) + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_STRINGS, "strings", flags, false); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + + out_compression_start(handle, compress); +@@ -645,7 +645,7 @@ static int read_header_files(struct tracecmd_output *handle, bool compress) + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_HEADER_INFO, + "headers", flags, true); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + + out_compression_start(handle, compress); +@@ -973,7 +973,7 @@ static int read_ftrace_files(struct tracecmd_output *handle, bool compress) + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_FTRACE_EVENTS, + "ftrace events", flags, true); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + + create_event_list_item(handle, &systems, &list); +@@ -1032,7 +1032,7 @@ static int read_event_files(struct tracecmd_output *handle, + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_EVENT_FORMATS, + "events format", flags, true); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + /* + * If any of the list is the special keyword "all" then +@@ -1146,7 +1146,7 @@ static int read_proc_kallsyms(struct tracecmd_output *handle, bool compress) + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_KALLSYMS, + "kallsyms", flags, true); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + + out_compression_start(handle, compress); +@@ -1210,7 +1210,7 @@ static int read_ftrace_printk(struct tracecmd_output *handle, bool compress) + if (compress) + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_PRINTK, "printk", flags, true); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + + out_compression_start(handle, compress); +@@ -1255,8 +1255,8 @@ static int save_tracing_file_data(struct tracecmd_output *handle, + unsigned long long endian8; + char *file = NULL; + struct stat st; +- off64_t check_size; +- off64_t size; ++ off_t check_size; ++ off_t size; + int ret = -1; + + file = get_tracing_file(handle, filename); +@@ -1850,9 +1850,9 @@ static int write_options_v6(struct tracecmd_output *handle) + return 0; + } + +-static int update_options_start(struct tracecmd_output *handle, off64_t offset) ++static int update_options_start(struct tracecmd_output *handle, off_t offset) + { +- if (do_lseek(handle, handle->options_start, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, handle->options_start, SEEK_SET) == (off_t)-1) + return -1; + offset = convert_endian_8(handle, offset); + if (do_write_check(handle, &offset, 8)) +@@ -1875,7 +1875,7 @@ static int update_options_start(struct tracecmd_output *handle, off64_t offset) + * + * Returns zero on success and -1 on error. + */ +-int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int whence) ++int tracecmd_prepare_options(struct tracecmd_output *handle, off_t offset, int whence) + { + tsize_t curr; + int ret; +@@ -1895,7 +1895,7 @@ int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int + break; + case SEEK_END: + offset = do_lseek(handle, offset, SEEK_END); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + break; + } +@@ -2067,7 +2067,7 @@ __hidden void *trace_get_options(struct tracecmd_output *handle, size_t *len) + if (!buf) + goto out; + +- if (do_lseek(&out_handle, 0, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(&out_handle, 0, SEEK_SET) == (off_t)-1) + goto out; + *len = read(msg_handle.cfd, buf, offset); + if (*len != offset) { +@@ -2278,7 +2278,7 @@ int tracecmd_write_cmdlines(struct tracecmd_output *handle) + flags |= TRACECMD_SEC_FL_COMPRESS; + offset = out_write_section_header(handle, TRACECMD_OPTION_CMDLINES, + "command lines", flags, true); +- if (offset == (off64_t)-1) ++ if (offset == (off_t)-1) + return -1; + + out_compression_start(handle, compress); +@@ -2527,7 +2527,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle, + current = do_lseek(handle, 0, SEEK_CUR); + + /* Go to the option data, where will write the offest */ +- if (do_lseek(handle, b_offset, SEEK_SET) == (off64_t)-1) { ++ if (do_lseek(handle, b_offset, SEEK_SET) == (off_t)-1) { + tracecmd_warning("could not seek to %lld", b_offset); + return -1; + } +@@ -2536,7 +2536,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle, + return -1; + + /* Go back to end of file */ +- if (do_lseek(handle, current, SEEK_SET) == (off64_t)-1) { ++ if (do_lseek(handle, current, SEEK_SET) == (off_t)-1) { + tracecmd_warning("could not seek to %lld", offset); + return -1; + } +@@ -2660,7 +2660,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle, + data_files[i].data_offset &= ~(page_size - 1); + + ret = do_lseek(handle, data_files[i].data_offset, SEEK_SET); +- if (ret == (off64_t)-1) ++ if (ret == (off_t)-1) + goto out_free; + + if (!tracecmd_get_quiet(handle)) +@@ -2668,7 +2668,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle, + i, (unsigned long long)data_files[i].data_offset); + + if (data[i].size) { +- if (lseek64(data[i].fd, data[i].offset, SEEK_SET) == (off64_t)-1) ++ if (lseek(data[i].fd, data[i].offset, SEEK_SET) == (off_t)-1) + goto out_free; + read_size = out_copy_fd_compress(handle, data[i].fd, + data[i].size, &data_files[i].write_size, +@@ -2686,19 +2686,19 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle, + + if (!HAS_SECTIONS(handle)) { + /* Write the real CPU data offset in the file */ +- if (do_lseek(handle, data_files[i].file_data_offset, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, data_files[i].file_data_offset, SEEK_SET) == (off_t)-1) + goto out_free; + endian8 = convert_endian_8(handle, data_files[i].data_offset); + if (do_write_check(handle, &endian8, 8)) + goto out_free; + /* Write the real CPU data size in the file */ +- if (do_lseek(handle, data_files[i].file_write_size, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, data_files[i].file_write_size, SEEK_SET) == (off_t)-1) + goto out_free; + endian8 = convert_endian_8(handle, data_files[i].write_size); + if (do_write_check(handle, &endian8, 8)) + goto out_free; + offset = data_files[i].data_offset + data_files[i].write_size; +- if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, offset, SEEK_SET) == (off_t)-1) + goto out_free; + } + if (!tracecmd_get_quiet(handle)) { +@@ -2717,7 +2717,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle, + goto out_free; + + free(data_files); +- if (do_lseek(handle, 0, SEEK_END) == (off64_t)-1) ++ if (do_lseek(handle, 0, SEEK_END) == (off_t)-1) + return -1; + + if (out_update_section_header(handle, offset)) +@@ -2986,7 +2986,7 @@ __hidden int out_save_options_offset(struct tracecmd_output *handle, unsigned lo + return -1; + + new = do_lseek(handle, 0, SEEK_CUR); +- if (do_lseek(handle, handle->options_start, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, handle->options_start, SEEK_SET) == (off_t)-1) + return -1; + + en8 = convert_endian_8(handle, start); +@@ -2994,7 +2994,7 @@ __hidden int out_save_options_offset(struct tracecmd_output *handle, unsigned lo + return -1; + + handle->options_start = new; +- if (do_lseek(handle, new, SEEK_SET) == (off64_t)-1) ++ if (do_lseek(handle, new, SEEK_SET) == (off_t)-1) + return -1; + } else { + handle->options_start = start; +diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c +index 23499f30..c172ad64 100644 +--- a/lib/trace-cmd/trace-recorder.c ++++ b/lib/trace-cmd/trace-recorder.c +@@ -51,7 +51,7 @@ static int append_file(int size, int dst, int src) + char buf[size]; + int r; + +- lseek64(src, 0, SEEK_SET); ++ lseek(src, 0, SEEK_SET); + + /* If there's an error, then we are pretty much screwed :-p */ + do { +@@ -82,10 +82,10 @@ void tracecmd_free_recorder(struct tracecmd_recorder *recorder) + recorder->fd2, recorder->fd1); + /* Error on copying, then just keep fd1 */ + if (ret) { +- lseek64(recorder->fd1, 0, SEEK_END); ++ lseek(recorder->fd1, 0, SEEK_END); + goto close; + } +- lseek64(recorder->fd1, 0, SEEK_SET); ++ lseek(recorder->fd1, 0, SEEK_SET); + ftruncate(recorder->fd1, 0); + } + append_file(recorder->page_size, recorder->fd1, recorder->fd2); +@@ -305,7 +305,7 @@ static inline void update_fd(struct tracecmd_recorder *recorder, int size) + fd = recorder->fd1; + + /* Zero out the new file we are writing to */ +- lseek64(fd, 0, SEEK_SET); ++ lseek(fd, 0, SEEK_SET); + ftruncate(fd, 0); + + recorder->fd = fd; +diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c +index 22e3d871..11c1baf1 100644 +--- a/tracecmd/trace-dump.c ++++ b/tracecmd/trace-dump.c +@@ -101,7 +101,7 @@ static int do_lseek(int fd, int offset, int whence) + if (read_compress) + return tracecmd_compress_lseek(compress, offset, whence); + +- return lseek64(fd, offset, whence); ++ return lseek(fd, offset, whence); + } + + static int read_file_string(int fd, char *dst, int len) +@@ -446,7 +446,7 @@ static void dump_section_header(int fd, enum dump_items v, unsigned short *flags + const char *desc; + int desc_id; + +- offset = lseek64(fd, 0, SEEK_CUR); ++ offset = lseek(fd, 0, SEEK_CUR); + if (read_file_number(fd, &id, 2)) + die("cannot read the section id"); + +@@ -500,13 +500,13 @@ static void dump_option_buffer(int fd, unsigned short option, int size) + return; + } + +- current = lseek64(fd, 0, SEEK_CUR); +- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1) ++ current = lseek(fd, 0, SEEK_CUR); ++ if (lseek(fd, offset, SEEK_SET) == (off_t)-1) + die("cannot goto buffer offset %lld", offset); + + dump_section_header(fd, FLYRECORD, &flags); + +- if (lseek64(fd, current, SEEK_SET) == (off_t)-1) ++ if (lseek(fd, current, SEEK_SET) == (off_t)-1) + die("cannot go back to buffer option"); + + do_print(OPTIONS|FLYRECORD, "\t\t[Option BUFFER, %d bytes]\n", size); +@@ -773,7 +773,7 @@ static void dump_sections(int fd, int count) + unsigned short flags; + + while (sec) { +- if (lseek64(fd, sec->offset, SEEK_SET) == (off_t)-1) ++ if (lseek(fd, sec->offset, SEEK_SET) == (off_t)-1) + die("cannot goto option offset %lld", sec->offset); + + dump_section_header(fd, sec->verbosity, &flags); +@@ -826,7 +826,7 @@ static int dump_option_done(int fd, int size) + if (!offset) + return 0; + +- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(fd, offset, SEEK_SET) == (off_t)-1) + die("cannot goto next options offset %lld", offset); + + do_print(OPTIONS, "\n\n"); +@@ -1006,7 +1006,7 @@ static void dump_therest(int fd) + else if (strncmp(str, HEAD_FLYRECORD, 10) == 0) + dump_flyrecord(fd); + else { +- lseek64(fd, -10, SEEK_CUR); ++ lseek(fd, -10, SEEK_CUR); + break; + } + } +@@ -1060,7 +1060,7 @@ static void get_meta_strings(int fd) + unsigned short fl, id; + int desc_id; + +- offset = lseek64(fd, 0, SEEK_CUR); ++ offset = lseek(fd, 0, SEEK_CUR); + do { + if (read_file_number(fd, &id, 2)) + break; +@@ -1074,7 +1074,7 @@ static void get_meta_strings(int fd) + if ((fl & TRACECMD_SEC_FL_COMPRESS)) { + read_file_number(fd, &csize, 4); + read_file_number(fd, &rsize, 4); +- lseek64(fd, -8, SEEK_CUR); ++ lseek(fd, -8, SEEK_CUR); + if (uncompress_block()) + break; + } else { +@@ -1083,12 +1083,12 @@ static void get_meta_strings(int fd) + read_metadata_strings(fd, rsize); + uncompress_reset(); + } else { +- if (lseek64(fd, size, SEEK_CUR) == (off_t)-1) ++ if (lseek(fd, size, SEEK_CUR) == (off_t)-1) + break; + } + } while (1); + +- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(fd, offset, SEEK_SET) == (off_t)-1) + die("cannot restore the original file location"); + } + +@@ -1102,9 +1102,9 @@ static int walk_v7_sections(int fd) + int desc_id; + const char *desc; + +- offset = lseek64(fd, 0, SEEK_CUR); ++ offset = lseek(fd, 0, SEEK_CUR); + do { +- soffset = lseek64(fd, 0, SEEK_CUR); ++ soffset = lseek(fd, 0, SEEK_CUR); + if (read_file_number(fd, &id, 2)) + break; + +@@ -1149,11 +1149,11 @@ static int walk_v7_sections(int fd) + id, soffset, desc, fl, size); + } + +- if (lseek64(fd, size, SEEK_CUR) == (off_t)-1) ++ if (lseek(fd, size, SEEK_CUR) == (off_t)-1) + break; + } while (1); + +- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(fd, offset, SEEK_SET) == (off_t)-1) + die("cannot restore the original file location"); + + return count; +@@ -1170,7 +1170,7 @@ static void dump_v7_file(int fd) + get_meta_strings(fd); + sections = walk_v7_sections(fd); + +- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1) ++ if (lseek(fd, offset, SEEK_SET) == (off_t)-1) + die("cannot goto options offset %lld", offset); + + dump_options(fd); +diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c +index 224a6dde..c094ad6a 100644 +--- a/tracecmd/trace-read.c ++++ b/tracecmd/trace-read.c +@@ -195,7 +195,7 @@ static void print_event(struct trace_seq *s, struct tracecmd_input *handle, + #define TEST_READ_AT 0 + #if TEST_READ_AT + #define DO_TEST +-static off64_t test_read_at_offset; ++static off_t test_read_at_offset; + static int test_read_at_copy = 100; + static int test_read_at_index; + static void show_test(struct tracecmd_input *handle) +-- +2.39.0 + diff --git a/meta-oe/recipes-kernel/trace-cmd/files/0001-trace-cmd-make-it-build-with-musl.patch b/meta-oe/recipes-kernel/trace-cmd/files/0001-trace-cmd-make-it-build-with-musl.patch deleted file mode 100644 index 220991804b..0000000000 --- a/meta-oe/recipes-kernel/trace-cmd/files/0001-trace-cmd-make-it-build-with-musl.patch +++ /dev/null @@ -1,132 +0,0 @@ -From b63f13d2df91ede45288653b21e0d30a6b45f2ac Mon Sep 17 00:00:00 2001 -From: Beniamin Sandu <beniaminsandu@gmail.com> -Date: Mon, 30 Nov 2020 18:24:48 +0200 -Subject: [PATCH] trace-cmd: make it build with musl - -Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com> ---- - include/trace-cmd/trace-cmd.h | 1 + - lib/trace-cmd/trace-msg.c | 1 + - lib/trace-cmd/trace-plugin.c | 2 ++ - lib/tracefs/tracefs-events.c | 1 + - tracecmd/trace-agent.c | 1 + - tracecmd/trace-setup-guest.c | 1 + - tracecmd/trace-tsync.c | 15 ++++++++++----- - 7 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h -index f3c95f3..a697905 100644 ---- a/include/trace-cmd/trace-cmd.h -+++ b/include/trace-cmd/trace-cmd.h -@@ -6,6 +6,7 @@ - #ifndef _TRACE_CMD_H - #define _TRACE_CMD_H - -+#include <sys/types.h> - #include "traceevent/event-parse.h" - - #define TRACECMD_MAGIC { 23, 8, 68 } -diff --git a/lib/trace-cmd/trace-msg.c b/lib/trace-cmd/trace-msg.c -index 4a0bfa9..fc1f2c7 100644 ---- a/lib/trace-cmd/trace-msg.c -+++ b/lib/trace-cmd/trace-msg.c -@@ -21,6 +21,7 @@ - #include <arpa/inet.h> - #include <sys/types.h> - #include <linux/types.h> -+#include <byteswap.h> - - #include "trace-write-local.h" - #include "trace-cmd-local.h" -diff --git a/lib/trace-cmd/trace-plugin.c b/lib/trace-cmd/trace-plugin.c -index 92f9edf..c2ef3dc 100644 ---- a/lib/trace-cmd/trace-plugin.c -+++ b/lib/trace-cmd/trace-plugin.c -@@ -8,6 +8,8 @@ - #include <dlfcn.h> - #include <sys/stat.h> - #include <libgen.h> -+#include <limits.h> -+ - #include "trace-cmd.h" - #include "trace-local.h" - -diff --git a/lib/tracefs/tracefs-events.c b/lib/tracefs/tracefs-events.c -index 8e825f5..a8d8560 100644 ---- a/lib/tracefs/tracefs-events.c -+++ b/lib/tracefs/tracefs-events.c -@@ -13,6 +13,7 @@ - #include <errno.h> - #include <sys/stat.h> - #include <fcntl.h> -+#include <limits.h> - - #include "kbuffer.h" - #include "tracefs.h" -diff --git a/tracecmd/trace-agent.c b/tracecmd/trace-agent.c -index b581696..abfefac 100644 ---- a/tracecmd/trace-agent.c -+++ b/tracecmd/trace-agent.c -@@ -20,6 +20,7 @@ - #include <unistd.h> - #include <linux/vm_sockets.h> - #include <pthread.h> -+#include <limits.h> - - #include "trace-local.h" - #include "trace-msg.h" -diff --git a/tracecmd/trace-setup-guest.c b/tracecmd/trace-setup-guest.c -index 899848c..99595a1 100644 ---- a/tracecmd/trace-setup-guest.c -+++ b/tracecmd/trace-setup-guest.c -@@ -13,6 +13,7 @@ - #include <string.h> - #include <sys/stat.h> - #include <unistd.h> -+#include <limits.h> - - #include "trace-local.h" - #include "trace-msg.h" -diff --git a/tracecmd/trace-tsync.c b/tracecmd/trace-tsync.c -index e639788..b8b5ac3 100644 ---- a/tracecmd/trace-tsync.c -+++ b/tracecmd/trace-tsync.c -@@ -104,13 +104,15 @@ int tracecmd_host_tsync(struct buffer_instance *instance, - - pthread_attr_init(&attrib); - pthread_attr_setdetachstate(&attrib, PTHREAD_CREATE_JOINABLE); -- if (!get_first_cpu(&pin_mask, &mask_size)) -- pthread_attr_setaffinity_np(&attrib, mask_size, pin_mask); - - ret = pthread_create(&instance->tsync_thread, &attrib, - tsync_host_thread, &instance->tsync); -- if (!ret) -+ if (!ret) { -+ if (!get_first_cpu(&pin_mask, &mask_size)) -+ pthread_setaffinity_np(instance->tsync_thread, mask_size, pin_mask); - instance->tsync_thread_running = true; -+ } -+ - if (pin_mask) - CPU_FREE(pin_mask); - pthread_attr_destroy(&attrib); -@@ -243,11 +245,14 @@ unsigned int tracecmd_guest_tsync(char *tsync_protos, - pthread_attr_init(&attrib); - tsync->sync_proto = proto; - pthread_attr_setdetachstate(&attrib, PTHREAD_CREATE_JOINABLE); -- if (!get_first_cpu(&pin_mask, &mask_size)) -- pthread_attr_setaffinity_np(&attrib, mask_size, pin_mask); - - ret = pthread_create(thr_id, &attrib, tsync_agent_thread, tsync); - -+ if (!ret) { -+ if (!get_first_cpu(&pin_mask, &mask_size)) -+ pthread_setaffinity_np(*thr_id, mask_size, pin_mask); -+ } -+ - if (pin_mask) - CPU_FREE(pin_mask); - pthread_attr_destroy(&attrib); --- -2.25.1 - diff --git a/meta-oe/recipes-kernel/trace-cmd/files/0002-Drop-using-_LARGEFILE64_SOURCE.patch b/meta-oe/recipes-kernel/trace-cmd/files/0002-Drop-using-_LARGEFILE64_SOURCE.patch new file mode 100644 index 0000000000..7b2ea79eb3 --- /dev/null +++ b/meta-oe/recipes-kernel/trace-cmd/files/0002-Drop-using-_LARGEFILE64_SOURCE.patch @@ -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 + diff --git a/meta-oe/recipes-kernel/trace-cmd/trace-cmd_2.9.1.bb b/meta-oe/recipes-kernel/trace-cmd/trace-cmd_2.9.1.bb deleted file mode 100644 index d39afff8e4..0000000000 --- a/meta-oe/recipes-kernel/trace-cmd/trace-cmd_2.9.1.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "User-space front-end command-line tool for ftrace" - -LICENSE = "GPLv2 & LGPLv2.1" -LIC_FILES_CHKSUM = "file://COPYING;md5=873f48a813bded3de6ebc54e6880c4ac" - -SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git;branch=master \ - file://0001-trace-cmd-make-it-build-with-musl.patch" - -SRCREV = "530b1a0caef39466e16bbd49de5afef89656f03f" - -S = "${WORKDIR}/git" - -do_install() { - oe_runmake etcdir=${sysconfdir} DESTDIR=${D} install -} - -FILES_${PN} += "${libdir}/traceevent/plugins" diff --git a/meta-oe/recipes-kernel/trace-cmd/trace-cmd_3.1.5.bb b/meta-oe/recipes-kernel/trace-cmd/trace-cmd_3.1.5.bb new file mode 100644 index 0000000000..11c4037b23 --- /dev/null +++ b/meta-oe/recipes-kernel/trace-cmd/trace-cmd_3.1.5.bb @@ -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} +} diff --git a/meta-oe/recipes-kernel/turbostat/turbostat_3.4.bb b/meta-oe/recipes-kernel/turbostat/turbostat_3.4.bb index 48c72140c8..bdc37c0382 100644 --- a/meta-oe/recipes-kernel/turbostat/turbostat_3.4.bb +++ b/meta-oe/recipes-kernel/turbostat/turbostat_3.4.bb @@ -11,10 +11,10 @@ DESCRIPTION = "The turbostat tool allows you to determine the actual \ processor frequency and idle power saving state residency on supported \ processors." -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://../COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux' -COMPATIBLE_HOST_libc-musl = "null" +COMPATIBLE_HOST:libc-musl = "null" SRC_URI += "\ file://COPYING \ @@ -38,7 +38,7 @@ EXTRA_OEMAKE = '\ # do_configure() is invoked so we can safely copy from it. # do_configure[depends] += "virtual/kernel:do_shared_workdir" -do_configure_prepend() { +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} diff --git a/meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb b/meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb new file mode 100644 index 0000000000..e7e4ca50af --- /dev/null +++ b/meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb @@ -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]) +}
\ No newline at end of file |