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 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 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.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
PKG_HASH:=416727ae1f1080ea6e3090cea36dd076826fc369151e36ab736557ba92196f9f
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,36 @@
From 52bead95d2957437c691891fcdc49bd6afccdd49 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Fri, 12 Apr 2024 18:45:13 +0200
Subject: Create.c: fix uclibc build
Define FALLOC_FL_ZERO_RANGE if needed as FALLOC_FL_ZERO_RANGE is only
defined for aarch64 on uclibc-ng resulting in the following or1k build
failure since commit 577fd10486d8d1472a6b559066f344ac30a3a391:
Create.c: In function 'write_zeroes_fork':
Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function)
155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE,
| ^~~~~~~~~~~~~~~~~~~~
Fixes:
- http://autobuild.buildroot.org/results/0e04bcdb591ca5642053e1f7e31384f06581e989
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
---
Create.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/Create.c
+++ b/Create.c
@@ -32,6 +32,10 @@
#include <sys/signalfd.h>
#include <sys/wait.h>
+#ifndef FALLOC_FL_ZERO_RANGE
+#define FALLOC_FL_ZERO_RANGE 16
+#endif
+
static int round_size_and_verify(unsigned long long *size, int chunk)
{
if (*size == 0)

View File

@@ -0,0 +1,30 @@
--- a/Monitor.c
+++ b/Monitor.c
@@ -27,6 +27,7 @@
#include "md_p.h"
#include "md_u.h"
#include <sys/wait.h>
+#include <libgen.h>
#include <limits.h>
#include <syslog.h>
--- a/platform-intel.c
+++ b/platform-intel.c
@@ -28,6 +28,7 @@
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <libgen.h>
#include <limits.h>
#define NVME_SUBSYS_PATH "/sys/devices/virtual/nvme-subsystem/"
--- a/super-intel.c
+++ b/super-intel.c
@@ -27,6 +27,7 @@
#include <scsi/sg.h>
#include <ctype.h>
#include <dirent.h>
+#include <libgen.h>
/* MPB == Metadata Parameter Block */
#define MPB_SIGNATURE "Intel Raid ISM Cfg Sig. "

View File

@@ -0,0 +1,14 @@
--- a/monitor.c
+++ b/monitor.c
@@ -449,9 +449,9 @@ static int read_and_act(struct active_ar
}
gettimeofday(&tv, NULL);
- dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n",
+ dprintf("(%d): %lld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n",
a->info.container_member,
- tv.tv_sec, tv.tv_usec,
+ (long long)tv.tv_sec, (long)tv.tv_usec,
array_states[a->curr_state],
array_states[a->prev_state],
sync_actions[a->curr_action],

View File

@@ -0,0 +1,26 @@
From 1750758c7ff526e3560433f6235e5cfa35cf646a Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Date: Wed, 6 Mar 2024 15:50:55 +0100
Subject: udev.c: Do not require libudev.h if DNO_LIBUDEV
libudev may not be presented at all, do not require it.
Reported-by: Boian Bonev <bbonev@ipacct.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
---
udev.c | 3 +++
1 file changed, 3 insertions(+)
--- a/udev.c
+++ b/udev.c
@@ -26,7 +26,10 @@
#include <signal.h>
#include <limits.h>
#include <syslog.h>
+
+#ifndef NO_LIBUDEV
#include <libudev.h>
+#endif
static char *unblock_path;

View File

@@ -0,0 +1,33 @@
From 893a55831e5abbcd15b171db66fa1f389fb61506 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Tue, 7 May 2024 19:32:16 +0200
Subject: Makefile: Move -pie to LDFLAGS
Move -pie from LDLIBS to LDFLAGS and make LDFLAGS configurable to allow
the user to drop it by setting their own LDFLAGS (e.g. PIE could be
enabled or disabled by the buildsystem such as buildroot).
Suggested-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -132,12 +132,12 @@ CFLAGS += -DUSE_PTHREADS
MON_LDFLAGS += -pthread
endif
-LDFLAGS = -Wl,-z,now,-z,noexecstack
+LDFLAGS ?= -pie -Wl,-z,now,-z,noexecstack
# If you want a static binary, you might uncomment these
# LDFLAGS += -static
# STRIP = -s
-LDLIBS = -ldl -pie
+LDLIBS = -ldl
# To explicitly disable libudev, set -DNO_LIBUDEV in CXFLAGS
ifeq (, $(findstring -DNO_LIBUDEV, $(CXFLAGS)))

View File

@@ -0,0 +1,11 @@
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,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
@@ -985,6 +985,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
@@ -1192,7 +1192,9 @@ void wait_for(char *dev, int fd)
struct superswitch *superlist[] =
{
&super0, &super1,
+#ifdef MDADM_FULL
&super_ddf, &super_imsm,
+#endif
&mbr, &gpt,
NULL
};