This Will Give U a Complete Procedure How To Compile Kernel on Debian on Right Way :
I give Wheezy Try :
If you're going to follow the procedures recommended in this document, your non-root user account must be enrolled in the "src" group. For example,
# mkdir /usr/src/build
# mkdir /usr/src/build/kernel
# adduser fa srcAlso, make sure that the directory /usr/src is owned by user root and by group src, and that the group has read and write privileges on the directory. Execute privileges on the directory should be granted to all users (user, group, and other). Also, make sure that the
$ ls -ld /usr/src drwxrwsr-x 3 root src 4096 Aug 24 13:52 /usr/src
The letter "s" in the seventh position of the file attributes indicates that the
#chgrp -R usr /usr/src
# chmod g+s /usr/src
#chmod -R g+w /usr/src
#chown -R fa:src /usr/src/build/kernel -> change 'fa' with your own username
(Any changes to the privileges on the /usr/src directory must be done by root.) Once you select a non-root user account for kernel-building purposes, you must use that same userid for all non-root steps.
Update The Sources.lit , Here My Example :
deb http://ftp.debian.org/debian/ wheezy main non-free contrib
deb-src http://ftp.debian.org/debian/ wheezy main non-free contrib
deb http://security.debian.org/ wheezy/updates main non-free contrib
deb-src http://security.debian.org/ wheezy/updates main non-free contrib
U can add the Mirror To add Faster Repository :
deb http://ftp.us.debian.org/debian wheezy main non-free contrib
deb-src http://ftp.us.debian.org/debian wheezy main non-free contrib
deb http://debian.corenetworks.net/debian/ wheezy main contrib non-free
deb-src http://debian.corenetworks.net/debian/ wheezy main contrib non-free
deb http://debian.mirrors.tds.net/debian/ wheezy main contrib non-free
deb-src http://debian.mirrors.tds.net/debian/ wheezy main contrib non-free
deb http://ftp.utexas.edu/debian/ wheezy main contrib non-free
deb-src http://ftp.utexas.edu/debian/ wheezy main contrib non-free
deb http://mirrors.xmission.com/debian/ wheezy main contrib non-free
deb-src http://mirrors.xmission.com/debian/ wheezy main contrib non-free
When mixing releases in the same system, it is important to define the default release. You do this in /etc/apt/apt.conf. Put a line such as the following in the above-named file:
APT::Default-Release "wheezy"; Aptitude::Purge-Unused "true";Then use :
#aptitude updade && aptitude full-upgrade#update-initramfs -u -k $(uname -r)
to install the updates. If you are running the testing release or the unstable release, you should perform this procedure regularly, since updates are not generally announced. When you are finished installing package updates, use
#aptitude clean
Got The Source From Here :
$cd /usr/src
$links http://www.kernel.org/
choose the kernel version you need, grab it with push 'D'
untar it, i use kernel 3.2.2 , so the command wil be :
tar -xjf linux-source-3.2.2.tar.bz2
Do this step as root. If you have not already done so, install the
dpkg-query -l kernel-package|grep iiIf it is not already installed, install it.
aptitude install kernel-packageRead the README file for
zless /usr/share/doc/kernel-package/README.gz At the time of this writing, the following packages will be required for the menuconfig method under Debian Squeeze:
gcc libc6-dev bin86 (i386 and amd64 architectures only) libncurses5-dev binutils make module-init-tools mawk | gawk gzip coreutils grep zlib1g-dev (if CONFIG_LGUEST is set) fakeroot (if building the kernel as a non-root user)Many of these packages will already be installed. To check to see if these packages are installed, use
dpkg-query -l gcc|grep iiInstall those packages which you need with
aptitude install bin86 libncurses5-dev zlib1g-dev fakeroot && aptitude clean
There may also be some packages needed to install the kernel image package once it has been built. For example, you may need
At this point I recommend that you edit the
No need for the patch since we use 64 kernel, i think so :
but if you are using 32 bit , you wiill need it for patch the Doumentation.
No apply the patch, issue the following sequence of commands:
cd /usr/share/kernel-package ... (download the patch file to the current directory) patch -p1 <patch3xx.diff
Configure The Kernel :
Do this step as a non-root user. Use the same userid for all non-root steps. The non-root user must be a member of group "src". First, change directories to the home directory for the source code.
cd /usr/src/build/kernel/linux-source-3.2.2Now, initialize the .config file based on the configuration file used by the stock Debian kernel.
cp /boot/config-2.6.32-5-686 .configThis means that if you make no changes, your custom kernel will be configured exactly like the stock Debian kernel. Obviously, adjust the name of the config file to copy based on your architecture and kernel release. The file you need will start with "config" and will have your kernel version name in it.
Now it's time to configure the kernel:
make menuconfigOK, with all that said, we are ready to start issuing commands. If you are running Lenny (or previous releases), issue the following command:
make-kpkg clean
Under Lenny and previous releases it is necessary to run
This For Debian Kernel Ways : ( If you download it from Debian Repository) :
time CONCURRENCY_LEVEL=8 make-kpkg --append-to-version -5custom1-686 --revision 2.6.32-38 --initrd --rootcmd fakeroot kernel_image modules_image
And This For My Own Ways, since it from Kernel Source :
CONCURRENCY_LEVEL=8 fakeroot make-kpkg --append-to-version -2fa4-666 --revision 7.5.88-1 --initrd kernel_image kernel_headers
Even if you are running Squeeze or later I suggest that you read this section because material covered here is assumed as background knowledge in later sections.
The
# Kernel image management overrides # See kernel-img.conf(5) for details do_symlinks = yes relative_links = yes do_bootloader = no do_bootfloppy = no do_initrd = yes link_in_boot = no postinst_hook = update-grub postrm_hook = update-grub Now We Already Have a new kernel, it;s time to install it :Do this step as root. OK, now it's time to actually install the kernel image package. You won't use aptitude or
cd /usr/src dpkg -i linux-image-2fa4-666_7.5.88-1_amd64.deb
Do this step as root. Shutdown and reboot to run your new custom kernel!
shutdown -F -r now;exit Now i't time to clean up home :Do this step as a non-root user. Use the same userid for all non-root steps. The non-root user must be a member of group "src". Once the new kernel image package has been installed, you can delete the package file (.deb file).
#cd /usr/src/build/kernel
#rm linux-image-2.6.32-5custom1-686_2.6.32-38_i386.deb
If you have also installed one or more modules image packages, you can delete their package files too. The same goes for a
Clean Up :
Do this step as root. Once you are satisfied with the new kernel, you may wish to de-install the old kernel image package. I like to keep at least one back version unless I know that the old kernel will no longer work due to changes made since migrating to the new kernel. For example, if my system now depends on a kernel module that did not exist in the old kernel, there's not much point in keeping the old kernel around.
aptitude purge linux-image-2.6.32-5-686
Done.,
:)