How to compile ZFS only ?

Ben RUBSON ben.rubson at gmail.com
Thu Mar 23 21:48:52 UTC 2017


Yes I also build with -j24 on these servers, dual E5 too :)

Goal was to keep default kernel (which is OK for my needs), and only modify/recompile zfs module.
I felt I was doing something "huge" / "enormous" recompiling whole kernel whereas I just need to modify one module.

Ben

> On 23 Mar 2017, at 22:41, Steven Hartland <killing at multiplay.co.uk> wrote:
> 
> When building are you building with -jXX where XX is the number of cores in your machine?
> 
> If not then definitely do that on a dual E5 (24 cores) with our cut down kernel config (excludes devices / modules we never use) a full kernel build takes under 60 seconds.
> 
> An example:
> make buildkernel KERNCONF=MULTIPLAY -j24
> 
>    Regards
>    Steve
> 
> On 23/03/2017 19:22, Ben RUBSON wrote:
>> I'm not sure other modules are missing : my server correctly starts, I then only overwrite ZFS module (/boot/kernel/zfs.ko), I think it should then work.
>> But server hangs during startup, certainly because module compiled directly using make is different from the one built with make buildkernel (which works).
>> As says Xin below, some options from sys/*/conf/GENERIC may not be taken into account with the quick make method...
>> 
>> I'll try to give the faulty module a try on a non-zfs root machine.
>> 
>> The -DNO_CLEAN method is interesting if src tree has not been cleaned before :)
>> (I always do a make clean to leave the tree cleaned ^^)
>> 
>> So sounds like there is no solution but trying to speed-up a whole kernel build.
>> 
>> Thank you !
>> 
>> Ben
>> 
>>> On 23 Mar 2017, at 00:51, Steven Hartland <killing at multiplay.co.uk> wrote:
>>> 
>>> In addition to the main zfs module there are also dependency modules which are required.
>>> 
>>> If you're able to test loading the module on a non-zfs root machine by manually loading it, it should detail any issues in /var/log/messages.
>>> 
>>> That said the method listed by Xin is the quickest and easiest solution.
>>> 
>>> On Wed, 22 Mar 2017 at 22:43, Xin LI <delphij at gmail.com <mailto:delphij at gmail.com>> wrote:
>>> Why not just -DNO_CLEAN= with 'make buildkernel'?
>>> 
>>> But to answer your question, 'make buildkernel' will take e.g.
>>> 'KERNCONF' aka kernel build configuration into account, while if you
>>> do make directly, it's not (and sometimes build options in the kernel
>>> build configuration, like WITNESS, etc., have material impact to data
>>> structure layouts).
>>> 
>>> On Wed, Mar 22, 2017 at 2:47 PM, Ben RUBSON <ben.rubson at gmail.com <mailto:ben.rubson at gmail.com>> wrote:
>>>> Thank you for your answer Steven.
>>>> Unfortunately it did not help, same behaviour :
>>>> Module with you method has the same smaller size, 2323000 bytes vs 2500544.
>>>> (I then did not try to boot with it)
>>>> 
>>>> Ben
>>>> 
>>>>> On 22 Mar 2017, at 22:09, Steven Hartland <killing at multiplay.co.uk <mailto:killing at multiplay.co.uk>> wrote:
>>>>> 
>>>>> cd /usr/src
>>>>> make buildenv
>>>>> cd sys/modules/zfs/
>>>>> make
>>>>> make install
>>>>> 
>>>>> On 22/03/2017 20:57, Ben RUBSON wrote:
>>>>>> Hi,
>>>>>> 
>>>>>> I'm trying to rebuild ZFS (with some patches) without having to rebuild whole kernel.
>>>>>> 
>>>>>> What I then try :
>>>>>> # cd /usr/src/sys/modules/zfs/
>>>>>> # make
>>>>>> # cp zfs.ko /boot/kernel/ #to replace current zfs module
>>>>>> 
>>>>>> But then server does not reboot properly (/ is on ZFS).
>>>>>> 
>>>>>> If I do :
>>>>>> # cd /usr/src/
>>>>>> # make buildkernel KERNCONF=GENERIC
>>>>>> # cp /usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/zfs/zfs.ko /boot/kernel/
>>>>>> 
>>>>>> Then server correctly reboot.
>>>>>> 
>>>>>> I clearly see that zfs.ko in method 1 is slightly smaller that in method 2.
>>>>>> 
>>>>>> Am I missing something ? (of course yes, but what ? :)
>>>>>> 
>>>>>> Many thanks !
>>>>>> 
>>>>>> Best regards,
>>>>>> 
>>>>>> Ben
>>>>>> 
>>>>>> _______________________________________________
>>>>>> freebsd-fs at freebsd.org <mailto:freebsd-fs at freebsd.org> mailing list
>>>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-fs <https://lists.freebsd.org/mailman/listinfo/freebsd-fs>
>>>>>> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org <mailto:freebsd-fs-unsubscribe at freebsd.org>"
>>>>> _______________________________________________
>>>>> freebsd-fs at freebsd.org <mailto:freebsd-fs at freebsd.org> mailing list
>>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-fs <https://lists.freebsd.org/mailman/listinfo/freebsd-fs>
>>>>> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org <mailto:freebsd-fs-unsubscribe at freebsd.org>"
>>>> _______________________________________________
>>>> freebsd-fs at freebsd.org <mailto:freebsd-fs at freebsd.org> mailing list
>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-fs <https://lists.freebsd.org/mailman/listinfo/freebsd-fs>
>>>> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org <mailto:freebsd-fs-unsubscribe at freebsd.org>"
>>> _______________________________________________
>>> freebsd-fs at freebsd.org <mailto:freebsd-fs at freebsd.org> mailing list
>>> https://lists.freebsd.org/mailman/listinfo/freebsd-fs <https://lists.freebsd.org/mailman/listinfo/freebsd-fs>
>>> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org <mailto:freebsd-fs-unsubscribe at freebsd.org>"
>> _______________________________________________
>> freebsd-fs at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
>> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
> 
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"



More information about the freebsd-fs mailing list