Tiny Core Extensions > Extension requests

MD(ADM) support for piCore

(1/3) > >>

CentralWare:
@Paul_123: This one's probably right up your alley :)

With the advent of the RasPi 4x/5x and USB3, mini NAS-like SATA boards/hats/backplanes have popped up here and there over the past few years.
Yesterday, I plugged in an OTG hub with a few low power flash drives thinking I'd Soft-RAID5 the bunch and realized... there's no raid tool support in piCore.
Dating back to 10.x it looks like there's never been - and probably by assumption "...who would want or need RAID on RasPi?"
I am *assuming* ATA (IDE/SATA) support is already in the kernel and I think I saw RAID modules in 15.x in there as well, so all we should need is the mdadm tool.

https://www.kernel.org/pub/linux/utils/raid/mdadm/

Version: 4.3 (2024)
Build Deps: libudev-dev
Patch: mdadm-4.3/udev.c Line 94: Remove "udev =" in line (void assignment)
Just ran it - looks like everything went well; untested at the moment beyond --help

NOTE: I'm assuming raid-KERNEL is a dependency but LDD says everything's good, so we'll see!

Compiled under native RasPi piCore 15.x
  add flags accordingly
  Install and Strip should be run as SU

--- Code: ---#!/bin/sh
CUR=$(pwd)

VERSION=4.3

HOST="https://www.kernel.org/pub/linux/utils/raid/mdadm"
DOWN="${HOST}/mdadm-${VERSION}.tar.gz"

EXTS="wget compiletc libudev-dev squashfs-tools"

for EXT in $EXTS
do
    EXT=${EXT/.tcz/}
    if [ ! -f /etc/sysconfig/tcedir/optional/${EXT}.tcz ]; then
        tce-load -w $EXT
    fi
done

for EXT in $EXTS
do
    EXT=${EXT/.tcz/}
    if [ ! -d /tmp/tcloop/${EXT} ]; then
        tce-load -i $EXT
    fi
done

nproc()
{
    CPUS=$(cat /proc/cpuinfo | grep processor | awk -F: '{print $2}')
    for CPU in $CPUS; do MAX=$(expr $CPU + 1 2>/dev/null); done; echo $MAX
}

[ ! -f mdadm-${VERSION}.tar.gz ] && wget --no-check-certificate $DOWN
[ ! -d mdadm-${VERSION} ] && tar -zxf mdadm-${VERSION}.tar.gz

cd mdadm-${VERSION}
sed -i 's/udev = udev_unref(udev)/udev_unref(udev)/g' udev.c

if [ ! ./.compiled ]; then
    make -j$(nproc) || exit 1
    touch ./.compiled
fi

make DESTDIR=/tmp/mdadm install || exit 1

if [ ! -f $CUR/mdadm-${VERSION}.tcz ]; then
    cd /tmp

    strip -s mdadm/sbin/mdadm
    strip -s mdadm/sbin/mdmon

    mkdir mdadm_doc
    cp /tmp/mdadm/usr ./mdadm_doc -R
    mksquashfs mdadm_doc $CUR/mdadm-${VERSION}-doc.tcz
    rm mdadm_doc -fR

    rm mdadm/usr -fR
    mksquashfs mdadm $CUR/mdadm-${VERSION}.tcz

    cd $CUR
    md5sum mdadm-${VERSION}.tcz > mdadm-${VERSION}.tcz.md5.txt
    md5sum mdadm-${VERSION}-doc.tcz > mdadm-${VERSION}-doc.tcz.md5.txt
fi

--- End code ---

Paul_123:
You did that much, just submit the extension.

CentralWare:
That'll take a bit (to compile for each platform, test accordingly, etc.) but, as you wish.
@Juanito normally runs the x86/64 maint. but it's been copied over since version 4.0 (2017)

Juanito:
I can update the x86/x86_64 mdadm extensions if you’d like?

Paul_123:
I don’t run raid on my raspi devices, nor do I have hardware.  So I cannot test.  Which is why I suggested for you to do it.

Navigation

[0] Message Index

[#] Next page

Go to full version