On Wed, 2008-07-23 at 17:41 -0700, Roland McGrath wrote:
So let's structure things around that: the kernel build for an
arch that
uses vdso might include a kernelcap.conf file (or might not).
For simplicity and consistency in the .spec file, we'll install a file for
all variants even when it's an empty placeholder. For the magic, the diff
below probably covers it (wholly untested). Then it's up to BuildKernel
just to add/remove ldconfig-kernelcap.conf as part of the build (perhaps
eventually done by the upstream makefiles).
The .conf files have to not conflict (reuse same bit with different name)
across all installed kernels (or else ldconfig will complain). So a single
kernel-%{KVERREL}.conf file would be fine. But instead I made it
kernel-%{KVERREL}.variant.conf just to stay consistent with all existing
names like /lib/module/FOO and the fact that no two kernel rpms conflict on
the same file name (even if identical).
All sounds fairly reasonable to me, but why not have "make vdso_install"
install the file?
Looking at your patch, if you're going have a file per-variant, you need
to install it in BuildKernel. And you also only want to do it on
vdso_arches.
Another wholly untested patch below :)
Cheers,
Mark.
Index: devel/kernel.spec
===================================================================
--- devel.orig/kernel.spec 2008-07-24 08:49:22.000000000 +0100
+++ devel.orig/kernel.spec 2008-07-24 08:49:22.000000000 +0100
@@ -1312,6 +1312,13 @@ BuildKernel() {
make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install
KERNELRELEASE=$KernelVer mod-fw=
%ifarch %{vdso_arches}
make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install
KERNELRELEASE=$KernelVer
+ if [ ! -s ldconfig-kernelcap.conf ]; then
+ echo > ldconfig-kernelcap.conf "\
+# Placeholder file, no vDSO hwcap entries used in this kernel."
+ fi
+
+ %{__install} -D -m 444 ldconfig-kernelcap.conf \
+ $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf
%endif
# And save the headers/makefiles etc for building modules against
@@ -1509,22 +1516,6 @@ BuildKernel vmlinux vmlinux kdump vmlinu
cd linux-%{kversion}.%{_target_cpu}
-%if %{includexen}
-%if %{with_xen}
-mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
-rm -f $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf
-cat > $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf <<\EOF
-# This directive teaches ldconfig to search in nosegneg subdirectories
-# and cache the DSOs there with extra bit 0 set in their hwcap match
-# fields. In Xen guest kernels, the vDSO tells the dynamic linker to
-# search in nosegneg subdirectories and to match this extra hwcap bit
-# in the ld.so.cache file.
-hwcap 0 nosegneg
-EOF
-chmod 444 $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf
-%endif
-%endif
-
%if %{with_doc}
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/kernel-doc-%{kversion}/Documentation
@@ -1728,6 +1719,7 @@ fi
/lib/modules/%{KVERREL}%{?2:.%{2}}/weak-updates\
%ifarch %{vdso_arches}\
/lib/modules/%{KVERREL}%{?2:.%{2}}/vdso\
+/etc/ld.so.conf.d/kernelcap-%{KVERREL}%{?2:.%{2}}.conf\
%endif\
/lib/modules/%{KVERREL}%{?2:.%{2}}/modules.block\
/lib/modules/%{KVERREL}%{?2:.%{2}}/modules.networking\