[LinuxPPS] task force
Hal V. Engel
hvengel at astound.net
Tue Feb 3 00:29:26 CET 2009
On Monday 02 February 2009 10:26:24 am Udo van den Heuvel wrote:
> Hal V. Engel wrote:
> > On Monday 02 February 2009 08:23:30 am Udo van den Heuvel wrote:
> >> Udo van den Heuvel wrote:
> >>> For userland I had to do this:
> >>>
> >>> cd /usr/include
> >>> mv linux linux.old
> >>> mv asm asm.old
> >>> mv asm-generic asm-generic.old
> >>> ln -s /lib/modules/$(uname -r)/build/include/linux linux
> >>> ln -s /lib/modules/$(uname -r)/build/arch/x86/include/asm asm
> >>> ln -s /lib/modules/$(uname -r)/build/include/asm-generic asm-generic
> >>> cp /lib/modules/$(uname -r)/build/Documentation/pps/timepps.h timepps.h
> >
> > Shouldn't the kernel header files for the kernel you are patching and
> > installing be installed in the normal way rather than using these links?
>
> Could be that the headers in the kernel are different from the ones in
> /usr/include/* ?
> I am on Fedora and found that at least for serial.h there are
> differences. See my other post about that.
Distros using patched kernel headers is an issue and it is a fairly common
one. In addition some distros do strange things like having links from dummy
kernel headers to distro specific ones. Basically what I am saying is that
rather than using the links to the directories that those files should
actually be installed in a way that makes them work for everything on the
machine.
To avoid using the links to the header files directories, which is a hack, you
need to patch a distro supplied kernel so that the header files match a linux
headers package from the distro or if that is not possible you need to
actually install the correct header files for the kernel you are using in a
distro specific way. This of course is the issue since what a gentoo user
would do to get these headers correct is different from what a Fedora user
needs to do. In other words this appears to be distro specific which means
that it is not possible to have a single simple method for this that works for
everyone and this makes documenting this part of the process difficult.
The reason I say that the directory links is a hack is that I have run
problems building other packages using the linked kernel headers. This may
not be a significant issue on a binary package distro like SuSE or Fedora but
it is on a source based distro like Gentoo. I ran into this on my gentoo
machine since it also has some header files that are patched or that are
different in some way from the vanilla kernel headers. I found that the
distro had made changes to the way the headers directories were structured
with earlier kernels (IE. before 2.6.26) that caused builds to fail when using
the links (newer linux-headers are now more generic). Since gentoo is a
source based distro this basically caused enough gentoo packages to fail that
it was a significant problem for me.
> I am no expert in this area but do know that the kernel and other header
> files are different.
> Anyone more knowledgeable may of course explain how the LinuxPPS
> situation is and how stuff should change to a more normalised situation.
>
> > I
> > have found that using the links to the linux, asm-generic and asm
> > directories is only needed if the installed version of the kernel header
> > files in not current with the kernel you are patching/installing.
>
> Mine are only a tiny bit behind.
> Kernel is 2.6.28.2. And we have kernel-headers-2.6.27.12-170.2.5.fc10.i386
On my distro I have linux-headers available for versions 2.6.23-r3, 2.6.27-r2,
2.6.28 and 2.6.28-r1. In some cases there are not any changes to the kernel
headers between kernel versions but based on the gentoo package repository it
appears that the 2.6.27... kernel headers package is probably not correct for
the newest kernel (version 2.6.28.2) you have available from your distro.
I ran into this same issue with Gentoo since at times the newer kernels that
were available in portage were out of sync with the linux-headers packages and
newer versions of the linux-headers needed to be available for this to work
correctly. This was a big issue for 2.6.26 since it was perhaps a month after
gentoo-sources-2.6.26 was in portage before linux-headers-2.6.26 was in the
tree. And there is an additional complication for most users on most distros
in that the available kernels will tend to be well behind where the LinuxPPS
work is being done. This may force users to use a hack like using links for
the header files directories if they can't figure out how to get the correct
headers installed using some distro specific process.
>
> (....)
>
> > In other words if you have the correct version of the kernel header files
> > installed you only need links to or copies of the two missing pps
> > specific header files. I have been using this on my own machine now for
> > some time and I also used this on another machine which I helped setup
> > and it works nicely on both machines.
>
> Can anybody explain what should and shouldn't work on a recent and up to
> date distro?
What I do on my gentoo machine is decide what gentoo supplied kernel I am
using as my base kernel. Unlike some distros I can pick from a wide range of
kernels including recent git versions of the kernel. For example there are
packages for git-sources-2.6.29_rc3-r2 and also vanilla-sources-2.6.29_rc3
available although the newest header file package is linux-headers-2.6.28-r1
(are there changes to the kernel header files between 2.6.28 and 2.6.29?).
This is considerably newer than any of the available LinuxPPS patch sets*.
For the selected kernel I download (emerge) the sources then patch the kernel
source tree and it builds I then install the correct linux-headers package for
the kernel I am using if it has not already been installed. Then all I have
to do is to create the links to pps.h and timepps.h to build and install the
userland tools and ntp (ignoring the glibc timex.h issue for now).
I recently helped someone who was running SuSE 11.1 which uses kernel version
2.6.27. What he did was to install the source rpm of the distros kernel
package. He then patched the kernel using ntp-pps-2.6.27-rc3.diff and built
a new binary kernel RPM and installed it. This is the SuSE way of doing this
(see http://www.howtoforge.com/kernel_compilation_suse). This automatically
installed the correct header files for the kernel and at that point all that
was needed was to create the links to the missing pps specific headers and he
was able to build the user land tools and ntp (after fixing the timex.h file).
The problem is that there is likely a Fedora way, a Debian way, a Red Hat
way... and documenting these in the LinuxPPS docs should not be done. Rather
what this should do is to let people know that they should research how this
should be handled for their distro. After all no one seriously contemplating
using these patches is a novice Linux user who can't figure out some of this
stuff themselves if the LinuxPPS docs contain some hints on what needs to be
done.
The "best" way to solve this issue is to get this into the kernel tree.
Unfortunately this is unlikely to happen anytime soon as it looks like it
might not make it into 2.6.29.
* I notice that the last patch set is for 2.6.28-rc6 and was put up on the web
site on Jan. 30. Shouldn't this patch be against 2.6.28 or perhaps 2.6.29_rcX
rather than a pre-release 2.6.28 kernel?
Hal
More information about the LinuxPPS
mailing list