How to compile the kernel just like how pfsense has it?

  • So, I had an issue where I needed to disable a driver that's compiled into the kernel.  I assume this meant that I needed to recompile the kernel.

    I think I've done this correctly, but wanted to verify with others here since uname -a is returning a version less than p25:

    Here's what I did from a clean FreeBSD 10.1 vm install:
    (as root)

    mkdir /usr/local/src
    cd /usr/local/src
    git clone -b RELENG_2_2 --single-branch
    cd FreeBSD-src
    vi sys/amd64/conf/GENERIC

    commented out line 207:

    #device        em                      # Intel PRO/1000 Gigabit Ethernet Family

    make buildkernel
    make installkernel

    I then renamed the /boot/kernel directory on the pfsense system and scp'ed the /boot/kernel directory that was created from the 'make installkernel' command.

    I then compiled a newer driver against the FreeBSD-src git branch:
    ln -s /usr/local/src/FreeBSD-src /usr/src
    (Download drivers from the internet and put in /usr/local/src/em-7.6.1)

    cd /usr/local/src/em-7.6.1/src
    make clean

    copy the resultant if_em.ko file over to the pfsense's /boot/kernel directory.

    Finally, I added this to the /boot/loader.conf file:


    and rebooted.

    Did I miss anything?  According to this page:
    the kernel version should be 10.1-RELEASE-p25, however, after reboot, uname -a shows:

    FreeBSD 10.1-RELEASE-p24 FreeBSD 10.1-RELEASE-p24 #1 a595f80(RELENG_2_2)-dirty: Thu Mar  3 21:39:01 UTC 2016     root@:/usr/obj/usr/local/src/FreeBSD-src/sys/GENERIC  amd64

    p24 instead of p25?  Did I check out the wrong branch?  Any other gotchas?  There seems to be WAY more kernel modules in /boot/kernel than what comes from the pfsense 2.2.6 distro.  Is there an official 'make' command I should be using when compiling the kernel?