You are not logged in.

#1 2007-08-27 21:46:27

Flasher
Member
From: Bavaria / Germany
Registered: 2005-04-24
Posts: 126

Custom Kernel compilation under Arch64

Hello,

I want to build a custom kernel for my new Arch64 installation. I also have a server-system running under archlinux with a 32 bit architecture. Because of that, I compiled some kernels in the past for this system with the following wiki-howto:

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

I used the kernel.install and PKGBUILD scripts for the server.

Now the Problem hmm

For my new Arch64 system these scripts don't work correctly because they are written for the i386 architecture.
Unfortunately I don't know what I have to change in the PKGBUILD and kernel.install scripts. Only change "i386" to "x86_64" ?

Are there any kernel.install and PKGBUILD scripts for Arch64 kernel compilation?

Thanks for your answers!

Greetings,

Flasher

Offline

#2 2007-08-27 22:20:10

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Custom Kernel compilation under Arch64

Use the kernel26 PKGBUILD etc as a template, and modify your custom PKGBUILD accordingly.

Offline

#3 2007-08-28 08:04:34

Flasher
Member
From: Bavaria / Germany
Registered: 2005-04-24
Posts: 126

Re: Custom Kernel compilation under Arch64

Hi!

The kernel26 PKGBUILD is completely differnt, so I tryed to modify my i386 PKGBUILD. Only one problem left:

I don't know how to change these script in my PKGBUILD:

  # get rid of the 'i' in i686
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config

Any ideas? I haven't much experience in linux shell scripting :-/

Greetings,

Flasher

Offline

#4 2007-08-28 09:08:46

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Custom Kernel compilation under Arch64

Of course it's different - i suggested it so you could create a merge of both PKGBUILDs.

Have another look at the kernel26 PKGBUILD and you will see that the lines you have quoted above are no longer used. Just delete them.

Offline

#5 2007-08-28 11:54:40

Flasher
Member
From: Bavaria / Germany
Registered: 2005-04-24
Posts: 126

Re: Custom Kernel compilation under Arch64

Ok, thanks for your answers, but I know you made me curious wink

A more general question:

In the past I always used the PKGBUILD from the wiki:

# Contributor: 
pkgname=kernel26225
pkgver=2.6.22.5
pkgrel=1
pkgdesc="The Linux Kernel 2.6.22.5 for xxx"
arch=(x86_64)
url="http://www.kernel.org"
license=('GPL')
depends=('module-init-tools')
install=kernel26.install
source=(config ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2)
md5sums=('bb144fe723324722452807f3cd8afe92'
         'f36616d74f2fde72040bccf50db03522')
     
