Compilation and usage of custom Porteus kernel

Home Download Docs FAQ Forum

Compilation and usage of custom Porteus kernel

THURSDAY, 13 JANUARY 2011 04:36 FANTHOM

Before you start: make a backup on your existing Porteus installation!

WARNING: after upgrading, all kernel dependent Porteus modules like: Virtualbox or proprietary GPU drivers will need to be recompiled against new kernel version too. WARNING: If you are changing something in kernel config and recompiling kernel once again, you may need to replace all kernel modules (M) in initrd and 000-kernel.lzm accordingly.

Hardware requirements: at least 2GB of memory when Porteus runs with copy2ram cheatcode 1,0GB of free space on usb stick or hard drive when building up maximum compatibility kernel (all options enabled)

Let's start!

Section I Kernel

First of all make sure that Porteus devel package is activated:

activate /mnt/sdb1/porteus/optional/006-devel.lzm

download recent kernel version and unpack it somewhere:

wget http://distfiles.gentoo.org/distfiles/l ... 37.tar.bz2 tar -xvjf -2.6.37.tar.bz2 -C /root/

enter kernel and download porteus patches:

cd /root/linux-2.6.37 wget http://ponce.cc/porteus/i486/current/pa ... atches.zip

decompress zip file and patch the kernel:

unzip porteus-v09-kernel-patches.zip mv porteus-v09-2.6.37-kernel-patches//* . patch -p1 < aufs.patch patch -p1 < porteus-v09-2.6.37-kernel-patches/squashfs-lzma.patch (bootsplash is optional) patch -p1 < porteus-v09-2.6.37-kernel-patches/bootsplash-2.6.37.diff

once you have kernel patched you need to configure it. Best way is to use old porteus kernel config file.

cp /usr/src/linux/.config . make oldconfig

If you are not sure which option choose, better keep enter pressed (default options are usually safe).

Check if your configuration is correct:

make

Navigate to "File systems" menu and make sure that FUSE will be compiled in (*). Then go to -> "Miscellaneous filesystems", Aufs and Squashfs must also be compiled in (*), as well as lzma compression for Squashfs (*)

Mark other drivers and features as you like

Now it's time to build a kernel so:

make && make modules_install && make firmware_install

It's gonna take long time so better grab a beer

http://www.porteus.org/component/content/article/51-development/91-compilation-and-usage-of-custom-porteus-kernel.html[14/01/2011 8:14:43 a.m.] Compilation and usage of custom Porteus kernel

If no errors are reported you can copy your shiny new kernel to Porteus /boot directory

cp arch/x86/boot/bzImage /mnt/sdb1/boot/vmlinuz

Comments:

1. Good idea it to store compiled sources somewhere (around 1GB when uncompressed), in case when you'll be adding/changing something, you wont have to go through whole process once again and compilation will be much faster.

2. If you use Porteus on different machines try to compile as many drivers as it's possible as a (M), kernel wont be bloated that much (my gentoo kernel stripped to maximum takes 2MB only)

3. Best place for compilation is RAM (fastest). Boot porteus with copy2ram cheatcode or use instead: http://en.wikipedia.org/wiki/Tmpfs

Section II Initrd

To tweak , do as follows:

cp /mnt/sdb1/boot/initrd.lz /root/initrd.lzma lzma -d /root/initrd.lzma mount -o loop /root/initrd /mnt/cdrom

Replace all modules in /mnt/cdrom/lib/modules/2.6.37-porteus/ with newer version manually and run 'depmod' command to update module index.

depmod -b /mnt/cdrom mv /mnt/cdrom/lib/modules/2.6.37-porteus/ /mnt/cdrom/lib/modules/your-new-kernel-version

All done for now so repack initrd and move it to boot folder:

umount /mnt/cdrom lzma /root/initrd mv /root/initrd.lzma /mnt/sdb1/boot/initrd.lz

Comments: 1. You can add some extra drivers to initrd, if needed (for example for support). Please remember that you need to have at least 600KB of free space inside initrd, otherwise Porteus wont be able to boot. Please use this script to resize initrd properly: viewtopic.php?f=39&t=138

Section III Updating 000-kernel.lzm module with new drives

Now we need to get rid of old drivers from 000-kernel.lzm so:

cp -r /mnt/live/memory/images/000-kernel.lzm/ /root/000-kernel rm -r /root/000-kernel/lib/modules/* rm -r /root/000-kernel/lib//* cp -r /lib/firmware /root/000-kernel/lib cp -r /lib/modules/your-new-kernel-version /root/000-kernel/lib/modules rm /mnt/sdb1/porteus/base/000-kernel.lzm mksquashfs /root/000-kernel/ /mnt/sdb1/porteus/base/000-kernel.lzm -b 256K

Reboot and enjoy

Good luck!

< PREV NEXT >

Login

Copyright © YouApps , All rights reserved. Custom Design by Youjoomla.com RSS | All Browsers | CSS Valid | XHTML Valid | Go to top

http://www.porteus.org/component/content/article/51-development/91-compilation-and-usage-of-custom-porteus-kernel.html[14/01/2011 8:14:43 a.m.] Compilation and usage of custom Porteus kernel

http://www.porteus.org/component/content/article/51-development/91-compilation-and-usage-of-custom-porteus-kernel.html[14/01/2011 8:14:43 a.m.]