You are not logged in.

#1 2007-02-25 14:16:03

cpu
Member
Registered: 2007-02-22
Posts: 68

Custom kernel - which way ?

Hi

I want to build my custom kernel based on kernel26-arch
I've read http://wiki.archlinux.org/index.php/Ker … n_with_ABS
And I tried to do this in this way:
mkdir /var/abs/local/kernel26
cp /var/abs/kernel/kernel26/* /var/abs/local/kernel26/
cd /var/abs/local/kernel26
nano PKGBUILD -> I've added some patches (fbsplash and vesa-tng) and changed to make menuconfig then ->
makepkg (everything fine I have menuconfig and I'm customizing my kernel)
kernel is build and placed in /home/packages

And here I'm starting getting some problems:
pacman -R nvidia kernel26 && pacman -A /home/packages/kernel26.pkg.tgz <- everytings fine (I've removed everything from MODULES in mkinitcpio.conf because I don't like modular kernel)
I can start new kernel but I can't build any modules on it - pacman -S nvidia shows no errors but when I modprobe nvidia I get msg about bad module format, I can't build fuse too hmm

How to solve this and which way is better - customize existing kernel or make my new ?

Offline

#2 2007-02-25 15:00:28

Pajaro
Member
Registered: 2004-04-21
Posts: 876

Re: Custom kernel - which way ?

the nvidia kernel module is build for a certain kernel. If you create you own kernel you need to rebuild the nvidia module.

I recommend you to instead of deleteing kernel26 and nvidia, create your own naming for kernel and nvidia, this way if you meess up you still have the stock kernel.

so create a package called kernel26-cpu and another called nvidia-cpu by changing its name in the PKGBUILD.

If you can't build modules you will have to post more information.

Offline

#3 2007-02-25 15:59:53

cpu
Member
Registered: 2007-02-22
Posts: 68

Re: Custom kernel - which way ?

Hmm but this is unclear for me - I've created kernel26-cpu in /var/abs/local and copied everything from /var/abs/kernels/kernel26 to my $startdir then I've edit PKGBUILD and put make menuconfig in right place but how to change name for this package ? (because when I build this and install this package I will have my stock kernel26 overwriten)

##EDIT##

OK this is my PKGBUILD

# Contributor: dibblethewrecker <dibblethewrecker.at.jiwe.org>
pkgname=kernel26201-CPU
pkgver=2.6.20.1
pkgrel=1
pkgdesc="The Linux Kernel 2.6.x.y and modules (IDE support)"
url="http://www.kernel.org"
depends=('module-init-tools')
install=kernel26.install

##### add any patch sources to this section
source=(config 
    ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2
    fbsplash-0.9.2-r5-2.6.20-rc6.patch
    coretemp.patch
    )

# 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

  # Create buildstats
  echo "Build started at `date +%c`" > $startdir/buildstats
  # end of buildstats part

  ##### Uncomment and apply any patches here
  #patch -Np1 -i ../patchname || return 1
  patch -Np1 -i ../fbsplash-0.9.2-r5-2.6.20-rc6.patch || return 1
  patch -Np1 -i ../coretemp.patch || return 1

  # 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}"

  # Add more build stats
  echo >> $startdir/buildstats
  echo "Package Info" >> $startdir/buildstats
  echo "  Package name: $pkgname" >> $startdir/buildstats
  echo "  Package  ver: $pkgver" >> $startdir/buildstats
  echo "  Package desc: $pkgdesc" >> $startdir/buildstats
  echo >> $startdir/buildstats
  echo "  Kernel EXTRAVERSION: $_kernextra" >> $startdir/buildstats
  echo "  Kernel LOCALVERSION: ${CONFIG_LOCALVERSION}" >> $startdir/buildstats
  echo "  Kernel RELEASE: $_kernrel" >> $startdir/buildstats
  # end of buildstats part

  # 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

  # Add more build stats  
  echo >> $startdir/buildstats
  echo "  Compile started at `date +%c`" >> $startdir/buildstats
  # end of buildstats part

  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 .config \
    $startdir/pkg/usr/src/linux-${_kernrel}/.config
  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 net pcmcia scsi 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/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)

  # Finalize build stats
  echo >> $startdir/buildstats
  echo "  Build finished at `date +%c`" >> $startdir/buildstats
  mv $startdir/buildstats $startdir/buildstats-$(date +%b%d\-%Hh)
  # end of buildstats part

  # 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

Should I modify kernel26.install too ?

Last edited by cpu (2007-02-25 18:23:33)

Offline

#4 2007-02-25 20:31:29

Pajaro
Member
Registered: 2004-04-21
Posts: 876

Re: Custom kernel - which way ?

You should adapt the whole process to match your custom needs.

also make sure that none of your files replace any already existing file.

You may find more information on how to crate a personalized kernel in the wiki: http://wiki.archlinux.org/

Offline

Board footer

Powered by FluxBB