7 echo "usage: $0 <kernel source tree>" >&2
11 [ "$#" -eq 1 ] || usage
12 KERNEL_DIR
="$(readlink --canonicalize-existing "$1")"
14 if ! [ -e 'zfs_config.h' ]
17 echo " $0: you did not run configure, or you're not in the ZFS source directory." >&2
18 echo " $0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." >&2
26 rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
27 cp --recursive include
"$KERNEL_DIR/include/zfs"
28 cp --recursive module
"$KERNEL_DIR/fs/zfs"
29 cp zfs_config.h
"$KERNEL_DIR/include/zfs/"
31 cat > "$KERNEL_DIR/fs/zfs/Kconfig" <<"EOF"
33 tristate "ZFS filesystem support"
34 depends on EFI_PARTITION
38 This is the ZFS filesystem from the ZFS On Linux project.
40 See https://zfsonlinux.org/
42 To compile this file system support as a module, choose M here.
54 while IFS='' read -r LINE
58 if [ -n "$MARKER" -a "$LINE" = "$MARKER" ]
62 if IFS='' read -r LINE
64 [ "$LINE" != "$NEW" ] && echo "$LINE"
67 done < "$FILE" > "$FILE.new"
69 mv "$FILE.new" "$FILE"
72 add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
73 add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
77 echo " $0: now you can build the kernel with ZFS support." >&2
78 echo " $0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2