blob: 14de9d88c2923dd9a2f4b1c059c79e0ff6886530 [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 \
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 \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000025 file://0001-Fix-parsing-of-r-in-monitor-manager-mode.patch \
26 file://0001-Makefile-install-mdcheck.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060027 file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060028 file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050029 file://0001-mdadm-Fix-optional-write-behind-parameter.patch \
30 file://0001-tests-02lineargrow-clear-the-superblock-at-every-ite.patch \
31 file://0001-tests-00raid0-add-a-test-that-validates-raid0-with-l.patch \
32 file://0001-tests-fix-raid0-tests-for-0.90-metadata.patch \
33 file://0001-tests-00readonly-Run-udevadm-settle-before-setting-r.patch \
34 file://0001-tests-04update-metadata-avoid-passing-chunk-size-to.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000035 "
36
37SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d"
38
39inherit autotools-brokensep ptest systemd
40
41DEPENDS = "udev"
42
43SYSTEMD_SERVICE:${PN} = "mdmonitor.service"
44SYSTEMD_AUTO_ENABLE = "disable"
45
Andrew Geissler595f6302022-01-24 19:11:47 +000046# PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h
47# prevents 64-bit userland from seeing this definition, instead defaulting
48# to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
49# int-ll64.h included
50CFLAGS:append:powerpc64 = ' -D__SANE_USERSPACE_TYPES__'
51CFLAGS:append:mipsarchn64 = ' -D__SANE_USERSPACE_TYPES__'
52CFLAGS:append:mipsarchn32 = ' -D__SANE_USERSPACE_TYPES__'
53
54EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}" SYSTEMD_DIR=${systemd_system_unitdir} \
55 BINDIR="${base_sbindir}" UDEVDIR="${nonarch_base_libdir}/udev"'
56
57DEBUG_OPTIMIZATION:append = " -Wno-error"
58
59do_compile() {
60 oe_runmake SYSROOT="${STAGING_DIR_TARGET}"
61}
62
63do_install() {
64 export STRIP=""
65 autotools_do_install
66}
67
68do_install:append() {
69 install -d ${D}/${sysconfdir}/
70 install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/mdadm.conf
71 install -d ${D}/${sysconfdir}/init.d
72 install -m 755 ${WORKDIR}/mdadm.init ${D}${sysconfdir}/init.d/mdmonitor
73}
74
75do_install:append() {
76 oe_runmake install-systemd DESTDIR=${D}
77}
78
79do_compile_ptest() {
80 oe_runmake test
81}
82
83do_install_ptest() {
84 cp -R --no-dereference --preserve=mode,links -v ${S}/tests ${D}${PTEST_PATH}/tests
85 cp ${S}/test ${D}${PTEST_PATH}
86 sed -e 's!sleep 0.*!sleep 1!g; s!/var/tmp!/mdadm-testing-dir!g' -i ${D}${PTEST_PATH}/test
87 sed -e 's!/var/tmp!/mdadm-testing-dir!g' -i ${D}${PTEST_PATH}/tests/*
88 sed -i -e '/echo -ne "$_script... "/d' \
89 -e 's/echo "succeeded"/echo -e "PASS: $_script"/g' \
90 -e '/save_log fail/N; /_fail=1/i\\t\t\techo -ne "FAIL: $_script"' \
91 -e '/die "dmesg prints errors when testing $_basename!"/i\\t\t\t\techo -ne "FAIL: $_script" &&' \
92 ${D}${PTEST_PATH}/test
93
94 chmod +x ${D}${PTEST_PATH}/test
95
96 ln -s ${base_sbindir}/mdadm ${D}${PTEST_PATH}/mdadm
97 for prg in test_stripe swap_super raid6check
98 do
99 install -D -m 755 $prg ${D}${PTEST_PATH}/
100 done
101}
102
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000103RDEPENDS:${PN} += "bash"
Andrew Geissler595f6302022-01-24 19:11:47 +0000104RDEPENDS:${PN}-ptest += "bash e2fsprogs-mke2fs"
105RRECOMMENDS:${PN}-ptest += " \
106 coreutils \
107 util-linux \
108 kernel-module-loop \
109 kernel-module-linear \
110 kernel-module-raid0 \
111 kernel-module-raid1 \
112 kernel-module-raid10 \
113 kernel-module-raid456 \
114"
115
116FILES:${PN} += "${systemd_unitdir}/*"