Skip to contentSkip to conversation

mce-inject: add recipe

PATCH New [email protected] 1 participant 2 messages Dec 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mce-inject: add recipe

From: Kai Kang <[email protected]>

Add recipe of mce-inject which is required to run mcelog ptest cases.

---
 meta-oe/recipes-support/mcelog/mce-inject_git.bb | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 meta-oe/recipes-support/mcelog/mce-inject_git.bb
meta-oe/recipes-support/mcelog/mce-inject_git.bb new file +20 -0
new file mode 100644
index 0000000..f876144
@@ -0,0 +1,20 @@
+SUMMARY = "Linux machine check injector tool"
+DESCRIPTION = "mce-inject allows to inject machine check errors on the \
+software level into a running Linux kernel. This is intended for \
+validation of the kernel machine check handler."
+SECTION = "System Environment/Base"
+
+SRC_URI = "git://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git"
+
+SRCREV = "4cbe46321b4a81365ff3aafafe63967264dbfec5"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://README;beginline=30;md5=94c18755082a2da9c9cf97cba3ad47d6"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'
+
+inherit autotools-brokensep
+
+EXTRA_OEMAKE = "destdir=${D}"
Signature · 1 line
2.6.1
#1 lore raw

PATCH 2/2 mcelog: remove bashism and create ptest subpackage

From: Kai Kang <[email protected]>

Create ptest subpackage. Add a patch to remove bashism and then only ptest package depends on bash.

Inherit autotools-brokensep and re-write do_install as well.

---
 .../mcelog/mcelog/mcelog-debash.patch              | 36 ++++++++++++++++++++++
 meta-oe/recipes-support/mcelog/mcelog/run-ptest    |  3 ++
 meta-oe/recipes-support/mcelog/mcelog_1.09.bb      | 32 ++++++++++++-------
 3 files changed, 60 insertions(+), 11 deletions(-)
 create mode 100644 meta-oe/recipes-support/mcelog/mcelog/mcelog-debash.patch
 create mode 100644 meta-oe/recipes-support/mcelog/mcelog/run-ptest
meta-oe/recipes-support/mcelog/mcelog/mcelog-debash.patch new file +36 -0
new file mode 100644
index 0000000..bea2f62
@@ -0,0 +1,36 @@
+From 8f57d35747a3b3fabc33466563077373090f869c Mon Sep 17 00:00:00 2001
+From: Robert Yang <[email protected]>
+Date: Tue, 2 Sep 2014 07:05:15 -0700
+Subject: [PATCH] cache-error-trigger: remove bashism
+
+Use "$(cat $F)" to instead of "$(< $F)" to debash.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <[email protected]>
+---
+ triggers/cache-error-trigger |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/triggers/cache-error-trigger b/triggers/cache-error-trigger
+index e32bfd6..785526f 100755
+--- a/triggers/cache-error-trigger
++++ b/triggers/cache-error-trigger
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # cache error trigger. This shell script is executed by mcelog in daemon mode
+ # when a CPU reports excessive corrected cache errors. This could be a indication
+ # for future uncorrected errors.
+@@ -28,7 +28,7 @@ for i in $AFFECTED_CPUS ; do
+ 	logger -s -p daemon.crit -t mcelog "Offlining CPU $i due to cache error threshold"
+ 	F=$(printf "/sys/devices/system/cpu/cpu%d/online" $i)
+ 	echo 0 > $F
+-	if [ "$(< $F)" != "0" ] ; then
++	if [ "$(cat $F)" != "0" ] ; then
+ 		logger -s -p daemon.warn -t mcelog "Offlining CPU $i failed"
+ 		EXIT=1
+ 	fi
+-- 
+1.7.9.5
+
meta-oe/recipes-support/mcelog/mcelog/run-ptest new file +3 -0
new file mode 100644
index 0000000..ba7a2c7
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+make -C tests test
meta-oe/recipes-support/mcelog/mcelog_1.09.bb +21 -11
index 34ff643..542b2ba 100644
@@ -4,23 +4,33 @@ and 64bit Linux kernels (since early 2.6 kernel releases) to log machine checks
 and should run on all Linux systems that need error handling."
 HOMEPAGE = "http://mcelog.org/"
 SECTION = "System Environment/Base"
-DEPENDS += "bash"
-SRC_URI = "git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git"
+
+SRC_URI = "git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git \
+    file://mcelog-debash.patch \
+    file://run-ptest \
+"
+
 SRCREV = "0fc9f702232cb2d9969916f899c67c3e64deedda"
+
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://README;md5=3eb76ca64fa07ad53ebb0ebb5b4c8ede"
 
 S = "${WORKDIR}/git"
 
-do_install() {
-    install -d ${D}/${sbindir}
-    install -m 0755 ${S}/mcelog ${D}/${sbindir}
-    install -d ${D}/${mandir}/man8
-    install -m 0644 ${S}/mcelog.8 ${D}/${mandir}/man8/
-    install -d ${D}/etc/cron.hourly
-    install -m 0755 ${S}/mcelog.cron ${D}/etc/cron.hourly/
-}
+inherit autotools-brokensep ptest
 
 COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'
 
-RDEPENDS_${PN} = "bash"
+do_install_append() {
+    install -d ${D}${sysconfdir}/cron.hourly
+    install -m 0755 ${S}/mcelog.cron ${D}${sysconfdir}/cron.hourly/
+    sed -i 's/bash/sh/' ${D}${sysconfdir}/cron.hourly/mcelog.cron
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}
+    cp -r ${S}/tests ${S}/input ${D}${PTEST_PATH}
+    sed -i 's#../../mcelog#mcelog#' ${D}${PTEST_PATH}/tests/test
+}
+
+RDEPENDS_${PN}-ptest += "${PN} make bash mce-inject"
Signature · 1 line
2.6.1