You are not logged in.

#1 2010-01-22 11:24:29

00_Spykes
Member
Registered: 2010-01-21
Posts: 4

Extra custom kernel

Hallo!

I've got the tiniest question; how do I create an extra kernel (a version of the one already installed) with my own custom config (with menuconfig preferably), without disturbing the Arch (and pacman) system all too much?

Is it as simple as:

cd /usr/src/linux
make menuconfig
make && make modules_install
mkinitcpio-something (Is it even necessary? Couldn't I use the same initrd as the "pacman-kernel"?)
cp the-kernel-image and initrd-thing to grub-folder and modify grub menu

That way I would retain the generic Arch kernel for backup, as well as have an extra custom kernel within the same pacman-installation, no?

Thanks in advance! smile

Last edited by 00_Spykes (2010-01-22 11:26:05)

Offline

#2 2010-01-22 12:08:52

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Extra custom kernel

There are a few wiki pages about custom kernel building. Have a look at them first, then try it.

N.B. There is no /usr/src/linux on an Arch system. If you install the kernel26-headers package, you get /usr/src/linux-<kernel_version> but as the name suggests, it provides headers only, not the full kernel source.

You need separate initramfs images for every on your system - unless, of course,you decide not to use initramfs with your custom kernel.

Offline

#3 2010-01-22 13:13:35

00_Spykes
Member
Registered: 2010-01-21
Posts: 4

Re: Extra custom kernel

Thank you for the help, and yeah I've checked out... both HowTo's about custom kernels in the wiki, but it seems such an awful lot of hassle. Yes, I should learn how to use ABS some day, but I can't see any point in using it for my own custom kernel, I don't plan on upgrading the kernel automagically anyway, I just want to do it when I have time and if I want to - too much depends on it.

There is no kernel source supplied with Pacman? Yes, yes, I know it's a binary distribution, but still, it's the kernel. wink

What separates the Archlinux-kernel from the "vanilla" kernels from kernel.org? (If you disregard the automatic functions ofc.)

Offline

#4 2010-01-22 15:33:49

broch
Banned
From: L.A. California
Registered: 2006-11-13
Posts: 975

Re: Extra custom kernel

00_Spykes wrote:

Hallo!

I've got the tiniest question; how do I create an extra kernel (a version of the one already installed) with my own custom config (with menuconfig preferably), without disturbing the Arch (and pacman) system all too much?

Is it as simple as:

cd /usr/src/linux
make menuconfig
make && make modules_install
mkinitcpio-something (Is it even necessary? Couldn't I use the same initrd as the "pacman-kernel"?)
cp the-kernel-image and initrd-thing to grub-folder and modify grub menu

That way I would retain the generic Arch kernel for backup, as well as have an extra custom kernel within the same pacman-installation, no?

Thanks in advance! smile

this would do.
you can have modified initrd for each specific kernel depending on purpose:
mkinitcpio -k kernel -c /etc/mkinitcpio_custom1.conf -g /boot/kernel_name.img
and leave original mkinitcpio.conf for default arch kernel
or
not use initrd at all with custom kernels.
I dont use initrd and I don't have arch kernel installed which makes maintenance much simpler (don't use ABS for kernel either - it is simpler this way and more flexible). I keep last working kernel as a backup.

Offline

#5 2010-01-22 20:21:48

00_Spykes
Member
Registered: 2010-01-21
Posts: 4

Re: Extra custom kernel

Ah, thanks a bunch for that confirmation, I've always used to do that before; keep the old kernel as backup and test with new ones, and in my opinions the classical way is the easiest.

Say, where do you get the kernels from, and do you manually patch them too etc.? I'm not entirely sure but I suspect that the patches are minor bugfixes, and new kernel releases are the major bugfixes plus new features, correct?

And oh, I can't escape from initrd's because I have encrypted my drive, but it's not a major concern. I just want my own kernel there, or to be more exact; my own kernel config. I don't mind using the same kernel as Arch, but I want to configure it myself.

Offline

#6 2010-01-22 22:27:45

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Extra custom kernel

Get the kernel source from kernel.org. If you want to use the patches that Arch uses, check here for the details, then download the bz2 here.

Offline

#7 2010-01-23 01:16:54

broch
Banned
From: L.A. California
Registered: 2006-11-13
Posts: 975

Re: Extra custom kernel

here you go smile

tomk wrote:

Get the kernel source from kernel.org. If you want to use the patches that Arch uses, check here for the details, then download the bz2 here.

In addition you can also try
BFS (instead of CFS) which is Kolivas desktop oriented cpu scheduler:
http://ck.kolivas.org/patches/bfs/
and alternative I/O scheduler called BFQ:
http://retis.sssup.it/~fabio/linux/bfq/patches/

bleeding edge kernels from here (based on stable and unstable kernel releases)
http://zen-kernel.org/

again I prefer direct git as it allows modification as soon as patch is available. Easy to maintain an fun.

good luck

Offline

#8 2010-01-27 04:09:29

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Extra custom kernel

As broch said you can use the ck patchset which includes BFS and other tweaks suited for the desktop. I use the kernel26-ck package from the aur which automates everything if you want a quick solution to building a kernel. You can choose to edit the kernel 3 different ways, make the configuration of your current kernel, or make the configuration that is in the base directory. Just edit the pkgbuild.

Offline

#9 2010-01-27 04:58:13

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: Extra custom kernel

Woah there. This ck nonsense is OT and as for zen, WTF? Follow tomk's advice and get the official kernel source from kernel.org with or without the Arch patches.

Offline

#10 2010-01-27 06:40:19

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Extra custom kernel

Aedit - what are you talking about? There is nothing wrong with either the -ck or -zen patchsets, and anyone who's building a kernel has to get the source from kernel.org anyway.

Offline

#11 2010-01-27 09:41:14

owain
Member
Registered: 2009-08-24
Posts: 251

Re: Extra custom kernel

For what the OP is wanting, it's not complicated to do it using abs, and keeping the current kernel available.  I for one found the wiki articles a bit of a jumble, given that all I wanted to do was change the kernel timer and build in various modules to speed up booting.  What I do is:

$ sudo abs

$ cp -r /var/abs/core/kernel26 ~/localbuilds  [my choice of directory]

$ cd ~/localbuilds/kernel26

Edit PKGBUILD, uncommenting 'make menuconfig' , and appending a suffix of my choice to the package name on various lines:

pkgbase="kernel26-suffix"
pkgname=('kernel26-suffix')
...
package_kernel26-suffix() {
...
package_kernel26-suffix-headers() {
...
package_kernel26-suffix-firmware() {

Similarly, edit kernel26.install to add the same suffix:

KERNEL_NAME=-suffix
KERNEL_VERSION=2.6.32-suffix

Once the packages are built, install kernel26-suffix and kernel26-suffix-headers, and don't worry about the firmware.  Add an entry to /boot/grub/menu.lst, including

kernel /boot/vmlinuz26-suffix root=...
initrd /boot/kernel26-suffix.img

Offline

#12 2010-01-27 12:45:00

00_Spykes
Member
Registered: 2010-01-21
Posts: 4

Re: Extra custom kernel

Thank you all for so much useful information, this kind of help is simply amazing! smile

Hah, nice name for the scheduler, huh, BFS? tongue

I think that I'll either try the kernel.org "vanilla" kernel, or the Arch kernel from ftp://ftp.archlinux.org/other/kernel26/ (is that the complete source with patches?), or the Arch-kernel via ABS. Thank you for simplifying the ABS build method for kernels, I didn't find the wiki too user-friendly but perhaps I never gave it an honest go. (When I look at the ABS wiki page it seems pretty strightforward, though. Alas, the custom kernel with ABS wiki page was harder to follow.)

If I get all this right the smoothest way for me to get a custom kernel is to either download a source and build it or build it via ABS. What type or kernel it is doesn't really matter I guess, well it does but not for the sake of me learning how to do it. wink The required package to install for building is in any case base-devel, correct? The ABS package doesn't seem to be such a huge waste (only 50-60MB) either.

The ABS way
* Install base-devel.
* Install abs.
* Modify PKGBUILD.
* Build it.
* Install it (via pacman?).
* Modify menu.lst, or grub.conf or whatever it is.
Some questions:  When installing, does pacman automagically copy the stuff to /boot? What is the install script, and why to use it? What is headers and why do I need them? Why shouldn't I worry about firmware?

The other way
* Install base-devel.
* Download the source. (Perhaps the Arch-kernel is to be found somewhere?)
* Build it.
* Manually copy to /boot.
* Edit the menu.lst or grub.conf.

It seems to me that I must be missing something because the ABS really doesn't seem easier (simpler) for this task. I want to keep it simple (the ABS slogan), but why? Furthermore, is there a way of protection the existing kernel when one is making a full system upgrage, I mean, is there a way of excluding it from pacman -Syu so that one could upgrade it when all the backups are in place?

Thank you in advance and have a nice day!

Edit: Forgot to add to both "ways" to build the initrd image. You have to build it to that specific kernel, as said earlier, but does the ABS way take care of that for you?

Last edited by 00_Spykes (2010-01-27 13:33:42)

Offline

#13 2010-01-27 13:11:58

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: Extra custom kernel

tomk wrote:

Aedit - what are you talking about? There is nothing wrong with either the -ck or -zen patchsets, and anyone who's building a kernel has to get the source from kernel.org anyway.

Firstly the 00_Spykes did not express any interest in any particular patches. He simply asked how to compile a kernel with a different config without disturbing his existing system. So talk of patchsets is off-topic.

I grant you that there are legitimate reasons for studying schedulers, but only a tiny minority of those trying out BFS have any competence in scheduler design or even benchmarking them. It is not easy or obvious and there are good reasons why it is not in the standard kernel.

There is a _hell_ of a lot wrong with the zen patch. Unzip the patch file and you will find it is 279,000 lines long (I'm not kidding). I guarantee you that _nobody_ fully understands the consequences of applying it. "Tainted" would not even begin to describe it. The 25 or so projects that are supposedly in it are not in the vanilla kernel for very good reasons. If you want to try out any of them then do it one-by-one using patches from the original authors and with extreme caution.

Offline

#14 2010-01-27 14:08:27

broch
Banned
From: L.A. California
Registered: 2006-11-13
Posts: 975

Re: Extra custom kernel

Aedit wrote:
tomk wrote:

Aedit - what are you talking about? There is nothing wrong with either the -ck or -zen patchsets, and anyone who's building a kernel has to get the source from kernel.org anyway.

Firstly the 00_Spykes did not express any interest in any particular patches. He simply asked how to compile a kernel with a different config without disturbing his existing system. So talk of patchsets is off-topic.

I grant you that there are legitimate reasons for studying schedulers, but only a tiny minority of those trying out BFS have any competence in scheduler design or even benchmarking them. It is not easy or obvious and there are good reasons why it is not in the standard kernel.

There is a _hell_ of a lot wrong with the zen patch. Unzip the patch file and you will find it is 279,000 lines long (I'm not kidding). I guarantee you that _nobody_ fully understands the consequences of applying it. "Tainted" would not even begin to describe it. The 25 or so projects that are supposedly in it are not in the vanilla kernel for very good reasons. If you want to try out any of them then do it one-by-one using patches from the original authors and with extreme caution.

post #1) OP asks about additional kernels installation
post #2 and post #4 say/confirm how to set up additional kernels

post #5 OP asks about patches - possible reason: updated drivers (current may not work), willing to experiment? (Yes, zen has a lot of latest drivers that are incorporated in future kernel releases, whether you are willing to use zen or not is up to you).
you will find responses in post #6 and post #7

nobody comments whether these are best kernel patches in the world or not so to comment yours:

Woah there. This ck nonsense is OT and as for zen, WTF? Follow tomk's advice and get the official kernel source from kernel.org with or without the Arch patches.

WTF? did you really read this thread?

Firstly the 00_Spykes did not express any interest in any particular patches. He simply asked how to compile a kernel with a different config without disturbing his existing system. So talk of patchsets is off-topic.

actually
1) OP asked about additional patches in general not specifying what he has in the mind and that was answered. I assume that he wants to test/play with available options without any constrains. I hope (not sure reading your posts) that this is o.k. and no lawsuits/prison follow is someone try different things?
2) it seems like your comments are off topic
3) this is free and nice distribution what it gives is much easier maintenance and customization than most of other distros
4) read OP comment #12
5) you just came here so let me explain: no policy country, but your free choice to decide what you install and how efficiently you maintain OS. Whether you will use ABS or not is up to you. Not using ABS will not affect system stability, abs can help you to customize OS particularly if you just starting with linux. Great tool but not only option
6) how stable Arch with non abs software plus abs customized packages plus standard packages is?
head -1 /var/log/pacman.log
[2007-06-22 17:51] synchronizing package lists
(almost 3yrs since installation, would be longer but HD died, thank God it was still on warranty)
and you find here users who installed 4-5 yrs ago (maybe no longer because people tend to update hardware)
7) now, you just came here (Registered: 2009-10-29) to tell everybody what is right what is not? How to maintain Arch? Is it not too bold?

