Linux freeze on high memory consumption

Sometimes when working with virtual images, R or python, I can see that the memory load is really high and then the system becomes completely unresponsive. This post will show you how to optimize memory management in linux so the system does not freeze.

Continue reading

Advertisements

How to compile the linux kernel

Download a kernel source from kernel.org and let’s suppose that it is extracted in the directory ~/linux-x.yy.zz

Sometimes it can be a good idea to start with a current kernel configuration. You can get this configuration from the text file /boot/config-xx.yy.zz or a compressed version from /proc/config.gz. Copy the text file into ~/linux-x.yy.zz/.config.

Now you can start configuring the new kernel by executing inside the dir ~/linux-x.yy.zz/:

make menuconfig

Then compile the kernel, the modules and the image:

make
make bzImage

If everything it’s ok the new kernel will be in ~/linux-x.yy.zz/arch/x86/boot/bzImage. Copy this file to the boot directory in the desired machine:

cp ~/linux-x.yy.zz/arch/x86/boot/bzImage /boot/vmlinuz-x.yy.z

Now you have to compile and install the modules:

make modules 
make modules_install

This will copy all the firmware and modules to /lib/firmware and /lib/modules/x.yy.z. If you want to change the directory you can do it by defining the INSTALL_MOD_PATH environment variable.

After install all the modules you have to go to /boot directory, create the initramfs and update the grub.

update-initramfs -c -k x.yy.zz
update-grub