{"id":24,"date":"2008-02-25T00:10:50","date_gmt":"2008-02-24T23:10:50","guid":{"rendered":"http:\/\/www.lightsoft.se\/_lightsoft\/?p=24"},"modified":"2008-03-03T20:36:15","modified_gmt":"2008-03-03T19:36:15","slug":"compile-debian-linux-kernel","status":"publish","type":"post","link":"https:\/\/www.lightsoftai.com\/?p=24","title":{"rendered":"Compile Debian linux kernel"},"content":{"rendered":"<p><em>Be aware that there is some risk in doing so! For example, it could happen that your machine does not boot properly after you have installed the new kernel so you might be forced to boot from a rescue CD to repair your system. You have been warned! This document comes without warranty of any kind!<\/em><br \/>\n<\/p>\n<hr>\n<p>\n<strong>Kernel-Compile-Howto<\/strong><\/p>\n<p>First login to your Debian machine on the command line as root. Install the prerequisites that we need to compile the new kernel:<\/p>\n<pre>apt-get install kernel-package ncurses-dev fakeroot wget bzip2<\/pre>\n<p>\nThen go to \/usr\/src:<\/p>\n<pre>cd \/usr\/src<\/pre>\n<p>\nThen get the latest Linux kernel source (or the kernel source you need) from <a href=\"http:\/\/www.kernel.org\/pub\/linux\/kernel\/v2.6\/\">http:\/\/www.kernel.org\/pub\/linux\/kernel\/v2.6\/<\/a>:<\/p>\n<pre>wget http:\/\/www.kernel.org\/pub\/linux\/kernel\/v2.6\/linux-2.6.24.tar.bz2<\/pre>\n<p><!--more--><br \/>\n<br \/>\nUnpack the kernel sources:<\/p>\n<pre>tar xjf linux-2.6.24.tar.bz2<\/pre>\n<p><\/p>\n<pre>cd linux-2.6.24\/<\/pre>\n<p>\nIt is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under \/boot, e.g. \/boot\/config-2.6.x. <\/p>\n<pre>make menuconfig<\/pre>\n<p>\nIf you should use a existing one, then select &#8220;Load an Alternate Configuration File&#8221; and enter the location of the configuration file of your current kernel.<\/p>\n<p>The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, save your new kernel configuration.<\/p>\n<p>Then run the following commands (please note that make dep is not needed any more for kernel 2.6):<\/p>\n<pre>make-kpkg clean<br>\r\nfakeroot make-kpkg --revision=custom.1.0 kernel_image<\/pre>\n<p>\nIf the compilation stops with an error, run<\/p>\n<pre>make clean<\/pre>\n<p>\nand then re-run the previous commands starting with<\/p>\n<pre>make menuconfig<\/pre>\n<p>\nChange the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.24_custom.1.0_i386.deb under \/usr\/src.<\/p>\n<pre>cd ..\/<\/pre>\n<p>Now you have to install some packages that are needed by kernel 2.6. Add the following line to \/etc\/apt\/sources.list:<\/p>\n<pre>deb http:\/\/www.backports.org\/debian\/ woody module-init-tools initrd-tools procps<\/pre>\n<p>\nThen run:<\/p>\n<pre>apt-get update<br>\r\napt-get install module-init-tools initrd-tools procps<\/pre>\n<p>If you are asked the following question:<\/p>\n<p>&#8220;If you really want to remove modutils type &#8216;yes&#8217;:&#8221;<\/p>\n<p>type yes.<\/p>\n<p>It might also be necessary to update packages like bind9, quota, etc. &#8211; depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.<\/p>\n<p>Install your new kernel:<\/p>\n<pre>dpkg -i kernel-image-2.6.24_custom.1.0_i386.deb<\/pre>\n<p>\nCreate a ramdisk of your new kernel (otherwise your system will most likely not boot):<\/p>\n<pre>cd \/boot\/<br>\r\nmkinitrd -o \/boot\/initrd.img-2.6.24 2.6.24\r\n<\/pre>\n<p>We are almost finished now. Edit the image=\/vmlinuz stanza of your \/etc\/lilo.conf and add the line initrd=\/boot\/initrd.img-2.6.24:<\/p>\n<p><code lang=\"bash\"><br \/>\n# Boot up Linux by default.<br \/>\n#<br \/>\ndefault=Linux<\/p>\n<p>image=\/vmlinuz<br \/>\n        label=Linux<br \/>\n        read-only<br \/>\n        initrd=\/boot\/initrd.img-2.6.24<br \/>\n#        restricted<br \/>\n#        alias=1<br \/>\n<\/code><\/p>\n<p>Run:<\/p>\n<pre>lilo<\/pre>\n<p>\nto update your boot loader and reboot your machine:<\/p>\n<pre>shutdown -r now<\/pre>\n<p>\nand if everything is ok your machine should come up with the new kernel. You can run<\/p>\n<pre>uname -a<\/pre>\n<p>\nto verify that. Good luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Be aware that there is some risk in doing so! For example, it could happen that your machine does not boot properly after you have installed the new kernel so you might be forced to boot from a rescue CD to repair your system. You have been warned! This document comes without warranty of any [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24"}],"version-history":[{"count":0,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}