![]() | ![]() | ![]() | ![]() |
|
faq search add article cool-stuff how-to main tips |
Posted by Jason on Thursday March 08, @10:20PMfrom the hard-core dept. In this post I am going to unmask the mysteries of compiling a custom kernel. I know this sounds sexy, but there's really not much to it. Q. Why would you want to compile a custom kernel?A. There are two basic reasons why, either you want to add some functionality to your system such as audio support, or you may want to remove some unused drivers to conserve memory. Before we begin we must look to the src (pronounced: source). The kernel src is not installed by default. To install the kernel src you will use your FreeBSD cdrom and the sysinstall
utility. /stand/sysinstall select Configure select Distributions select src select sys (/usr/src/sys (FreeBSD Kernel) press (enter) press (enter) select CDROM select Install The kernel source should now be installed. Exit from the sysinstall utility and check if the directory /usr/src/sys is on your system. Now change to the src directory: /usr/src/sys/i386/conf/ cd /usr/src/sys/i386/conf This is where FreeBSD keeps it's kernel configuration files for intel computers. The generic kernel config is in the file GENERIC. All the possible kernel options can be found in the LINT file. Take a moment to look at the GENERIC file. I like to use the ee editor for tasks like this, but if your a vi person, you can use it instead. Now type: ee GENERIC (you can use the menu at the top to help you use the editor) Now that you've peeked at a kernel config file, let's compile a kernel! For our first compile, let's use the GENERIC kernel config and not change anything. Login as root and type: cd /usr/src/sys/i386/conf config GENERIC cd ../../compile/GENERIC make depend make make install This is a good exercise to benchmark how long a kernel will take to compile on your system. If you have FreeBSD installed on an old 486 or low end pentium, this could take quite some time (hours). If you have a PII 350 or higher it should only take about 10 to 20 minutes. When the task has completed, reboot your system and it will use the new kernel! Lets try a custom kernel this time. To build a custom kernel, copy the GENERIC config file to a new filename and edit the copy. Login as root and type: cp GENERIC NEWBIE ee NEWBIE Scroll down the line that reads: ident GENERIC Change the line to read: ident NEWBIE (Note: ident is a tag that identifies your kernel name. It needs to match the name of your kernel config file) Save the file and compile it using the instructions above from our compile test. Congratulations! Your can now compile and install a customized kernel. To find out what options are available for a kernel, read the LINT file (/usr/src/sys/i386/conf/LINT) as it contains all the possible drivers and options (like what sound cards are supported. ;-) A word of caution: If you remove options from your kernel, use the pound (#) sign to comment them out. If you delete a config line entirely and make a mistake, you may find it difficult to remember what you did. Comments are your friends. The FreeBSD Handbook has a very good tutorial for compiling a kernel. Check it out. < | >
|
|
||||||||||||||||||
|
||||||||||||||||||||
| "You never know how many friends you have until you own a Condo on the beach." -- Jason's Postulate |
|
| All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©2001 Jason Neumann. |