You are not logged in.

#1 2004-08-18 13:30:22

Iolo
Member
Registered: 2004-06-03
Posts: 38

Problem building kernel with makepkg

I tried several times building a custom 2.6.8.1 kernel with makepkg and the PKGBUILD file obtained from http://wiki.archlinux.org/index.php/Ker … with%20ABS. Unfortionately, the process allways ends with the following error:

ln: when making multiple links, last argument must be a directory
make: *** [_modinst_] Error 1
==> ERROR: Build Failed.  Aborting...

Is there something wrong with the build file posted on the wiki or am I doing something stupid?

Offline

#2 2004-08-18 13:50:06

robot5x
Member
Registered: 2004-01-26
Posts: 266

Re: Problem building kernel with makepkg

If you updated abs, you could just copy your custom config to /var/abs/kernels/kernel26 then run makepkg there - the pkgbuild in that directory should already be updated to latest version, rather than editing the one from wiki.

Offline

#3 2004-08-18 16:08:58

Iolo
Member
Registered: 2004-06-03
Posts: 38

Re: Problem building kernel with makepkg

Okay, building with the modded official PKGBUILD file worked.... but for some reason there is a mismatch between the kernel version and the directory the kernel installs its modules into.

uname -r produces: 2.6.8- .1

while the modules are placed in: /lib/modules/2.6.8.1

As you can imagine, this tends to be problematic on boot, as the new kernel can't update its module dependencies, or load any modules.

Offline

#4 2004-08-18 17:12:00

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

Iolo wrote:

I tried several times building a custom 2.6.8.1 kernel with makepkg and the PKGBUILD file obtained from http://wiki.archlinux.org/index.php/Ker … with%20ABS.
[...]
Is there something wrong with the build file posted on the wiki or am I doing something stupid?

Yes, there is something wrong with the build posted on the wiki - I had a similar problem.
I'm currently working on an improved version.

If you want to build a plain kernel (no addons such as mm,ck, etc) use kernel26 PKGBUILD from abs.

Offline

#5 2004-08-18 17:25:04

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

Re: Problem building kernel with makepkg

I'll look into it. I've got so many kernels installed on this computer it isn't funny...

AFAIK, the build worked with 2.6.7. I haven't gotten around to updating yet.

Dusty

Offline

#6 2004-08-18 18:32:35

mak
Member
Registered: 2004-03-08
Posts: 47
Website

Re: Problem building kernel with makepkg

hiho.

i had the very same problems. it's the EXTRAVERSION-string, set by the
PKGBUILD, 'cause 2.6.8.1 already sets one. wink

--- edit ---
iceram's fix does the trick ... so this line is no longer necessary.
--- edit ---

mak.


$ wget -c -r -l inf -i what_the_hel.l

Offline

#7 2004-08-18 18:53:29

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

Err... I might have done a small mistake in my previous post.
I didn't try to build the kernel using the Wiki page above.
I've used http://wiki.archlinux.org/index.php/Bui … with%20ABS

You can find below the revised PKGBUILD for that page. It might look weird, but it's very functional. It should also work with the stock kernels.

This PKGBUILD includes kernel version/revision autodetection. This helps when you apply patches which change those variables (such as ck, mm etc.). The changes I've made automatically change the package details (pkgname, pkgver, pkgdesc) to reflect the kernel changes.
Please test because I've made some cosmetic changes lately which might have scrambled something around there. If you find it working, please post here and I'll put it in the Wiki page above. Maybe it could also be used as a base for building kernels with the ABS.

Any feedback is welcomed. Enjoy.

# ChangeLog
#
# v0.3 2004/08/19 - Mircea Ionut Bardac (IceRAM)
# Updated the PKGBUILD for autodetection of the kernel version and kernel revision
#
# 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.

# you can leave kerrev empty if you don't want to name the kernel in any way
kerrev=

pkgname=kernel26
pkgver=2.6.7
pkgrel=1
pkgdesc="Custom Linux Kernel and modules"
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=('a74671ea68b0e3c609e8785ed8497c14' 
         '4da09ca74deafb3c6769b8de895e089b' 
        )

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

