Recompile custom Mepis kernel

Just upgraded my main computer to a shiny new custom Mepis Linux kernel (2.6.27-31). This allows me to keep my existing, working one (if there’s a pbm).  Here’s how:

For more detail, see:  http://www.mepis.org/docs/en/index.php/Compiling_and_installing_a_new_kernel

cd /usr/src
#MAYBE BACKUP /usr/src/*, /boot/*, and /usr/src/linux/.config!!!!!
# BACK UP THOSE SOURCE TARBALLS!!!!!!!!!!
(as user):  rm -rf *         #this removes the untarred source files only.
(in synaptic):  Upgrade kernel images and sources (search for "linux").
(as USER):
unzip, untar linux-source-*.tar.bz2
ln -s linux-source-* linux
cd linux
make-kpkg clean
make oldconfig
# MOVE YOUR GOOD CONFIG FILE TO .config
make xconfig      #to add your customizations!
export CFLAGS="-march=prescott -mtune=prescott"
export CXXFLAGS="-march=prescott -mtune=prescott"
export LDFLAGS="-s"
fakeroot make-kpkg buildpackage -append_to_version <YourCustomName> kernel_image –initrd -us -uc
cd ..
sudo dpkg -i linux-image-*<YourCustomName>
cd /boot
### DON’T SEEM TO NEED INITRD ANYMORE – JUST SLOWS DOWN BOOTING!
#IF there’s not a file called "initrd.img-…<YourCustomName> here, then:
     cd /usr/src
     sudo update-initramfs -c -k <YourCustomName>
     cd /boot
#ENDIF
sudo rm initrd.img
sudo ln -s initrd.img-2.6.27-1-mepis-smp initrd.img
sudo rm vmlinuz
sudo ln -s vmlinuz-2.6.27-1-mepis-smp vmlinuz
cd grub
vi menu.lst    #add your new kernel here.
<reboot>

To repeat (recomplie same one):

cd /usr/src
(in synaptic):  Remove your custom kernel package (current version).
rm *.deb
cd linux
make-kpkg clean
make xconfig      #to add your customizations!
export CFLAGS="-march=prescott -mtune=prescott -pipe"
export CXXFLAGS="-march=prescott -mtune=prescott -pipe"
fakeroot make-kpkg buildpackage -append_to_version <YourCustomName> kernel_image –initrd -us -uc
cd ..
sudo dpkg -i linux-image-*<YourCustomName>
cd /boot
#IF there’s not a file called "initrd.img-…<YourCustomName> here, THEN:
     cd /usr/src
     sudo update-initramfs -c -k <YourCustomName>
     cd /boot
#ENDIF
sudo rm initrd.img
sudo ln -s initrd.img-2.6.27-1-mepis-smp initrd.img
sudo rm vmlinuz
sudo ln -s vmlinuz-2.6.27-1-mepis-smp vmlinuz
cd grub

#FOR THE VIRTUALBOX STUFF:
/lib/modules/<version><YourCustomName>/build needs to point to /usr/src/linux-headers-<version><YourCustomName> and source to /usr/src/linux-source-<version><YourCustomName>!

 

Advertisements

Feel Free to Comment (Name/Email/Website optional):

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: