Compile & Installing your own kernel in FreeBSD is not that difficult, as long as you follow the process properly. I managed to compile and install my own kernel using DigitalOcean's kernel configuration example. I will most mine as an example as it was done in VMware. Following is the kernel configuration example:
[code lang=text] cpu I486_CPU cpu I586_CPU cpu I686_CPU ident CUSTOM
makeoptions DEBUG=-g makeoptions WITH_CTF=1
options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options TCP_OFFLOAD # TCP offload options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling options QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_RAID # Soft RAID functionality. options GEOM_LABEL # Provides labelization options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities #options PROCDESC # Support for process descriptors options MAC # TrustedBSD MAC Framework options KDTRACE_FRAME # Ensure frames are compiled in options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data options INCLUDE_CONFIG_FILE # Include this file in kernel
options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic.
options SMP # Symmetric MultiProcessor Kernel device apic device cpufreq
device acpi options ACPI_DMAR device pci
device ata # Legacy ATA/SATA controllers options ATA_STATIC_ID # Static device numbering
device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device cd # CD device pass # Passthrough device (direct ATA/SCSI access)
device atkbdc # AT keyboard controller device atkbd # AT keyboard
device vga # VGA video card driver
device splash # Splash screen and screen saver support
device sc options SC_PIXEL_MODE # add support for the raster text mode
device uart # Generic UART driver device em device loop # Network loopback device random # Entropy device device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling #device faith # IPv6-to-IPv4 relaying (translation) device firmware # firmware assist module
device bpf # Berkeley packet filter
options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device usb # USB Bus (required)
device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device
device pf # Enables PF in kernel device pflog # PF logging interface
options ALTQ options ALTQ_CBQ # Class Based Queuing (CBQ) options ALTQ_RED # Random Early Detection (RED) options ALTQ_RIO # RED In/Out options ALTQ_HFSC # Hierarchical Packet Scheduler (HFSC) options ALTQ_PRIQ # Priority Queuing (PRIQ)
device crypto # Enables kernel crypto device aesni # Intel driver for hardware crypto options GEOM_ELI # GELI Option for FDE options IPSEC # IPSEC Option options IPSEC_DEBUG # Debug option for IPSEC
[/code]
Before you do any compiling, installing and such, make sure you have your /usr/src
directory. Execute following command to install that directory if you don't have:
svn co https://svn0.us-east.FreeBSD.org/base/stable/
/usr/src
Copy my kernel configuration above and paste it in your favorite editor, make sure file name is CUSTOM
.
Change to /usr/src
directory and execute following commands in order:
make buildkernel KERNCONF=CUSTOM
make cleandepend
make depend
make installkernel KERNCONF=CUSTOM
Reboot your VM.
Once your machine restarts, simply execute:
uname -a
and check if the word CUSTOM anywhere in the line
Or
sysctl kern.conftxt | grep ident
Either command will do.
Source:
1)https://www.digitalocean.com/community/tutorials/how-to-customize-and-recompile-your-kernel-on-freebsd-10-1
2)https://www.freebsd.org/doc/handbook/kernelconfig-building.html