Compiling your own/custom/latest Linux kernel made easy :)

Here is a place for your projects which are not officially supported by the Porteus Team. For example: your own kernel patched with extra features; desktops not included in the standard ISO like Gnome; base modules that are different than the standard ISO, etc...
Post Reply
User avatar
bdheeman
Contributor
Contributor
Posts: 77
Joined: 15 Sep 2012, 19:39
Distribution: Porteus 3.0.1+ MATE/XFCE
Location: Chandigarh, PB, India
Contact:

Compiling your own/custom/latest Linux kernel made easy :)

Post#1 by bdheeman » 28 Aug 2014, 09:29

Hello,

For compiling your own/custom/latest Linux kernel, I have created a few SlackBuild scripts, which must be run in the following sequence:

1) http://ebba.ddns.net/pub/Linux/SlackBui ... nel.tar.xz
2) http://ebba.ddns.net/pub/Linux/SlackBui ... ers.tar.xz
3) http://ebba.ddns.net/pub/Linux/SlackBui ... rce.tar.xz

Please note, that you'll need ample (3-4 Gib) disk space on a mounted partition, if your changes are being saved only to memory. Better mount the partition say at /mnt/sda3 or substitute sda3 with the partition you want to use and execute a few commands as root/su:

Code: Select all

# mkdir -p /mnt/sda3
# mount /dev/sda3 /mnt/sda3
# mkdir -p /mnt/sda3/usr/src/{tmp,SlackBuilds,Packages}
# OUTPUT=/mnt/sda3/usr/src/Packages; export OUTPUT
# SRCDIR=/mnt/sda3/usr/src; export SRCDIR
# TMP=/mnt/sda3/usr/src/tmp; export TMP
Extract the above said SlackBuild scripts into $SRCDIR/SlackBuilds.
Activate 05-devel.xzm; which can be downloaded from http://ftp.nluug.nl/os/Linux/distr/port ... t/modules/
Get git package using usm and either convert and activate git-<version>*.t[gx]z or install it.

Now chdir into $SRCDIR/SlackBuilds/kernel and run:

Code: Select all

$ ./kernel.SlackBuild
Grab a few cans/bottles of beer or whatever you like to pass time, since the above said build will take an hour or so; depending on processing power of your machine.

Build kernel-headers and then kernel-source in a similar manner. you will get 3 *.txz packages in your $OUTPUT directory; which we also need convert into Porteus modules using txz2xzm script.

Finally, we'll need to move the new kernel module onto an ISO image; which is quite easy for Porteus users, as follows:

Code: Select all

# cp -a /mnt/live/mnt/isoloop /mnt/sda3/porteus
# cp $TMP/kernel-packege/boot/vmlinuz /mnt/sda3/porteus/boot/syslinux
# cp $OUTPUT/kernel-<version>*.xzm /mnt/sda3/porteus/porteus/000-kernel.xzm
# cd /mnt/sda3/porteus/porteus
# ./make_iso.sh
# cd ../..
Now, you may either boot off of the resulting ISO image using grub2 or need to fix this ISO image using isohybrid command from syslinux package; which again can either be installed or downloaded using usm tool so that you may copy the hybrid ISO image on USB Stick, Pen-drive or SDCard for booting. You may copy this hybrid ISO image using cat or dd command; Be warned, you'll lose everything from the target USB Stick, Pen-drive or SDCard. try booting off of the target media.

If everything worked as expected, we can move onto integrating other kernel modules into 05-devel.xzm, as follows:
(Hope you still have copy of /mnt/sda3/porteus/<whatever> intact, and you have 00-devel.xzm in optional directory)

Code: Select all

# cd /mnt/sda3/porteus/porteus/optional
# mkdir 05-devel; xzm2dir 05-devel.xzm 05-devel
# ROOT=05-devel removepkg kernel-headers
# rm 05-devel/var/log/removed_packages/*
# rm 05-devel/var/log/removed_scripts/*
# rm -rf 05-devel/usr/src/{linux,linux-*}
# xzm2dir <path/to/>kernel-headers-3.16.1*.xzm 05-devel
# xzm2dir <path/to/>kernel-source-3.16.1*.xzm 05-devel
# dir2xzm 05-devel 05-devel.xzm
# rm -rf 05-devel
# cd ..
# ./make_iso.sh
# cd ../..
# isohybrid porteus*.iso
And you've done it! Try/use this new ISO image ;)

BTW, our current initrd.xz in boot/syslinux does not have any kernel modules; hence we need not update the same. Anyway, in case the need arises to update and, or rebuild the initrd.xz as well, I better leave it as an exercise for you ;)

EDIT: Updated links to new site/location ;-)
Last edited by bdheeman on 19 Apr 2015, 12:02, edited 6 times in total.
--
Balwinder S "bdheeman" Dheeman (http://bdheeman.BlogSpot.in/)
"Working together, works! The proof is GNU/Linux and F/LOSS Projects;
Do you too voluntarily work on or contribute to making any difference?"

User avatar
brokenman
Site Admin
Site Admin
Posts: 5436
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Compiling your own/custom/latest Linux kernel made easy

Post#2 by brokenman » 28 Aug 2014, 14:53

Excellent contribution.

Typo in first codeblock: OUTOUT --> OUTPUT

Also perhaps bear is a typo (but who knows)
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
bdheeman
Contributor
Contributor
Posts: 77
Joined: 15 Sep 2012, 19:39
Distribution: Porteus 3.0.1+ MATE/XFCE
Location: Chandigarh, PB, India
Contact:

Re: Compiling your own/custom/latest Linux kernel made easy

Post#3 by bdheeman » 28 Aug 2014, 15:15

brokenman wrote:Excellent contribution.

Typo in first codeblock: OUTOUT --> OUTPUT

Also perhaps bear is a typo (but who knows)
Thanks for the encouragement :)
Fixed, both were typos, indeed; yes, that's beer and I like Haywards 5000 :Yahoo!:
--
Balwinder S "bdheeman" Dheeman (http://bdheeman.BlogSpot.in/)
"Working together, works! The proof is GNU/Linux and F/LOSS Projects;
Do you too voluntarily work on or contribute to making any difference?"

User avatar
brokenman
Site Admin
Site Admin
Posts: 5436
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Compiling your own/custom/latest Linux kernel made easy

Post#4 by brokenman » 28 Aug 2014, 17:19

Haywards 5000.

Alcohol content: < 7.5% by volume :shock:
Serving temperature: 7 - 9 °C :crazy:

This is a recipe for getting very drunk, very quick. :beer:

I will do some testing with the scripts this weekend.
How do i become super user?
Wear your underpants on the outside and put on a cape.

yldouright
Black ninja
Black ninja
Posts: 45
Joined: 04 Mar 2015, 16:27
Distribution: Porteus (slackware 12.1)
Location: NY

Re: Compiling your own/custom/latest Linux kernel made easy

Post#5 by yldouright » 13 Mar 2015, 00:52

I'm late to this party but have two questions before I try to custom compile a kernel. The processor is an old Celeron Coppermine 8.5x100. The GPU is AGP, nVidia GF3_ ti500. What flags should I use and how long should it take? The system is unusable stock 32 bit, 640MB RAM.

Post Reply