Can I bring over a module built on FreeBSD ?



  • pfsense 2.1 will be based on FreeBSD 8.3.

    So, if I have a FreeBSD 8.3-RELEASE system, and compile a custom module there, can I transfer that module over to pfsense 2.1, and kldload it, and expect that to work ?

    It seems to me that building a module in FreeBSD (in vmware or whatever) would be much easier than trying to build and maintain a system to compile custom pfsense modules and kernels, etc., but I need to know if I the modules are portable like that…

    Thanks.


  • Netgate Administrator

    Yes, generally speaking.
    What sort of module are you trying to compile?
    I have done that with network drivers and also with my own code for small binaries.

    Steve



  • @stephenw10:

    Yes, generally speaking.
    What sort of module are you trying to compile?
    I have done that with network drivers and also with my own code for small binaries.

    Steve

    I need xircom pcmcia cards to work, and they do not on 8.3.  There's a PR for it, and there is fixed code in 9.x, and will even be in place if they release 8.4, but it is not in 8.3, and therefore it will not be in pfsense 2.1.


  • Netgate Administrator

    There is a good chance that will work.
    I seem to remember something about this in the forum recently. Might be worth searching.

    Steve

    Edit: I think I must have only read it recently, looks like it was you anyway!  ::)


  • Rebel Alliance Developer Netgate

    You can bring over a module provided that it was compiled on the same version of FreeBSD that pfSense was built on.

    So if you can get the updated code to compile on 8.3, then you can bring the resulting module over. But you can't take a module compiled for 9.x and load it on 8.x



  • @jimp:

    You can bring over a module provided that it was compiled on the same version of FreeBSD that pfSense was built on.

    So if you can get the updated code to compile on 8.3, then you can bring the resulting module over. But you can't take a module compiled for 9.x and load it on 8.x

    Yes, I figured as much.  Also, the architecture needs to match (ie., i386 vs. amd64).

    But here's the problem I now run into:  'dc' is already part of the default pfsense kernel, so I can't kldload my new dc module:

    module_register: module dc/miibus already exists!

    So … is there a way to do this without compiling a custom pfsense kernel ?  I'm not excited about doing that because I do not have a pfsense build environment set up ...

    Is there a kernel config file for pfsense that I can pull into FreeBSD, edit to my liking, build a kernel, and then drag it back to pfsense ?

    What's the easiest way from point A to point B if I need a custom module for a driver that is already compiled into the pfsense kernel ?

    Thanks.


  • Netgate Administrator

    I have done this with a few different network drivers. I'm not sure you can kldload the module at run time.
    If you add the line:
    if_dc_load="yes"
    To the file /boot/loader.conf.local you should find it works. You will have create that file. Make sure your new module is in /boot/modules.

    Steve



  • @stephenw10:

    I have done this with a few different network drivers. I'm not sure you can kldload the module at run time.
    If you add the line:
    if_dc_load="yes"
    To the file /boot/loader.conf.local you should find it works. You will have create that file. Make sure your new module is in /boot/modules.

    Steve

    Ok, so create my new module, then copy my new if_dc.ko into /boot/kernel, and then add the line to /boot/loader.conf

    Yes ?


  • Netgate Administrator

    Yes.
    However if you use loader.conf.local and /boot/modules your changes will survive a firmware update.

    Steve



  • @apfusertoo:

    @stephenw10:

    I have done this with a few different network drivers. I'm not sure you can kldload the module at run time.
    If you add the line:
    if_dc_load="yes"
    To the file /boot/loader.conf.local you should find it works. You will have create that file. Make sure your new module is in /boot/modules.

    Steve

    Ok, so create my new module, then copy my new if_dc.ko into /boot/kernel, and then add the line to /boot/loader.conf

    Yes ?

    Hmmm…  not quite.

    So, the if_dc.ko that I created (and brought over from FreeBSD 8.3) is indeed loaded now - I can see it in the list when I 'kldstat'.

    However, in dmesg, I am seeing:

    module_register: module dc/miibus already exists!
    Module dc/miibus failed to register: 17

    I get the same set of errors for pci/dc and miibus/dcphy...

    So do I need to bring over my corresponding miibus.ko from my 8.3 system ?



  • Use the latest 2.1 snapshot, we went to the trouble of getting that back ported at your request and need someone with the hardware to test it.

    You can't necessarily override the built-in driver with a kernel module.



  • ok, I will get latest snapshot - thanks.


Locked