Last edited by broch (2010-01-27 14:22:13)

Offline

#15 2010-01-27 14:33:33

owain
Member
Registered: 2009-08-24
Posts: 251

Re: Extra custom kernel

00_Spykes wrote:

Install it (via pacman?).

Yes - pacman -U /path/to/package.tar.gz

Some questions:  When installing, does pacman automagically copy the stuff to /boot? What is the install script, and why to use it? What is headers and why do I need them? Why shouldn't I worry about firmware?

Yes, it copies the necessary files to /boot.  In the case of this package, the kernel26.install script runs mkinitcpio, so there's no   additional step needed to do this manually.  The headers are needed for compiling kernel modules - a requirement if you use VirtualBox, for instance - so it makes sense to install them even if you don't need them straight away.  The firmware files are, AFAIK, no different to those in kernel26-firmware, and conflict with them if you attempt to install kernel26-custom-firmware.

It seems to me that I must be missing something because the ABS really doesn't seem easier (simpler) for this task. I want to keep it simple (the ABS slogan), but why?

As with all other packages, pacman keeps track of everything that's installed with the custom kernel, so you can easily remove or replace it in future.

Furthermore, is there a way of protection the existing kernel when one is making a full system upgrage, I mean, is there a way of excluding it from pacman -Syu so that one could upgrade it when all the backups are in place?

