You are not logged in.

#1 2004-07-23 23:58:05

forn4x
Member
Registered: 2004-06-23
Posts: 13

Alternative PKGBUILD to create custom kernels

There is one PKGBUILD in Wiki, but it creates kind of a little mess because upgrading of packages doesn't work when you make different releases. My PKGBUILD is modification of that one by jea and the original by judd.

# v0.2 2004/07/23
# Wojciech Szlachta
#
# Modified from official PKGBUILD for kernel26-scsi by judd <jvinet@zeroflux.org>
# and from custom PKGBUILD to support multiple installed kernels by jea.
kerrev=

pkgname=kernel26-$kerrev
pkgver=
pkgrel=1
pkgdesc="Custom Linux Kernel and modules revision: $kerrev ver: $pkgver build: $pkgrel"
url="http://www.kernel.org"
depends=('module-init-tools')
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2 
        config)
md5sums=('' '')

build() {
  cd $startdir/src/linux-$pkgver
  # apply patches here
  # get rid of the 'i' in i686
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config
  # make changes in kernel configuration
  #make menuconfig
  yes "" | make config
  # set EXTRAVERSION to create unique /lib/modules/ subdirectories
  cat Makefile | sed "s|EXTRAVERSION =|EXTRAVERSION = -$kerrev|" > tmpMake
  mv tmpMake Makefile
  make clean bzImage modules || return 1
  mkdir -p $startdir/pkg/{lib/modules,boot}
  make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
  # create unique names in /boot/
  cp System.map $startdir/pkg/boot/System.map26-$kerrev
  cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26-$kerrev
  install -D -m644 Makefile $startdir/pkg/usr/src/linux-$pkgver/Makefile
  install -D -m644 .config $startdir/pkg/usr/src/linux-$pkgver/.config
  install -D -m644 .config $startdir/pkg/boot/kconfig26-$kerrev
  mkdir -p $startdir/pkg/usr/src/linux-$pkgver/include
  mkdir -p $startdir/pkg/usr/src/linux-$pkgver/arch/i386/kernel
  for i in acpi asm-generic asm-i386 config linux math-emu net pcmcia scsi video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-$pkgver/include/
  done
  # copy files necessary for later builds, like nvidia and vmware
  cp -a scripts $startdir/pkg/usr/src/linux-$pkgver/
  mkdir -p $startdir/pkg/usr/src/linux-$pkgver/.tmp_versions
  cp arch/i386/Makefile $startdir/pkg/usr/src/linux-$pkgver/arch/i386/
  cp arch/i386/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-$pkgver/arch/i386/kernel/
  # copy in Kconfig files
  for i in `find . -name "Kconfig*"`; do
    mkdir -p $startdir/pkg/usr/src/linux-$pkgver/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-$pkgver/$i
  done
  cd $startdir/pkg/usr/src/linux-$pkgver/include && ln -s asm-i386 asm
  chown -R root.root $startdir/pkg/usr/src/linux-$pkgver
  # create a unique subdirectory under /usr/src/
  cd $startdir/pkg/usr/src
  mv linux-$pkgver linux-$pkgver-$kerrev
  cd $startdir/pkg/lib/modules/$pkgver-$kerrev && 
    (rm -f build; ln -sf /usr/src/linux-$pkgver-$kerrev build)
}

For example to apply patch add:

  # apply patches here
  # patch to use given dsdt table
  patch -p1 -i ../dsdt-$pkgver.patch
  cp ../dsdt.hex drivers/acpi/

Of course you need to add the patches to the source section and preferably to md5sum section.

To be able to configure your kernel during making package uncomment:

make menuconfig

You can substitute menu config by what ever method you want...

