aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Yao <ryao@cs.stonybrook.edu>2012-01-28 13:57:11 -0500
committerRobin H. Johnson <robbat2@gentoo.org>2012-02-06 08:19:17 +0000
commitfc98fa9d89319e7705a393a739b99f994e12420b (patch)
treec39cbcc441b70c31884c4a0d6a066bfd87c63d7f
parentcopy_binaries, multipath: refactor for ease of use and readability. (diff)
downloadgenkernel-fc98fa9d89319e7705a393a739b99f994e12420b.tar.gz
genkernel-fc98fa9d89319e7705a393a739b99f994e12420b.tar.bz2
genkernel-fc98fa9d89319e7705a393a739b99f994e12420b.zip
Implement ZFS Support
This provides ZFS support, to go with the sys-fs/zfs package. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> (cleanups)
-rw-r--r--ChangeLog10
-rw-r--r--arch/alpha/modules_load2
-rw-r--r--arch/arm/modules_load2
-rw-r--r--arch/ia64/modules_load2
-rw-r--r--arch/mips/modules_load2
-rw-r--r--arch/parisc/modules_load2
-rw-r--r--arch/parisc64/modules_load2
-rw-r--r--arch/ppc/modules_load2
-rw-r--r--arch/ppc64/modules_load2
-rw-r--r--arch/sparc/modules_load2
-rw-r--r--arch/sparc64/modules_load2
-rw-r--r--arch/um/modules_load2
-rw-r--r--arch/x86/modules_load2
-rw-r--r--arch/x86_64/modules_load2
-rw-r--r--defaults/busy-config2
-rwxr-xr-xdefaults/initrd.scripts5
-rwxr-xr-xdefaults/linuxrc71
-rw-r--r--defaults/modules_load2
-rw-r--r--doc/genkernel.8.txt8
-rwxr-xr-xgen_cmdline.sh6
-rwxr-xr-xgen_determineargs.sh1
-rwxr-xr-xgen_initramfs.sh27
-rwxr-xr-xgenkernel2
23 files changed, 141 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c2a7d7a..d6e4dcf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,16 @@
# Distributed under the GPL v2
# $Id$
+ 06 Feb 2012: Richard Yao <ryao@cs.stonybrook.edu> arch/alpha/modules_load,
+ arch/arm/modules_load, arch/ia64/modules_load, arch/mips/modules_load,
+ arch/parisc/modules_load, arch/parisc64/modules_load, arch/ppc/modules_load,
+ arch/ppc64/modules_load, arch/sparc/modules_load, arch/sparc64/modules_load,
+ arch/um/modules_load, arch/x86/modules_load, arch/x86_64/modules_load,
+ defaults/busy-config, defaults/initrd.scripts, defaults/linuxrc,
+ defaults/modules_load, doc/genkernel.8.txt, gen_cmdline.sh,
+ gen_determineargs.sh, gen_initramfs.sh, genkernel:
+ This provides ZFS support, to go with the sys-fs/zfs package.
+
06 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_initramfs.sh:
Refactor copy_binaries and multipath slightly for ease of usage and readability.
diff --git a/arch/alpha/modules_load b/arch/alpha/modules_load
index 2aeb5c1d..6d7dfbf8 100644
--- a/arch/alpha/modules_load
+++ b/arch/alpha/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/arm/modules_load b/arch/arm/modules_load
index a4c5f51f..616caaf5 100644
--- a/arch/arm/modules_load
+++ b/arch/arm/modules_load
@@ -21,5 +21,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/ia64/modules_load b/arch/ia64/modules_load
index 971484c4..aa9ae313 100644
--- a/arch/ia64/modules_load
+++ b/arch/ia64/modules_load
@@ -24,4 +24,4 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/mips/modules_load b/arch/mips/modules_load
index 2aeb5c1d..6d7dfbf8 100644
--- a/arch/mips/modules_load
+++ b/arch/mips/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/parisc/modules_load b/arch/parisc/modules_load
index 2aeb5c1d..6d7dfbf8 100644
--- a/arch/parisc/modules_load
+++ b/arch/parisc/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/parisc64/modules_load b/arch/parisc64/modules_load
index 971484c4..aa9ae313 100644
--- a/arch/parisc64/modules_load
+++ b/arch/parisc64/modules_load
@@ -24,4 +24,4 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/ppc/modules_load b/arch/ppc/modules_load
index 2aeb5c1d..6d7dfbf8 100644
--- a/arch/ppc/modules_load
+++ b/arch/ppc/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/ppc64/modules_load b/arch/ppc64/modules_load
index 971484c4..aa9ae313 100644
--- a/arch/ppc64/modules_load
+++ b/arch/ppc64/modules_load
@@ -24,4 +24,4 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/sparc/modules_load b/arch/sparc/modules_load
index 2aeb5c1d..6d7dfbf8 100644
--- a/arch/sparc/modules_load
+++ b/arch/sparc/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/sparc64/modules_load b/arch/sparc64/modules_load
index 971484c4..aa9ae313 100644
--- a/arch/sparc64/modules_load
+++ b/arch/sparc64/modules_load
@@ -24,4 +24,4 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/um/modules_load b/arch/um/modules_load
index cf3b19f5..d00e495e 100644
--- a/arch/um/modules_load
+++ b/arch/um/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/x86/modules_load b/arch/x86/modules_load
index a9383e55..c6019272 100644
--- a/arch/x86/modules_load
+++ b/arch/x86/modules_load
@@ -25,5 +25,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/arch/x86_64/modules_load b/arch/x86_64/modules_load
index d12f57d8..0da1ec39 100644
--- a/arch/x86_64/modules_load
+++ b/arch/x86_64/modules_load
@@ -24,4 +24,4 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd hid-a4tech hid-apple hid-belkin hid-cherry hid-chicony hid-cypress hid-dummy hid-ezkey hid-gyration hid-logitech hid-microsoft hid-monterey hid-petalynx hid-pl hid-samsung hid-sony hid-sunplus"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/defaults/busy-config b/defaults/busy-config
index 8d693693..2b9a4c45 100644
--- a/defaults/busy-config
+++ b/defaults/busy-config
@@ -220,7 +220,7 @@ CONFIG_FALSE=y
CONFIG_FSYNC=y
CONFIG_HEAD=y
# CONFIG_FEATURE_FANCY_HEAD is not set
-# CONFIG_HOSTID is not set
+CONFIG_HOSTID=y
# CONFIG_INSTALL is not set
# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
CONFIG_LN=y
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 609c52f7..54e7b807 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -664,6 +664,11 @@ startVolumes() {
bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
fi
fi
+
+ if [ "${USE_ZFS}" = '1' ]
+ then
+ /sbin/zpool import -N -a ${ZPOOL_FORCE}
+ fi
}
startiscsi() {
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 6bdaea1b..0a69a6d8 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -96,6 +96,19 @@ do
DMRAID_OPTS=${x#*=}
USE_DMRAID_NORMAL=1
;;
+ dozfs*)
+ if [ ! -x /sbin/zfs ]; then
+ USE_ZFS=0
+ bad_msg 'zfs binary not found: aborting use of zfs!'
+ else
+ USE_ZFS=1
+ MY_HWOPTS="${MY_HWOPTS} zfs"
+ if [ "${x#*=}" = 'force' ]
+ then
+ ZPOOL_FORCE=-f
+ fi
+ fi
+ ;;
# Debug Options
debug)
DEBUG='yes'
@@ -444,6 +457,49 @@ do
continue
fi
;;
+ ZFS*)
+ ROOT_DEV="${REAL_ROOT#*=}"
+ if [ "${ROOT_DEV}" != 'ZFS' ]
+ then
+ zfs get type ${ROOT_DEV} > /dev/null
+
+ if [ "$?" = '0' ]
+ then
+ got_good_root=1;
+ REAL_ROOT=${ROOT_DEV}
+ ROOTFSTYPE=zfs
+ fi
+ else
+ BOOTFS=$(/sbin/zpool list -H -o bootfs)
+ if [ "${BOOTFS}" != '-' ]
+ then
+
+ for i in ${BOOTFS}
+ do
+
+ zfs get type ${i} > /dev/null
+ retval=$?
+
+ if [ ${retval} -eq 0 ]; then
+ got_good_root=1
+ REAL_ROOT=${i}
+ ROOTFSTYPE=zfs
+ break
+ fi
+
+ done;
+
+ fi
+
+ fi
+
+ if [ ${got_good_root} -ne 1 ]; then
+ prompt_user "REAL_ROOT" "root block device"
+ got_good_root=0
+ fi
+
+ continue
+ ;;
esac
if [ "${REAL_ROOT}" = '' ]
@@ -477,17 +533,24 @@ do
else
good_msg "Mounting root..."
+ if [ "${ROOTFSTYPE}" = 'zfs' ]
+ then
+ MOUNT_STATE=rw
+ else
+ MOUNT_STATE=ro
+ fi
+
# Try to mount the device as ${NEW_ROOT}
if [ "${REAL_ROOT}" = '/dev/nfs' ]; then
findnfsmount
else
# mount ro so fsck doesn't barf later
if [ "${REAL_ROOTFLAGS}" = '' ]; then
- good_msg "Using mount -t ${ROOTFSTYPE} -o ro"
- mount -t ${ROOTFSTYPE} -o ro ${REAL_ROOT} ${NEW_ROOT}
+ good_msg "Using mount -t ${ROOTFSTYPE} -o ${MOUNT_STATE}"
+ mount -t ${ROOTFSTYPE} -o ${MOUNT_STATE} ${REAL_ROOT} ${NEW_ROOT}
else
- good_msg "Using mount -t ${ROOTFSTYPE} -o ro,${REAL_ROOTFLAGS}"
- mount -t ${ROOTFSTYPE} -o ro,${REAL_ROOTFLAGS} ${REAL_ROOT} ${NEW_ROOT}
+ good_msg "Using mount -t ${ROOTFSTYPE} -o ${MOUNT_STATE},${REAL_ROOTFLAGS}"
+ mount -t ${ROOTFSTYPE} -o ${MOUNT_STATE},${REAL_ROOTFLAGS} ${REAL_ROOT} ${NEW_ROOT}
fi
fi
diff --git a/defaults/modules_load b/defaults/modules_load
index 269a40c7..d65f9f93 100644
--- a/defaults/modules_load
+++ b/defaults/modules_load
@@ -24,5 +24,5 @@ MODULES_PCMCIA="pcmcia pcmcia_core yenta_socket pd6729 i82092 i82365 tcic ds ide
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage uhci-hcd ohci-hcd usbhid sl811-hcd"
# Filesystems
-MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs fuse"
+MODULES_FS="ext2 ext3 ext4 btrfs reiserfs jfs nfs xfs zfs fuse"
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 1e02fb7d..67edbd94 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -260,6 +260,9 @@ INITIALIZATION
*--*[*no-*]*dmraid*::
Includes or excludes DMRAID support.
+*--*[*no-*]*zfs*::
+ Includes or excludes ZFS support.
+
*--*[*no-*]*multipath*::
Includes or excludes Multipath support
@@ -439,6 +442,10 @@ which the ramdisk scripts would recognize.
*domdadm*::
Scan for RAID arrays on bootup
+*dozfs*[=force]::
+ Scan for bootable ZFS pools on bootup. Optionally force import if
+ necessary.
+
*doscsi*::
Activate SCSI devices on bootup, necessary when SCSI support is
compiled as modules and you're using SCSI or SATA devices.
@@ -586,6 +593,7 @@ AUTHORS
- NFS Support by Thomas Seiler <thseiler@gmail.com>
- GnuPG 1.x integration by dacook <schism@subverted.org>
- MDADM integration by Matthias Dahl <ua_bugz_gentoo@mortal-soul.de>
+- ZFS integration by Richard Yao <ryao@cs.stonybrook.edu>
SEE ALSO
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 4c04f940..de56a253 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -90,6 +90,8 @@ longusage() {
echo " --mdadm-config=<file> Use file as mdadm.conf in initramfs"
echo " --dmraid Include DMRAID support"
echo " --no-dmraid Exclude DMRAID support"
+ echo " --zfs Include ZFS support"
+ echo " --no-zfs Exclude ZFS support"
echo " --multipath Include Multipath support"
echo " --no-multipath Exclude Multipath support"
echo " --iscsi Include iSCSI support"
@@ -296,6 +298,10 @@ parse_cmdline() {
fi
print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
;;
+ --zfs|--no-zfs)
+ CMD_ZFS=`parse_optbool "$*"`
+ print_info 2 "CMD_ZFS: ${CMD_ZFS}"
+ ;;
--multipath|--no-multipath)
CMD_MULTIPATH=`parse_optbool "$*"`
if [ "$CMD_MULTIPATH" = "1" -a ! -e /usr/include/libdevmapper.h ]
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index b12efcaf..e6ed0a3c 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -120,6 +120,7 @@ determine_real_args() {
set_config_with_override BOOL GPG CMD_GPG
set_config_with_override BOOL MDADM CMD_MDADM
set_config_with_override STRING MDADM_CONFIG CMD_MDADM_CONFIG
+ set_config_with_override BOOL ZFS CMD_ZFS
set_config_with_override BOOL MULTIPATH CMD_MULTIPATH
set_config_with_override BOOL FIRMWARE CMD_FIRMWARE
set_config_with_override STRING FIRMWARE_DIR CMD_FIRMWARE_DIR "/lib/firmware"
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 43fd77f4..170361bc 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -328,6 +328,31 @@ append_mdadm(){
rm -rf "${TEMP}/initramfs-mdadm-temp" > /dev/null
}
+append_zfs(){
+ if [ -d "${TEMP}/initramfs-zfs-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-zfs-temp"
+ fi
+
+ mkdir -p "${TEMP}/initramfs-zfs-temp/etc/zfs/"
+
+ # Copy files to /etc/zfs
+ for i in /etc/zfs/{zdev.conf,zpool.cache}
+ do
+ cp -a "${i}" "${TEMP}/initramfs-zfs-temp/etc/zfs" \
+ || gen_die "Could not copy file ${i} for ZFS"
+ done
+
+ # Copy binaries
+ copy_binaries "${TEMP}/initramfs-zfs-temp" /sbin/{mount.zfs,zfs,zpool}
+
+ cd "${TEMP}/initramfs-zfs-temp/"
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
+ || gen_die "compressing zfs cpio"
+ cd "${TEMP}"
+ rm -rf "${TEMP}/initramfs-zfs-temp" > /dev/null
+}
+
append_splash(){
splash_geninitramfs=`which splash_geninitramfs 2>/dev/null`
if [ -x "${splash_geninitramfs}" ]
@@ -642,6 +667,8 @@ create_initramfs() {
print_info 1 "initramfs: Not copying modules..."
fi
+ append_data 'zfs' "${ZFS}"
+
append_data 'blkid' "${DISKLABEL}"
append_data 'unionfs_fuse' "${UNIONFS}"
diff --git a/genkernel b/genkernel
index 19ef6571..5883b5d9 100755
--- a/genkernel
+++ b/genkernel
@@ -351,6 +351,8 @@ then
[ "${DMRAID}" = '1' ] && print_warning 1 'add "dodmraid" for dmraid support'
[ "${MDADM}" = '1' ] && print_warning 1 'add "domdadm" for RAID support'
[ "${DMRAID}" = '1' ] && print_warning 1 ' or "dodmraid=<additional options>"'
+ [ "${ZFS}" = '1' ] && print_warning 1 'add "dozfs" for ZFS support'
+ [ "${ZFS}" = '1' ] && print_warning 1 ' and either "real_root=ZFS" to use bootfs autodetection or "real_root=ZFS=<dataset>" to force booting from a specific dataset'
[ "${ISCSI}" = '1' ] && print_warning 1 'add at least "iscsi_initiatorname=<initiator name> iscsi_target=<target name> and iscsi_address=<target ip>" for iscsi support'
if [ `grep 'CONFIG_EXT[0-9]_FS=' "${KERNEL_DIR}"/.config | wc -l` -ge 2 ]; then
print_warning 1 'With support for several ext* filesystems around it may be needed to'