Initial commit
This commit is contained in:
70
package/utils/mdadm/Makefile
Normal file
70
package/utils/mdadm/Makefile
Normal file
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# Copyright (C) 2008-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mdadm
|
||||
PKG_VERSION:=4.1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
|
||||
PKG_HASH:=ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_CPE_ID:=cpe:/a:mdadm_project:mdadm
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mdadm
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Disc
|
||||
TITLE:=A tool for managing Soft RAID under Linux
|
||||
URL:=https://www.kernel.org/pub/linux/utils/raid/mdadm/
|
||||
DEPENDS:=+libpthread +kmod-md-mod +kmod-md-raid0 +kmod-md-raid10 +kmod-md-raid1
|
||||
endef
|
||||
|
||||
define Package/mdadm/description
|
||||
A tool for managing Linux Software RAID arrays.
|
||||
RAID 0, 1 and 10 support included.
|
||||
If you need RAID 4,5 or 6 functionality please
|
||||
install kmod-md-raid456 .
|
||||
endef
|
||||
|
||||
define Package/mdadm/conffiles
|
||||
/etc/config/mdadm
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-ffunction-sections -fdata-sections \
|
||||
-DHAVE_STDINT_H -DNO_COROSYNC -DNO_DLM -DUSE_PTHREADS \
|
||||
-DCONFFILE='\"/var/etc/mdadm.conf\"' \
|
||||
-DMAP_DIR='\"/var/run/mdadm\"' \
|
||||
-DMDMON_DIR='\"/var/run/mdadm\"' \
|
||||
-DFAILED_SLOTS_DIR='\"/var/run/mdadm/failed-slots\"'
|
||||
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
MAKE_VARS += CHECK_RUN_DIR=0
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default,mdadm)
|
||||
endef
|
||||
|
||||
define Package/mdadm/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdadm $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/mdadm.init $(1)/etc/init.d/mdadm
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/mdadm.config $(1)/etc/config/mdadm
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mdadm))
|
||||
18
package/utils/mdadm/files/mdadm.config
Normal file
18
package/utils/mdadm/files/mdadm.config
Normal file
@@ -0,0 +1,18 @@
|
||||
config mdadm
|
||||
option email root
|
||||
# list devices /dev/hd*
|
||||
# list devices /dev/sd*
|
||||
# list devices partitions
|
||||
|
||||
config array
|
||||
option uuid 52c5c44a:d2162820:f75d3464:799750f8
|
||||
option device /dev/md0
|
||||
# option name raid:0
|
||||
# option super_minor 0
|
||||
# list devices /dev/sda1
|
||||
# list devices /dev/sdb1
|
||||
# option spares 0
|
||||
# option spare_group spares
|
||||
# option bitmap /bitmap.md
|
||||
# option container 00000000:00000000:00000000:00000000
|
||||
# option member 1
|
||||
93
package/utils/mdadm/files/mdadm.init
Normal file
93
package/utils/mdadm/files/mdadm.init
Normal file
@@ -0,0 +1,93 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=13
|
||||
STOP=98
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/sbin/mdadm
|
||||
NAME=mdadm
|
||||
|
||||
CONF="/var/etc/mdadm.conf"
|
||||
|
||||
append_list_item() {
|
||||
append "$2" "$1" "$3"
|
||||
}
|
||||
|
||||
append_option() {
|
||||
local var="$1"
|
||||
local cfg="$2"
|
||||
local opt="$3"
|
||||
local name="$4"
|
||||
local sep="$5"
|
||||
local str
|
||||
|
||||
if [ -n "$sep" ]; then
|
||||
config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
|
||||
else
|
||||
config_get str "$cfg" "$opt"
|
||||
fi
|
||||
|
||||
[ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
|
||||
}
|
||||
|
||||
mdadm_common() {
|
||||
local cfg="$1"
|
||||
local email devices
|
||||
|
||||
if [ -x /usr/sbin/sendmail ]; then
|
||||
config_get email "$cfg" email
|
||||
[ -n "$email" ] && printf "MAILADDR %s\n" "$email" >> $CONF
|
||||
fi
|
||||
|
||||
config_list_foreach "$cfg" devices append_list_item devices " "
|
||||
[ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $CONF
|
||||
}
|
||||
|
||||
mdadm_array() {
|
||||
local cfg="$1"
|
||||
local uuid device devices name array
|
||||
|
||||
config_get uuid "$cfg" uuid
|
||||
config_get name "$cfg" name
|
||||
config_get device "$cfg" device
|
||||
|
||||
if [ -z "$device" ] || [ -z "$uuid$name" ]; then
|
||||
echo "Skipping array without device, uuid or name" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
[ -n "$uuid" ] && append array "uuid=$uuid"
|
||||
[ -n "$name" ] && append array "name=$name"
|
||||
|
||||
append_option array "$cfg" super_minor
|
||||
append_option array "$cfg" spares
|
||||
append_option array "$cfg" spare_group
|
||||
append_option array "$cfg" bitmap
|
||||
append_option array "$cfg" container
|
||||
append_option array "$cfg" member
|
||||
append_option array "$cfg" devices devices ","
|
||||
|
||||
printf "ARRAY %s %s\n" "$device" "$array" >> $CONF
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local email
|
||||
|
||||
mkdir -p "${CONF%/*}"
|
||||
printf "# Autogenerated from /etc/config/mdadm, do not edit!\n" > $CONF
|
||||
|
||||
config_load mdadm
|
||||
config_foreach mdadm_common mdadm
|
||||
config_foreach mdadm_array array
|
||||
|
||||
$PROG --assemble --scan --config="$CONF"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" --monitor --syslog --scan --config="$CONF"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
$PROG --stop --scan
|
||||
}
|
||||
|
||||
11
package/utils/mdadm/patches/100-cross_compile.patch
Normal file
11
package/utils/mdadm/patches/100-cross_compile.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -97,7 +97,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h
|
||||
DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
|
||||
DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
|
||||
DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
|
||||
-CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
|
||||
+#CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
|
||||
|
||||
VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
|
||||
VERS_DATE = $(shell [ -d .git ] && date --iso-8601 --date="`git log -n1 --format=format:%cd --date=iso --date=short`")
|
||||
@@ -0,0 +1,38 @@
|
||||
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(+)
|
||||
|
||||
--- a/mdadm.h
|
||||
+++ b/mdadm.h
|
||||
@@ -1649,11 +1649,13 @@ static inline char *to_subarray(struct m
|
||||
}
|
||||
|
||||
#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...) \
|
||||
@@ -0,0 +1,29 @@
|
||||
From 452dc4d13a012cdcb05088c0dbc699959c4d6c73 Mon Sep 17 00:00:00 2001
|
||||
From: Baruch Siach <baruch@tkos.co.il>
|
||||
Date: Tue, 6 Aug 2019 16:05:23 +0300
|
||||
Subject: mdadm.h: include sysmacros.h unconditionally
|
||||
|
||||
musl libc now also requires sys/sysmacros.h for the major/minor macros.
|
||||
All supported libc implementations carry sys/sysmacros.h, including
|
||||
diet-libc, klibc, and uclibc-ng.
|
||||
|
||||
Cc: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
mdadm.h | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/mdadm.h
|
||||
+++ b/mdadm.h
|
||||
@@ -45,10 +45,8 @@ extern __off64_t lseek64 __P ((int __fd,
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
-#ifdef __GLIBC__
|
||||
/* Newer glibc requires sys/sysmacros.h directly for makedev() */
|
||||
#include <sys/sysmacros.h>
|
||||
-#endif
|
||||
#ifdef __dietlibc__
|
||||
#include <strings.h>
|
||||
/* dietlibc has deprecated random and srandom!! */
|
||||
25
package/utils/mdadm/patches/200-reduce_size.patch
Normal file
25
package/utils/mdadm/patches/200-reduce_size.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
--- a/Incremental.c
|
||||
+++ b/Incremental.c
|
||||
@@ -1619,6 +1619,10 @@ static int Incremental_container(struct
|
||||
if (ra_all == ra_blocked)
|
||||
return 0;
|
||||
|
||||
+#ifndef MDADM_FULL
|
||||
+ return 0;
|
||||
+#endif
|
||||
+
|
||||
/* Now move all suitable spares from spare container */
|
||||
domains = domain_from_array(list, st->ss->name);
|
||||
memcpy(suuid, uuid_zero, sizeof(int[4]));
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -1220,7 +1220,9 @@ void wait_for(char *dev, int fd)
|
||||
struct superswitch *superlist[] =
|
||||
{
|
||||
&super0, &super1,
|
||||
+#ifdef MDADM_FULL
|
||||
&super_ddf, &super_imsm,
|
||||
+#endif
|
||||
&mbr, &gpt,
|
||||
NULL
|
||||
};
|
||||
Reference in New Issue
Block a user