It is going to be cool if you have your own compiled kernel. Why? It will give you that special feeling of "my machine is more than yours". Above and beyond, a custom kernel doles out as an interesting tête-à-tête topic with geeks. A question like "What is your kernel size?" would keep the Geek busy for sometime where he would explain all the great things he did to the kernel to optimize his box. If you happen to be a geek yourself, this is a great question to put forward to Newbie. A custom kernel boots up the system faster. It takes up lesser memory space, and one can install drivers for special hardware not supported by a default kernel.
Before we get down to compile our own kernel, it is a wonderful idea to backup the present kernel. # cd /boot # cp -pvr kernel kernel.orig The original generic kernel is now stored as kernel.orig. Lest the kernel does not boot, boot up with the generic kernel, and try again. Booting any other kernel is simple. At the boot time, go to the boot prompt and simple say "boot kernel.orig", and the default kernel would boot up. The kernel sources are located in the /usr/src/sys directory. If not installed, the kernel sources can be installed with these following commands. First, insert the FreeBSD install CD in your CD drive.
# mount /cdrom # mkdir -p /usr/src/sys # ln -s /usr/src/sys /sys #cat /cdrom/src/ssys.[a-d]* | tar -xzvf -
Then, go to the directory where the configuration files are located. #cd /sys/i386/conf
In this directory, the GENERIC kernel configuration file is located. Copy this file and it as your custom name.
#cp -pvr GENERIC BABYBSD # vi BABYBSD
First, change the ident value from GENERIC to BABYBSD (or whatever name you prefer). The options are quite easy to understand and a good starting point would be the FreeBSD Handbook which has documented most of the kernel options. You can also go to a shell and run the command #make LINT in this directory, which would create a file called LINT that has all the options supported by the kernel listed.
After this stage, just run the following commands: #/usr/sbin/config BABYBSD #cd ../compile/BABYBSD #make depend #make #make install
Please remember that you must be root to run the make install. Reboot and the kernel should boot with your shining new kernel. <hr size="2" width="100%">
Here is a Sample Kernel Configuration File for FreeBSD/i386
machine i386 cpu I586_CPU cpu I686_CPU ident BABYBSD
options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols 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 MD_ROOT # MD is a potential root device options NFSCLIENT # Network Filesystem Client options NFSSERVER # Network Filesystem Server options NFS_ROOT # NFS usable as /, requires NFSCLIENT options MSDOSFS # MSDOS Filesystem options NTFS options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_GPT # GUID Partition Tables. options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options SCSI_DELAY=15000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) 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 KBD_INSTALL_CDEV # install a CDEV entry in /dev options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. options ADAPTIVE_GIANT # Giant mutex is adaptive.
device apic # I/O APIC
# Bus support. Do not remove isa, even if you have no isa slots device isa device eisa device pci
# Floppy drives device fdc
# ATA and ATAPI devices device ata device atadisk # ATA disk drives device atapicd # ATAPI CDROM drives options ATA_STATIC_ID # Static device numbering
# SCSI peripherals device scbus # SCSI bus (required for SCSI) device ch # SCSI media changers device da # Direct Access (disks) device cd # CD device pass # Passthrough device (direct SCSI access) device ses # SCSI Environmental Services (and SAF-TE)
# atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard device psm # PS/2 mouse
device vga # VGA video card driver
device splash # Splash screen and screen saver support
# syscons is the default console driver, resembling an SCO console device sc
# Enable this for the pcvt (VT220 compatible) console driver #device vt #options XSERVER # support for X server on a vt console #options FAT_CURSOR # start with block cursor
device agp # support several AGP chipsets
# Floating point support - do not disable. device npx
# Power management support (see NOTES for more options) #device apm # Add suspend/resume support for the i8254. device pmtimer
# PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device rl # RealTek 8129/8139
# The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter
# USB support device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) #device udbp # USB Double Bulk Pipe devices device ugen # Generic device uhid # "Human Interface Devices" device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse
# Specific to my Machine device atapicam # for CD Writer to be detected by K3B and other CD writing software device sound # To Enable Sound device "snd_ad1816" device "snd_als4000" device snd_cmi device "snd_cs4281" device snd_csa device "snd_ds1" device "snd_emu10k1" device "snd_es137x" device snd_ess device "snd_fm801" device snd_gusc device snd_ich device snd_maestro device "snd_maestro3" device snd_mss device snd_neomagic device "snd_sb16" device snd_sbc device snd_solo device "snd_t4dwave" device "snd_via8233" device "snd_via82c686" device snd_vibes device snd_uaudio device pcii device acpi device acpi_asus device acpi_video
device cbb # cardbus (yenta) bridge device pccard # PC Card (16-bit) bus device cardbus # CardBus (32-bit) bus