summaryrefslogtreecommitdiffstats
path: root/poky/meta/recipes-extended/mdadm
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/recipes-extended/mdadm')
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch44
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch31
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch48
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0001-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch37
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch43
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch75
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0003-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch59
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0004-mdadm-Forced-type-conversion-to-avoid-truncation.patch33
-rw-r--r--poky/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch128
-rw-r--r--poky/meta/recipes-extended/mdadm/files/gcc-4.9.patch22
-rw-r--r--poky/meta/recipes-extended/mdadm/files/mdadm-3.3.2_x32_abi_time_t.patch25
-rw-r--r--poky/meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-errors.patch45
-rw-r--r--poky/meta/recipes-extended/mdadm/files/run-ptest10
-rw-r--r--poky/meta/recipes-extended/mdadm/mdadm_4.0.bb78
14 files changed, 678 insertions, 0 deletions
diff --git a/poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch b/poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch
new file mode 100644
index 000000000..a89161404
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch
@@ -0,0 +1,44 @@
+From 1f5baf3ad95ae4c39efe4d8ad8b2e642b3a351da Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Tue, 9 Feb 2016 11:44:01 +0200
+Subject: [PATCH] Fix the path of corosync and dlm header files check
+
+Original Makefile will check headers on host instead of sysroot.
+Fix it.
+
+Upstream-Status: Inappropriate [Yocto specific]
+
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
+---
+mdadm only works with corosync 2.x which provides header file corosync/cmap.h.
+If build mdadm with corosync 1.x, it fails with:
+
+| member.c:12:27: fatal error: corosync/cmap.h: No such file or directory
+| #include <corosync/cmap.h>
+| ^
+
+Build with corosync only header file corosync/cmap.h exists.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index fd79cfb..34150a9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -80,8 +80,8 @@ MDMON_DIR = $(RUN_DIR)
+ FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
+ SYSTEMD_DIR=/lib/systemd/system
+
+-COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
+-DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)
++COROSYNC:=$(shell [ -f $(SYSROOT)/usr/include/corosync/cmap.h ] || echo -DNO_COROSYNC)
++DLM:=$(shell [ -f $(SYSROOT)/usr/include/libdlm.h ] || echo -DNO_DLM)
+
+ DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
+ DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
+--
+2.4.0
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch b/poky/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch
new file mode 100644
index 000000000..a4b7b8acd
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch
@@ -0,0 +1,31 @@
+From a129ee6d80f3b2cda0d827c35fa81a517cf6d505 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 13 Oct 2017 10:27:34 -0700
+Subject: [PATCH] Use CC to check for implicit-fallthrough warning support
+
+This warning it new in gcc7 and in cross compile case
+its possible that build host gcc is version 7+ but the
+cross compile used for compiling mdadm is < version 7
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index d207ee4..971f255 100644
+--- a/Makefile
++++ b/Makefile
+@@ -48,7 +48,7 @@ ifdef WARN_UNUSED
+ CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
+ endif
+
+-FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
++FALLTHROUGH := $(shell ${CC} -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
+ ifneq "$(FALLTHROUGH)" "0"
+ CWFLAGS += -Wimplicit-fallthrough=0
+ endif
+--
+2.14.2
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch b/poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
new file mode 100644
index 000000000..acd64ada2
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
@@ -0,0 +1,48 @@
+From 943616e5dffb79f307e4bd9b249d316212998750 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 18 Dec 2016 08:30:51 +0000
+Subject: [PATCH] include <sys/sysmacros.h> for major/minor defintions
+
+glibc 2.25 is warning about it if applications depend on
+sys/types.h for these macros, it expects to be included
+from <sys/sysmacros.h>
+
+Fixes
+| Grow.c:3534:13: error: In the GNU C Library, "minor" is defined
+| by <sys/sysmacros.h>. For historical compatibility, it is
+| currently defined by <sys/types.h> as well, but we plan to
+| remove this soon. To use "minor", include <sys/sysmacros.h>
+| directly. If you did not intend to use a system-defined macro
+| "minor", you should undefine it after including <sys/types.h>. [-Werror]
+| Query.c: In function 'Query':
+| Query.c:105:13: error: In the GNU C Library, "makedev" is defined
+| by <sys/sysmacros.h>. For historical compatibility, it is
+| currently defined by <sys/types.h> as well, but we plan to
+| remove this soon. To use "makedev", include <sys/sysmacros.h>
+| directly. If you did not intend to use a system-defined macro
+| "makedev", you should undefine it after including <sys/types.h>. [-Werror]
+| makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
+| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ mdadm.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/mdadm.h b/mdadm.h
+index 8c8f4d1..3ce13b5 100755
+--- a/mdadm.h
++++ b/mdadm.h
+@@ -34,6 +34,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
+ #endif
+
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <sys/stat.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+--
+1.9.1
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0001-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch b/poky/meta/recipes-extended/mdadm/files/0001-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
new file mode 100644
index 000000000..ce15170c7
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0001-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
@@ -0,0 +1,37 @@
+From aa09af0fe2ec0737fa04ffd00957532684e257b9 Mon Sep 17 00:00:00 2001
+From: Xiao Ni <xni@redhat.com>
+Date: Fri, 17 Mar 2017 19:55:42 +0800
+Subject: [PATCH 1/5] mdadm: Add Wimplicit-fallthrough=0 in Makefile
+
+There are many errors like 'error: this statement may fall through'.
+But the logic is right. So add the flag Wimplicit-fallthrough=0
+to disable the error messages. The method I use is from
+https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+#index-Wimplicit-fallthrough-375
+
+Signed-off-by: Xiao Ni <xni@redhat.com>
+Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
+---
+Upstream-Status: Backport
+ Makefile | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 0f307ec..e1a7058 100644
+--- a/Makefile
++++ b/Makefile
+@@ -48,6 +48,11 @@ ifdef WARN_UNUSED
+ CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
+ endif
+
++FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
++ifneq "$(FALLTHROUGH)" "0"
++CWFLAGS += -Wimplicit-fallthrough=0
++endif
++
+ ifdef DEBIAN
+ CPPFLAGS += -DDEBIAN
+ endif
+--
+2.12.2
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch b/poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch
new file mode 100644
index 000000000..4cf809290
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch
@@ -0,0 +1,43 @@
+From 6d369e8f226594632ce4260129509daf7030de0a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 9 May 2016 22:03:57 +0000
+Subject: [PATCH] mdadm.h: Undefine dprintf before redefining
+
+dprintf is also defined in libc see
+usr/include/bits/stdio2.h, this comes into
+play especially when fortify sources is enabled
+and compilers like clang reports the override
+
+In file included from policy.c:25:
+./mdadm.h:1562:9: error: 'dprintf' macro redefined [-Werror,-Wmacro-redefined]
+ ^
+/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/qemux86/usr/include/bits/stdio2.h:145:12: note: previous definition is here
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ mdadm.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/mdadm.h b/mdadm.h
+index 230e60f..8c8f4d1 100755
+--- a/mdadm.h
++++ b/mdadm.h
+@@ -1554,11 +1554,13 @@ static inline char *to_subarray(struct mdstat_ent *ent, char *container)
+ }
+
+ #ifdef DEBUG
++#undef dprintf
+ #define dprintf(fmt, arg...) \
+ fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg)
+ #define dprintf_cont(fmt, arg...) \
+ fprintf(stderr, fmt, ##arg)
+ #else
++#undef dprintf
+ #define dprintf(fmt, arg...) \
+ ({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; })
+ #define dprintf_cont(fmt, arg...) \
+--
+1.9.1
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch b/poky/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch
new file mode 100644
index 000000000..cbce053a3
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch
@@ -0,0 +1,75 @@
+From bb4df273041ba206008bdb0ada75ccd97c29f623 Mon Sep 17 00:00:00 2001
+From: Xiao Ni <xni@redhat.com>
+Date: Fri, 17 Mar 2017 19:55:43 +0800
+Subject: [PATCH 2/5] mdadm: Specify enough length when write to buffer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In Detail.c the buffer path in function Detail is defined as path[200],
+in fact the max lenth of content which needs to write to the buffer is
+287. Because the length of dname of struct dirent is 255.
+During building it reports error:
+error: ‘%s’ directive writing up to 255 bytes into a region of size 189
+[-Werror=format-overflow=]
+
+In function examine_super0 there is a buffer nb with length 5.
+But it need to show a int type argument. The lenght of max
+number of int is 10. So the buffer length should be 11.
+
+In human_size function the length of buf is 30. During building
+there is a error:
+output between 20 and 47 bytes into a destination of size 30.
+Change the length to 47.
+
+Signed-off-by: Xiao Ni <xni@redhat.com>
+Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
+---
+Upstream-Status: Backport
+ Detail.c | 2 +-
+ super0.c | 2 +-
+ util.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Detail.c b/Detail.c
+index 509b0d4..cb33794 100644
+--- a/Detail.c
++++ b/Detail.c
+@@ -575,7 +575,7 @@ This is pretty boring
+ printf(" Member Arrays :");
+
+ while (dir && (de = readdir(dir)) != NULL) {
+- char path[200];
++ char path[287];
+ char vbuf[1024];
+ int nlen = strlen(sra->sys_name);
+ dev_t devid;
+diff --git a/super0.c b/super0.c
+index 938cfd9..f5b4507 100644
+--- a/super0.c
++++ b/super0.c
+@@ -231,7 +231,7 @@ static void examine_super0(struct supertype *st, char *homehost)
+ d++) {
+ mdp_disk_t *dp;
+ char *dv;
+- char nb[5];
++ char nb[11];
+ int wonly, failfast;
+ if (d>=0) dp = &sb->disks[d];
+ else dp = &sb->this_disk;
+diff --git a/util.c b/util.c
+index f100972..32bd909 100644
+--- a/util.c
++++ b/util.c
+@@ -811,7 +811,7 @@ unsigned long calc_csum(void *super, int bytes)
+ #ifndef MDASSEMBLE
+ char *human_size(long long bytes)
+ {
+- static char buf[30];
++ static char buf[47];
+
+ /* We convert bytes to either centi-M{ega,ibi}bytes or
+ * centi-G{igi,ibi}bytes, with appropriate rounding,
+--
+2.12.2
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0003-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch b/poky/meta/recipes-extended/mdadm/files/0003-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch
new file mode 100644
index 000000000..dcec84ffc
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0003-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch
@@ -0,0 +1,59 @@
+From bc87af1314325b00c6ac002a60a2b0f0caa81e34 Mon Sep 17 00:00:00 2001
+From: Xiao Ni <xni@redhat.com>
+Date: Sat, 18 Mar 2017 10:33:44 +0800
+Subject: [PATCH 3/5] Replace snprintf with strncpy at some places to avoid
+ truncation
+
+In gcc7 there are some building errors like:
+directive output may be truncated writing up to 31 bytes into a region of size 24
+snprintf(str, MPB_SIG_LEN, %s, mpb->sig);
+
+It just need to copy one string to target. So use strncpy to replace it.
+
+For this line code: snprintf(str, MPB_SIG_LEN, %s, mpb->sig);
+Because mpb->sig has the content of version after magic, so
+it's better to use strncpy to replace snprintf too.
+
+Signed-off-by: Xiao Ni <xni@redhat.com>
+Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
+---
+Upstream-Status: Backport
+ super-intel.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/super-intel.c b/super-intel.c
+index 57c7e75..5499098 100644
+--- a/super-intel.c
++++ b/super-intel.c
+@@ -1811,7 +1811,8 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
+ __u32 reserved = imsm_reserved_sectors(super, super->disks);
+ struct dl *dl;
+
+- snprintf(str, MPB_SIG_LEN, "%s", mpb->sig);
++ strncpy(str, (char *)mpb->sig, MPB_SIG_LEN);
++ str[MPB_SIG_LEN-1] = '\0';
+ printf(" Magic : %s\n", str);
+ snprintf(str, strlen(MPB_VERSION_RAID0), "%s", get_imsm_version(mpb));
+ printf(" Version : %s\n", get_imsm_version(mpb));
+@@ -7142,14 +7143,16 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
+
+ u->type = update_rename_array;
+ u->dev_idx = vol;
+- snprintf((char *) u->name, MAX_RAID_SERIAL_LEN, "%s", name);
++ strncpy((char *) u->name, name, MAX_RAID_SERIAL_LEN);
++ u->name[MAX_RAID_SERIAL_LEN-1] = '\0';
+ append_metadata_update(st, u, sizeof(*u));
+ } else {
+ struct imsm_dev *dev;
+ int i;
+
+ dev = get_imsm_dev(super, vol);
+- snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name);
++ strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
++ dev->volume[MAX_RAID_SERIAL_LEN-1] = '\0';
+ for (i = 0; i < mpb->num_raid_devs; i++) {
+ dev = get_imsm_dev(super, i);
+ handle_missing(super, dev);
+--
+2.12.2
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0004-mdadm-Forced-type-conversion-to-avoid-truncation.patch b/poky/meta/recipes-extended/mdadm/files/0004-mdadm-Forced-type-conversion-to-avoid-truncation.patch
new file mode 100644
index 000000000..94fde42e9
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0004-mdadm-Forced-type-conversion-to-avoid-truncation.patch
@@ -0,0 +1,33 @@
+From 5da889032e2d99751ed9fe60016146e9ae8114cd Mon Sep 17 00:00:00 2001
+From: Xiao Ni <xni@redhat.com>
+Date: Sat, 18 Mar 2017 10:33:45 +0800
+Subject: [PATCH 4/5] mdadm: Forced type conversion to avoid truncation
+
+Gcc reports it needs 19 bytes to right to disk->serial. Because the
+type of argument i is int. But the meaning of i is failed disk
+number. So it doesn't need to use 19 bytes. Just add a type
+conversion to avoid this building error
+
+Signed-off-by: Xiao Ni <xni@redhat.com>
+Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
+---
+Upstream-Status: Backport
+ super-intel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/super-intel.c b/super-intel.c
+index 5499098..4e466ff 100644
+--- a/super-intel.c
++++ b/super-intel.c
+@@ -5228,7 +5228,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
+ disk->status = CONFIGURED_DISK | FAILED_DISK;
+ disk->scsi_id = __cpu_to_le32(~(__u32)0);
+ snprintf((char *) disk->serial, MAX_RAID_SERIAL_LEN,
+- "missing:%d", i);
++ "missing:%d", (__u8)i);
+ }
+ find_missing(super);
+ } else {
+--
+2.12.2
+
diff --git a/poky/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch b/poky/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
new file mode 100644
index 000000000..3d9d3b904
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
@@ -0,0 +1,128 @@
+From 09014233bf10900f7bd8390b3b64ff82bca45222 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 19 Apr 2017 12:04:15 -0700
+Subject: [PATCH 5/5] Add a comment to indicate valid fallthrough
+
+gcc7 warns about code with fallthroughs, this patch adds
+the comment to indicate a valid fallthrough, helps gcc7
+compiler warnings
+
+This works in cross and native compilation case
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ Grow.c | 4 ++++
+ bitmap.c | 8 ++++++++
+ mdadm.c | 2 ++
+ super-intel.c | 1 +
+ util.c | 1 +
+ 5 files changed, 16 insertions(+)
+
+diff --git a/Grow.c b/Grow.c
+index 455c5f9..27c73b1 100755
+--- a/Grow.c
++++ b/Grow.c
+@@ -1257,6 +1257,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
+ switch (info->new_level) {
+ case 4:
+ delta_parity = 1;
++ /* fallthrough */
+ case 0:
+ re->level = 4;
+ re->before.layout = 0;
+@@ -1284,10 +1285,12 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
+
+ case 4:
+ info->array.layout = ALGORITHM_PARITY_N;
++ /* fallthrough */
+ case 5:
+ switch (info->new_level) {
+ case 0:
+ delta_parity = -1;
++ /* fallthrough */
+ case 4:
+ re->level = info->array.level;
+ re->before.data_disks = info->array.raid_disks - 1;
+@@ -1343,6 +1346,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
+ case 4:
+ case 5:
+ delta_parity = -1;
++ /* fallthrough */
+ case 6:
+ re->level = 6;
+ re->before.data_disks = info->array.raid_disks - 2;
+diff --git a/bitmap.c b/bitmap.c
+index ccedfd3..a6ff091 100644
+--- a/bitmap.c
++++ b/bitmap.c
+@@ -82,13 +82,21 @@ static inline int count_dirty_bits_byte(char byte, int num_bits)
+
+ switch (num_bits) { /* fall through... */
+ case 8: if (byte & 128) num++;
++ /* fallthrough */
+ case 7: if (byte & 64) num++;
++ /* fallthrough */
+ case 6: if (byte & 32) num++;
++ /* fallthrough */
+ case 5: if (byte & 16) num++;
++ /* fallthrough */
+ case 4: if (byte & 8) num++;
++ /* fallthrough */
+ case 3: if (byte & 4) num++;
++ /* fallthrough */
+ case 2: if (byte & 2) num++;
++ /* fallthrough */
+ case 1: if (byte & 1) num++;
++ /* fallthrough */
+ default: break;
+ }
+
+diff --git a/mdadm.c b/mdadm.c
+index c3a265b..2d06d3b 100644
+--- a/mdadm.c
++++ b/mdadm.c
+@@ -148,6 +148,7 @@ int main(int argc, char *argv[])
+ mode == CREATE || mode == GROW ||
+ mode == INCREMENTAL || mode == MANAGE)
+ break; /* b means bitmap */
++ /* fallthrough */
+ case Brief:
+ c.brief = 1;
+ continue;
+@@ -828,6 +829,7 @@ int main(int argc, char *argv[])
+
+ case O(INCREMENTAL,NoDegraded):
+ pr_err("--no-degraded is deprecated in Incremental mode\n");
++ /* fallthrough */
+ case O(ASSEMBLE,NoDegraded): /* --no-degraded */
+ c.runstop = -1; /* --stop isn't allowed for --assemble,
+ * so we overload slightly */
+diff --git a/super-intel.c b/super-intel.c
+index 4e466ff..00a2925 100644
+--- a/super-intel.c
++++ b/super-intel.c
+@@ -3271,6 +3271,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
+ << SECT_PER_MB_SHIFT;
+ }
+ }
++ /* fallthrough */
+ case MIGR_VERIFY:
+ /* we could emulate the checkpointing of
+ * 'sync_action=check' migrations, but for now
+diff --git a/util.c b/util.c
+index 32bd909..f2a4d19 100644
+--- a/util.c
++++ b/util.c
+@@ -335,6 +335,7 @@ unsigned long long parse_size(char *size)
+ switch (*c) {
+ case 'K':
+ c++;
++ /* fallthrough */
+ default:
+ s *= 2;
+ break;
+--
+2.12.2
+
diff --git a/poky/meta/recipes-extended/mdadm/files/gcc-4.9.patch b/poky/meta/recipes-extended/mdadm/files/gcc-4.9.patch
new file mode 100644
index 000000000..df21399de
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/gcc-4.9.patch
@@ -0,0 +1,22 @@
+super-intel.c:5063:2: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
+ snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
+ ^
+cc1: all warnings being treated as errors
+make: *** [super-intel.o] Error 1
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: mdadm-4.0/super-intel.c
+===================================================================
+--- mdadm-4.0.orig/super-intel.c
++++ mdadm-4.0/super-intel.c
+@@ -5725,7 +5725,7 @@ static int write_super_imsm_spares(struc
+ spare->cache_size = mpb->cache_size;
+ spare->pwr_cycle_count = __cpu_to_le32(1);
+
+- snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
++ (void)snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
+ MPB_SIGNATURE MPB_VERSION_RAID0);
+
+ for (d = super->disks; d; d = d->next) {
diff --git a/poky/meta/recipes-extended/mdadm/files/mdadm-3.3.2_x32_abi_time_t.patch b/poky/meta/recipes-extended/mdadm/files/mdadm-3.3.2_x32_abi_time_t.patch
new file mode 100644
index 000000000..00e6657e0
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/mdadm-3.3.2_x32_abi_time_t.patch
@@ -0,0 +1,25 @@
+When try to print time_t values as a long int it causes an error because time_t
+data type in x32 ABI is long long int.
+
+Upstream-Status: Pending
+
+Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
+
+Index: mdadm-4.0/monitor.c
+===================================================================
+--- mdadm-4.0.orig/monitor.c
++++ mdadm-4.0/monitor.c
+@@ -445,9 +445,12 @@ static int read_and_act(struct active_ar
+ if (FD_ISSET(mdi->bb_fd, fds))
+ check_for_cleared_bb(a, mdi);
+ }
+-
+ gettimeofday(&tv, NULL);
++#if defined(__x86_64__) && defined(__ILP32__)
++ dprintf("(%d): %lld.%06lld state:%s prev:%s action:%s prev: %s start:%llu\n",
++#else
+ dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n",
++#endif
+ a->info.container_member,
+ tv.tv_sec, tv.tv_usec,
+ array_states[a->curr_state],
diff --git a/poky/meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-errors.patch b/poky/meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-errors.patch
new file mode 100644
index 000000000..267c007c2
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/mdadm-fix-ptest-build-errors.patch
@@ -0,0 +1,45 @@
+From c65898b9da82df94e1bae7937e415a7eb80355d5 Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Wed, 10 Feb 2016 17:28:05 +0200
+Subject: [PATCH] mdadm-fix-ptest-build-errors
+
+builds fail with ptest enabled:
+
+| restripe.c: In function 'test_stripes':
+| restripe.c:845:4: error: ignoring return value of 'read', declared with
+| attribute warn_unused_result [-Werror=unused-result]
+| read(source[i], stripes[i], chunk_size);
+| ^
+| cc1: all warnings being treated as errors
+| Makefile:214: recipe for target 'test_stripe' failed
+
+Upstream-Status: Pending
+
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
+---
+ restripe.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/restripe.c b/restripe.c
+index 56dca73..d24b2b4 100644
+--- a/restripe.c
++++ b/restripe.c
+@@ -842,10 +842,14 @@ int test_stripes(int *source, unsigned long long *offsets,
+
+ while (length > 0) {
+ int disk;
++ ssize_t ret;
+
+ for (i = 0 ; i < raid_disks ; i++) {
+ lseek64(source[i], offsets[i]+start, 0);
+- read(source[i], stripes[i], chunk_size);
++ ret = read(source[i], stripes[i], chunk_size);
++ if (ret == -1) {
++ printf("Read Failed\n");
++ }
+ }
+ for (i = 0 ; i < data_disks ; i++) {
+ int disk = geo_map(i, start/chunk_size, raid_disks,
+--
+2.4.0
+
diff --git a/poky/meta/recipes-extended/mdadm/files/run-ptest b/poky/meta/recipes-extended/mdadm/files/run-ptest
new file mode 100644
index 000000000..5b276090f
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/files/run-ptest
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+./test &>./test.log
+if [ $? -eq 0 ]
+then
+ echo "PASS: mdadm"
+ rm test.log
+else
+ echo "FAIL: mdadm"
+fi
diff --git a/poky/meta/recipes-extended/mdadm/mdadm_4.0.bb b/poky/meta/recipes-extended/mdadm/mdadm_4.0.bb
new file mode 100644
index 000000000..dc098f19b
--- /dev/null
+++ b/poky/meta/recipes-extended/mdadm/mdadm_4.0.bb
@@ -0,0 +1,78 @@
+SUMMARY = "Tool for managing software RAID under Linux"
+HOMEPAGE = "http://www.kernel.org/pub/linux/utils/raid/mdadm/"
+
+# Some files are GPLv2+ while others are GPLv2.
+LICENSE = "GPLv2 & GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://mdmon.c;beginline=4;endline=18;md5=af7d8444d9c4d3e5c7caac0d9d34039d \
+ file://mdadm.h;beglinlne=4;endline=22;md5=462bc9936ac0d3da110191a3f9994161"
+
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
+ file://gcc-4.9.patch \
+ file://mdadm-3.3.2_x32_abi_time_t.patch \
+ file://mdadm-fix-ptest-build-errors.patch \
+ file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \
+ file://run-ptest \
+ file://0001-mdadm.h-Undefine-dprintf-before-redefining.patch \
+ file://0001-include-sys-sysmacros.h-for-major-minor-defintions.patch \
+ file://0001-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch \
+ file://0002-mdadm-Specify-enough-length-when-write-to-buffer.patch \
+ file://0003-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch \
+ file://0004-mdadm-Forced-type-conversion-to-avoid-truncation.patch \
+ file://0005-Add-a-comment-to-indicate-valid-fallthrough.patch \
+ file://0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch \
+ "
+SRC_URI[md5sum] = "2cb4feffea9167ba71b5f346a0c0a40d"
+SRC_URI[sha256sum] = "1d6ae7f24ced3a0fa7b5613b32f4a589bb4881e3946a5a2c3724056254ada3a9"
+
+CFLAGS += "-fno-strict-aliasing"
+inherit autotools-brokensep
+
+EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"'
+# PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h
+# prevents 64-bit userland from seeing this definition, instead defaulting
+# to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
+# int-ll64.h included
+CFLAGS_append_powerpc64 = ' -D__SANE_USERSPACE_TYPES__'
+CFLAGS_append_mipsarchn64 = ' -D__SANE_USERSPACE_TYPES__'
+CFLAGS_append_mipsarchn32 = ' -D__SANE_USERSPACE_TYPES__'
+
+do_compile() {
+ # Point to right sbindir
+ sed -i -e "s;BINDIR = /sbin;BINDIR = $base_sbindir;" ${S}/Makefile
+ oe_runmake SYSROOT="${STAGING_DIR_TARGET}"
+}
+
+do_install() {
+ export STRIP=""
+ autotools_do_install
+}
+
+inherit ptest
+
+do_compile_ptest() {
+ oe_runmake test
+}
+
+do_install_ptest() {
+ cp -R --no-dereference --preserve=mode,links -v ${S}/tests ${D}${PTEST_PATH}/tests
+ cp ${S}/test ${D}${PTEST_PATH}
+ sed -e 's!sleep 0.*!sleep 1!g; s!/var/tmp!/!g' -i ${D}${PTEST_PATH}/test
+ ln -s ${base_sbindir}/mdadm ${D}${PTEST_PATH}/mdadm
+ for prg in test_stripe swap_super raid6check
+ do
+ install -D -m 755 $prg ${D}${PTEST_PATH}/
+ done
+}
+RDEPENDS_${PN}-ptest += "bash"
+RRECOMMENDS_${PN}-ptest += " \
+ coreutils \
+ util-linux \
+ kernel-module-loop \
+ kernel-module-linear \
+ kernel-module-raid0 \
+ kernel-module-raid1 \
+ kernel-module-raid10 \
+ kernel-module-raid456 \
+"
OpenPOWER on IntegriCloud