BPI-W2 build module driver ZFS (or any other module)

What is the method to cross-compile and build the zfs module (or any other module)? Or is there any mechanism to integrate the source code into the kernel tree, so that everything can be done through the build.sh command provided by SINOVOIP?

The sources used:

  1. https://github.com/BPI-SINOVOIP/BPI-W2-bsp
  2. spl-0.7.5
  3. zfs-0.7.5

Well I got this and it works.

I built the module to support ZFS on the BPI-w2 board, these were the steps.

(Ubuntu 16.04)

  • Download Kernel source & build cross-compile (PC)
  • Download & extract https://github.com/BPI-SINOVOIP/BPI-W2-bsp/archive/refs/heads/master.zip
  • ./build.sh (3. Build kernel only.)
  • ./build.sh (5.)
  • ./build.sh (6.)
  • ./build.sh (7. Update local build to SD with BPI Image flashed)
  • Copy linux-rtk/ -> SD /root/linux-stable
  • Download & extract spl 0.7.5 -> SD /root/spl-0.7.5
  • Download & extract zfs 0.7.5 -> SD /root/zfs-0.7.5

Then I installed the SD on the board and I prepared the modules, as follows…

  • cd /root/zfs-0.7.5
  • ./autogen.sh
  • ./configure --prefix=/ --libdir=/lib --includedir=/usr/include --datarootdir=/usr/share --enable-linux-builtin=yes --with-linux=/root/linux-stable --with-linux-obj=/root/linux-stable
  • ./copy-builtin /root/linux-stable
  • make
  • make install
  • cd /root/zfs-0.7.5
  • Edit META file change CDDL to GPL (Reported: https://github.com/openzfs/zfs/issues/9948)
  • ./autogen.sh
  • ./configure --prefix=/ --libdir=/lib --includedir=/usr/include --datarootdir=/usr/share --enable-linux-builtin=yes --with-linux=/root/linux-stable --with-linux-obj=/root/linux-stable --with-spl=/root/spl-0.7.5 --with-spl-obj=/root/spl-0.7.5
  • ./copy-builtin /root/linux-stable
  • make
  • make install

Then I copied the directory to the PC (/root/linux-stable), in the directory tree of BPI-W2-bsp. I enabled the SPL and ZFS modules, to finally recompile the kernel.

  • ./build.sh (4. kernel configure.) Enable SPL module and ZFS File System module
  • ./build.sh (3. Build kernel only.)
  • ./build.sh (5.)
  • ./build.sh (6.)
  • ./build.sh (7. Update local build to SD with BPI Image flashed)

I hope it works for you.