blob: fa51364283c6c65e6871f009a0bfea984a045bc1 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "Tool for managing software RAID under Linux"
2HOMEPAGE = "http://www.kernel.org/pub/linux/utils/raid/mdadm/"
3DESCRIPTION = "mdadm is a Linux utility used to manage and monitor software RAID devices."
4
5# Some files are GPLv2+ while others are GPLv2.
6LICENSE = "GPLv2 & GPLv2+"
7LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
8 file://mdmon.c;beginline=4;endline=18;md5=af7d8444d9c4d3e5c7caac0d9d34039d \
9 file://mdadm.h;beglinlne=4;endline=22;md5=462bc9936ac0d3da110191a3f9994161"
10
11
12SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
13 file://run-ptest \
14 file://mdadm-3.3.2_x32_abi_time_t.patch \
15 file://0001-mdadm.h-Undefine-dprintf-before-redefining.patch \
16 file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \
17 file://0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch \
18 file://0001-fix-gcc-8-format-truncation-warning.patch \
19 file://debian-no-Werror.patch \
20 file://0001-Revert-tests-wait-for-complete-rebuild-in-integrity-.patch \
21 file://mdadm.init \
22 file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \
23 file://include_sysmacros.patch \
24 file://0001-mdadm-skip-test-11spare-migration.patch \
25 "
26
27SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d"
28
29inherit autotools-brokensep ptest systemd
30
31DEPENDS = "udev"
32
33SYSTEMD_SERVICE:${PN} = "mdmonitor.service"
34SYSTEMD_AUTO_ENABLE = "disable"
35
36CFLAGS:append:toolchain-clang = " -Wno-error=address-of-packed-member"
37
38# PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h
39# prevents 64-bit userland from seeing this definition, instead defaulting
40# to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
41# int-ll64.h included
42CFLAGS:append:powerpc64 = ' -D__SANE_USERSPACE_TYPES__'
43CFLAGS:append:mipsarchn64 = ' -D__SANE_USERSPACE_TYPES__'
44CFLAGS:append:mipsarchn32 = ' -D__SANE_USERSPACE_TYPES__'
45
46EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}" SYSTEMD_DIR=${systemd_system_unitdir} \
47 BINDIR="${base_sbindir}" UDEVDIR="${nonarch_base_libdir}/udev"'
48
49DEBUG_OPTIMIZATION:append = " -Wno-error"
50
51do_compile() {
52 oe_runmake SYSROOT="${STAGING_DIR_TARGET}"
53}
54
55do_install() {
56 export STRIP=""
57 autotools_do_install
58}
59
60do_install:append() {
61 install -d ${D}/${sysconfdir}/
62 install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/mdadm.conf
63 install -d ${D}/${sysconfdir}/init.d
64 install -m 755 ${WORKDIR}/mdadm.init ${D}${sysconfdir}/init.d/mdmonitor
65}
66
67do_install:append() {
68 oe_runmake install-systemd DESTDIR=${D}
69}
70
71do_compile_ptest() {
72 oe_runmake test
73}
74
75do_install_ptest() {
76 cp -R --no-dereference --preserve=mode,links -v ${S}/tests ${D}${PTEST_PATH}/tests
77 cp ${S}/test ${D}${PTEST_PATH}
78 sed -e 's!sleep 0.*!sleep 1!g; s!/var/tmp!/mdadm-testing-dir!g' -i ${D}${PTEST_PATH}/test
79 sed -e 's!/var/tmp!/mdadm-testing-dir!g' -i ${D}${PTEST_PATH}/tests/*
80 sed -i -e '/echo -ne "$_script... "/d' \
81 -e 's/echo "succeeded"/echo -e "PASS: $_script"/g' \
82 -e '/save_log fail/N; /_fail=1/i\\t\t\techo -ne "FAIL: $_script"' \
83 -e '/die "dmesg prints errors when testing $_basename!"/i\\t\t\t\techo -ne "FAIL: $_script" &&' \
84 ${D}${PTEST_PATH}/test
85
86 chmod +x ${D}${PTEST_PATH}/test
87
88 ln -s ${base_sbindir}/mdadm ${D}${PTEST_PATH}/mdadm
89 for prg in test_stripe swap_super raid6check
90 do
91 install -D -m 755 $prg ${D}${PTEST_PATH}/
92 done
93}
94
95RDEPENDS:${PN}-ptest += "bash e2fsprogs-mke2fs"
96RRECOMMENDS:${PN}-ptest += " \
97 coreutils \
98 util-linux \
99 kernel-module-loop \
100 kernel-module-linear \
101 kernel-module-raid0 \
102 kernel-module-raid1 \
103 kernel-module-raid10 \
104 kernel-module-raid456 \
105"
106
107FILES:${PN} += "${systemd_unitdir}/*"