For pkgver=2.6.7 and kerrev=dsdt it will create:
/lib/modules/2.6.7-dsdt/*
/usr/src/linux-2.6.7-dsdt/*
vmlinuz26-dsdt
kconfig26-dsdt
System.map26-dsdt

It doesn't conflict with any of the distribution kernel's and when you want to create new version you just change pkgrel=2 etc. , and simply upgrade wink

Enjoy wink

Thanks to judd and jea for great job they did - I just modified what they had previously done.

Wojciech Szlachta


"Earth is the cradle of humanity, but one cannot live
in a cradle forever."     Konstantin E. Tsiolkovsky

Offline

#2 2004-07-24 03:30:44

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Alternative PKGBUILD to create custom kernels

You're free to edit the wiki to include this if you're sure it works better. smile

Dusty

Offline

#3 2004-07-24 05:06:46

forn4x
Member
Registered: 2004-06-23
Posts: 13

Re: Alternative PKGBUILD to create custom kernels

well, actually I was thinking about putting that in Wiki, but I don't know if I should create a new entry or just update the existing one...
I believe that my PKGBUILD is more flexible, causes less mess and has the naming scheme more similiar to that used by arch... but since nobody has to agree with me, I don't want to remove the PKGBUILD that is already there... if you think that I can do that, I will put that in Wiki

waiting for response...


"Earth is the cradle of humanity, but one cannot live
in a cradle forever."     Konstantin E. Tsiolkovsky

Offline

#4 2004-07-24 05:14:56

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Alternative PKGBUILD to create custom kernels

I'd say update the existing one, the changes aren't that much, and changes for the better are always good in wiki. smile

Dusty

Offline

#5 2004-07-24 06:38:32

forn4x
Member
Registered: 2004-06-23
Posts: 13

Re: Alternative PKGBUILD to create custom kernels

It's in Wiki now.


"Earth is the cradle of humanity, but one cannot live
in a cradle forever."     Konstantin E. Tsiolkovsky

Offline

#6 2004-07-24 20:49:49

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Alternative PKGBUILD to create custom kernels

Thanks very much. I'll try it next kernel release.

Offline

#7 2004-07-25 22:03:46

ro0x
Member
From: Santiago, Chile
Registered: 2004-06-20
Posts: 79

Re: Alternative PKGBUILD to create custom kernels

kernel 2.4 version???

Offline

#8 2004-07-26 07:11:06

forn4x
Member
Registered: 2004-06-23
Posts: 13

Re: Alternative PKGBUILD to create custom kernels

Here we go for 2.4 kernel

NOT TESTED !!! but should work

# v0.0 2004/07/26
# Wojciech Szlachta
#
# Modified from official PKGBUILD for kernel24-scsi by judd <jvinet@zeroflux.org>
# and from custom PKGBUILD to support multiple installed kernels by jea.
kerrev=

pkgname=kernel24-$kerrev
pkgver=
pkgrel=1
pkgdesc="Custom Linux Kernel and modules revision: $kerrev ver: $pkgver build: $pkgrel"
url="http://www.kernel.org"
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-$pkgver.tar.bz2 
        config gcc340.patch)
md5sums=('' 'c994af35c58625d396659ff1c1a7ef8b'
         '')

build() {
  cd $startdir/src/linux-$pkgver
  # apply patches here
  patch -Np1 -i ../gcc340.patch
  # get rid of the 'i' in i686
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config
  # make changes in kernel configuration 
  #make menuconfig 
  yes "" | make config
  # set EXTRAVERSION to create unique /lib/modules/ subdirectories 
  cat Makefile | sed "s|EXTRAVERSION =|EXTRAVERSION = -$kerrev|" > tmpMake
  mv tmpMake Makefile 
  make dep clean bzImage modules || return 1
  mkdir -p $startdir/pkg/{lib/modules,boot}
  make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
  # create unique names in /boot/
  cp System.map $startdir/pkg/boot/System.map24-$kerrev
  cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz24-kerrev
  install -D -m644 .config $startdir/pkg/usr/src/linux-$pkgver/.config
  install -D -m644 .config $startdir/pkg/boot/kconfig24-$kerrev
  mkdir -p $startdir/pkg/usr/src/linux-$pkgver/include
  for i in acpi asm-generic asm-i386 config linux math-emu net pcmcia scsi video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-$pkgver/include/
  done
  cd $startdir/pkg/usr/src/linux-$pkgver/include && ln -s asm-i386 asm
  chown -R root.root $startdir/pkg/usr/src/linux-$pkgver
  # create a unique subdirectory under /usr/src/ 
  cd $startdir/pkg/usr/src 
  mv linux-$pkgver linux-$pkgver-$kerrev 
  cd $startdir/pkg/lib/modules/$pkgver-$kerrev && 
    (rm -f build; ln -sf /usr/src/linux-$pkgver-$kerrev build)
}

Let me know if you test so that I will be able to put it into Wiki...


"Earth is the cradle of humanity, but one cannot live
in a cradle forever."     Konstantin E. Tsiolkovsky

Offline

Board footer

Powered by FluxBB