You are not logged in.

#1 2007-09-20 14:25:20

big_gie
Member
Registered: 2005-01-19
Posts: 637

kernel26 PKGBUILD: A simple patch for customization

Hi all!

I have saw many PKGBUILDs for custom kernels. There is some on the wiki, some on the forum, others on AUR, etc. Diversity is great, as the possible choices, but it gets a bit confusing because each of these PKGBUILDs are different. It's a bit like to many forks of a project...

I sometimes want a customized kernel, but since I'm not a kernel dev/maintainer, I still want to keep the -ARCH kernel. If I break something in my own customization, I still want to be able to boot. I think others will want the same thing.

What I propose is a modification the stock PKGBUILD so a change in the pkgname variable will result in a custom kernels, installable side-by-side with Arhc's stock one.

The advantages of this approach:
1) Nothing changes for devs
2) Simplification of custom kernel building
3) Easier testing of patches
4) Easier testing of new kernels

There is not much modification for the PKGBUILD. It mainly adds the possibility to give a special name to the package like this : pkgname=kernel26-mypatchset. Then, through the LOCAVERSION in the config file, folders and files will have the "-mypatchset" suffix. For example :
/boot/vmlinuz26-mypatchset
/etc/mkinitcpio.d/kernel26-mypatchset.preset
/lib/modules/2.6.27-mypatchset/
/usr/src/linux-2.6.27-mypatchset/
etc.

To build Arch's stock kernel, just keep "pkgname=kernel26" and it will build as before.

This is something I am using right now. Would other people be interested? Could it be included included in the distribution?

I hope it will help others.

big_gie

EDITs:
2009-02-04:
-Bump version to 2.6.28.2-1 (from core)
2009-01-21:
-Added corrections from the bug report (http://bugs.archlinux.org/task/12384)
-Bump version to 2.6.28.1 (from core)
2008-12-07:
-Cleaned the patch, some comments
2008-12-01:
-Corrected problem where initrd files were overwritten
-Updated to 2.6.27.7

kernel26-2.6.28.1-1-personnal.patch REMOVED. Please check bug report at http://bugs.archlinux.org/task/12384 for the latest patch. This should prevent bad copy/paste from the forum...

Last edited by big_gie (2009-02-05 04:22:58)

Offline

#2 2008-12-01 23:18:14

methuselah
Member
Registered: 2007-10-02
Posts: 570

Re: kernel26 PKGBUILD: A simple patch for customization

Seems like a good idea, I'm not that advanced so what I saw looks like a nice idea. I do have another solution that I use if you want a kernel installed side by side in your grub list that will allow your Stock -ARCH kernel to not be ruined and still allow updates.


What I do is I have my custom PKGBUILD that I made from modifying an ABS kernel26 PKGBUILD. I give the kernel a different pkgname such as kernel26zen3.


I also change the "_patchname=-ARCH" to the name of my patchset like zen2 or zen3 so it looks like this: "_patchset=-zen3". Then I add this line to the line above "make menuconfig": "_kernver="${_basekernel}${_patchset}" so it writes "2.6.27-zen3" for the kernver.


I also include the kernel26.preset and kernel26.install and rename them to use my new pkgname so they are called: kernel26zen3.preset and kernel26zen3.install..... I also modify both of those files to use the appropriate names and versions as well as anything in the PKGBUILD.


This builds me a separate "kernel26zen3" that has a separate "vmlinuz26zen3", "System.map26zen3", "kernel26zen3.img", and "kerenl26zen3fallback.img" in the /boot directory, and a separate "2.6.27-zen3" directory in /lib/modules, and also a separate "linux-2.6.27-zen3" in /usr/src. It also adds a "kernel26zen3.kver" and "kernel26zen3.preset" to the /etc/mkinitcpio.d directory.

Then I add my kernel26zen3 kernel to my grub list, if I run into any problems with it, I can still boot into my stock -ARCH kernel or my Vista partition.

This is me using my zen3 kernel while I still have my other stock -ARCH kernel installed..... I just updated the stock kernel while logged into my kernel26zen3 that I use as my default kernel.....

[seventy3@HPdv9920us ~]$ uname -r
2.6.27-zen3
[seventy3@HPdv9920us ~]$ pacman -Q kernel26zen3
kernel26zen3 2.6.27-1
[seventy3@HPdv9920us ~]$ pacman -Q kernel26
kernel26 2.6.27.7-1
[seventy3@HPdv9920us ~]$

I also didn't mean to hijack your thread or anything.

Last edited by methuselah (2008-12-01 23:21:30)

Offline

#3 2008-12-01 23:54:36

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: kernel26 PKGBUILD: A simple patch for customization

Oh man, I was looking for something EXACTLY like this! Thanks for being so awesome big_gie. Big thumb-up from me on this. Maybe you should add it to the wiki?

Offline

#4 2008-12-02 00:12:48

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Thanx you two for your feedback! wink

@methuselah: Both our methods are the basically the same. The main difference is that I propose that these modification be included in Arch stock kernel, so it will be really easy to grab the PKGBUILD, put a name, recompile and install. All this without overlapping. It would be way easier to hack on the kernel like this.

@Daenyth: I'm happy it is usefull to you! smile I wanted more support from users before pushing this to devs...

Offline

#5 2008-12-02 00:24:18

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: kernel26 PKGBUILD: A simple patch for customization

I'm in agreement with Daenyth on this.  Even if it doesn't get included by default, it should be at least on the wiki.  Good stuff.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#6 2008-12-02 01:01:48

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: kernel26 PKGBUILD: A simple patch for customization

I'm all for anything to make building custom kernels easier (without stuffing the stock kernel) big_smile

Offline

#7 2008-12-04 14:22:32

mentallaxative
Member
From: Australia
Registered: 2008-07-14
Posts: 134
Website

Re: kernel26 PKGBUILD: A simple patch for customization

I just compiled my first custom kernel with this. It works! smile

(unfortunately not a huge difference between the original and the new; I think I have to rip out more modules)

Offline

#8 2008-12-04 16:00:51

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

mentallaxative wrote:

I just compiled my first custom kernel with this. It works! smile

(unfortunately not a huge difference between the original and the new; I think I have to rip out more modules)

Wow thats great news!

Any suggestion on the best way to push this to arch dev? I think I'll suggest it through the mailing list, and maybe later a bug report.

Anyone brave enought to test this? I already tested building -ARCH kernel (pkgname=kernel26), a version for my laptop and another one for my eeePC 901 (arch is soooo great on this! smile )

Basically I'd like to be sure the stock kernel compiled with this would be identical to the original one...

Thanx for your help ! smile

Offline

#9 2008-12-04 16:32:16

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: kernel26 PKGBUILD: A simple patch for customization

Been looking for this! Going to try it right now to rip out some modules etc.

Offline

#10 2008-12-04 20:12:07

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: kernel26 PKGBUILD: A simple patch for customization

How well does this work when combined with for example, nvidia and madwifi? I'd love to see a whole set done in this style.

Offline

#11 2008-12-04 20:15:43

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: kernel26 PKGBUILD: A simple patch for customization

Daenyth wrote:

How well does this work when combined with for example, nvidia and madwifi? I'd love to see a whole set done in this style.

AFAIK you'd have to make custom PKGs of them aswell. Everything that includes kernel modules. (for example, I just rebuilt the kernel myself and had to rebuilt the vhba module to get cdemu to work).

Strangely enough, the patch above didn't apply well to the kernel26 package in ABS on my PC.

Offline

#12 2008-12-04 20:19:35

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Daenyth wrote:

How well does this work when combined with for example, nvidia and madwifi? I'd love to see a whole set done in this style.

Good idea wink
The goal is that it does not change anything at all.

I'm not using nvidia, but I've been compiling a couple of kernel modules without any sort of problems. The only problematic part is installing the same module for different kernel. For example, if a module's PKGBUILD installs in /lib/modules/`uname -r`", one cannot install multiple version of the module: if you upgrade a package where files have moved from /lib/modules/2.6.27-ARCH to /lib/modules/2.6.27-mine, then the files in /lib/modules/2.6.27-ARCH will be deleted.
To correct this, one should add "-mine" in their module's pkgname.

But this "problem" is independent of the proposed patch. Everybody who install a custom kernel, with my patch or not, needs to recompile their modules.

Offline

#13 2008-12-04 20:22:49

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Fackamato wrote:

Strangely enough, the patch above didn't apply well to the kernel26 package in ABS on my PC.

Ok thanx for reporting.
This is probably because 1) your abs tree has not been updated to the one I used to create the patch, or more plausible 2) the stock PKGBUILD has already been updated.
The third option is just that the patch is bad, my mistake tongue
I'll verify that.

Offline

#14 2008-12-05 08:42:34

mentallaxative
Member
From: Australia
Registered: 2008-07-14
Posts: 134
Website

Re: kernel26 PKGBUILD: A simple patch for customization

Now when you mention it, I had a problem with patching mine too. I went ahead with compiling anyway, since the error didn't appear to be a critical one.

kernel26.install.rej

***************
*** 105,111 ****
      echo ""
      echo ">>> piix/ata_piix (Intel chipsets) - IMPORTANT"
      echo "----------"
-     echo ">>> If you have enabled ide/pata/sata HOOKs in /etc/mkinitcpio.conf"
      echo ">>> the 'ata_piix' module will be used."
      echo ">>> This may cause your devices to shift names, eg:"
      echo ">>> - IDE: devices from hd? to sd?"
--- 106,112 ----
      echo ""
      echo ">>> piix/ata_piix (Intel chipsets) - IMPORTANT"
      echo "----------"
+     echo ">>> If you have enabled ide/pata/sata HOOKs in /etc/mkinitcpio.conf"
      echo ">>> the 'ata_piix' module will be used."
      echo ">>> This may cause your devices to shift names, eg:"
      echo ">>> - IDE: devices from hd? to sd?"

Offline

#15 2008-12-07 21:01:52

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Ok I re-did the patch to be sure. I also made sure no white space confusions (there is some end of line white space in the core/PKGBUILD...)
I also added some simple comments.
The diff is against actual abs, or revision 19747 for i686 and 19749 for x86_64.

Offline

#16 2008-12-08 18:24:21

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

I opened a bug:
http://bugs.archlinux.org/task/12384

Their is also some discussion on the mailing list:
http://archlinux.org/pipermail/arch-gen … 02937.html

Offline

#17 2008-12-12 13:53:54

xaiviax
Member
From: Michigan
Registered: 2008-11-04
Posts: 282

Re: kernel26 PKGBUILD: A simple patch for customization

This is what I have been looking for  smile

Offline

#18 2008-12-13 02:18:29

lldmer
Member
From: Amsterdam
Registered: 2008-05-17
Posts: 119

Re: kernel26 PKGBUILD: A simple patch for customization

hehe, I had one of those moments of "Why didn't I think of this before?!"


For lack of better words: chair, never, toothbrush, really. Ohw, and fish!

Offline

#19 2008-12-13 22:02:03

joephantom
Member
From: Latinoamérica
Registered: 2008-01-09
Posts: 94
Website

Re: kernel26 PKGBUILD: A simple patch for customization

Great idea.


By striving to do the impossible, man has always achieved what is possible. Those who have cautiously done no more than they believed possible have never taken a single step forward - Mikhail Bakunin

Offline

#20 2009-01-21 18:33:15

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Bumped version to 2.6.28.1 (from core)

Offline

#21 2009-01-21 18:35:05

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Anybody tried it? Comments? Critics?

Offline

#22 2009-01-21 20:54:40

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: kernel26 PKGBUILD: A simple patch for customization

This sounds like a great idea, I'm currently a little too busy with school but when I have time I'll give it a go. The stuff about modules will still bug me though .... but hey ... still a linux newbie, I'll sort it out when I give this a go.
This will make everyone's life so much easier big_smile .... I blew an arch64 install because of a custom kernel this would have been handy smile


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#23 2009-01-21 20:58:02

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

R00KIE wrote:

The stuff about modules will still bug me though ....

What do you mean? That the modules be installed in /lib/modules/2.6.28-custom ?

Offline

#24 2009-01-21 21:39:25

Aphanic
Member
From: Verín or Madrid (Spain)
Registered: 2008-12-31
Posts: 27

Re: kernel26 PKGBUILD: A simple patch for customization

At least for me, patching PKGBUILD fails in the 3rd hunk using PKGBUILD from "Core": http://repos.archlinux.org/viewvc.cgi/k … iew=markup

PKGBUILD.rej:
http://arch.pastebin.com/m7a860f8a

***************
*** 39,53 ****
    KARCH=x86
  
    cd ${srcdir}/linux-$_basekernel
    # Add -ARCH patches
    # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary
    patch -Np1 -i ${srcdir}/${_patchname} || return 1
  
    if [ "$CARCH" = "x86_64" ]; then
      cat ../config.x86_64 >./.config
    else
      cat ../config >./.config
    fi
    # get kernel version
    make prepare
    _kernver="$(make kernelrelease)"
--- 45,68 ----
    KARCH=x86
  
    cd ${srcdir}/linux-$_basekernel
+   if [[ ! -e _arch_patched ]]; then
    # Add -ARCH patches
    # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary
    patch -Np1 -i ${srcdir}/${_patchname} || return 1
+   touch _arch_patched
+   else
+     msg "Already patched, skipping."
+   fi
+   msg "Patching done, continuating with compilation..."
  
    if [ "$CARCH" = "x86_64" ]; then
      cat ../config.x86_64 >./.config
    else
      cat ../config >./.config
    fi
+   if [ "${_kernelname}" != "" ]; then
+     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
+   fi
    # get kernel version
    make prepare
    _kernver="$(make kernelrelease)"

I've not tried to compile yet, I just don't have the time today, sorry, I'll compile it tomorrow.

Offline

#25 2009-01-21 21:53:23

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: kernel26 PKGBUILD: A simple patch for customization

Aphanic wrote:

At least for me, patching PKGBUILD fails in the 3rd hunk using PKGBUILD from "Core": http://repos.archlinux.org/viewvc.cgi/k … iew=markup

I just sync my abs and tested the patch. It applies cleanly. I downloaded the pkgbuild from http://repos.archlinux.org/viewvc.cgi/k … sion=24709 and it still applied cleanly. The only difference between abs sync and websvn is "# $Id: PKGBUILD 24584 2009-01-18 19:58:10Z tpowa $" at the begining of the file.

It might just be due to a copy paste from the forum problem... I thus removed the code from the first thread and pointed to the bug report @ http://bugs.archlinux.org/task/12384 for the latest patch (scroll down to the bottom for latest...)

Offline

Board footer

Powered by FluxBB