How to compile a Linux kernel

Download Ubuntu packages:

sudo apt-get install build-essential kernel-package gcc libncurses5 libncurses5-dev libqt3-mt-dev

After copying a running kernel config file from /boot directory to the file .config of the kernel source files directory, run this command to check configuration options not present the config file of the /boot directory:

make oldconfig

To configure the kernel

make menuconfig o make xconfig

To compile the kernel:

make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-rtai1 kernel_image kernel_headers  modules_image

With Ubuntu 10.04 –initrd does not work, so us those commands

update-initramfs -c -k 2.6.32.11-rtai1
update-grub2

For multiprocessor compilation with bash shell:

export CONCURRENCY_LEVEL=<n>

For multiprocessor compilation with tcsh shell:

setenv CONCURRENCY_LEVEL <n>

Check those links if they exist:

arch/x86/Makefile_32.cpu
link include/asm with asm-86

GRUB 2

To open GRUB2 at boot press continuously left shift key.

The configuration file of GRUB2 is: /etc/default/grub

GRUB_DEFAULT=0 Sets the default between kernel listed in /boot/grub/grub.cfg
GRUB_TIMEOUT=10 : wait 10 seconds before booting with the default kernel

Another way is to install Grub Customizer and use a graphic environment:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer