Mica noastra lume

… sau fiecare cu lumea lui

Compiling the kernel in FreeBSD

Posted by unepetitemonde pe mai 7, 2008

FreeBSD like other operating systems OpenSource allow us to recompile the kernel how we want. That is a big advantage towards operating systems with closed source-like Ms Windows or commercial UNIX systems.
If you want to install a FAMP (FreeBSD, Apache, MySQL, PHP) server which uses like administration system cPanel/WHM is important to recompile the kernel for add the option QUOTA. QUOTA cannot be included like modulus,therefore is important to be built-in. You can add more useful options like PAE, IPFIREWALL,etc.
We need the sources of kernel. To copy the sources through CVS we need a application which do that. He names cvsup. I make a director /root/install where i work.
mkdir /root/install
cd /root/install

For CVS we use cvsup-without-gui. For installing we use 2 commands:
fetch ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.3-release/Latest/cvsup-without-gui.tbz
pkg_add cvsup-without-gui.tbz

Good, we have all necessary tools for download the sources of kernel. We need saying to cvsup application what we want. For that we make a file named supfile which will contain next lines:
*default host=cvsup.FreeBSD.org
*default base=/usr/local/etc/cvsup
*default base=/usr
*default tag=RELENG_6_2
*default release=cvs delete use-rel-suffix compress
or, if you do not use a text editor:
echo ‘*default host=cvsup.FreeBSD.org’ > supfile
echo ‘*default base=/usr/local/etc/cvsup’ >> supfile
echo ‘*default base=/usr’ >> supfile
echo ‘*default tag=RELENG_6_2’ >> supfile
echo ‘*default release=cvs delete use-rel-suffix compress’ >> supfile
echo ‘src-all’ >> supfile
Of course, you need replace cvsup.freebsd.org with a csup server which is so closed to the location of server and RELENG_6_2 need replaced with the corresponding string of installed version. I chose cvsup.freebsd.org because for the moment any mirror from Romania don’t work and i chose RELENG_6_2 because cPanel supports only FreeBSD 6.2-RELEASE or lower.
Now, we need copy the sources:
/usr/local/bin/cvsup -g -L 2 supfile
The cvsup command read the supfile file because it is the parameter and it will download the specified version of source files. The -g option tell to the application to deactivate the support for gui and the -L 2 option indicate the level of returned data while downloading.
After some minutes the sources are downloaded.
We enter in the director which contain the configuration file:
cd /usr/src/sys/`uname -m`/conf/

We copy the GENERIC file with a new name and we’ll modify the copy:

cp GENERIC server

The server file(or GENERIC if you modify directly) can be open with any text file for modify. My favorite is vi or vim. These are the changes:
Add PAE support,if i want to access more than 3GB RAM on i386.
options PAE
Leave only I686_CPU, because I486_CPU and I586_CPU aren’t necessary on XEON
cpu I686_CPU
I modify ident and i give a name to the server(it need to correspond with the name of the file)
ident server
Add a comment(#) before the line makeoptions DEBUG=-g because i want to minimize the final file:
#makeoptions DEBUG=-g
Deactivate INET6 because i use only INET
#options INET6
Add support QUOTA and the firewall:
options QUOTA
Now, we go to compile the kernel:
make buildkernel KERNCONF=server
make installkernel KERNCONF=server
After that, restart your pc.
The original article was posted here


Lasă un răspuns

Completează mai jos detaliile tale sau dă clic pe un icon pentru a te autentifica:

Logo WordPress.com

Comentezi folosind contul tău WordPress.com. Dezautentificare /  Schimbă )

Fotografie Google+

Comentezi folosind contul tău Google+. Dezautentificare /  Schimbă )

Poză Twitter

Comentezi folosind contul tău Twitter. Dezautentificare /  Schimbă )

Fotografie Facebook

Comentezi folosind contul tău Facebook. Dezautentificare /  Schimbă )

Conectare la %s

%d blogeri au apreciat asta: