You are not logged in.

#1 2004-10-08 20:10:46

crobot
Member
Registered: 2004-10-08
Posts: 25

SOLVED /usr/bin/makepkg: line 552: build: command not found

I'm trying to build a custom kernel, but am receiving this error:

/usr/bin/makepkg: line 552: build: command not found

I've searched all over for a fix, but haven't had any luck, it doesn't seem to be a common error, or it's so incredibly easy to fix that noone has bothered  lol

Thanks for any help.

/crobot

Offline

#2 2004-10-08 20:15:02

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

Re: SOLVED /usr/bin/makepkg: line 552: build: command not found

Post the PKGBUILD that's failing on.

It sounds like the build() function is not defined or not properly defined in the PKGBUILD.

Dusty

Offline

#3 2004-10-08 20:21:46

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: SOLVED /usr/bin/makepkg: line 552: build: command not found

that happens when:
a) you just flat out dont have a build function
b) you didn't close some quotes or parenthesis in the script above build()

most likely it's (b) - I'm assuming you added some patches or source to the source array and the parenthesis are not closed...

Offline

#4 2004-10-08 20:24:37

crobot
Member
Registered: 2004-10-08
Posts: 25

Re: SOLVED /usr/bin/makepkg: line 552: build: command not found

Thanks for your response, it has failed on two builds, i'll post both.

Here's the first:

# $Id: PKGBUILD,v 1.26 2004/10/06 18:21:54 judd Exp $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=kernel26
pkgver=2.6.8.1
pkgrel=3
pkgdesc="The Linux Kernel and modules (IDE support)"
url="http://www.kernel.org"
backup=('boot/kconfig26')
depends=('module-init-tools')
install=kernel26.install
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2 
  config cdburning.patch logo_linux_clut224.ppm 
  bio_uncopy_user-mem-leak.patch bio_uncopy_user-mem-leak-fix.patch 
  http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/26-stable-release/acpi-20040715-2.6.8.diff.bz2)
md5sums=('9517ca999e822b898fbdc7e72796b1aa' '20ad5bea85099dfcced9a6b91064b04e'
         '66b87662e6dd54b6324f874739fa1b99' '5a62bcc7e96601052c7405459b483826'
         'd2329bc663089cd99b8dbfd25b6a7ebc' '15a9165ae02c4a3a3875fb7924a68cbf'
         'e00d08709581f215b15e321d162f782c')

build() {
  cd $startdir/src/linux-$pkgver
  patch -Np1 -i ../bio_uncopy_user-mem-leak.patch || return 1
  patch -Np1 -i ../bio_uncopy_user-mem-leak-fix.patch || return 1
  patch -Np1 -i ../cdburning.patch || return 1
  #patch -Np1 -i ../acpi-20040715-2.6.8.diff || return 1
  # Arch logo!
  cp ../logo_linux_clut224.ppm drivers/video/logo/
  # get rid of the 'i' in i686
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config
  yes "" | make config
  make clean 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/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26
  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
  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
  cd $startdir/pkg/lib/modules/$pkgver && 
    (rm -f source build; ln -sf /usr/src/linux-$pkgver build)
}

Here's the second:

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

###### Choose generic name, version, and release. updated later for $_kerrev
pkgname=kernel26
pkgver=2.6.8.1
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:
#md5sum=()

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

Thanks,

/crobot

Offline

#5 2004-10-08 20:28:44

crobot
Member
Registered: 2004-10-08
Posts: 25

Re: SOLVED /usr/bin/makepkg: line 552: build: command not found

phrakture wrote:

that happens when:
a) you just flat out dont have a build function
b) you didn't close some quotes or parenthesis in the script above build()

It's possible i don't have a build function, i only installed arch yesterday, from the beta minimal disk, when i last installed via the stable disk i didn't come across this problem, but then i didn't use abs for the kernel, i just used the vanilla sources and compiled manually.

I haven't edited the script at all yet, i'm performing a dry run before adding patches etc.

/crobot

Offline

#6 2004-10-08 22:51:16

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: SOLVED /usr/bin/makepkg: line 552: build: command not found

hmmm
did you rename them?
in order for makepkg to work they need to stay named "PKGBUILD"

also, did you set any funny permissions on them? the PKGBUILD is "source"ed from makepkg, so check the permissions....

if you have the stock file and it's failing then its something you did beforehand....

make sure to run "abs" once to update the PKGBUILDs....

Offline

#7 2004-10-08 23:18:13

crobot
Member
Registered: 2004-10-08
Posts: 25

Re: SOLVED /usr/bin/makepkg: line 552: build: command not found

ls -l /var/abs/kernels/kernel26 | grep P
-rw-r--r--  1 root root   2902 Oct  6 19:21 PKGBUILD

That should answer your first two questions (i'm running makepkg as root), and yes i have run abs.

There are two things i have changed, the first was to replace the config file in the above mentioned dir. Secondly i've disabled the md5 checks, asides from that i don't believe i've changed anything else. Maybe i could try flushing the abs dir and running abs again, to get a fresh tree, i'll give that a go. Okay, that has resolved it, i must have done something else, i wish i knew what! Maybe it was the config file. Unfortunately now i've lost one or two other builds, i should have backed them up! roll

Thanks for your help, i'll change the status of this post to fixed.

/crobot

Offline

Board footer

Powered by FluxBB