# Function to grab var from src

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

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

  ##### Uncomment and apply any patches here

  # get rid of the 'i' in i686
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config

  ##### Load config - uncomment your preferred config method
  #yes "" | make config
  #make oldconfig || return 1
  #make menuconfig
  #make xconfig
  #make gconfig

  ##### NO USER CHANGES BELOW HERE #####

  # save the current pkgname
  old_pkgname=$pkgname

  # set pkgname for build purposes - DO NOT alter!
  pkgname=kernel26

  # save the updated config to build with today's date
  cp ./.config $startdir/config-$(date +%b%d\-%Hh)

  # get EXTRAVERSION from Makefile to create a unique pkgname and /usr/src directory
  _kernextra=$(getvar "EXTRAVERSION")
  # grab the 2.6.x.y version suffix from pkgver
  _y="`echo $pkgver | cut --delim "." --fields 4`"
  # remove .y version suffix from _kernextra
  _kernextra="`echo $_kernextra | sed "s|\.$_y||g"`"

  # Read the full kernel version info from new config to use in pathnames and pkgname
  . ./.config

  # Kernel custom - to create a unique pkgname (see below)
  _kerncust="${_kernextra}${CONFIG_LOCALVERSION}"
  # Kernel release - will be the same as Makefile
  _kernrel="${pkgver}${_kerncust}"
  # Get the pkgver suffix for unique pkgname and /boot file suffices
  _pkgversuf="`echo $pkgver | sed "s|2.6.||g" | sed "s|\.||g"`"
  # Set /boot file suffices from kernel release and pkgver suffix
  _kernboot="${_pkgversuf}${_kerncust}"

  # Set a new pkgname from  kernel release and pkgver suffix
  pkgname="${pkgname}${_pkgversuf}${_kerncust}"

  # build!
  echo
  echo -n "Do you want to make clean (default YES)? (YES/NO): "
  read choice
  echo
  echo -n "Press any key to start make or CTRL+C to quit"
  read anykey

  if [ "${choice}" = "NO" ] ; then
        make bzImage modules || return 1
  else
        make clean bzImage modules || return 1
  fi

  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${_kernboot}
  cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26${_kernboot}
  install -D -m644 Makefile \
    $startdir/pkg/usr/src/linux-${_kernrel}/Makefile
  install -D -m644 kernel/Makefile \
    $startdir/pkg/usr/src/linux-${_kernrel}/kernel/Makefile
  install -D -m644 .config \
    $startdir/pkg/usr/src/linux-${_kernrel}/.config
  install -D -m644 .kernelrelease \
    $startdir/pkg/usr/src/linux-${_kernrel}/.kernelrelease
  install -D -m644 .config $startdir/pkg/boot/kconfig26${_kernboot}
  mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/include
  mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/arch/i386/kernel
  for i in acpi asm-generic asm-i386 config linux math-emu media net pcmcia scsi sound video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-${_kernrel}/include/
  done
  # copy files necessary for later builds, like nvidia and vmware
  cp Module.symvers $startdir/pkg/usr/src/linux-${_kernrel}
  cp -a scripts $startdir/pkg/usr/src/linux-${_kernrel}
  mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/.tmp_versions
  cp arch/i386/Makefile $startdir/pkg/usr/src/linux-${_kernrel}/arch/i386/
  cp arch/i386/Makefile.cpu $startdir/pkg/usr/src/linux-${_kernrel}/arch/i386/
  cp arch/i386/kernel/asm-offsets.s \
    $startdir/pkg/usr/src/linux-${_kernrel}/arch/i386/kernel/
  # copy in Kconfig files
  for i in `find . -name "Kconfig*"`; do
    mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-${_kernrel}/$i
  done
  cd $startdir/pkg/usr/src/linux-${_kernrel}/include && ln -s asm-i386 asm
  chown -R root.root $startdir/pkg/usr/src/linux-${_kernrel}
  cd $startdir/pkg/lib/modules/${_kernrel} && \
    (rm -f source build; ln -sf /usr/src/linux-${_kernrel} build)

  # Correct the pkgname in our PKGBUILD - this allows correct gensync operation
  # NOTE: pkgname variable must be declared with first 10 lines of PKGBUILD!
  cd $startdir
  sed -i "1,11 s|pkgname=$old_pkgname|pkgname=$pkgname|" ./PKGBUILD
}
# vim:syntax=sh

But I always asked myself, if I could use the original PKGBUILD from kernel26 because the maintainer integrated some patches. Maybe these patches are usefull for my own kernel?

Up to now, I don't use the kernel26 script, because I don't need the mkinit-stuff. I suppose during the kernel compliation something will be done for the mkinit-"things" and because of that this PKGBUILD aren't appropriated for my own kernel! Correct?

Sorry, but the mkinit-things were always a black hole for me tongue

Can I use the original kernel26 PKGBUILD with some modifications for my own kernel?
- changing package name
- replace config with my own config

Have I something to do, to remove this mkinit-"things"?


Thanks for help and sorry for my terrible english wink

Greetings,

Flasher

Offline

#6 2007-08-28 12:16:45

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Custom Kernel compilation under Arch64

Many users choose to adapt the kernel26 PKGBUILD for their custom kernels. It would be up to you to research the patches applied there and decide if they are of use to you.

For most purposes, the default initramfs configuration is not required for custom kernels, as the boot-time requirements can be built in to the kernel. This is a config change, not a PKGBUILD change. In the PKGBUILD, the lines relating to mkinitcpio would then be superfluous. The default *.install file also does significant intiramfs-related work, which could also be removed.

Your english is fine, btw, particularly when compared to my German. smile

Offline

Board footer

Powered by FluxBB