kernel compile debian way

1. prepare your system

verify you have sufficient diskspace. about 1g or so.
you do not need root. normal user can compile.
you do not need to compile on your own system. another system, with faster cpu, more memory, spare demand, etc can compile your kernel.

2. install pre-requisites

# apt-get install kernel-package fakeroot libncurses5-dev

3. download source

# apt-get install linux-source

4. config

$ zless /usr/share/doc/kernel-package/README.gz
$ mkdir ~/src
$ cd ~/src
$ tar xjf /usr/src/linux-source-{nn}
$ cd linux-source-{nn}
$ cp /boot/config-{nn} .config
$ make menuconfig


5. make

$ make-kpkg clean
$ fakeroot make-kpkg -j{n} --initrd --revision={3.2.63-2+deb7u1} --append-to-version={-4-686-pae} kernel_image


-j to use more than one core, eg -j2 or -j5

i list current debian values inside the {..}s, only as an example for you. *do not* use the same ones. use different values each time you compile. if you don't understand, don't use these two options, for now.

6. install

# dpkg -i ../linux-image-3.2.{your custom text}.deb

7. reboot


http://debian.org/releases/stable/i386/ch08s06.html.en#idp7581840
http://users.wowway.com/~zlinuxman/Kernel.htm

using tmpfs

i find my ram usage doesn't go much over 512k. apart from some of my trusty old friends, most of my systems have ample ram left over. how do i make more efficient usage of extra ram?

ram is fast. disk is slow. move operations from disk to ram, depending on how ram is spare.

enable tmpfs

mount /tmp on tmpfs

# vi /etc/default/tmpfs
RAMTMP=yes


default cache is ~/.cache on disk
move cache to tmpfs

i set this in ~/.profile. i could have set in ~/.xsession instead.
$ export XDG_CACHE_HOME=/dev/shm

now our systems has become a lot more efficient in using ram vs disk. end result is blazing fast.

do you have any other tips?

most popular posts