You are not logged in.

#1 2005-09-05 10:22:01

mr_brightside
Member
Registered: 2005-09-01
Posts: 78

kernel compilation via ABS: line 560 error

I'll tell you everything that's happened, so you're up to scratch tongue

I installed arch a couple of days ago, fell in love since it's got speed without long compile times. My audigy 2 value wouldn't work, despite me building a kernel from source upon installation from the  base ISO, which I made sure included ALSA statically and emu10k1 as well. I still haven't fixed this; my kernel version is 2.6.10, and i've got an nforce2 mobo. Alsa defaults to the nforce2 for sound, and alsaconf reckons it can't find any PCI soundcards.

Anyway, I'll try and overcome this at some point on my own; my nforce2 will suffice for the moment. My problem now is recompiling the kernel; I'm a regular slackware and gentoo user, so know a fair bit, but I want to learn how to compile the kernel via ABS... this is where things aren't working now, lol   :cry:

Following the wiki guide, I made a directory /var/abs/local/kernel26-custom . In this, i saved the following PKBUILD:


###### Give the kernel a unique name (for multiple builds - can be empty)
  _kerrev=

  ###### Choose generic name, version, and release. updated later for $_kerrev
  pkgname=kernel26
  pkgver=2.6.12
  pkgrel=1
  pkgdesc="Custom Linux Kernel and modules"
  url="http://www.kernel.org"
  depends=('module-init-tools')
  ###### Add a default config file and any patches to be applied to source array
  source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2)
  ###### Add md5 checksums here:
  #md5sums=()

  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 #model

    #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
    ###### Use first option for config in source array
    #yes "" || make config
    #make oldconfig ||| return 1
    #make menuconfig
    make xconfig
    #make gconfig

    ##### No user changes below here
    # save the configuration with today's date
    cp ./.config ../../NEWCONFIG-$(date +%b%d)

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

    # update EXTRAVERSION in the Makefile by adding our _kerrev
    _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
    # (just in case the Makefile changed during a patch)
    pkgver=$kerver$(echo $_kerrev || sed -e 's/-/./g')
    pkgdesc="Custom Linux Kernel and modules version: $kerver revision: $_kerrev / package ver:
$pkgver build: $pkgrel"

    # changing the package name
    # removing patches versions from the revision string
    ''t=$(echo $''kerrev || sed -e "s/^..[[0-9]]*//g")
    # ''t=$(echo $''t || sed -e "s/^-rc[[0-9]]?*//g")
    # _suf contains the suffix identifying the kernel (it has the versions removed from it)
    ''suf=$(echo $''t || sed -e "s/[[0-9]]*-/-/g")
    pkgname=kernel26$_suf

    echo "Package name: $pkgname"
    echo "Package  ver: $pkgver"
    echo "Package desc: $pkgdesc"
    sleep 5

    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$_suf
    cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26$_suf

    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$_suf
    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)
  }



I then ran makepkg in this directory, and get the following error:

[root@teardrop kernel26-custom]# makepkg
./PKGBUILD: line 8: Linux: command not found
./PKGBUILD: line 77: syntax error near unexpected token `|'
./PKGBUILD: line 77: `    make clean bzImage modules ||| return 1'
==> Making package: kernel26 2.6.12-1 (Mon Sep  5 11:09:03 BST 2005)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
==>     Using local copy of linux-2.6.12.tar.bz2
==> WARNING: MD5sums are missing or incomplete.  Cannot verify source integrity.
==> Extracting Sources...
==>     tar --use-compress-program=bzip2 -xf linux-2.6.12.tar.bz2
==> Starting build()...
/usr/bin/makepkg: line 560: build: command not found
==> ERROR: Build Failed.  Aborting...

I've tried doing things slightly differently about 4 times now, and nothing's changed; plus searches in these forums haven't turned up anything useful, sadly, and neither has a lengthy google search.

I'd be grateful for help; if I can get past this stage, I know there's a patch for the kernel I'm trying to compile (2.6.12, as you've seen in PKGBUILD) to get emu10k1 soundcards to work, so hopefully everything can be sorted...

Thanks for your time.

Offline

#2 2005-09-05 10:27:59

kth5
Member
Registered: 2004-04-29
Posts: 657
Website

Re: kernel compilation via ABS: line 560 error

if build isn't found it most probbaly is some syntax problem within build(). at a first glance i can tell you shouldn't escape all quotes no matter what.

echo "Package name: $pkgname"

should be:

echo "Package name: $pkgname"

or

echo "Package name: ${pkgname}"

I recognize that while theory and practice are, in theory, the same, they are, in practice, different. -Mark Mitchell

Offline

#3 2005-09-05 10:35:49

mr_brightside
Member
Registered: 2005-09-01
Posts: 78

Re: kernel compilation via ABS: line 560 error

Thanks for the reply kth5.

I made the changes you suggested; the PKGBUILD now reads as follows:



pkgver=2.6.12
  pkgrel=1
  pkgdesc="Custom Linux Kernel and modules"
  url="http://www.kernel.org"
  depends=('module-init-tools')
  ###### Add a default config file and any patches to be applied to source array
  source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2)
  ###### Add md5 checksums here:
  #md5sums=()

  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 #model

    #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
    ###### Use first option for config in source array
    #yes "" || make config
    #make oldconfig ||| return 1
    #make menuconfig
    make xconfig
    #make gconfig

    ##### No user changes below here
    # save the configuration with today's date
    cp ./.config ../../NEWCONFIG-$(date +%b%d)

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

    # update EXTRAVERSION in the Makefile by adding our _kerrev
    _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
    # (just in case the Makefile changed during a patch)
    pkgver=$kerver$(echo $_kerrev || sed -e 's/-/./g')
    pkgdesc="Custom Linux Kernel and modules version: $kerver revision: $_kerrev / package ver:
$pkgver build: $pkgrel"

    # changing the package name
    # removing patches versions from the revision string
    ''t=$(echo $''kerrev || sed -e "s/^..[[0-9]]*//g")
    # ''t=$(echo $''t || sed -e "s/^-rc[[0-9]]?*//g")
    # _suf contains the suffix identifying the kernel (it has the versions removed from it)
    ''suf=$(echo $''t || sed -e "s/[[0-9]]*-/-/g")
    pkgname=kernel26$_suf

    echo "Package name: $pkgname"
    echo "Package  ver: $pkgver"
    echo "Package desc: $pkgdesc"
    sleep 5

    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$_suf
    cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26$_suf

    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$_suf
    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)
  }



Sadly, I get exactly the same error message.

I've tried looking at the script myself, but since I've only done basic scripts myself, I don't know what half of it means.

Offline

#4 2005-09-05 10:42:24

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

Re: kernel compilation via ABS: line 560 error

Which wiki document did you use? This version of the kernel PKGBUILD is highly deprecated - I think you may have better results if you try this one:

http://wiki.archlinux.org/index.php/Cus … n_with_ABS

Offline

#5 2005-09-05 10:45:33

mr_brightside
Member
Registered: 2005-09-01
Posts: 78

Re: kernel compilation via ABS: line 560 error

Thanks a lot dtw, I'll give it a go  smile

I was using the one at

http://wiki.archlinux.org/index.php/Ker … Earlier%29

... I know it says '2.6.8 or earlier', but I thought it would still be applicable.. I guess not.

I'll post when I've tried the other wiki document, and seen whether or not I have more success.

Offline

#6 2005-09-05 10:50:06

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: kernel compilation via ABS: line 560 error

I have no idea what is going on with this PKGBUILD and all the escape characters. It appears they are what causing the errors.

Get rid of them (the 's) in this:

 pkgdesc="Custom Linux Kernel and modules"
url="http://www.kernel.org"  
make clean bzImage modules ||| return 1 

lol and that....

Offline

#7 2005-09-05 10:53:30

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

Re: kernel compilation via ABS: line 560 error

Dude, why on earth would it be applicable if it specifically says for 2.6.8 and earlier? lol

I have now updated the doc you tried to use to warn people and direct them to the new doc

Offline

#8 2005-09-05 10:54:28

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

Re: kernel compilation via ABS: line 560 error

Yeah, good spot penguin - that old PKGBUILD got screwed up in the wiki migration!  Volunteers to fix it?

Dave, the new one is still the better one tho big_smile

Offline

#9 2005-09-05 11:05:15

mr_brightside
Member
Registered: 2005-09-01
Posts: 78

Re: kernel compilation via ABS: line 560 error

okie dokie.

Offline

#10 2005-09-05 11:34:54

mr_brightside
Member
Registered: 2005-09-01
Posts: 78

Re: kernel compilation via ABS: line 560 error

You total legends, the other (correct!) PKGBUILD worked like a charm. Your guide is excellent btw, dtw.

A couple of comments and queries about the guide: firstly, should it not be mentioned that your .config has to be in the build directory as 'config'? Maybe an indication that it can be copied from /usr/src/kernel-.... would be helpful for newbies?

Also, where you have the 'make oldconfig' option in the PKGBUILD; what happens if you use that? Is the reason you haven't done as I suggested above because using this make method will automatically use your current, booted kernel .config?

Offline

#11 2005-09-05 11:44:12

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

Re: kernel compilation via ABS: line 560 error

mr_brightside wrote:

A couple of comments and queries about the guide: firstly, should it not be mentioned that your .config has to be in the build directory as 'config'? Maybe an indication that it can be copied from /usr/src/kernel-.... would be helpful for newbies?

As I recall the config, and where to get one, is discussed quite extensively, maybe you missed that bit?

mr_brightside wrote:

Also, where you have the 'make oldconfig' option in the PKGBUILD; what happens if you use that? Is the reason you haven't done as I suggested above because using this make method will automatically use your current, booted kernel .config?

I dunno to be honest - I do know that they are all the config options and so people can choose the one that suits them - that's kind of where my concern ends I'm afraid....but feel free to add a decription of what each config option does to the wiki - if you can be bothered to do the research big_smile

Offline

#12 2005-09-05 11:59:30

mr_brightside
Member
Registered: 2005-09-01
Posts: 78

Re: kernel compilation via ABS: line 560 error

dibblethewrecker wrote:

....but feel free to add a decription of what each config option does to the wiki - if you can be bothered to do the research big_smile

lol, will do  wink

Offline

Board footer

Powered by FluxBB