build() {
  cd $startdir/src/linux-$pkgver

  # apply patches here
  # patch -p1 < ../patch1

  # 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 oldconfig || return 1 
  cp ./.config ../../config.new

  #use the following line instead of the 2 lines above for default config
  #yes "" | make config || return 1 

  # set EXTRAVERSION to create unique /lib/modules/ subdirectories
  _ker_extraversion=$(getvar "EXTRAVERSION")

  # update EXTRAVERSION in the Makefile
  _oldline=$(cat Makefile | grep "^EXTRAVERSION")
  if [ $kerrev != "" ]; then
   _ker_extraversion="$_ker_extraversion-$kerrev"
   cat Makefile | sed "s|$_oldline|EXTRAVERSION = $_ker_extraversion|" > tmpMake
   mv tmpMake Makefile
  fi

  kerrev=$_ker_extraversion
  kerver=$(getvar "VERSION").$(getvar "PATCHLEVEL").$(getvar "SUBLEVEL")

  # update the package information from the kernel Makefile
  pkgver=$kerver$(echo $_ker_extraversion | sed -e 's/-/./g')

  # removing patches versions from the revision string
  _n1=$(expr match $kerrev '([.][0-9]*)')
  _n21=$(expr match $q '[.][0-9]*(.*)')
  _n2=$(echo $_n21 | sed -e "s/[0-9]*-/-/g")
  pkgname=kernel26$_n1$_n2
  pkgdesc="Custom Linux Kernel ($kerver) and modules - revision $kerrev / package version: $pkgver build: $pkgrel"

  echo "- Package information ----------------"
  echo "     Package name: $pkgname"
  echo "  Package version: $pkgver"
  echo "  Package release: $pkgrel"
  echo "   Kernel version: $kerver"
  echo "  Kernel revision: $kerrev"
  echo "--------------------------------------"

  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-$kerver/Makefile
  install -D -m644 .config $startdir/pkg/usr/src/linux-$kerver/.config
  install -D -m644 .config $startdir/pkg/boot/kconfig26$kerrev
  mkdir -p $startdir/pkg/usr/src/linux-$kerver/include
  mkdir -p $startdir/pkg/usr/src/linux-$kerver/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-$kerver/include/
  done
  # copy files necessary for later builds, like nvidia and vmware
  cp -a scripts $startdir/pkg/usr/src/linux-$kerver/
  mkdir -p $startdir/pkg/usr/src/linux-$kerver/.tmp_versions
  cp arch/i386/Makefile $startdir/pkg/usr/src/linux-$kerver/arch/i386/
  cp arch/i386/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-$kerver/arch/i386/kernel/
  # copy in Kconfig files
  for i in `find . -name "Kconfig*"`; do
    mkdir -p $startdir/pkg/usr/src/linux-$kerver/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-$kerver/$i
  done
  cd $startdir/pkg/usr/src/linux-$kerver/include && ln -s asm-i386 asm
  chown -R root.root $startdir/pkg/usr/src/linux-$kerver
  # create a unique subdirectory under /usr/src/
  cd $startdir/pkg/usr/src
  mv linux-$kerver linux-$kerver$kerrev
  cd $startdir/pkg/lib/modules/$kerver$kerrev && 
    (rm -f build; ln -sf /usr/src/linux-$kerver$kerrev build)
}

Offline

#8 2004-08-18 22:10:11

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

I've updated the above PKGBUILD to allow any kind of EXTRAVERSION string, including ".1" (as it is in 2.6.8.1). It is still untested.

Please provide feedback. Thanks.

Offline

#9 2004-08-19 00:11:48

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

Re: Problem building kernel with makepkg

Works like a charm. Thanks for researching this, I really wasn't up to it. wink

I updated the wiki:
http://wiki.archlinux.org/index.php/Ker … with%20ABS

My PKGBUILD is a somewhat simplified version of yours, but the differences are mainly cosmetic.

Hopefully it works unedited for a few revisions, eh?

Dusty

Offline

