You are not logged in.

#1 2008-05-28 13:39:38

bavardage
Member
Registered: 2008-02-17
Posts: 160

Kernel patching with ABS

I have a problem with the newest kernel (kacpid takes 90% of cpu), so I found a patch on kernel.org bugzilla, located at http://bugzilla.kernel.org/show_bug.cgi?id=10224#c25

I really have no clue what I am doing, but I carried on regardless.

I copied /var/abs/core/kernel26 into ~/builds/, put the patch into kernel26/src called acpi.patch and edited the PKGBUILD like so:
I added   patch -Np1 -i $startdir/src/acpi.patch || return 1

# $Id: PKGBUILD 1759 2008-05-16 13:58:54Z thomas $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer: Thomas Baechler <thomas@archlinux.org>
pkgname=kernel26
_basekernel=2.6.25
pkgver=2.6.25.4
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')
install=kernel26.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.preset)
md5sums=('db95a49a656a3247d4995a797d333153'
         'bf582e97c84be9abce998a8d640f4ae7'
         '777d94911faa1cb480832b1c47bee307'
         '2b19c2ff9abd0e6d0ad1e29f124021c3'
         '25584700a0a679542929c4bed31433b6')

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/src/acpi.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
  ####################
  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
  cp arch/$KARCH/boot/bzImage $startdir/pkg/boot/vmlinuz26
  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 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.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,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
}

It compiled fine and so I though all was well, but when installing, I get the following errors.

(1/1) upgrading kernel26                            [####################################################################################################] 100%
>>>
>>> If you use the LILO bootloader, you should run 'lilo' before rebooting.
>>>
>>> Updating module dependencies. Please wait ...
>>> MKINITCPIO SETUP
>>> ----------------
>>> If you use LVM2, Encrypted root or software RAID,
>>> Ensure you enable support in /etc/mkinitcpio.conf .
>>> More information about mkinitcpio setup can be found here:
>>> http://wiki.archlinux.org/index.php/Mkinitcpio

>>> Generating initial ramdisk, using mkinitcpio.  Please wait...
==> Building image "default"
==> Running command: /sbin/mkinitcpio -k 2.6.25-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.img
:: Begin build
find: /lib/modules/2.6.25-ARCH: No such file or directory
ERROR: module 'ata[-_]generic' not found
find: /lib/modules/2.6.25-ARCH: No such file or directory
ERROR: module 'ahci' not found
find: /lib/modules/2.6.25-ARCH: No such file or directory
ERROR: module 'ata[-_]piix' not found
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [autodetect]
find: /lib/modules/2.6.25-ARCH: No such file or directory
:: Parsing hook [sata]
:: Parsing hook [uresume]
:: Parsing hook [keymap]
:: Parsing hook [filesystems]
:: Generating image '/boot/kernel26.img'...SUCCESS
==> SUCCESS
==> Building image "fallback"
==> Running command: /sbin/mkinitcpio -k 2.6.25-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26-fallback.img -S autodetect
:: Begin build
find: /lib/modules/2.6.25-ARCH: No such file or directory
ERROR: module 'ata[-_]generic' not found
find: /lib/modules/2.6.25-ARCH: No such file or directory
ERROR: module 'ahci' not found
find: /lib/modules/2.6.25-ARCH: No such file or directory
ERROR: module 'ata[-_]piix' not found
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [sata]
:: Parsing hook [uresume]
:: Parsing hook [keymap]
:: Parsing hook [filesystems]
:: Generating image '/boot/kernel26-fallback.img'...SUCCESS
==> SUCCESS

Is that kernel safe to boot from or not - the No such file or directory errors are worrying.

Offline

#2 2008-05-28 14:12:29

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

Re: Kernel patching with ABS

Is that kernel safe to boot from or not - the No such file or directory errors are worrying.

not safe.

just had a quick look. first i guess you should add acpi.patch to the source array.
then, try to add:

sed -i 's|^EXTRAVERSION = .*$|EXTRAVERSION =|g' Makefile

after your patch command to see if it helps to solve:

find: /lib/modules/2.6.25-ARCH: No such file or directory

Offline

#3 2008-05-28 16:37:10

bavardage
Member
Registered: 2008-02-17
Posts: 160

Re: Kernel patching with ABS

Thanks. Will have a go right away big_smile

For anyone getting those messages, no it's definitely not safe (I tried to boot with it, luckily some sane people in the IRC advised me to make a backup kernel).

Last edited by bavardage (2008-05-28 16:47:39)

Offline

#4 2008-05-28 18:32:57

bavardage
Member
Registered: 2008-02-17
Posts: 160

Re: Kernel patching with ABS

Right - still no joy. I get the same error messages even with your suggestions.
In /lib/modules there is no 2.6.25-ARCH but there is a 2.6.25-ARCH-DIRTY directory. What does that mean?

Offline

#5 2008-05-28 20:42:44

bavardage
Member
Registered: 2008-02-17
Posts: 160

Re: Kernel patching with ABS

Yet another update:
I have tried compiling the kernel directly from abs  - no patching, no modding, nothing.
I just copied the directory across and did a makepkg.
The package doesn't install correctly, and there is no 2.6.25-ARCH in /lib/modules but there is a -dirty. What is this -dirty?

Offline

#6 2008-05-28 21:21:12

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Kernel patching with ABS

While I don't know why your current approach doesn't work, you can try the PKGBUILD from the wiki: http://wiki.archlinux.org/index.php/Ker … n_with_ABS

Offline

#7 2008-05-29 00:57:00

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

Re: Kernel patching with ABS

can you post your kernel config and your acpi.patch ?

Offline

#8 2008-05-29 11:36:58

bavardage
Member
Registered: 2008-02-17
Posts: 160

Re: Kernel patching with ABS

The kernel config and patch are irrelevant - I have tried to compile the stock arch kernel just to make sure that it WASN'T the patch - I simple copied the folder from ABS, did makepkg and installed - no lucky. The problem seems to be that all of the kernels I compile end up with the folder in /lib/modules having -dirty on the end of them. How do I stop this '-dirty'?

I notice in the build I get this message -
==> Building the kernel
fatal: cannot describe '604d205b49b9a478cbda542c65bacb9e1fa4c840'
  CHK     include/linux/version.h

Offline

#9 2008-05-29 11:58:43

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

Re: Kernel patching with ABS

[edit] i should have read the former post more carefully [/edit]

Last edited by bangkok_manouel (2008-05-29 12:05:43)

Offline

#10 2008-05-29 14:31:33

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Kernel patching with ABS

@bavardage: I tried the same thing as you did: copied /var/abs/core/kernel26 to /tmp/kernel26, and ran 'makepkg'. It went fine. No fatals. No modules in -dirty (ls /tmp/kernel/pkg/lib/modules -> 2.6.25-ARCH). You can take a look at my screenlog and compare (dunno if that helps) http://filebin.ca/zomrwr/screenlog.0

Offline

#11 2008-05-29 15:01:21

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

Re: Kernel patching with ABS

what about your kernel source, do you unpack it for each build, is it cloned from git or are you using the same dir over and over again ? you could try to run make mrproper in your src dir to see if it helps.

Offline

#12 2008-05-29 21:32:58

bavardage
Member
Registered: 2008-02-17
Posts: 160

Re: Kernel patching with ABS

I have found the solution - deselecting append local version info in the config - all it took tongue Thanks for all help - I now have a nice working kernel big_smile

Offline

Board footer

Powered by FluxBB