Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 16:07:44 +02:00
commit 6d0099d1a1
9195 changed files with 1607273 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
#
# 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.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
PKG_HASH:=461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_CPE_ID:=cpe:/a:mdadm_project:mdadm
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=gc-sections
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 += \
-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\"' \
-DNO_LIBUDEV \
-D_LARGEFILE64_SOURCE
TARGET_CXFLAGS = -DNO_LIBUDEV
MAKE_FLAGS += \
CHECK_RUN_DIR=0 \
CXFLAGS="$(TARGET_CXFLAGS)"
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))

View 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

View 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
}

View File

@@ -0,0 +1,11 @@
--- a/Makefile
+++ b/Makefile
@@ -99,7 +99,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`")

View File

@@ -0,0 +1,25 @@
--- a/Incremental.c
+++ b/Incremental.c
@@ -983,6 +983,10 @@ static int array_try_spare(char *devname
goto next;
}
+ #ifndef MDADM_FULL
+ return 0;
+ #endif
+
dl = domain_from_array(sra, st2->ss->name);
if (domain_test(dl, pol, st2->ss->name) != 1) {
/* domain test fails */
--- a/util.c
+++ b/util.c
@@ -1147,7 +1147,9 @@ void wait_for(char *dev, int fd)
struct superswitch *superlist[] =
{
&super0, &super1,
+#ifdef MDADM_FULL
&super_ddf, &super_imsm,
+#endif
&mbr, &gpt,
NULL
};