You are not logged in.

#1 2010-05-09 20:05:50

iosonofabio
Member
From: Australia
Registered: 2008-10-09
Posts: 105

[SOLVED] kernel26 one-line customization

Hi all!

I'm trying to build a custom kernel in order to include the tp_smapi version of the HDAPS module for IBM/Lenovo Thinkpads. According to the bug report:

http://bugs.archlinux.org/task/12384 ,

a one-line modification of the kernel26 PKGBUILD should be sufficient to get a custom kernel image, together with the modules etc. However, I can't understand how this exactly works, and the wiki pages are not up-to-date. I did the following:

1. get the package kernel26 from ABS
2. modify line 5, commenting out

pkgname=kernel26-custom

3. run makepkg.

I get the following error (translated approximately from italian):

 ERROR: lacking package function to separate package 'kernel26-custom'

What is wrong? And what the correct procedure?

Thanks, cheers,
Fabio

Last edited by iosonofabio (2010-05-09 22:56:20)

Offline

#2 2010-05-09 20:21:02

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: [SOLVED] kernel26 one-line customization

You have to set the package function names according to your kernel name.

package_kernel26-own() {
  pkgdesc="The Linux Kernel and modules"
  groups=('base')
...}

package_kernel26-own-headers() {
  pkgdesc="Header files and scripts for building modules for kernel26"
  mkdir -p ${pkgdir}/lib/modules/${_kernver}
..
}

Personally I would not split the package, so I would merge all three package functions into one:

package() {
  KARCH=x86
  cd ${srcdir}/linux-$_basekernel
  # get kernel version
  _kernver="$(make kernelrelease)"
  mkdir -p ${pkgdir}/{lib/modules,boot}
  make INSTALL_MOD_PATH=${pkgdir} modules_install || return 1
  cp System.map ${pkgdir}/boot/System.map26${_kernelname}
  cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname}
  #  # add vmlinux
  install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
....
# then the headers part
  mkdir -p ${pkgdir}/lib/modules/${_kernver}
  cd ${pkgdir}/lib/modules/${_kernver}
  ln -sf ../../../usr/src/linux-${_kernver} build
  cd ${srcdir}/linux-$_basekernel
  install -D -m644 Makefile \
    ${pkgdir}/usr/src/linux-${_kernver}/Makefile
....

# then the firmware part
  cd ${srcdir}/linux-$_basekernel
  make firmware || return 1
  make INSTALL_MOD_PATH=${pkgdir} firmware_install || return 1
...
}

PS: As you see, you have to remove the global variables (not the ones starting with an underscore like "_kernver") inside the package() function.

Last edited by DonVla (2010-05-09 20:26:22)

Offline

#3 2010-05-09 22:56:02

iosonofabio
Member
From: Australia
Registered: 2008-10-09
Posts: 105

Re: [SOLVED] kernel26 one-line customization

Thanks, as I suspected. Now, adapting the function for kernel26 to my kernel26-custom, I get a working kernel.

I still have to figure out how to substitute a module (HDAPS) into the kernel, and the X server is not working under the new kernel, but these are different issues.

I'll write a line on the wiki about this.

Offline

#4 2010-05-09 23:43:34

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: [SOLVED] kernel26 one-line customization

iosonofabio wrote:

I still have to figure out how to substitute a module (HDAPS) into the kernel...

What do you mean by substitute?
Most of the time you don´t have to recompile the kernel to build a module.
You just need the headers and compile the module itself against the running kernel.
I guess the module has a readme which explains the build steps.

Offline

#5 2010-05-10 07:53:38

iosonofabio
Member
From: Australia
Registered: 2008-10-09
Posts: 105

Re: [SOLVED] kernel26 one-line customization

Well, I'm a beginner in this field.

The kernel implements a module called HDAPS for controlling the accelerometer of my laptop. This works, but does not support all functions. So, there is another version of HDAPS out in the wild, which ships along with the package (module) TP_SMAPI.

The ArchWiki has an article about this, and suggests the following procedure:

Attempting to add hdaps to your MODULES array will result in the default drivers being loaded. This is not what we want, as we have our special ThinkPad HDAPS drivers. Instead, modify your /etc/rc.local to include the following line: insmod /lib/modules/$(uname -r)/extra/hdaps.ko

I would like to simply add the string 'hdaps' to my rc.conf to keep the KISS idea. For this I add the TP_SMAPI and the modified HDAPS modules to my custom kernel, in order to override the standard HDAPS module.

If you have any suggestion, it is appreciated :-)

Offline

Board footer

Powered by FluxBB