[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Issue on UTS_RELEASE after compiling custom kernel



On martedì 9 ottobre 2007, Thiemo Seufer wrote:
> Federico Giacomini wrote:
> > Hello,
> > I need to build the kernel-image and headers .deb packages for a embedded system equipped with Debian etch.
> > As the embedded processor is not much powerful (P III) and is too busy with several other tasks, I have to compile the kernel source (vanilla 2.6.20 patched with RTAI) on a PC running Kubuntu feisty.
> > I made the packages with the usual command:
> > 
> > fakeroot make-kpkg --revision=0.1 --append-to-version=-rtai kernel_image kernel_headers
> > 
> > The kernel .deb package could be successfully installed on the Debian system, but when I tried to install the kernel_headers package, the following error occurred:
> > 
> > dpkg: dependency problems prevent configuration of linux-headers-2.6.20-rtai:
> >  linux-headers-2.6.20-rtai depends on libc6 (>= 2.5-0ubuntu1); however:
> >   Version of libc6 on system is 2.3.6.ds1-13etch2.
> > dpkg: error processing linux-headers-2.6.20-rtai (--install):
> >  dependency problems - leaving unconfigured
> > Errors were encountered while processing:
> >  linux-headers-2.6.20-rtai
> > 
> > My question is: how can I correctly make a cross-system (Ubuntu/Debian) kernel compilation/installation?
> > Any help will be highly appreciated!
> 
> Build inside an etch chroot.
> 
> 
> Thiemo
> 

So, after creating the etch environment with debootstrap, I downloaded the 2.6.20 vanilla kernel and applied the proper RTAI patch.
In the chroot jail on the host I built all packages to be installed on the Debian target machine, including source:

# cd /usr/src/linux-source-2.6.20
# make menuconfig
# fakeroot make-kpkg --append-to-version=-rtai --revision=0.5 buildpackage

Then, after uploading the .deb packages on the target:

debian01:~# cd /usr/src
debian01:/usr/src# dpkg -i linux-image-2.6.20-rtai_0.5_i386.deb
debian01:/usr/src# dpkg -i linux-source-2.6.20-rtai_0.5_all.deb
debian01:/usr/src# tar xjvf linux-source-2.6.20-rtai.tar.bz2
debian01:/usr/src# rm linux
debian01:/usr/src# ln -s linux-source-2.6.20-rtai linux
debian01:/usr/src# dpkg -i linux-headers-2.6.20-rtai_0.5_i386.deb
debian01:/usr/src# reboot

After rebooting and selecting the new kernel in the grub menu:

debian01:~# ln -s /usr/src/linux-source-2.6.20-rtai /lib/modules/2.6.20-rtai/build
debian01:~# cd /usr/src/linux-source-2.6.20-rtai
debian01:/usr/src/linux-source-2.6.20-rtai# cp /boot/config-2.6.20-rtai ./.config
debian01:/usr/src/linux-source-2.6.20-rtai# make oldconfig
debian01:/usr/src/linux-source-2.6.20-rtai# make prepare
debian01:/usr/src/linux-source-2.6.20-rtai# make prepare scripts

The steps above are required in order to be able to compile any external module. Namely, the 'madwifi' driver has to be built on the target machine. Source directory is: /usr/src/madwifi-0.9.3.2

debian01:/usr/src/linux-source-2.6.20-rtai# cd ../madwifi-0.9.3.2
debian01:/usr/src/madwifi-0.9.3.2# make
[...]

Apparently, the module is successfully compiled, but there comes the issue:

debian01:/usr/src/madwifi-0.9.3.2# insmod ath/ath_pci.ko
ath_pci: version magic '2.6.20 preempt mod_unload PENTIUMIII ' should be '2.6.20-rtai preempt mod_unload PENTIUMIII '
insmod: error inserting 'ath_pci.ko': -1 Invalid module format
debian01:/usr/src/madwifi-0.9.3.2# uname -r
2.6.20-rtai
debian01:/usr/src/madwifi-0.9.3.2# cat /usr/src/linux-source-2.6.20-rtai/include/linux/utsrelease.h
#define UTS_RELEASE "2.6.20"

I would expect the command 'make prepare' to set the value equal to "2.6.20-rtai", so why is the string trimmed?
Actually I could only work around it by manually edit the file "utsrelease.h" and set the macro to the full string, but I wonder if there is any cleaner way to configure and prepare properly the kernel sources.
Any advise will be welcome.



Reply to: