You are not logged in.

#1 2008-11-18 11:32:52

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

proposing a kernel patch for future releases

as you might see from my post count, im fairly new to arch. in fact, i setup the system yesterday, after weeks of struggling with a brown ditro which didnt cut it for me anymore for several reasons. one if which is the reluctanse to include a kernel patch that would fix some bugs on a bunch of laptop models.

since i dont know how this works around here, im just asking which are the right channels to propose this patch applied. as of now, im running the stock arch kernel with the patch applied as explained in the AUR wiki.

the patch is supposed to only affect the intended hardware, and is ignored if its not present. but mayble some kernel devs can verify this.

for the record, im posting original bug reports from both, launchpad and kernel.org so that anyone can review.

thanks a lot


http://bugzilla.kernel.org/show_bug.cgi?id=9905
https://bugs.launchpad.net/ubuntu/+sour … bug/187671

Offline

#2 2008-11-18 11:44:23

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: proposing a kernel patch for future releases

Welcome to Arch.

Arch is quite well-known for some of the following points:
1. It's a DIY distro
2. It tries to provide package as close to vanilla as possible
3. It's extremely easy to build your own packages.

/edit: when one does not read (that is me), one does not give accurate answers...

/edit2: answer to your question: open a bug report, that's the best way I suppose.

Last edited by bangkok_manouel (2008-11-18 11:48:10)

Offline

#3 2008-11-18 11:49:51

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

bangkok_manouel wrote:

Welcome to Arch.

Arch is quite well-known for some of the following points:
1. It's a DIY distro
2. It tries to provide package as close to vanilla as possible
3. It's extremely easy to build your own packages.

So, I'm not a dev but I would guess it's not that easy to propose patches (there has been a lot of ink about this few months ago) but, OTOH, everyone will be happy to help you modifying a PKGBUILD for your own needs.

hey, thanks for the post. yes, its been quite simple to build my own custom kernel, even if it did step over the original kernel (something i didnt intend to) everything worked ok so no harm done.

i take this oportunity to ask the following: when a kernel upgrade is available. it will definaltely step over my custom kernel wont it?

in fact, ive got kernel26-2.6.27.6-1 in the update bin, and dont know what to do. so....any info on it would be nice. im posting my grub menu just in case its useful

# (0) Arch Linux
title  Arch Linux
root   (hd0,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/3f0b7664-5266-41f7-b43d-d2014aee1db4 ro
initrd /boot/kernel26.img

# (1) Arch Linux
title  Arch Linux Fallback
root   (hd0,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/3f0b7664-5266-41f7-b43d-d2014aee1db4 ro
initrd /boot/kernel26-fallback.img

ive just posted the essentials... thanks in advance

Offline

#4 2008-11-18 11:53:10

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: proposing a kernel patch for future releases

eldragon wrote:

i take this oportunity to ask the following: when a kernel upgrade is available. it will definaltely step over my custom kernel wont it?

yes it will. that's why you may want to build a kernel26-eldragon package to avoid this.

Offline

#5 2008-11-18 12:23:56

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,594
Website

Re: proposing a kernel patch for future releases

Or use IgnorePkg in pacman.conf.

In general, we don't tend to include patches that are not accepted upstream.  Although I'm not sure if there are exceptions made for kernel patch set.  You could file a bug report asking for its inclusion but given the current patch is just a hack...

Offline

#6 2008-11-18 12:25:12

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,227
Website

Re: proposing a kernel patch for future releases

I have never applied a patch before, so I'm not sure what is possibel and what not, but as Archlinux and its package manager is so easy to install and adapt to your own needs, it might be a good idea to let pacman search for patches in a specified directory upon upgrading the kernel, no?

The kernel is always built on the host itself, so including whatever patch is desired would definetly make Archlinux even more easy to adapt to your own needs.

Just brainstorming here - no harm done I guess smile

Offline

#7 2008-11-18 12:46:34

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

zenlord wrote:

I have never applied a patch before, so I'm not sure what is possibel and what not, but as Archlinux and its package manager is so easy to install and adapt to your own needs, it might be a good idea to let pacman search for patches in a specified directory upon upgrading the kernel, no?

The kernel is always built on the host itself, so including whatever patch is desired would definetly make Archlinux even more easy to adapt to your own needs.

Just brainstorming here - no harm done I guess smile

no, the kernel is not built on the host. the kernel comes prebuilt, since it takes a couple of hours to build the kernel, and i need to build the kernel in order to include the patch.


yes, it is a hack. not that nasty if it does what it says it does (just extend some memory area sizes to certain devices IF the problem is id'ed. anyway, i guess it wont make it into the patchset, so enough about that.

now to the topic at hand. how do i make my own pack name? ive read a bit on the subject, and i thought i was doing that. yet, it apperas i wasnt sad

gonna give it a second go. but feel free to add some insights, since ive got a couple of hours of overhead..

thanks a lot everyone.

Last edited by eldragon (2008-11-18 12:48:11)

Offline

#8 2008-11-18 12:58:56

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

Re: proposing a kernel patch for future releases

There's a good article about rolling your own kernel via abs.  I believe it describes the process quite well, and also shows you how to add a -name suffix to the kernel.  At least I think that's your question.


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

Offline

#9 2008-11-18 13:02:23

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,594
Website

Offline

#10 2008-11-18 13:21:53

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

yes, ive read already that and its child articles, yet i find some things quite confusing.

first, id rather use abs and its PKGBUILD for kernel26 (this is what i used for my current kernel). yet, it doesnt leave much room for customizations, and even here, where it gives its own PKGBUILD, id rather use the stock file. and work on that, since i wish to get the same kernel arch offers, but with my patch applied.

so far, my PKGBUILD looks as follows. (im placing modified lines only, for your convenience).

pkgname=kernel26-H12Y
_basekernel=2.6.27
pkgver=2.6.27.6
pkgrel=1
_patchname="patch-${pkgver}-${pkgrel}-ARCH"
pkgdesc="The Linux Kernel and modules"
arch=(i686)

and the patching section:

 # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary
  patch -Np1 -i $startdir/src/${_patchname} || return 1
  patch -Np1 -i $startdir/src/quirks-h12y.patch || return 1

ive placed my patch where it belongs, so it gets applied.

ive got many more questions concerning how is this kernel being installed. there is this file called kernel26.install and the kernel26.preset which i dont know if i should modify, or how to do so.


and finally, if i wanted to do some config tweaking, how is this done here? back in ubuntu, i used the good old make menuconfig. is this the same here?

thanks for your time

Offline

#11 2008-11-18 18:43:38

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: proposing a kernel patch for future releases

eldragon wrote:

yes, ive read already that and its child articles, yet i find some things quite confusing.

first, id rather use abs and its PKGBUILD for kernel26 (this is what i used for my current kernel). yet, it doesnt leave much room for customizations, and even here, where it gives its own PKGBUILD, id rather use the stock file. and work on that, since i wish to get the same kernel arch offers, but with my patch applied.

so far, my PKGBUILD looks as follows. (im placing modified lines only, for your convenience).

pkgname=kernel26-H12Y
_basekernel=2.6.27
pkgver=2.6.27.6
pkgrel=1
_patchname="patch-${pkgver}-${pkgrel}-ARCH"
pkgdesc="The Linux Kernel and modules"
arch=(i686)

and the patching section:

 # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary
  patch -Np1 -i $startdir/src/${_patchname} || return 1
  patch -Np1 -i $startdir/src/quirks-h12y.patch || return 1

ive placed my patch where it belongs, so it gets applied.

ive got many more questions concerning how is this kernel being installed. there is this file called kernel26.install and the kernel26.preset which i dont know if i should modify, or how to do so.


and finally, if i wanted to do some config tweaking, how is this done here? back in ubuntu, i used the good old make menuconfig. is this the same here?

thanks for your time

I've uploaded an archive of the PKGBUILD/install/config/preset files I use to try out rc kernels. You may use this for your custom kernel, you just have to replace the name to what you want in every file (including config, see CONFIG_LOCALVERSION line 60) and adjust the PKGBUILD for your patch of course.
http://rapidshare.com/files/165065946/c … ar.gz.html

/edit: don't use this config by the way, that was just an example. BTW, this PKGBUILD will bring you menuconfig to answer one of your questions...

Last edited by bangkok_manouel (2008-11-18 20:42:36)

Offline

#12 2008-11-18 23:19:58

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

bangkok_manouel wrote:

I've uploaded an archive of the PKGBUILD/install/config/preset files I use to try out rc kernels. You may use this for your custom kernel, you just have to replace the name to what you want in every file (including config, see CONFIG_LOCALVERSION line 60) and adjust the PKGBUILD for your patch of course.
http://rapidshare.com/files/165065946/c … ar.gz.html

/edit: don't use this config by the way, that was just an example. BTW, this PKGBUILD will bring you menuconfig to answer one of your questions...

thanks for the help, i wasnt going to anyway. thanks for the menuconfig tip, i wanted to add some power saving features to the kernel too big_smile

will report back when im back big_smile

Offline

#13 2008-11-19 01:33:11

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

no joy, problem is there are several files involved, and i dont get info on all of them, or what they do, or  how to modify them, so....im stuck sad

is there any other wiki entry i should be looking at because it appears that information is incomplete.

Offline

#14 2008-11-19 03:07:36

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: proposing a kernel patch for future releases

search the AUR for alternate kernel packages. then compare the difference between that package and the one in abs.

the differences will be the same as what you need to do to accomplish what you want. Most notably will be the name changes for all the files.

I personally have 3 different kernels installed and available upon boot from the grub menu.

It's really not that hard.

Offline

#15 2008-11-19 03:11:09

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: proposing a kernel patch for future releases

http://aur.archlinux.org/packages/kerne … rnel26-ice

take for instance this version of the kernel26.

NOTE: The name changes to kernel26-ice in config.x86/_64 files. this is important, you must change this name in the config file or when you build your kernel, w/e name is in the config will be used for your special kernel. If that name is kernel26-ARCH, then you will be overwriting stock arch kernel. Changing the name will make sure that your don't overwrite the stock arch kernel. Then you will also be able to boot into different kernels when grub menu appears. MUST update menu.lst for this to happen though. Just fix the hardlinks to the right kernel*.img file in /boot.

Hope that gives you some hints.

Last edited by jacko (2008-11-19 03:16:45)

Offline

#16 2008-11-19 07:31:47

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: proposing a kernel patch for future releases

http://bugs.archlinux.org if you want it included...

Offline

#17 2008-11-19 10:18:48

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

i managed to use the PKGBUILD prposed from the wiki to build the kernel. the file looks as follows:

#############################################
# Linux Kernel and Modules PKGBUILD prototype
#
# This PKGBUILD provides a structure to build, install, and remove
# versions of kernels from different trees and with different options
# enabled in the config file.

_desc="Linux Kernel and Modules"
_pkg_base="kernel"
_patchset="-h12y"
_cfgname=""
_kerver=2.6.27.6
_extraver=""  # Use _ instead of - in _extraver! Ex: mm4_ck7
pkgrel=1
arch=('i686')
url="http://www.kernel.org"
license=('GPL')
depends=('module-init-tools')
makedepends=('bzip2' 'gcc')

# PAGE DOWN TWO PAGES FOR PATCHES AND MD5 SUMS
#
#
# The preceding information is used to configure the build:
#
# _desc:
#    This is the base of the package description.  It should be
#    okay to leave the default value of "Linux Kernel and Modules"
#
# _pkg_base:
#    This is the base of the pkgname.  It should be okay to leave
#    this with the default value of "kernel"
#
# _patchset: [optional - set to "" to not use]
#    This value is an identifier which you can use to indicate
#    what patches are being applied to the kernel.  Examples would be:
#    ck - Indicates following Con Kolivas' patch sets
#    mm - Indicates kernel is patched with Andrew Morton's tree
#    acpi - Indicates patches have been added for acpi
#    ck_acpi_no_r4 - Indicates the source is patched with Kon Colivas'
#       patchset, acpi patches are applied, and reiser4 patches have
#       been removed.
#    Recommendation: Add an identifier for any tree you follow, but don't
#       get too carried away.  You may include hyphens, but I strongly
#       recommend underscores instead.
#
# _cfgname: [optional - set to "" to not use]
#    This value is an identifier used to indicate how the kernel is
#    configured.  Whereas patchset should indicate manipulations to then
#    source tree, here you should indicate changes to the default config.
#    Examples:
#    sn45g - The kernel is configured with drivers and modules found in
#       Shuttle's SN45G XPC.
#    test - This kernel is a test of a different or new configuration
#    Recommendation: You may use hyphens but I strongly suggest underscores
#       instead.  Leave blank ("") to indicate the kernel is configured
#       with the same options as the current Arch stock kernel package.
#
# _kerver:
#    This is the version of the kernel source tree that is going to be
#    downloaded.  (ex: 2.6.5 or 2.6.8.1)
#
# _extraver:
#    This is additional version information for the kernel.  This should
#    reflect any kernel version modifiers that will be applied by the
#    patches you are going to apply.  Example:
#    ck7 - This kernel version will have "-ck7" appended to indicate it is
#       patched with the 7th release of Con Kolivas' patches against the
#       current (_kerver) kernel version.
#    Recommendation: Including a ck7 here may seem redundant to including
#       a ck in the _patchset value.  I strongly recommend doing it in
#       both places.  A ck in the _patchset indicates the nature of then
#       source tree, but is not used in the arch pkgver.  The ck7 inside
#       _extraver will be applied as part of the pkgver.
#
#  pkgrel:
#     This is the standard Arch pkgrel value.  Start at one for each
#     release of a new combination of _patchset, _cfgname, _kerver, and
#     _extraver.  Increment by one for each repackaging where those four
#     values remain the same.
#
#  The generated package will have the following properties:
#    name: $_pkg_base-$_patchset-$_cfgname
#    version: $_kerver_$_extraver-#pkgrel
#    pkg: kernel-$_patchset-$_cfgname-$_kerver_$_extraver-$pkgrel.pkg.tar.gz
#    vmlinuz-$_kerver-$_extraver-$_patchset-$_cfgname
#    System.map-$_kerver-$_extraver-$_patchset-$_cfgname
#    kconfig-$_kerver-$_extraver-$_patchset-$_cfgname
#    /lib/modules/$_kerver-$_extraver-$_patchset-$_cfgname
#    /usr/src/linux-$_kerver-$_extraver-$_patchset-$_cfgname
#    /usr/src/linux -> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#    /usr/src/linux/config.stock = a stock arch kernel config file
#    A copy of the .config use to build the kernel will be copied to
#       the abs build directory.
#

#############################################
#DO NOT CHANGE INSIDE THIS BLOCK
pkgver=$_kerver

if [ ! -z "$_extraver" ]; then
  _scratch="_$_extraver"
  pkgver=$pkgver$_scratch
  _extraver=`echo "-$_extraver" | sed 's|_|-|'`
fi

pkgdesc="$_desc - ver: $_kerver$_extraver;"
pkgname=$_pkg_base

if [ ! -z "$_patchset" ]; then
  pkgdesc="$pkgdesc pset: $_patchset;"
  _patchset="-$_patchset"
  pkgname="$pkgname$_patchset"
fi

if [ ! -z "$_cfgname" ]; then
  pkgdesc="$pkgdesc cfg: $_cfgname;"
  _cfgname="-$_cfgname"
  pkgname="$pkgname$_cfgname"
fi

pkgdesc="$pkgdesc bld: $pkgrel"
_idstr="$_kerver$_extraver$_patchset$_cfgname"
#############################################

###### Add patchfiles to the source array.  Make sure the config file matches
###### the configuration for the kernel you intend to package.  Make sure the
###### config.stock matches the .config from the current Arch stock kernel.
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_kerver.tar.bz2
  config
  config.stock
  )

###### Add md5 checksums here:
md5sums=()

getvar() {
  old=$(cat Makefile | grep "^$1")
  echo $(echo ${old/"$1 ="/} | sed -e "s/[ ]*\(.*\)[ ]*/\1/g")
  return 0
}

build() {
  echo "_pkg_base: $_pkg_base"
  echo "_patchset: $_patchset"
  echo "_cfgname: $_cfgname"
  echo "_kerver: $_kerver"
  echo "_extraver: $_extraver"
  echo "pkgrel: $pkgrel"
  echo "_desc: $_desc"
  echo "url: $url"
  echo "license: $license"
  echo "pkgver: $pkgver"
  echo "pkgdesc: $pkgdesc"
  echo "_idstr: $_idstr"
  #read KEY

  cd ${srcdir}/linux-$_kerver

###### apply patches here
   patch -p1 < ../quirks-h12y.patch || return 1

  #get rid of i in i686 in default config
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config

###### Choose one of the following configuration types
  #make oldconfig || return 1
  make menuconfig || return 1
  #make xconfig || return 1 #### (BROKEN?)
  #make gconfig || return 1

#############################################
# NO CHANGES BELOW THIS POINT

  # Save the configuration file to a backup in the build directory
  cp ./.config ../../config$_cfgname.bak

  # set EXTRAVERSION to help use unique /lib/modules/ subdirectories
  _ker_make_ver=$(getvar "VERSION").$(getvar "PATCHLEVEL").$(getvar "SUBLEVEL")
  _ker_extraver=`echo $_idstr | sed "s|^$_ker_make_ver||"`

  # update EXTRAVERSION in the Makefile by adding our (for modules location)
  _oldline=$(cat Makefile | grep "^EXTRAVERSION")
  cat Makefile | sed "s|$_oldline|EXTRAVERSION\ =\ $_ker_extraver$_patchset$_cfgname|" > tmpMake
  mv tmpMake Makefile

  make clean bzImage modules || return 1
  mkdir -p ${pkgdir}/{lib/modules,boot}
  make INSTALL_MOD_PATH=${pkgdir} modules_install || return 1

  # create unique names in /boot/
  cp System.map ${pkgdir}/boot/System.map-$_idstr
  cp arch/i386/boot/bzImage ${pkgdir}/boot/vmlinuz-$_idstr

  install -D -m644 Makefile ${pkgdir}/usr/src/linux-$_idstr/Makefile
  install -D -m644 .config ${pkgdir}/usr/src/linux-$_idstr/.config
  install -D -m644 ../config.stock ${pkgdir}/usr/src/linux-$_idstr/config.stock
  install -D -m644 .config ${pkgdir}/boot/kconfig-$_idstr
  mkdir -p ${pkgdir}/usr/src/linux-$_idstr/include
  mkdir -p ${pkgdir}/usr/src/linux-$_idstr/arch/i386/kernel
  for i in acpi asm-generic asm-i386 config linux math-emu net pcmcia scsi video; do
    cp -a include/$i ${pkgdir}/usr/src/linux-$_idstr/include/
  done

  # copy files necessary for later builds, like nvidia and vmware
  cp -a scripts ${pkgdir}/usr/src/linux-$_idstr/
  mkdir -p ${pkgdir}/usr/src/linux-$_idstr/.tmp_versions
  cp arch/i386/Makefile ${pkgdir}/usr/src/linux-$_idstr/arch/i386/
  cp arch/i386/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-$_idstr/arch/i386/kernel/

  # copy in Kconfig files
  for i in `find . -name "Kconfig*"`; do
    mkdir -p ${pkgdir}/usr/src/linux-$_idstr/`echo $i | sed 's|/Kconfig.*||'`
    cp $i ${pkgdir}/usr/src/linux-$_idstr/$i
  done
  cd ${pkgdir}/usr/src/linux-$_idstr/include && ln -s asm-i386 asm
  chown -R root.root ${pkgdir}/usr/src/linux-$_idstr

  cd ${pkgdir}/lib/modules/$_idstr && \
    (rm -f build; ln -sf /usr/src/linux-$_idstr build)

  ln -sf /usr/src/linux-$_idstr ${pkgdir}/usr/src/linux

  cp ${srcdir}/config.stock ${pkgdir}/usr/src/linux-$_idstr/config.stock
}

there is something about config and config.stock which i dont know from where to supply, so i just pick the config for the installed ARCH kernel, and copy it as config and config.stock in the basedir where PKGBUILD is. is this correct?

what is the difference from getting the 2.6.27.6 from git, and the 2.6.27 from git, and applying the patches proposed by ARCH? i get the feeling im going to want the kernel with the arch patches.... sad


anyway, i cant install the thing,i get an error that  all .fw files already exist in /lib/firmware, and the package will not install. if im correct, all firmware files, are not kernel dependant, and they should be ignored. yet i dont want to break everything.... how do i fix this?

Offline

#18 2008-11-19 15:43:50

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: proposing a kernel patch for future releases

anyway, i cant install the thing,i get an error that  all .fw files already exist in /lib/firmware, and the package will not install. if im correct, all firmware files, are not kernel dependant, and they should be ignored. yet i dont want to break everything.... how do i fix this?

if the build was fine, just force the install (use the -f flag). _maybe_not_a_good_advice_ but all i can tell is that i did it maaaaaaaany times and i'm still alive...

Offline

#19 2008-11-19 15:56:57

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

bangkok_manouel wrote:

anyway, i cant install the thing,i get an error that  all .fw files already exist in /lib/firmware, and the package will not install. if im correct, all firmware files, are not kernel dependant, and they should be ignored. yet i dont want to break everything.... how do i fix this?

if the build was fine, just force the install (use the -f flag). _maybe_not_a_good_advice_ but all i can tell is that i did it maaaaaaaany times and i'm still alive...

you are a funny guy big_smile (im doing it right now), just scared i would overwrite important files......

im filing the bug report after reading the guidelines....chances feel slim that it would get included, but im still crossing my fingers big_smile

Offline

#20 2008-11-19 16:00:36

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

iphitus wrote:

http://bugs.archlinux.org if you want it included...

here goes nothing....http://bugs.archlinux.org/task/12180

Offline

#21 2008-11-23 16:58:25

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

ok, ended up succesfully building my own parallel kernel with these files:

PKGBUILD

# $Id: PKGBUILD 19042 2008-11-14 09:12:35Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer: Thomas Baechler <thomas@archlinux.org>
pkgname=kernel26-h12y
_basekernel=2.6.27
pkgver=2.6.27.6
pkgrel=1
_patchname="patch-${pkgver}-${pkgrel}-ARCH"
pkgdesc="The Linux Kernel and modules"
arch=(i686 x86_64)
license=('GPL2')
groups=('base')
url="http://www.kernel.org"
backup=(etc/mkinitcpio.d/${pkgname}.preset)
depends=('coreutils' 'module-init-tools' 'mkinitcpio>=0.5.18')
# pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
# nforce package support was abandoned by nvidia, kernel modules should cover everything now.
# kernel24 support is dropped since glibc24
replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
          'alsa-driver' 'ieee80211' 'hostap-driver26'
          'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
      'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
      'gspcav1')
install=kernel26-h12y.install
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
        ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
        # the main kernel config files
        config config.x86_64
        # standard config files for mkinitcpio ramdisk
        kernel26-h12y.preset)
md5sums=('b3e78977aa79d3754cb7f8143d7ddabd'
         'ef7188b740c4d8817e492c159cd359ed'
         '7938728a8cd8bdb51844e964e4b8db92'
         '303f55bfbe8ff81b4ae2ce33a28dedd0'
         '814771d453d37c416ad362c68a3d5c84')

build() {
  KARCH=x86

  cd $startdir/src/linux-$_basekernel
  # Add -ARCH patches
  # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary
  patch -Np1 -i $startdir/src/${_patchname} || return 1
  patch -Np1 -i $startdir/quirks-h12y.patch || return 1

  if [ "$CARCH" = "x86_64" ]; then
    cat ../config.x86_64 >./.config
  else
    cat ../config >./.config
  fi
  
  # build the full kernel version to use in pathnames
  . ./.config
  ### next line is only needed for rc kernels
  #_kernver="2.6.25${CONFIG_LOCALVERSION}"
  _kernver="${_basekernel}${CONFIG_LOCALVERSION}"
  # load configuration
  
  
  yes "" | make config
  # build!
  ####################
  # stop here
  # this is useful to configure the kernel
  #msg "Stopping build"
  #return 1
  ####################
  
  # edit configuration file
  make menuconfig || return 1

  make bzImage modules || return 1
  mkdir -p $startdir/pkg/{lib/modules,boot}
  make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
  cp System.map $startdir/pkg/boot/System.map26-h12y
  cp arch/$KARCH/boot/bzImage $startdir/pkg/boot/vmlinuz26-h12y
  install -D -m644 Makefile \
    $startdir/pkg/usr/src/linux-${_kernver}/Makefile
  install -D -m644 kernel/Makefile \
    $startdir/pkg/usr/src/linux-${_kernver}/kernel/Makefile
  install -D -m644 .config \
    $startdir/pkg/usr/src/linux-${_kernver}/.config
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include

  for i in acpi asm-{generic,x86} config linux math-emu media net pcmcia scsi sound video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-${_kernver}/include/
  done

  # copy files necessary for later builds, like nvidia and vmware
  cp Module.symvers $startdir/pkg/usr/src/linux-${_kernver}
  cp -a scripts $startdir/pkg/usr/src/linux-${_kernver}
  # fix permissions on scripts dir
  chmod og-w -R $startdir/pkg/usr/src/linux-${_kernver}/scripts
  #mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/.tmp_versions

  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/kernel

  cp arch/$KARCH/Makefile $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/
  if [ "$CARCH" = "i686" ]; then
    cp arch/$KARCH/Makefile_32.cpu $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/
  fi
  cp arch/$KARCH/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/kernel/

  # add headers for lirc package
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video
  cp drivers/media/video/*.h  $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/
  for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
   mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/$i
   cp -a drivers/media/video/$i/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/$i
  done
  # add dm headers
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/md
  cp drivers/md/*.h  $startdir/pkg/usr/src/linux-${_kernver}/drivers/md
  # add inotify.h
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include/linux
  cp include/linux/inotify.h $startdir/pkg/usr/src/linux-${_kernver}/include/linux/
  # add CLUSTERIP file for iptables
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/net/ipv4/netfilter/
  # add wireless headers
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/net/mac80211/
  cp net/mac80211/*.h $startdir/pkg/usr/src/linux-${_kernver}/net/mac80211/
  # add dvb headers for external modules
  # in reference to:
  # http://bugs.archlinux.org/task/9912
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
  cp drivers/media/dvb/dvb-core/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
  # add dvb headers for external modules
  # in reference to:
  # http://bugs.archlinux.org/task/11194
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include/config/dvb/
  cp include/config/dvb/*.h $startdir/pkg/usr/src/linux-${_kernver}/include/config/dvb/
  # add xfs and shmem for aufs building
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/fs/xfs
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/mm
  cp fs/xfs/xfs_sb.h $startdir/pkg/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
  # add vmlinux
  cp vmlinux $startdir/pkg/usr/src/linux-${_kernver}
  # copy in Kconfig files
  for i in `find . -name "Kconfig*"`; do 
    mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-${_kernver}/$i
  done

  cd $startdir/pkg/usr/src/linux-${_kernver}/include && ln -s asm-$KARCH asm

  chown -R root.root $startdir/pkg/usr/src/linux-${_kernver}
  find $startdir/pkg/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
  cd $startdir/pkg/lib/modules/${_kernver} && \
    (rm -f source build; ln -sf ../../../usr/src/linux-${_kernver} build)
  # install fallback mkinitcpio.conf file and preset file for kernel
  install -m644 -D $startdir/src/${pkgname}.preset $startdir/pkg/etc/mkinitcpio.d/${pkgname}.preset || return 1
  # set correct depmod command for install
  sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" $startdir/kernel26-h12y.install
  echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${startdir}/pkg/etc/mkinitcpio.d/${pkgname}.kver
  # remove unneeded architectures
  rm -rf $startdir/pkg/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
}

kernel26-h12y.install

# arg 1:  the new package version
# arg 2:  the old package version

KERNEL_VERSION=2.6.27-ARCH-h12y

post_install () {
  # updating module dependencies
  echo ">>> Updating module dependencies. Please wait ..."
  depmod -v $KERNEL_VERSION > /dev/null 2>&1
  # generate init ramdisks
  echo ">>> MKINITCPIO SETUP"
  echo ">>> ----------------"
  echo ">>> If you use LVM2, Encrypted root or software RAID,"
  echo ">>> Ensure you enable support in /etc/mkinitcpio.conf ."
  echo ">>> More information about mkinitcpio setup can be found here:"
  echo ">>> http://wiki.archlinux.org/index.php/Mkinitcpio"
  echo ""
  echo ">>> Generating initial ramdisk, using mkinitcpio.  Please wait..."
  /sbin/mkinitcpio -p kernel26-h12y
}

post_upgrade() {
  pacman -Q grub &>/dev/null
  hasgrub=$?
  pacman -Q lilo &>/dev/null
  haslilo=$?
  # reminder notices
  if [ $haslilo -eq 0 ]; then
    echo ">>>"
    if [ $hasgrub -eq 0 ]; then
      echo ">>> If you use the LILO bootloader, you should run 'lilo' before rebooting."
    else
      echo ">>> You appear to be using the LILO bootloader. You should run"
      echo ">>> 'lilo' before rebooting."
    fi
    echo ">>>"
  fi

  if grep "/boot" /etc/fstab 2>&1 >/dev/null; then
    if ! grep "/boot" /etc/mtab 2>&1 >/dev/null; then
      echo "WARNING: /boot appears to be a seperate partition but is not mounted"
      echo "         This is most likely not what you want.  Please mount your /boot"
      echo "         partition and reinstall the kernel unless you are sure this is OK"
    fi
  fi

  if [ "`vercmp $2 2.6.13`" -lt 0 ]; then
    # important upgrade notice
    echo ">>>"
    echo ">>> IMPORTANT KERNEL UPGRADE NOTICE"
    echo ">>> -------------------------------"
    echo ">>> As of kernel 2.6.13, DevFS is NO LONGER AVAILABLE!"
    echo ">>> If you still use DevFS, please make the transition to uDev before"
    echo ">>> rebooting.  If you really need to stay with DevFS for some reason,"
    echo ">>> then you can manually downgrade to an older version:"
    echo ">>>"
    echo ">>> # pacman -U http://archlinux.org/~judd/kernel/kernel26-scsi-2.6.12.2-1.pkg.tar.gz"
    echo ">>>"
    echo ">>> If you choose to downgrade, don't forget to add kernel26-scsi to your"
    echo ">>> IgnorePkg list in /etc/pacman.conf"
    echo ">>>"
    echo ">>> (NOTE: The following portion applies to uDev users as well!)"
    echo ">>>"
    echo ">>> If you use any DevFS paths in your GRUB menu.lst, then you will not"
    echo ">>> be able to boot!  Change your root= parameter to use the classic"
    echo ">>> naming scheme."
    echo ">>>"
    echo ">>> EXAMPLES:"
    echo ">>> - change root=/dev/discs/disc0/part3 to root=/dev/sda3"
    echo ">>> - change root=/dev/md/0 to root=/dev/md0"
    echo ">>>"
  fi
  # generate new init ramdisk
  if [ "`vercmp $2 2.6.18`" -lt 0 ]; then
    echo ">>> --------------------------------------------------------------"
    echo ">>> |                          WARNING:                          |"
    echo ">>> |mkinitrd is not supported anymore in kernel >=2.6.18 series!|"
    echo ">>> |              Please change to Mkinitcpio setup.            |"
    echo ">>> --------------------------------------------------------------"
    echo ">>>"
  fi
  # updating module dependencies
  echo ">>> Updating module dependencies. Please wait ..."
  depmod -v $KERNEL_VERSION > /dev/null 2>&1
  echo ">>> MKINITCPIO SETUP"
  echo ">>> ----------------"
  if [ "`vercmp $2 2.6.18`" -lt 0 ]; then
    echo ">>> Please change your bootloader config files:"
    echo ">>> Grub: /boot/grub/menu.lst | Lilo: /etc/lilo.conf"
    echo "------------------------------------------------"
    echo "| - initrd26.img to kernel26.img               |"
    echo "| - initrd26-full.img to kernel26-fallback.img |"
    echo "------------------------------------------------"
  fi
  if [ "`vercmp $2 2.6.19`" -lt 0 ]; then
    echo ""
    echo ">>> New PATA/IDE subsystem - EXPERIMENTAL"
    echo ">>> ----------"
    echo ">>> To use the new pata drivers, change the 'ide' hook "
    echo ">>> to 'pata' in /etc/mkinicpio.conf HOOKS="
    echo ">>> The new system changes: /dev/hd? to /dev/sd?"
    echo ">>> Don't forget to modify GRUB, LILO and fstab to the"
    echo ">>> new naming system. "
    echo ">>> eg: hda3 --> sda3, hdc8 --> sdc8"
    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?"
    echo ">>> - SATA: sda might shift to sdc if you have 2 other disks on a PIIX IDE port."
    echo ">>> To check if this will affect you, check 'mkinitcpio -M' for piix/ata_piix"
    echo ""
  fi

  echo ">>> If you use LVM2, Encrypted root or software RAID,"
  echo ">>> Ensure you enable support in /etc/mkinitcpio.conf ."
  echo ">>> More information about mkinitcpio setup can be found here:"
  echo ">>> http://wiki.archlinux.org/index.php/Mkinitcpio"
  echo ""
  echo ">>> Generating initial ramdisk, using mkinitcpio.  Please wait..."
if [ "`vercmp $2 2.6.19`" -lt 0 ]; then
  /sbin/mkinitcpio -p kernel26-h12y -m "ATTENTION:\nIf you get a kernel panic below
and are using an Intel chipset, append 'earlymodules=piix' to the
kernel commandline"
else
  /sbin/mkinitcpio -p kernel26-h12y
fi
if [ "`vercmp $2 2.6.21`" -lt 0 ]; then
  echo ""
  echo "Important ACPI Information:"
  echo ">>> Since 2.6.20.7 all possible ACPI parts are modularized."
  echo ">>> The modules are located at:"
  echo ">>> /lib/modules/$(uname -r)/kernel/drivers/acpi"
  echo ">>> For more information about ACPI modules check this wiki page:"
  echo ">>> 'http://wiki.archlinux.org/index.php/ACPI_modules'"
fi
}

op=$1
shift

$op $*

kernel26-h12y.preset

# mkinitcpio preset file for kernel26

#presetname_kver="2.6.27-ARCH-h12y"
########################################
# DO NOT EDIT THIS LINE:
source /etc/mkinitcpio.d/kernel26.kver
########################################
ALL_config="/etc/mkinitcpio.conf"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/kernel26-h12y.img"
#default_options=""

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/kernel26-h12y-fallback.img" 
fallback_options="-S autodetect"

and the config file got its CONFIG_LOCALVERSION set to "-ARCH-h12y"



i still cannot grasp the whole idea of whats being done. i had to try about 5 or 6 kernel build before i got the result i was looking.

i dont remember if prior to doing a makepkg -R i edited some install script inside ./pkg so there still might be some mistakes.

please someone verify this.



PS. is is normal to have a bug filed and have no response whatsoever in the ticket issued?

Offline

#22 2008-11-30 21:29:07

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: proposing a kernel patch for future releases

it appears ive been heard... the patch has been included in the recent updates..so no more kernel building for me big_smile im falling in love with arch by the minute big_smile

Last edited by eldragon (2008-11-30 21:31:43)

Offline

Board footer

Powered by FluxBB