diff --git a/kernel.spec b/kernel.spec index 768ec3d..d960d6f 100644 --- a/kernel.spec +++ b/kernel.spec @@ -32,6 +32,7 @@ %(chmod +x %_sourcedir/{guards,apply-patches,check-for-config-changes}) %define install_vdso 1 +%define debuginfodir /usr/lib/debug Name: kernel Summary: The Xen Kernel @@ -76,13 +77,8 @@ Source17: apply-patches Source33: check-for-config-changes Source100: config-%{build_flavor} # FIXME: Including dirs this way does NOT produce proper src.rpms -Source200: patches.arch -Source201: patches.drivers -Source202: patches.fixes -Source203: patches.rpmify -Source204: patches.suse +Source204: patches.rpmify Source205: patches.xen -Source207: patches.kernel.org Source300: patches.qubes Source301: u2mfn Source302: vm-initramfs @@ -162,6 +158,16 @@ find . ! -type d -printf '%%P\n' > %my_builddir/obj-files cd %kernel_build_dir +# This override tweaks the kernel makefiles so that we run debugedit on an +# object before embedding it. When we later run find-debuginfo.sh, it will +# run debugedit again. The edits it does change the build ID bits embedded +# in the stripped object, but repeating debugedit is a no-op. We do it +# beforehand to get the proper final build ID bits into the embedded image. +# This affects the vDSO images in vmlinux, and the vmlinux image in bzImage. +export AFTER_LINK=\ +'sh -xc "/usr/lib/rpm/debugedit -b $$RPM_BUILD_DIR -d /usr/src/debug \ + -i $@ > $@.id"' + make %{?_smp_mflags} all $MAKE_ARGS CONFIG_DEBUG_SECTION_MISMATCH=y # Build u2mfn module diff --git a/patches.rpmify/makefile-after_link.patch b/patches.rpmify/makefile-after_link.patch new file mode 100644 index 0000000..b520b19 --- /dev/null +++ b/patches.rpmify/makefile-after_link.patch @@ -0,0 +1,100 @@ +From b707aea6a4947c3806ced2c23e889943a0f36876 Mon Sep 17 00:00:00 2001 +From: Roland McGrath +Date: Mon, 6 Oct 2008 23:03:03 -0700 +Subject: [PATCH] kbuild: AFTER_LINK + +If the make variable AFTER_LINK is set, it is a command line to run +after each final link. This includes vmlinux itself and vDSO images. + +Signed-off-by: Roland McGrath + +diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile +index 9a7946c..28d6765 100644 +--- a/arch/powerpc/kernel/vdso32/Makefile ++++ b/arch/powerpc/kernel/vdso32/Makefile +@@ -41,7 +41,8 @@ $(obj-vdso32): %.o: %.S + + # actual build commands + quiet_cmd_vdso32ld = VDSO32L $@ +- cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $^ -o $@ ++ cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $^ -o $@ \ ++ $(if $(AFTER_LINK),; $(AFTER_LINK)) + quiet_cmd_vdso32as = VDSO32A $@ + cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $< + +diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile +index 8c500d8..d27737b 100644 +--- a/arch/powerpc/kernel/vdso64/Makefile ++++ b/arch/powerpc/kernel/vdso64/Makefile +@@ -36,7 +36,8 @@ $(obj-vdso64): %.o: %.S + + # actual build commands + quiet_cmd_vdso64ld = VDSO64L $@ +- cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ ++ cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ \ ++ $(if $(AFTER_LINK),; $(AFTER_LINK)) + quiet_cmd_vdso64as = VDSO64A $@ + cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< + +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index 8ad2b34..e153572 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -43,7 +43,8 @@ $(obj-vdso32): %.o: %.S + + # actual build commands + quiet_cmd_vdso32ld = VDSO32L $@ +- cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ ++ cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ \ ++ $(if $(AFTER_LINK),; $(AFTER_LINK)) + quiet_cmd_vdso32as = VDSO32A $@ + cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< + +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index 2a8ddfd..452ca53 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -43,7 +43,8 @@ $(obj-vdso64): %.o: %.S + + # actual build commands + quiet_cmd_vdso64ld = VDSO64L $@ +- cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ ++ cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ \ ++ $(if $(AFTER_LINK),; $(AFTER_LINK)) + quiet_cmd_vdso64as = VDSO64A $@ + cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< + +diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile +index fd14be1..1f3eb19 100644 +--- a/arch/x86/vdso/Makefile ++++ b/arch/x86/vdso/Makefile +@@ -178,8 +178,9 @@ $(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE + quiet_cmd_vdso = VDSO $@ + cmd_vdso = $(CC) -nostdlib -o $@ \ + $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ +- -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ +- sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' ++ -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) \ ++ $(if $(AFTER_LINK),; $(AFTER_LINK)) && \ ++ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' + + VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) + GCOV_PROFILE := n +diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh +index cd9c6c6..3edf048 100644 +--- a/scripts/link-vmlinux.sh ++++ b/scripts/link-vmlinux.sh +@@ -65,6 +65,10 @@ vmlinux_link() + -lutil ${1} + rm -f linux + fi ++ if [ -n "${AFTER_LINK}" ]; then ++ /usr/lib/rpm/debugedit -b ${RPM_BUILD_DIR} -d /usr/src/debug -i ${2} \ ++ > ${2}.id ++ fi + } + + +-- +1.7.7.6 + diff --git a/series-pvops.conf b/series-pvops.conf index f94f79a..02190e1 100644 --- a/series-pvops.conf +++ b/series-pvops.conf @@ -1,3 +1,5 @@ +patches.rpmify/makefile-after_link.patch + # fix for GPU performance (revert workaround and apply proper fix), should go in 3.5 patches.xen/pvops-3.4-Revert-xen-pat-Disable-PAT-support-for-now.patch patches.xen/pvops-Revert-xen-pat-Disable-PAT-using-pat_enabled-value.patch