Implement ZFS Support
authorRichard Yao <ryao@cs.stonybrook.edu>
Sat, 28 Jan 2012 18:57:11 +0000 (13:57 -0500)
committerRobin H. Johnson <robbat2@gentoo.org>
Mon, 6 Feb 2012 08:19:17 +0000 (08:19 +0000)
This provides ZFS support, to go with the sys-fs/zfs package.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> (cleanups)
23 files changed:
ChangeLog
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

index 6c2a7d7af2b54d3a3fcd1239ae8e676853815878..d6e4dcf2663633cf4e72ea0f2541ddfae437f452 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,16 @@
 # Distributed under the GPL v2
 # $Id$
 
 # 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.
 
   06 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_initramfs.sh:
   Refactor copy_binaries and multipath slightly for ease of usage and readability.
 
index 2aeb5c1dfc3418356c441f5b7242fe683b30839f..6d7dfbf81169820318b3119faae7f9fabeddd997 100644 (file)
@@ -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_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"
 
 
index a4c5f51f358d2e0e0463dc333cdc70e6aafe87d1..616caaf5bf0ad89f589fe12bd64557de035b0e6e 100644 (file)
@@ -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_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"
 
 
index 971484c44536d97f367951db11f22a21bfc26696..aa9ae313bfdf10451e78da9dae69722eced98067 100644 (file)
@@ -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_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"
index 2aeb5c1dfc3418356c441f5b7242fe683b30839f..6d7dfbf81169820318b3119faae7f9fabeddd997 100644 (file)
@@ -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_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"
 
 
index 2aeb5c1dfc3418356c441f5b7242fe683b30839f..6d7dfbf81169820318b3119faae7f9fabeddd997 100644 (file)
@@ -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_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"
 
 
index 971484c44536d97f367951db11f22a21bfc26696..aa9ae313bfdf10451e78da9dae69722eced98067 100644 (file)
@@ -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_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"
index 2aeb5c1dfc3418356c441f5b7242fe683b30839f..6d7dfbf81169820318b3119faae7f9fabeddd997 100644 (file)
@@ -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_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"
 
 
index 971484c44536d97f367951db11f22a21bfc26696..aa9ae313bfdf10451e78da9dae69722eced98067 100644 (file)
@@ -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_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"
index 2aeb5c1dfc3418356c441f5b7242fe683b30839f..6d7dfbf81169820318b3119faae7f9fabeddd997 100644 (file)
@@ -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_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"
 
 
index 971484c44536d97f367951db11f22a21bfc26696..aa9ae313bfdf10451e78da9dae69722eced98067 100644 (file)
@@ -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_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"
index cf3b19f568a839b1bb1152db9356adbb6ceb0510..d00e495e5b162ffd6601257893017a3c91bc5891 100644 (file)
@@ -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_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"
 
 
index a9383e553200b393fff4af2fbef21b4da93d72c1..c6019272602a444d65779d61eac82c2c88617e37 100644 (file)
@@ -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_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"
 
 
index d12f57d8d8ac93d7110e59a085fd548c014e2a02..0da1ec39ad38c705bce3335c1004bf3d36336fb5 100644 (file)
@@ -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_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"
index 8d6936938814271a1b326b645adc224b3d61ece4..2b9a4c458f02b4bf02e35fbba1daac3538b89e00 100644 (file)
@@ -220,7 +220,7 @@ CONFIG_FALSE=y
 CONFIG_FSYNC=y
 CONFIG_HEAD=y
 # CONFIG_FEATURE_FANCY_HEAD is not set
 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
 # CONFIG_INSTALL is not set
 # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
 CONFIG_LN=y
index 609c52f7734bb3bc41942108761ef386ee1d2f13..54e7b807e0b91be2cdf55a53c69cf85a2e8641b8 100755 (executable)
@@ -664,6 +664,11 @@ startVolumes() {
                        bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
                fi
        fi
                        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() {
 }
 
 startiscsi() {
index 6bdaea1b20c86237ce7c4150287499247fe37c33..0a69a6d8cd48463461d566f33a0921539f42d847 100755 (executable)
@@ -96,6 +96,19 @@ do
                        DMRAID_OPTS=${x#*=}
                        USE_DMRAID_NORMAL=1
                ;;
                        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'
                # Debug Options
                debug)
                        DEBUG='yes'
@@ -444,6 +457,49 @@ do
                                        continue
                                fi
                                ;;
                                        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}" = '' ]
                esac
 
                if [ "${REAL_ROOT}" = '' ]
@@ -477,17 +533,24 @@ do
        else
                good_msg "Mounting root..."
 
        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
                # 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
                        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
 
                        fi
                fi
 
index 269a40c78ca39fa05d418a280b638923e06d8edf..d65f9f93f4374a923617d647177c5a5a47721649 100644 (file)
@@ -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_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"
 
 
index 1e02fb7d67e1f9a04d79316f8874ffdb9fd6860c..67edbd944bfc41ddeecc1c6c08447deb307f4a58 100644 (file)
@@ -260,6 +260,9 @@ INITIALIZATION
 *--*[*no-*]*dmraid*::
     Includes or excludes DMRAID support.
 
 *--*[*no-*]*dmraid*::
     Includes or excludes DMRAID support.
 
+*--*[*no-*]*zfs*::
+    Includes or excludes ZFS support.
+
 *--*[*no-*]*multipath*::
     Includes or excludes Multipath 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
 
 *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.
 *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>
 - 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
 
 
 SEE ALSO
index 4c04f940b0f2a2eaf06992ab4e5cd6dddea0351e..de56a25393e70466415a381975f1003e9295bded 100755 (executable)
@@ -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 "       --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"
   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}"
                        ;;
                        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 ]
                --multipath|--no-multipath)
                        CMD_MULTIPATH=`parse_optbool "$*"`
                        if [ "$CMD_MULTIPATH" = "1" -a ! -e /usr/include/libdevmapper.h ]
index b12efcaf85977dc66c0b3a33b6f1232ef870c56b..e6ed0a3cdbb1ff388f120c915bb7ef5e2f86cb5c 100755 (executable)
@@ -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   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"
        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"
index 43fd77f4767eb6e7d74cb0235373589ffea5257e..170361bc5a90ec53209089c16708a639e597555d 100755 (executable)
@@ -328,6 +328,31 @@ append_mdadm(){
        rm -rf "${TEMP}/initramfs-mdadm-temp" > /dev/null
 }
 
        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}" ]
 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
 
                print_info 1 "initramfs: Not copying modules..."
        fi
 
+       append_data 'zfs' "${ZFS}"
+
        append_data 'blkid' "${DISKLABEL}"
 
        append_data 'unionfs_fuse' "${UNIONFS}"
        append_data 'blkid' "${DISKLABEL}"
 
        append_data 'unionfs_fuse' "${UNIONFS}"
index 19ef657181b5d44588bd92467f934ed17c1b4253..5883b5d9295b4459b85c5476d9d672101b143ebc 100755 (executable)
--- 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>"'
        [ "${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'
        [ "${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'