diff -pruN busybox-1.17.4.orig/include/usage.src.h busybox-1.17.4/include/usage.src.h --- a/include/usage.src.h 2010-11-22 22:24:58.000000000 +0200 +++ b/include/usage.src.h 2010-11-29 15:41:42.000000000 +0200 @@ -2674,6 +2674,11 @@ INSERT "the last line match .* to override this.)\n\n" \ ) +#define mdstart_trivial_usage \ + "{[PARTITION] MD-NODE}..." +#define mdstart_full_usage \ + "Run the RAID_AUTORUN ioctl on the given MD number" + #define mesg_trivial_usage \ "[y|n]" #define mesg_full_usage "\n\n" \ diff -pruN busybox-1.17.4.orig/util-linux/Config.src busybox-1.17.4/util-linux/Config.src --- busybox-1.17.4.orig/util-linux/Config.src 2010-11-22 22:24:58.000000000 +0200 +++ busybox-1.17.4/util-linux/Config.src 2010-11-29 15:41:42.000000000 +0200 @@ -429,6 +429,13 @@ config FEATURE_MDEV_LOAD_FIRMWARE /lib/firmware/ and if it exists, send it to the kernel for loading into the hardware. +config MDSTART + bool "mdstart" + default n + help + Allows you to autostart /dev/md devices if using an initramfs to + boot. + config MKSWAP bool "mkswap" default y diff -pruN busybox-1.17.4.orig/util-linux/Kbuild.src busybox-1.17.4/util-linux/Kbuild.src --- busybox-1.17.4.orig/util-linux/Kbuild.src 2010-11-22 22:24:58.000000000 +0200 +++ busybox-1.17.4/util-linux/Kbuild.src 2010-11-29 15:41:59.000000000 +0200 @@ -24,6 +24,7 @@ lib-$(CONFIG_HWCLOCK) += hwclo lib-$(CONFIG_IPCRM) += ipcrm.o lib-$(CONFIG_IPCS) += ipcs.o lib-$(CONFIG_LOSETUP) += losetup.o +lib-$(CONFIG_MDSTART) += mdStart.o lib-$(CONFIG_LSPCI) += lspci.o lib-$(CONFIG_LSUSB) += lsusb.o lib-$(CONFIG_MDEV) += mdev.o diff -pruN busybox-1.17.4.orig/util-linux/mdStart.c busybox-1.17.4/util-linux/mdStart.c --- busybox-1.17.4.orig/util-linux/mdStart.c 1970-01-01 03:00:00.000000000 +0300 +++ busybox-1.17.4/util-linux/mdStart.c 2010-11-29 15:41:42.000000000 +0200 @@ -0,0 +1,59 @@ +/* + * Linux 2.6(+) RAID Autostarter + * + * Copyright (C) 2005 by Tim Yamin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include + +extern int +mdstart_main(int argc, char *argv[]) +{ + int i, fd, part = 0, retval = 0; + + if(argc < 2) + { + bb_show_usage(); + } + + for(i = 1; i < argc; i++) + { + if(sscanf(argv[i], "%d", &part) == 1) + continue; + + fd = open(argv[i], 0, 0); + if (fd >= 0) + { + ioctl(fd, RAID_AUTORUN, part); + close(fd); + } else + { + printf("Error: Failed to open %s!\n", argv[i]); + retval=1; + } + + part = 0; + } + + return retval; +}