I am preparing my machine to work with heterogeneous parallel programming. Some kernel updates (kernel headers) are required to install the latest driver from my video card NVidia CUDA toolkit and ... So I decided to create a step-by-step. Let's go!
Get the latest linux-source and unpack it
~$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.3.tar.xz
~$ tar -xvf linux-3.19.3.tar.xz
Install required packages and build dependencies
~$ sudo aptitude install fakeroot bzip2 kernel-package libncurses-dev
Copy sources, create symlink to linux source folder
~$ cd /usr/src /usr/src$ sudo mv ~/linux-3.19.3/ . /usr/src$ sudo ln -s linux-3.19.3 linux /usr/src$ cd linux/
Prepare to build linux kernel
/usr/src/linux$ sudo make clean /usr/src/linux$ sudo make mrproper
Copy the config file from existing linux kernel installed on your system
/usr/src/linux$ sudo cp /boot/config-`uname -r` .config
/usr/src/linux$ sudo make menuconfig
Working on kernel configuration file
- Load ".config" file
- Go into Processor type and features
- Go into Processor family (Generic-x86-64)
- Select Core 2/newer Xeon
- Go into Preemption Model (Voluntary kernel Preemption (Desktop))
- Select Preemtible Kernel (Low-Latency Desktop)
- Go into Time frequency (250 HZ)
- Select 300 HZ
Compilation with speedup tips
If you have an i7 core (like me), you can setup this in make process:
/usr/src/linux$ sudo export CONCURRENCY_LEVEL=8
Clear the folder to initialize compilation
/usr/src/linux$ sudo make-kpkg clean
Build the kernel
/usr/src/linux$ sudo fakeroot make-kpkg --append-to-version "<-suffix>" --revision "<revision#>" --us --uc --initrd kernel_image kernel_headers
On my system I typed:
/usr/src/linux$ sudo fakeroot make-kpkg --append-to-version "i7core" --revision "1" --us --uc --initrd kernel_image kernel_headers
This step takes a several minutes (or hours)...
Install newly built kernel packages
/usr/src/linux$ cd .. /usr/src$ sudo dpkg -i
Update initramfs before rebooting into new kernel
/usr/src$ sudo update-initramfs -c -k
Check if you are running new kernel after rebooting using uname
~$ uname -a
New kernel is compiled for core2 with preemption, it should feel more responsive :)
No comments:
Post a Comment