echo " --evms2 Include EVMS2 support"
echo " --> 'emerge evms' in the host operating system first"
echo " --lvm2 Include LVM2 support"
+ echo " --dmraid Include DMRAID support"
echo " --bootloader=grub Add new kernel to GRUB configuration"
echo " --linuxrc=<file> Specifies a user created linuxrc"
echo " Internals"
CMD_LVM2=1
print_info 2 'CMD_LVM2: 1'
;;
+ --dmraid)
+ CMD_DMRAID=1
+ print_info 2 'CMD_DMRAID: 1'
+ ;;
--bootloader=*)
CMD_BOOTLOADER=`parse_opt "$*"`
print_info 2 "CMD_BOOTLOADER: $CMD_BOOTLOADER"
fi
}
+compile_dmraid() {
+ compile_device_mapper
+ if [ ! -f "${DMRAID_BINCACHE}" ]
+ then
+ [ -f "${DMRAID_SRCTAR}" ] ||
+ gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf ${DMRAID_DIR} > /dev/null
+ tar -jxpf ${DMRAID_SRCTAR} ||
+ gen_die 'Could not extract DMRAID source tarball!'
+ [ -d "${DMRAID_DIR}" ] ||
+ gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
+ rm -rf "${TEMP}/device-mapper" > /dev/null
+ tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
+ gen_die "Could not extract device-mapper binary cache!";
+
+ cd "${DMRAID_DIR}"
+ print_info 1 'dmraid: >> Configuring...'
+
+ LDFLAGS="-L${TEMP}/device-mapper/lib" \
+ CFLAGS="-I${TEMP}/device-mapper/include" \
+ CPPFLAGS="-I${TEMP}/device-mapper/include" \
+ ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
+ gen_die 'Configure of dmraid failed!'
+ mkdir "${TEMP}/dmraid"
+ print_info 1 'dmraid: >> Compiling...'
+ compile_generic '' utils
+ #compile_generic 'install' utils
+ mkdir ${TEMP}/dmraid/sbin
+ install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
+ print_info 1 ' >> Copying to bincache...'
+ cd "${TEMP}/dmraid"
+ tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
+ gen_die 'Could not create binary cache'
+
+ cd "${TEMP}"
+ rm -rf "${TEMP}/device-mapper" > /dev/null
+ rm -rf "${DMRAID_DIR}" dmraid
+ fi
+}
+
compile_modutils() {
# I've disabled dietlibc support for the time being since the
# version we use misses a few needed system calls.
UDEV_BINCACHE=`cache_replace "${UDEV_BINCACHE}"`
DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
LVM2_BINCACHE=`cache_replace "${LVM2_BINCACHE}"`
+ DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
UDEV_BINCACHE=`arch_replace "${UDEV_BINCACHE}"`
DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
LVM2_BINCACHE=`arch_replace "${LVM2_BINCACHE}"`
+ DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
if [ "${CMD_BOOTSPLASH}" != '' ]
then
else
LVM2=0
fi
+
+ if isTrue "${CMD_DMRAID}"
+ then
+ DMRAID=1
+ else
+ DMRAID=0
+ fi
}
mkdir -p ${TEMP}/initrd-temp/temp
mkdir -p ${TEMP}/initrd-temp/sys
mkdir -p ${TEMP}/initrd-temp/.initrd
+ mkdir -p ${TEMP}/initrd-temp/var/lock/dmraid
ln -s bin ${TEMP}/initrd-temp/sbin
ln -s ../bin ${TEMP}/initrd-temp/usr/bin
ln -s ../bin ${TEMP}/initrd-temp/usr/sbin
# bunzip2 "${TEMP}/initrd-temp/etc/devfsd.conf.bz2" ||
# gen_die "could not uncompress devfsd.conf"
+ # DMRAID
+ if [ "${DMRAID}" = '1' ]
+ then
+ print_info 1 'DMRAID: Adding support (compiling binaries)...'
+ compile_dmraid
+ tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initrd-temp" ||
+ gen_die "Could not extract dmraid binary cache!";
+ fi
# LVM2
if [ "${LVM2}" = '1' ]
then
INITRD_CALC_SIZE=`calc_initrd_size`
INITRD_SIZE=`expr ${INITRD_CALC_SIZE} + 100`
print_info 1 " :: Size is at ${INITRD_SIZE}K"
-
print_info 1 " >> Creating loopback filesystem..."
create_initrd_loop ${INITRD_SIZE}
USE_UDEV_NORMAL=2
USE_EVMS_NORMAL=1
USE_LVM2_NORMAL=1
+USE_DMRAID_NORMAL=1
if [ "$$" != '1' ]
then
nolvm2)
USE_LVM2_NORMAL=0
;;
+ nodmraid)
+ USE_DMRAID_NORMAL=0
+ ;;
noevms)
USE_EVMS_NORMAL=0
;;
devfsd /dev -np
fi
+if [ -e '/sbin/dmraid' -a "${USE_DMRAID_NORMAL}" -eq '1' ]
+then
+ echo -e "${GOOD}>>${NORMAL}${BOLD} Activating device-mapper raid array(s)...${NORMAL}"
+ /sbin/dmraid -ay
+fi
+
if [ "${DO_lvm2}" -a "${USE_LVM2_NORMAL}" -eq '1' ]
then
if [ -e '/sbin/vgscan' -a -e '/sbin/vgchange' ]
LVM2_DIR="LVM2.${LVM2_VER}"
LVM2_SRCTAR="${GK_SHARE}/pkg/LVM2.${LVM2_VER}.tgz"
LVM2_BINCACHE="%%CACHE%%/LVM2.${LVM2_VER}-%%ARCH%%.tar.bz2"
+
+DMRAID_VER="1.0.0-rc5f"
+DMRAID_DIR="dmraid/${DMRAID_VER}"
+DMRAID_SRCTAR="${GK_SHARE}/pkg/dmraid-${DMRAID_VER}.tar.bz2"
+DMRAID_BINCACHE="%%CACHE%%/dmraid-${DMRAID_VER}-%%ARCH%%.tar.bz2"