Error Building 2.4.0 Kernel
I'm trying to compile the 2.4.0 kernel and receiving "taking address of packed member of class or structure may result in an unaligned pointer value" errors. The sequence of steps I followed is:
Grabbed an official FreeBSD 11.1-RELEASE VM image from https://download.freebsd.org/ftp/releases/VM-IMAGES/11.1-RELEASE/amd64/Latest/FreeBSD-11.1-RELEASE-amd64.vmdk.xz and successfully fired it up in VirtualBox
Cloned the RELENG_2_4 branch via the command: git clone –depth 1 --branch RELENG_2_4 -- https://github.com/pfsense/FreeBSD-src.git pfSense_2.4
Removed the device re line from /usr/src/sys/amd64/conf/GENERIC (I'm building the kernel because I want to compile use use Realtek's latest driver for my NICs)
Executed make buildkernel KERNCONF=pfSense
The error I receive is:
In file included from /root/pfSense_2.4/sys/cam/nvme/nvme_all.h:32:
/usr/src/sys/dev/nvme/nvme.h:922:16: error: taking address of packed member 'cdw10' of class or structure 'nvme_command' may result in an
unaligned pointer value [-Werror,-Waddress-of-packed-member]
*(uint64_t *)&cmd->cdw10 = lba;
I found some suggestions that clang 4.0 was the first version to flag this as an error, so I even tried installing and using clang 3.8 instead, but I still received the same error. I also found suggestions that the flag -Wno-address-of-packed-member would suppress this error, but I'm not sufficiently well-versed in makefiles to know where to insert this.
I have been able to sucessfully compile just the Realtek driver under this build environment, so maybe this is a moot point? Will the stock kernel still load my compiled driver module if I just add if_re_load="YES" to /boot/loader.conf.local?
Thanks in advance to anyone who may have advice, and I'm glad to provide any further information that may be useful.
So I'm still not clear on why I was unable to compile the kernel, but I wanted to follow up to say that it does appear that placing my compiled v1.94 Realtek if_re.ko driver in /boot/kernel/ and adding if_re_load="YES" to /boot/loader.conf.local was sufficient. At least, I make this judgment based on the fact that if_re.ko is listed in the output from kldstat.
I also found myself with this problem, which I was able to fix with this fix : https://github.com/freebsd/freebsd/commit/6884a6e482ca6effa702761a1e3fa98bb6946c30#diff-49d9a861ee932d5b656eb20466f2a292
But other problems have occurred. :-[
I had not had this problem with the RC version, which it was in "FreeBSD 11.0", so I put a compilation environment under this version, and compilation to work.
I therefore conclude that the development team forgot to add a "BRANCH RELENG_2_4_0" on this repository: https://github.com/pfsense/FreeBSD-src
The "Main repository for pfSense" is also unusable because it refers to a "BRANCH" that is missing: https://github.com/pfsense/pfsense/blob/RELENG_2_4_0/tools/builder_defaults.sh#L108
Can someone tell us about this omission ?
Thank you !