]>
git.proxmox.com Git - mirror_zfs.git/blob - copy-builtin
7 echo "usage: $0 <kernel source tree>" >&2
11 [ "$#" -eq 1 ] || usage
12 KERNEL_DIR
="$(readlink --canonicalize-existing "$1")"
15 for MODULE_DIR
in module
/* module
/os
/linux
/*
17 [ -d "$MODULE_DIR" ] ||
continue
18 [ "os" = "${MODULE_DIR#*/}" ] && continue
19 MODULES
+=("${MODULE_DIR#*/}")
22 if ! [ -e 'zfs_config.h' ]
25 echo " $0: you did not run configure, or you're not in the ZFS source directory." >&2
26 echo " $0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." >&2
32 scripts
/make_gitrev.sh || true
34 rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
35 cp --recursive include
"$KERNEL_DIR/include/zfs"
36 cp --recursive module
"$KERNEL_DIR/fs/zfs"
37 cp zfs_config.h
"$KERNEL_DIR/include/zfs/"
39 for MODULE
in "${MODULES[@]}"
41 sed -i.bak
'/obj =/d' "$KERNEL_DIR/fs/zfs/$MODULE/Makefile"
42 sed -i.bak
'/src =/d' "$KERNEL_DIR/fs/zfs/$MODULE/Makefile"
45 cat > "$KERNEL_DIR/fs/zfs/Kconfig" <<"EOF"
47 tristate "ZFS filesystem support"
48 depends on EFI_PARTITION
52 This is the ZFS filesystem from the ZFS On Linux project.
54 See http://zfsonlinux.org/
56 To compile this file system support as a module, choose M here.
63 ZFS_MODULE_CFLAGS = -I$(srctree)/include/zfs
64 ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/os/linux/spl
65 ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/os/linux/zfs
66 ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/os/linux/kernel
67 ZFS_MODULE_CFLAGS += -include $(srctree)/include/zfs/zfs_config.h
68 ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
69 ZFS_MODULE_CPPFLAGS = -D_KERNEL
70 ZFS_MODULE_CPPFLAGS += -UDEBUG -DNDEBUG
71 export ZFS_MODULE_CFLAGS ZFS_MODULE_CPPFLAGS
76 for MODULE in "${MODULES[@]}"
78 echo 'obj-$(CONFIG_ZFS) += ' "$MODULE/"
80 } > "$KERNEL_DIR/fs/zfs/Kbuild"
89 while IFS='' read -r LINE
93 if [ -n "$MARKER" -a "$LINE" = "$MARKER" ]
97 if IFS='' read -r LINE
99 [ "$LINE" != "$NEW" ] && echo "$LINE"
102 done < "$FILE" > "$FILE.new"
104 mv "$FILE.new" "$FILE"
107 add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
108 add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
111 echo " $0: done." >&2
112 echo " $0: now you can build the kernel with ZFS support." >&2
113 echo " $0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2