Skip to content

Commit

Permalink
Add dracut support
Browse files Browse the repository at this point in the history
To simplify the process of using zfs as your root filesystem a
zfs-drucat sub-package has been added.  This sub-package adds a zfs
dracut module which allows your initramfs to be rebuilt with zfs
support.  The process for doing this is still complicated but there
is clearly interest from the community about getting this working
well and documented.  This should help lay some of the groundwork.

Longer term these changes should be pushed in the upstream dracut
package.  Once that occurs this subpackage will no longer be
required for new systems, however we may want to conditionally
build this package in the future for systems running older
dracut versions.

Signed-off-by: Brian Behlendorf <[email protected]>
  • Loading branch information
Rudd-O authored and behlendorf committed Mar 17, 2011
1 parent 01c0e61 commit ae26d04
Show file tree
Hide file tree
Showing 19 changed files with 1,355 additions and 8 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ to the project and deserve to be acknowledged.
Ned Bass <[email protected]>
Herb Wartens <[email protected]>
Jim Garlick <[email protected]>
Manuel Amador (Rudd-O) <[email protected]>
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include $(top_srcdir)/config/deb.am
include $(top_srcdir)/config/tgz.am

if CONFIG_USER
USER_DIR = etc man scripts lib cmd
USER_DIR = dracut etc man scripts lib cmd
endif
if CONFIG_KERNEL
KERNEL_DIR = module
Expand Down
9 changes: 5 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = etc man scripts lib cmd module include
DIST_SUBDIRS = dracut etc man scripts lib cmd module include
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
Expand Down Expand Up @@ -325,7 +325,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@CONFIG_USER_TRUE@USER_DIR = etc man scripts lib cmd
@CONFIG_USER_TRUE@USER_DIR = dracut etc man scripts lib cmd
@CONFIG_KERNEL_TRUE@KERNEL_DIR = module
SUBDIRS = $(USER_DIR) $(KERNEL_DIR) include
AUTOMAKE_OPTIONS = foreign
Expand Down Expand Up @@ -954,8 +954,9 @@ deb-utils: deb-local rpm-utils
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3; \
$(RM) $$pkg1 $$pkg2 $$pkg3
pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \
$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4

deb: deb-modules deb-utils
tgz-local:
Expand Down
5 changes: 3 additions & 2 deletions config/deb.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ deb-utils: deb-local rpm-utils
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3; \
$(RM) $$pkg1 $$pkg2 $$pkg3
pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \
$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4

deb: deb-modules deb-utils
4 changes: 3 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -19928,7 +19928,7 @@ fi
$as_echo "$enable_debug" >&6; }


ac_config_files="$ac_config_files Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"


cat >confcache <<\_ACEOF
Expand Down Expand Up @@ -20845,6 +20845,8 @@ do
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"dracut/Makefile") CONFIG_FILES="$CONFIG_FILES dracut/Makefile" ;;
"dracut/90zfs/Makefile") CONFIG_FILES="$CONFIG_FILES dracut/90zfs/Makefile" ;;
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
"etc/udev/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/Makefile" ;;
"etc/udev/rules.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/Makefile" ;;
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ ZFS_AC_DEBUG

AC_CONFIG_FILES([
Makefile
dracut/Makefile
dracut/90zfs/Makefile
etc/Makefile
etc/udev/Makefile
etc/udev/rules.d/Makefile
Expand Down
7 changes: 7 additions & 0 deletions dracut/90zfs/90-zfs.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SUBSYSTEM!="block", GOTO="zfs_end"
ACTION!="add|change", GOTO="zfs_end"

ENV{ID_FS_TYPE}=="zfs", RUN+="/sbin/modprobe zfs"
ENV{ID_FS_TYPE}=="zfs_member", RUN+="/sbin/modprobe zfs"

LABEL="zfs_end"
27 changes: 27 additions & 0 deletions dracut/90zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pkgdracutdir = $(datarootdir)/dracut/modules.d/90zfs
dist_pkgdracut_SCRIPTS = \
$(top_srcdir)/dracut/90zfs/90-zfs.rules \
$(top_srcdir)/dracut/90zfs/check \
$(top_srcdir)/dracut/90zfs/install \
$(top_srcdir)/dracut/90zfs/installkernel \
$(top_srcdir)/dracut/90zfs/mount-zfs.sh \
$(top_srcdir)/dracut/90zfs/zfs-genrules.sh \
$(top_srcdir)/dracut/90zfs/parse-zfs.sh

all:
@list='$(dist_pkgdracut_SCRIPTS)'; \
for file in $$list; do \
link=$$(basename $$file); \
if [ ! -e $$link ]; then \
$(LN_S) $$file $$link; \
fi \
done

clean:
@list='$(dist_pkgdracut_SCRIPTS)'; \
for file in $$list; do \
link=$$(basename $$file); \
if [ -L $$link ]; then \
$(RM) $$link; \
fi \
done
Loading

0 comments on commit ae26d04

Please sign in to comment.