pacman -Syu --ignore packagename

Offline

#16 2010-01-27 18:04:52

Ultraman
Member
Registered: 2009-12-24
Posts: 242

Re: Extra custom kernel

owain wrote:

For what the OP is wanting, it's not complicated to do it using abs, and keeping the current kernel available.  I for one found the wiki articles a bit of a jumble, given that all I wanted to do was change the kernel timer and build in various modules to speed up booting.  What I do is:

$ sudo abs

$ cp -r /var/abs/core/kernel26 ~/localbuilds  [my choice of directory]

$ cd ~/localbuilds/kernel26

Edit PKGBUILD, uncommenting 'make menuconfig' , and appending a suffix of my choice to the package name on various lines:

pkgbase="kernel26-suffix"
pkgname=('kernel26-suffix')
...
package_kernel26-suffix() {
...
package_kernel26-suffix-headers() {
...
package_kernel26-suffix-firmware() {

Similarly, edit kernel26.install to add the same suffix:

KERNEL_NAME=-suffix
KERNEL_VERSION=2.6.32-suffix

Once the packages are built, install kernel26-suffix and kernel26-suffix-headers, and don't worry about the firmware.  Add an entry to /boot/grub/menu.lst, including

kernel /boot/vmlinuz26-suffix root=...
initrd /boot/kernel26-suffix.img

Because I had trouble with the ABS method on the Wiki as well, but did the PKGBUILD myself by simply editing it.
But I have the same problem I had when trying my own, similar method:
I do makepkg -s, it downloads and checks (I've updated the md5 of kernel26.install to the new one, so it checks out), runs menuconfig in which I apply my settings, it starts to build like you'd expect it, after it is done I end up with a pkg.tar.gz2 file of only 390 bytes, that only contains .PKGINFO.

I think I'm going to use the PKGBUILD from the Wiki tomorrow, unless somebody can spot the error for me.

Last edited by Ultraman (2010-01-27 18:07:50)

Offline

#17 2010-01-27 18:12:41

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: Extra custom kernel

Why don't you check out a PKGBUILD from AUR and edit it? Also can you post your PKGBUILD?
I modify the kernel26-ice PKGBUILD according to my needs. I put the kernel config in config.x86_64 which gets utilized automatically when the build starts, ie. make menuconfig isn't run while building.


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#18 2010-01-27 18:25:14

Ultraman
Member
Registered: 2009-12-24
Posts: 242

Re: Extra custom kernel

sHyLoCk wrote:

Why don't you check out a PKGBUILD from AUR and edit it?

Yup did that, the ones I checked seem to use the script that you can find on the wiki or similar.

Also can you post your PKGBUILD?

It's the PKGBUILD you get in abs with kernel26 (version for 2.6.32.5), and applied owain's edits applied to it. Double-checked my edited entries for typo's a minute ago, that's not it either.
I will retry tomorrow when .6 is also in abs. If that doesn't work either, I'll post the complete file.

I modify the kernel26-ice PKGBUILD according to my needs. I put the kernel config in config.x86_64 which gets utilized automatically when the build starts, ie. make menuconfig isn't run while building.

I just checked out the ice PKGBUILD. Looks a lot like the Wiki one, but better laid out and applies a boat of patches.
I'm simply trying to use the ARCH kernel but with some of my own settings. I have experimented with editing the config.x86_64 file, I have the same issue. It's not the way of config that seems to be the issue, as the configuration bit works fine. I also checked the config file in the kernel src directory, it contains my settings.
If I find the time tomorrow, I will play with the ice PKGBUILD if the .6 in abs doesn't work for me as well.
Thanks for the tip.

Right now I'm going to try and see if I can build the -ARCH kernel from abs without any modifications. Wonder if that works perfectly, I bet it does...
[Edit]
Yup, works fine. Perhaps I should check my version for errors somewhere after make bzImage modules || return 1 ...

Last edited by Ultraman (2010-01-27 18:48:09)

Offline

Board footer

Powered by FluxBB