![]() |
|
|
|
|
|
Compiling the FreeBSD kernel
By Aditya Kulkarni <aditya@freeos.com>
The FreeBSD kernel sources are available in the directory /usr/src/sys. This directory is also accessible from /sys directory. If you don't have the kernel sources, you can run the /stand/sysinstall command as root choosing configure, select distribution, src and finally sys to install the sources. This installs the kernel sources in /usr/src/sys directory. If you have seen the Linux kernel sources, you will see a similar hierarchy of source code of the kernel. Move to the /usr/src/sys/i386/conf directory where the following files are present: GENERIC and LINT. GENERIC is the configuration file from which the kernel boots. LINT is the advanced configuration file for more hardware and device driver support. The GENERIC is the default file. See also in your "/" directory the file called kernel.GENERIC and kernel. These files are 3MB long (On my FreeBSD 4.1) system. They are the kernel image files. Configuring your custom kernel Copy the GENERIC file to a file called NEWKER. This is your new kernel configuration file. Do not remove or delete the GENERIC and LINT files. Sample Of my configuration file : NEWKER /* Configuration File */ machine i386 #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options MATH_EMULATE #Support for x87 emulation # To make an SMP kernel, the next two are needed device isa # Floppy drives # ATA and ATAPI devices # atkbdc0 controls both the keyboard and the PS/2 mouse device vga0 at isa? # splash screen/screen saver # syscons is the default console driver, resembling an SCO console # Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver # Floating point support - do not disable. # Power management support (see LINT for more options) # Serial (COM) ports # Parallel port # PCI Ethernet NICs that use the common MII bus controller code. # Pseudo devices - the number indicates how many units to allocated. # The `bpf' pseudo-device enables the Berkeley Packet Filter. /* End of File */ By default FreeBSD does not detect sound cards. For sound card parameters, refer to the file LINT and copy the details of the sound device from LINT and put it in your new configuration file. For example, add the following lines in the configuration file. device snd0 For more sound specific documentation related to your sound card look at the following file sound.doc present in /usr/src/sys/i386/isa/sound/sound.doc Now do the following: # cd /usr/src/sys/i386/conf Configuring the kernel using the config command : # config NEWKER After this step you will get the following message Don't forget to do make depend If you get any errors in this step, then there is a problem in your configuration file. Check the file again and edit it. Refer to GENERIC and LINT for more details regarding device drivers. Go to the following directory and compile the kernel. # cd /usr/src/sys/compile/NEWKER Compiling the kernel Do the following steps to compile the kernel: The make depend stage executes a set of Perl scripts to gather all the source code files and checks for kernel dependencies. Now the make stage actually compiles the kernel along with device drivers for sound, ethernet, usb and supported file systems etc. By default FreeBSD renames the new kernel in a file called kernel and the old kernel that is either the kernel or kernel.GENERIC as kernel.old in the same root directory. Now shutdown your system and reboot using your new kernel. If you have added sound support, you will have to add device nodes in your /dev directory . For sound cards, the following command creates the appropriate entries: As always, the FreeBSD handbook is a great reference. In case of any problems, look there or just send me an e-mail.
Other articles by Aditya Kulkarni
Current Rating: [ 7.78 / 10 ]
Number of Times Rated: [ 85 ]
|
|
|
© 1998-2004 FreeOS Technologies (I) Pvt. Ltd. All rights reserved.
[Privacy Policy]
![]() |