blob: 228fc6f84e5d727a90ac4e43d83651ca692f8821 [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
Andrew Geissler9aee5002022-03-30 16:27:02 +00005# Some files are GPL-2.0-only while others are GPL-2.0-or-later.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00006LICENSE = "GPL-2.0-only & GPL-2.0-or-later"
Andrew Geissler595f6302022-01-24 19:11:47 +00007LIC_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 \
Andrew Geissler595f6302022-01-24 19:11:47 +000020 file://mdadm.init \
21 file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000022 file://0001-Makefile-install-mdcheck.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060023 file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \
Patrick Williams44b3caf2024-04-12 16:51:14 -050024 file://0002-Create.c-include-linux-falloc.h-for-FALLOC_FL_ZERO_R.patch \
25 file://0001-util.c-add-limits.h-include-for-NAME_MAX-definition.patch \
26 file://0001-include-libgen.h-for-basename-API.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000027 "
28
Patrick Williams44b3caf2024-04-12 16:51:14 -050029SRC_URI[sha256sum] = "416727ae1f1080ea6e3090cea36dd076826fc369151e36ab736557ba92196f9f"
Andrew Geissler595f6302022-01-24 19:11:47 +000030
31inherit autotools-brokensep ptest systemd
32
33DEPENDS = "udev"
34
35SYSTEMD_SERVICE:${PN} = "mdmonitor.service"
36SYSTEMD_AUTO_ENABLE = "disable"
37
Andrew Geissler595f6302022-01-24 19:11:47 +000038# 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} \
Patrick Williams44b3caf2024-04-12 16:51:14 -050047 BINDIR="${base_sbindir}" UDEVDIR="${nonarch_base_libdir}/udev" LDFLAGS="${LDFLAGS}"'
Andrew Geissler595f6302022-01-24 19:11:47 +000048
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
Andrew Geissler595f6302022-01-24 19:11:47 +000079 sed -i -e '/echo -ne "$_script... "/d' \
80 -e 's/echo "succeeded"/echo -e "PASS: $_script"/g' \
81 -e '/save_log fail/N; /_fail=1/i\\t\t\techo -ne "FAIL: $_script"' \
82 -e '/die "dmesg prints errors when testing $_basename!"/i\\t\t\t\techo -ne "FAIL: $_script" &&' \
83 ${D}${PTEST_PATH}/test
84
85 chmod +x ${D}${PTEST_PATH}/test
86
87 ln -s ${base_sbindir}/mdadm ${D}${PTEST_PATH}/mdadm
88 for prg in test_stripe swap_super raid6check
89 do
90 install -D -m 755 $prg ${D}${PTEST_PATH}/
91 done
Andrew Geissler5082cc72023-09-11 08:41:39 -040092
93 # Disable tests causing intermittent autobuilder failures
94 echo "intermittent failure on autobuilder" > ${D}${PTEST_PATH}/tests/19raid6check.broken
95 echo "intermittent failure on autobuilder" > ${D}${PTEST_PATH}/tests/20raid5journal.broken
96 echo "intermittent failure on autobuilder" > ${D}${PTEST_PATH}/tests/21raid5cache.broken
Patrick Williams56b44a92024-01-19 08:49:29 -060097 echo "intermittent failure on autobuilder" > ${D}${PTEST_PATH}/tests/10ddf-fail-spare.broken
98 echo "intermittent failure on autobuilder" > ${D}${PTEST_PATH}/tests/10ddf-fail-stop-readd.broken
Andrew Geissler595f6302022-01-24 19:11:47 +000099}
100
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000101RDEPENDS:${PN} += "bash"
Patrick Williams2a254922023-08-11 09:48:11 -0500102RDEPENDS:${PN}-ptest += " \
103 bash \
104 e2fsprogs-mke2fs \
105 util-linux-lsblk \
106 util-linux-losetup \
107 util-linux-blockdev \
108 strace \
109"
Andrew Geissler595f6302022-01-24 19:11:47 +0000110RRECOMMENDS:${PN}-ptest += " \
111 coreutils \
Andrew Geissler595f6302022-01-24 19:11:47 +0000112 kernel-module-loop \
113 kernel-module-linear \
114 kernel-module-raid0 \
115 kernel-module-raid1 \
116 kernel-module-raid10 \
117 kernel-module-raid456 \
118"
119
120FILES:${PN} += "${systemd_unitdir}/*"
Andrew Geissler5082cc72023-09-11 08:41:39 -0400121
122# strace is not yet ported to rv32
123RDEPENDS:${PN}-ptest:remove:riscv32 = "strace"
124do_install_ptest:append:riscv32 () {
125 echo "disabled, no strace" > ${D}${PTEST_PATH}/tests/07revert-grow.broken
126 echo "disabled, no strace" > ${D}${PTEST_PATH}/tests/07revert-inplace.broken
127}