#10 2004-08-19 07:57:27

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

Dusty wrote:

Works like a charm. Thanks for researching this, I really wasn't up to it. wink

What is the Arch community for? wink

The page below might as well be removed, because it says the same thing but it doesn't work in every case: http://wiki.archlinux.org/index.php/Bui … with%20ABS (I used it as a base for the PKGBUILD above)

Dusty wrote:

Hopefully it works unedited for a few revisions, eh?

What versions (&extra versions have you tested)?
dp could try to build his mm kernel with it, I might try others.

Also, I think I'll make some small changes to the text in the Wiki page, because I don't think I've put enough comments in the PKGBUILD.

Oh, I've seen you have removed some lines out of it.
Let me explain a little... (the following piece of code is updated to refflect your changes in the PKGBUILD)

  # removing patches versions from the revision string
  _n1=$(expr match $_kerrev '([.][0-9]*)')
  _n21=$(expr match $_kerrev '[.][0-9]*(.*)')
  _n2=$(echo $_n21 | sed -e "s/[0-9]*-/-/g")
  pkgname=kernel26$_n1$_n2 

Let's assume kerrev=".1-mm1-ck6-win4lin" (this is only an example) & kerver = "2.6.8"
_n1 - contains the .1 from the kernel extra version
_n21 - contains "-mm1-ck6-win4lin" (there was a small mistake in it)
_n2 - contains only the name of the patches applied, without their versions ("-mm-ck-win4lin").
Now that I think of it, _n1 could be dropped (it has no use here).
Why this?
The line bellow (which you already included) will make the correct pkgver.

pkgver=$kerver$(echo $_ker_extraversion | sed -e 's/-/./g')

[you can change the above line with pkgver=$kerver$(echo $_kerrev | sed -e 's/-/./g') - will be easier to understand]
In our case, pkgver = 2.6.8.1.mm1.ck6.win4lin (all the dashes are replaced with dots).
Well, let's assume there is also mm2... kerrev will be ".1-mm2-ck6-win4lin". Why I've chosen to remove the patches version? Because the pkgname of the package in our last case (mm2) will be the same as in the previous case (only pkgver different) and pacman will see it as an upgrade.
The resulting package will be named
in our 1st case: kernel26-mm-ck-win4lin-2.6.8.1.mm1.ck6.win4lin-1.pkg.tar.gz
in our 2nd case: kernel26-mm-ck-win4lin-2.6.8.1.mm2.ck6.win4lin-1.pkg.tar.gz

The correct code that will change the pkgname correctly follows:

  # removing patches versions from the revision string
  _t=$(expr match $_kerrev '[.][0-9]*(.*)')
  pkgname=kernel26$(echo $_t | sed -e "s/[0-9]*-/-/g")

If you have any questions, please ask.

IceRAM

Offline

#11 2004-08-19 16:03:27

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

Re: Problem building kernel with makepkg

I'll remove the multiple kernels howto later.

I don't have time to delve into the code you're suggesting right now, but feel free to make any changes in the wiki PKGBUILD. You do good work.

Dusty

Offline

#12 2004-08-22 08:09:55

android
Member
From: San Diego
Registered: 2003-04-18
Posts: 160

Re: Problem building kernel with makepkg

Wow!

That's one intense PKGBUILD...

John E. A.

Offline

#13 2004-08-22 15:35:06

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

I updated http://wiki.archlinux.org/index.php/Ker … with%20ABS to reflect my previous post.

Offline

#14 2004-09-15 13:25:09

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

with regard to this step:

A screen will come up telling you to select kernel options. It will be qt, gtk, or ncurses based, depending on which config option you chose. (You could also edit the PKGBUILD to use a default config file of your choice)

but as it is supposed to be a guide it is weird it doesn't tell you HOW or WHERE to edit the PKGBUILD.  could the PKGBUILD please be updated so that if you have a config already included in your source array you can just uncomment a line to allow you to use it - in the same way the other config methods are available?

e.g.

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

to

  ###### Choose one of the following configuration types
  ###### Use first option for config in source array
  #yes "" | make config
  #make oldconfig || return 1
  #make menuconfig
  #make xconfig
  make gconfig

not sure if that is actually correct - is a complete guess based on Judd's PKGBUILD

Offline

#15 2004-09-15 18:19:48

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

You are right, I updated it.

Offline

#16 2004-09-17 08:18:28

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

yay! i contibuted something useful!

Offline

#17 2004-09-19 08:26:16

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

does this only work with 2.6 kernels or should it wokr with any kernel?

cos i have found references to thinsg like this:

  install -D -m644 .config $startdir/pkg/boot/kconfig26$_suf

i have altered them in my PKGBUILD to 24 but it exits with errors re:no rule to make gconfig - i assume this is not available for 24 kernels so maybe the this PKGBUILD could be updated to be more generic for both kernel branches?

Offline

#18 2004-09-19 09:18:44

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

Well, I haven't tested it with 2.4 but.. it might work.

That error you're getting reffers to the fact that "gconfig" is not working with the 2.4 Makefile (not implemented). Try one of the other config methods "oldconfig", "menuconfig" etc.

An update for the PKGBUILD to be more generic... hmm.. haven't thought of that. I haven't actually used 2.4 at all. Did you only change 26 to 24 and it simply worked (besides that "make gconfig" error)? If there are no differences between the files structure in 2.4 it might work only renaming 24 to 26.

Anyhow, I'll change that to "make menuconfig" because I *think* it should work in 2.4 also.

Offline

#19 2004-09-19 09:30:46

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

make menuconfig does work - but the build method is different i think (compare the stock 2.6 and 2.4 configs)

however - if one of the var can be set at the start e.g kerbranch=24 or 26

then all the refs to 26 could be changed to $kerbranch and you could add an if statement that uses one build method for kerbranch=24 and one for kerbranch=26

would that work?  i would do it myself but i am unsure about adding the customization vars to the 24 stock PKGBUILD steps.

would be fantastic if this PKGBUILD worked for both main branches

of course i'll be happy to test it!

Offline

#20 2004-09-19 09:37:58

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

I was thinking of adding such a variable (kerbranch) also, but I'm more concerned about the building process. I'll have a look over the 2.4 PKGBUILD and see what resembles. Adding some ifs wouldn't hurt, but I think it might get the PKGBUILD a little bit bloated.

Offline

#21 2004-09-19 09:40:18

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

in that case would an alternative PKGBUILD for 24 kernels be possible?

i think, after you look at the 24 PKGBUILD, you will be able to set this up very quickly - which makes me very happy!  big_smile

Offline

#22 2004-09-19 09:51:52

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

Or an alternative... smile
I'll have a look later this day.

IceRAM

Offline

#23 2004-09-19 10:09:22

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

that's fantastic RAM - thanks very much

Offline

#24 2004-09-20 18:23:44

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: Problem building kernel with makepkg

i had a go at perverting the custom build to wrok with both 24 and 26 but is pointless - the deps, source and build method are all different - it just needs a separate custom PKGBUILD.

the version i ended up with didn't result in the expected file names tho.  the 26 build results in nice clear nameing with "-" 's - mine (with a kerbranch) just resulted in files called vmlinuz24bspl rather than vmlinuz-26-bspl etc

i think it needs an expert eye sad

Offline

#25 2004-09-20 19:15:28

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Problem building kernel with makepkg

I had a look over them and I got to the same conclusion.

Unfortunately, I wasn't able to create anything functional since I had to prepare a one-week holiday abroad. I'll be out for a couple of days. The core commands for building a package are quite few, both in 2.6 and in 2.4. Converting might not be very difficult.

The thing you got there might have been the right one. If EXTRAVERSION returns "bspl" with no "-" before, it will be added as is. The 2.6 PKGBUILD does not add by itself dashes. It worked this way for a while until Linus introduced 2.6.8 + EXTRAVERSION=".1" which totally messed it. After a fix, I have made it dash-independant smile

If you ignore the naming problem, does the kernel work?

Offline

Board footer

Powered by FluxBB