blob: 001d3331a727bee73da6280776a6e90446ba08d6 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "Tool for managing software RAID under Linux"
2HOMEPAGE = "http://www.kernel.org/pub/linux/utils/raid/mdadm/"
3
4# Some files are GPLv2+ while others are GPLv2.
5LICENSE = "GPLv2 & GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
7 file://mdmon.c;beginline=4;endline=18;md5=af7d8444d9c4d3e5c7caac0d9d34039d \
8 file://mdadm.h;beglinlne=4;endline=22;md5=462bc9936ac0d3da110191a3f9994161"
9
10
11SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
12 file://run-ptest \
13 file://mdadm-3.3.2_x32_abi_time_t.patch \
14 file://mdadm-fix-ptest-build-errors.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-Compute-abs-diff-in-a-standard-compliant-way.patch \
19 file://0001-fix-gcc-8-format-truncation-warning.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040020 file://debian-no-Werror.patch \
Brad Bishop96ff1982019-08-19 13:50:42 -040021 file://0001-Revert-tests-wait-for-complete-rebuild-in-integrity-.patch \
Andrew Geissler5a43b432020-06-13 10:46:56 -050022 file://mdadm.init \
23 file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \
Brad Bishop96ff1982019-08-19 13:50:42 -040024 file://include_sysmacros.patch \
Brad Bishop79641f22019-09-10 07:20:22 -040025 file://0001-mdadm-skip-test-11spare-migration.patch \
Brad Bishop19323692019-04-05 15:28:33 -040026 "
Brad Bishop79641f22019-09-10 07:20:22 -040027
Brad Bishop19323692019-04-05 15:28:33 -040028SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"
29SRC_URI[sha256sum] = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a"
30
31inherit autotools-brokensep ptest systemd
32
Andrew Geissler5a43b432020-06-13 10:46:56 -050033SYSTEMD_SERVICE_${PN} = "mdmonitor.service"
Brad Bishop19323692019-04-05 15:28:33 -040034SYSTEMD_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
Brad Bishop64c979e2019-11-04 13:55:29 -050046EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}" SYSTEMD_DIR=${systemd_unitdir}/system \
47 BINDIR="${base_sbindir}" UDEVDIR="${nonarch_base_libdir}/udev"'
Brad Bishop19323692019-04-05 15:28:33 -040048
49DEBUG_OPTIMIZATION_append = " -Wno-error"
50
51do_compile() {
Brad Bishop19323692019-04-05 15:28:33 -040052 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
Brad Bishop19323692019-04-05 15:28:33 -040063 install -d ${D}/${sysconfdir}/init.d
64 install -m 755 ${WORKDIR}/mdadm.init ${D}${sysconfdir}/init.d/mdmonitor
65}
66
Brad Bishop393846f2019-05-20 12:24:11 -040067do_install_append() {
68 oe_runmake install-systemd DESTDIR=${D}
69}
70
Brad Bishop19323692019-04-05 15:28:33 -040071do_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}
Andrew Geissler82c905d2020-04-13 13:39:40 -050078 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/*
Brad Bishop96ff1982019-08-19 13:50:42 -040080 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
Brad Bishop19323692019-04-05 15:28:33 -040088 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
Brad Bishop15ae2502019-06-18 21:44:24 -040095RDEPENDS_${PN}-ptest += "bash e2fsprogs-mke2fs"
Brad Bishop19323692019-04-05 15:28:33 -040096RRECOMMENDS_${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"
Brad Bishop393846f2019-05-20 12:24:11 -0400106
Brad Bishop15ae2502019-06-18 21:44:24 -0400107FILES_${PN} += "${systemd_unitdir}/*"