Debian-kernel: Difference between revisions

From Bashlinux
Jump to navigationJump to search
Content deleted Content added
No edit summary
Manpaz (talk | contribs)
Redirected page to Debian Kernel setup
 
Line 1: Line 1:
#REDIRECT [[Debian Kernel setup]]
__NOTOC__
= GNU/Debian Kernel setup =

== How to build the Kernel from Debian repositories ==

=== Get the sources and setup the environment ===
# Install the proper packages to build the kernel
<pre><nowiki>
apt-get install ncurses-dev fakeroot kernel-package build-essential devscripts
</nowiki></pre>

# Build kernel dependencies
<pre><nowiki>
apt-get build-dep linux-2.6
</nowiki></pre>

# Get Debian kernel sources
<pre><nowiki>
apt-get source linux-2.6
</nowiki></pre>

* Note that `deb-src` must be present on `/etc/apt/sources.list` file

=== Build Debian Kernel ===
# If kernel is patched, check it twice as follows
<pre><nowiki>
make -f debian/rules source-all
</nowiki></pre>

* First time must fail
* If building all kernel related packages, then do as follows. It takes almos 40GB on Hard drive.
<pre><nowiki>
~/src/linux-2.6-2.6.24~rc6$ debuild -e DEBIAN_KERNEL_JOBS=${NR_CPUS}
</nowiki></pre>

* If building an specific architecture, then
<pre><nowiki>
fakeroot make -f debian/rules.gen setup_i386_none_k7
</nowiki></pre>

* This will build the packages for AMD K7
* If there is any change to apply, then go the the `k7` folder and config the kernel
<pre><nowiki>
debian/build/build_i386_none_k7
make menuconfig
</nowiki></pre>

* Build the kernel
<pre><nowiki>
fakeroot make -f debian/rules.gen binary-arch_i386_none_k7 binary-indep DEBIAN_KERNEL_JOBS=${NR_CPUS}
</nowiki></pre>


=== Install Debian Kernel ===
Kernel packages will be created in `/usr/src` folder. Install them as any other ''deb'' package
<pre><nowiki>
dpkg -i linux*.deb
</nowiki></pre>


== How to build Real-Time Vanilla Kernel for Debian ==

=== Get sources and setup environment ===
# Create `vanilla` folder in `/usr/src` and change directory to such location
<pre><nowiki>
mkdir -p /usr/src/vanilla
cd !$
</nowiki></pre>

# Download the latest rt patch
http://www.kernel.org/pub/linux/kernel/projects/rt/
# Download the matched kernel for the proper patch downloaded in previous step
http://www.kernel.org/pub/linux/kernel/v2.6/
# Decompress both, the linux kernel sources and the patch
<pre><nowiki>
tar jxvf *.bz2
</nowiki></pre>

# Patch the kernel
<pre><nowiki>
cd linux-2.6.AA.BB
patch -p1 <../patch-2.6.AA.BB-rtNN
</nowiki></pre>

# Create a link `linux` which points to the linux kernel sources
<pre><nowiki>
ln -s /usr/src/vanilla/linux-2.6.AA.BB /usr/src/linux
</nowiki></pre>


=== Build RT Kernel ===
# Go to the linux source folder
# Configure the kernel, if necessary `make menuconfig`
#* Backup the old config file
<pre><nowiki>
cd /usr/src/linux
cp .config config.yy-mm-dd
</nowiki></pre>

* When finish save your changes
* Build the bzImage
<pre><nowiki>
cd /usr/src/linux
make
</nowiki></pre>


=== Install RT Kernel ===
* If only modules are needed, then use `make modules`
* Install the modules
<pre><nowiki>
make modules_install
</nowiki></pre>

# Install the kernel, usually locate on `arch/MY_ARCH/boot` in kernel sources
<pre><nowiki>
cp arch/MY_ARCH/boot/bzImage /boot/vmlinuz-2.6.AA.BB-rtNN
</nowiki></pre>

# Create initial root filesystem
<pre><nowiki>
cd /usr/src/linux
update-inintramfs -c -k 2.6.AA-BB-rtNN
</nowiki></pre>

# Add the proper entry to grub in `/boot/grub/menu.lst`
<pre><nowiki>
title RT kernel 2.6.AA.BB-rtNN
root (hd0,0)
kernel /boot/vmlinuz-2.6.AA.BB-rtNN root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.AA.BB-rtNN
</nowiki></pre>

* '''TIP:''' if `default` parameter is set to `0` at the beginning of the `menu.lst` file, then try to put this entry at the top of the entries list.

Latest revision as of 05:45, 12 June 2015