summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiwei Song <liwei.song@windriver.com>2019-04-08 04:26:20 -0400
committerKhem Raj <raj.khem@gmail.com>2019-04-09 21:33:39 -0700
commita12a37659db90a5534349f81fbe3744431f75b1d (patch)
treeb907dc1f24005d6b651937907ebf1bb59d36f12e
parentd219ba7a28e0f906df7ff5de20d8185fce31ed67 (diff)
downloadmeta-openembedded-a12a37659db90a5534349f81fbe3744431f75b1d.tar.gz
ledmon: control hard disk led for RAID arrays
Enable LED support for Intel Virtual RAID On CPU. Fix build with musl Signed-off-by: Liwei Song <liwei.song@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-bsp/ledmon/ledmon/0001-use-atexit-insead-of-on_exit-for-musl-compatibility.patch53
-rw-r--r--meta-oe/recipes-bsp/ledmon/ledmon/0002-include-sys-select.h-and-sys-types.h.patch43
-rw-r--r--meta-oe/recipes-bsp/ledmon/ledmon_git.bb34
3 files changed, 130 insertions, 0 deletions
diff --git a/meta-oe/recipes-bsp/ledmon/ledmon/0001-use-atexit-insead-of-on_exit-for-musl-compatibility.patch b/meta-oe/recipes-bsp/ledmon/ledmon/0001-use-atexit-insead-of-on_exit-for-musl-compatibility.patch
new file mode 100644
index 000000000..de5ce9fc8
--- /dev/null
+++ b/meta-oe/recipes-bsp/ledmon/ledmon/0001-use-atexit-insead-of-on_exit-for-musl-compatibility.patch
@@ -0,0 +1,53 @@
1From 8aba09b743b4e89ef581a679943ce39a5c7fd4a5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 9 Apr 2019 21:25:21 -0700
4Subject: [PATCH 1/2] use atexit insead of on_exit for musl compatibility
5
6musl does not support on_exit which is used in clean up.
7Instead use atexit with is supported by musl and glibc.
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/ledctl.c | 2 +-
13 src/ledmon.c | 4 ++--
14 2 files changed, 3 insertions(+), 3 deletions(-)
15
16diff --git a/src/ledctl.c b/src/ledctl.c
17index 2aa1abc..2c97dcf 100644
18--- a/src/ledctl.c
19+++ b/src/ledctl.c
20@@ -689,7 +689,7 @@ int main(int argc, char *argv[])
21 status = _init_ledctl_conf();
22 if (status != STATUS_SUCCESS)
23 return status;
24- if (on_exit(_ledctl_fini, progname))
25+ if (atexit(_ledctl_fini))
26 exit(STATUS_ONEXIT_ERROR);
27 if (_cmdline_parse(argc, argv))
28 exit(STATUS_CMDLINE_ERROR);
29diff --git a/src/ledmon.c b/src/ledmon.c
30index 0ea2583..2333c7c 100644
31--- a/src/ledmon.c
32+++ b/src/ledmon.c
33@@ -860,7 +860,7 @@ int main(int argc, char *argv[])
34 set_invocation_name(argv[0]);
35 openlog(progname, LOG_PID | LOG_PERROR, LOG_DAEMON);
36
37- if (on_exit(_ledmon_status, &terminate))
38+ if (atexit(_ledmon_status))
39 return STATUS_ONEXIT_ERROR;
40
41 if (_cmdline_parse_non_daemonise(argc, argv) != STATUS_SUCCESS)
42@@ -930,7 +930,7 @@ int main(int argc, char *argv[])
43 }
44 _ledmon_setup_signals();
45
46- if (on_exit(_ledmon_fini, progname))
47+ if (atexit(_ledmon_fini))
48 exit(STATUS_ONEXIT_ERROR);
49 list_init(&ledmon_block_list, (item_free_t)block_device_fini);
50 sysfs_init();
51--
522.21.0
53
diff --git a/meta-oe/recipes-bsp/ledmon/ledmon/0002-include-sys-select.h-and-sys-types.h.patch b/meta-oe/recipes-bsp/ledmon/ledmon/0002-include-sys-select.h-and-sys-types.h.patch
new file mode 100644
index 000000000..75bf2b4f5
--- /dev/null
+++ b/meta-oe/recipes-bsp/ledmon/ledmon/0002-include-sys-select.h-and-sys-types.h.patch
@@ -0,0 +1,43 @@
1From 2ee8796db5019341b774bcb4f7d0944d89e1845b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 9 Apr 2019 21:26:55 -0700
4Subject: [PATCH 2/2] include sys/select.h and sys/types.h
5
6sys/select.h is needed to provide fd_set definition
7sys/types.h is needed for ssize_t
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 src/dellssd.c | 1 +
14 src/utils.h | 1 +
15 2 files changed, 2 insertions(+)
16
17diff --git a/src/dellssd.c b/src/dellssd.c
18index 7b8d431..e97fe45 100644
19--- a/src/dellssd.c
20+++ b/src/dellssd.c
21@@ -27,6 +27,7 @@
22 #include <unistd.h>
23
24 #include <sys/ioctl.h>
25+#include <sys/select.h>
26 #include <linux/ipmi.h>
27
28 #if _HAVE_DMALLOC_H
29diff --git a/src/utils.h b/src/utils.h
30index 720447a..c106529 100644
31--- a/src/utils.h
32+++ b/src/utils.h
33@@ -21,6 +21,7 @@
34 #define _UTILS_H_INCLUDED_
35
36 #include <getopt.h>
37+#include <sys/types.h>
38 #include "config_file.h"
39 #include "stdlib.h"
40 #include "stdint.h"
41--
422.21.0
43
diff --git a/meta-oe/recipes-bsp/ledmon/ledmon_git.bb b/meta-oe/recipes-bsp/ledmon/ledmon_git.bb
new file mode 100644
index 000000000..4376ad394
--- /dev/null
+++ b/meta-oe/recipes-bsp/ledmon/ledmon_git.bb
@@ -0,0 +1,34 @@
1SUMMARY = "Intel(R) Enclosure LED Utilities"
2
3DESCRIPTION = "The utilities are designed primarily to be used on storage servers \
4 utilizing MD devices (aka Linux Software RAID) for RAID arrays.\
5"
6HOMEPAGE = "https://github.com/intel/ledmon"
7
8LICENSE = "GPLv2"
9LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
10"
11
12DEPENDS = "sg3-utils udev"
13
14inherit systemd
15
16SYSTEMD_SERVICE_${PN} = "ledmon.service"
17
18SRC_URI = "git://github.com/intel/ledmon;branch=master \
19 file://0001-use-atexit-insead-of-on_exit-for-musl-compatibility.patch \
20 file://0002-include-sys-select.h-and-sys-types.h.patch \
21 "
22
23SRCREV = "ad1304ca1363d727425a1f23703c523e21feae4f"
24
25COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
26
27S = "${WORKDIR}/git"
28EXTRA_OEMAKE = "CC='${CC}' LDFLAGS='${LDFLAGS}' CFLAGS='${CFLAGS}'"
29
30do_install_append() {
31 install -d ${D}/${systemd_unitdir}/system
32 oe_runmake DESTDIR=${D} install
33 oe_runmake DESTDIR=${D}${systemd_unitdir}/system install-systemd
34}