Last active
May 16, 2021 06:09
-
-
Save thehaven/6946427 to your computer and use it in GitHub Desktop.
ZFS kernel module build script (assumes /usr/src/linux for kernel path), useful for patching a kernel with ZFS code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
current=`pwd` | |
#branch='0.6.5.8' | |
#zfs_commit='cb2e3360380ad465c2e5685941ae125b5cff463a' # OpenZFS 2.1.0-rc5 | |
#zfs_commit='6150fbe67f7a9485eaabbca7df9a66852cda6892' # OpenZFS 2.0.4 | |
function prep_and_clean() { | |
cd /usr/src/linux && make prepare | |
rm -Rf ${current}/spl ${current}/zfs | |
} | |
function build_spl() { | |
if [ ! -d "${current}/spl" ]; then | |
cd ${current} && git clone https://github.com/zfsonlinux/spl.git | |
fi | |
cd ${current}/spl | |
if [ ! "${spl_commit}" == "" ]; then | |
git checkout ${spl_commit} | |
elif [ ! "${branch}" == "" ]; then | |
git checkout spl-${branch} | |
else | |
git checkout master | |
fi | |
git pull | |
make distclean | |
./autogen.sh | |
./configure --prefix=/ \ | |
--libdir=/lib64 \ | |
--includedir=/usr/include \ | |
--datarootdir=/usr/share \ | |
--enable-linux-builtin=yes \ | |
--with-linux=/usr/src/linux \ | |
--with-linux-obj=/usr/src/linux | |
./copy-builtin /usr/src/linux | |
} | |
function build_zfs() { | |
if [ ! -d "$current/zfs" ]; then | |
cd $current && git clone https://github.com/zfsonlinux/zfs.git | |
fi | |
cd ${current}/zfs | |
if [ ! "${zfs_commit}" == "" ]; then | |
git checkout ${zfs_commit} | |
elif [ ! "${branch}" == "" ]; then | |
git checkout zfs-${branch} | |
else | |
git checkout master | |
fi | |
git pull | |
make distclean | |
./autogen.sh | |
./configure --prefix=/ \ | |
--libdir=/lib64 \ | |
--includedir=/usr/include \ | |
--datarootdir=/usr/share \ | |
--enable-linux-builtin=yes \ | |
--with-linux=/usr/src/linux \ | |
--with-linux-obj=/usr/src/linux \ | |
--with-spl="../spl" \ | |
--with-spl-obj="../spl" | |
./copy-builtin /usr/src/linux | |
} | |
prep_and_clean | |
#build_spl | |
build_zfs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment