public
Created

core/linux PKGBUILD patch for building debuginfo package

  • Download Gist
linux-systemtap.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
diff -ur linux.orig/PKGBUILD linux/PKGBUILD
--- linux.orig/PKGBUILD 2012-08-28 21:53:04.757568936 +0400
+++ linux/PKGBUILD 2012-08-28 22:05:23.470891452 +0400
@@ -24,8 +24,8 @@
'i915-i2c-crash-3.5.x.patch')
md5sums=('24153eaaa81dedc9481ada8cd9c3b83d'
'01e0536109d2a06b1701b5051edfcea2'
- '4eb50449b069bd699d92a290dce76d00'
- '74c0ce9291ad8aaf26546fe85a1a7d18'
+ 'f2abe8d7f67936cc0cc8fc50a8d5dcf0'
+ 'ab1872774f43493dabb6e12ef763f5b7'
'eb14dcfd80c00852ef81ded6e826826a'
'9d3c56a4b999c8bfbd4018089a62f662'
'c1d58e712112cf8f95e7831012a1e67a'
@@ -134,6 +134,7 @@
# add vmlinux
install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
+ objcopy --strip-debug "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
# install fallback mkinitcpio.conf file and preset file for kernel
install -D -m644 "${srcdir}/linux.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
@@ -155,7 +156,7 @@
# remove the firmware
rm -rf "${pkgdir}/lib/firmware"
# gzip -9 all modules to save 100MB of space
- find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
+ find "${pkgdir}" -name '*.ko' -exec objcopy --strip-debug {} \; -exec gzip -9 {} \;
# make room for external modules
ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
# add real version for building modules and running depmod from post_install/upgrade
@@ -169,6 +170,39 @@
depmod -b "$pkgdir" -F System.map "$_kernver"
}
+_package-debuginfo() {
+ pkgdesc="Debug information for the Linux Kernel and modules"
+ depends=('linux')
+
+ cd "${srcdir}/linux-${_basekernel}"
+
+ KARCH=x86
+
+ # get kernel version
+ _kernver="$(make kernelrelease)"
+
+ mkdir -p "${pkgdir}"/usr/lib/debug/lib/modules/"${_kernver}"
+ make INSTALL_MOD_PATH="${pkgdir}"/usr/lib/debug modules_install
+
+ # add vmlinux
+ _kernfile="${pkgdir}/usr/lib/debug/lib/modules/${_kernver}/vmlinux"
+ install -D -m644 vmlinux "${_kernfile}"
+ objcopy --only-keep-debug "${_kernfile}"
+
+ # gzip -9 vmlinux
+ gzip -9 "${_kernfile}"
+ mv "${_kernfile}".gz "${_kernfile}"
+
+ # remove build and source links
+ rm -f "${pkgdir}"/usr/lib/debug/lib/modules/${_kernver}/{source,build,modules.builtin,modules.order}
+
+ # remove the firmware
+ rm -rf "${pkgdir}"/usr/lib/debug/lib/firmware
+
+ # gzip -9 all modules
+ find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \; -exec mv {}.gz {}.gz.debug \;
+}
+
_package-headers() {
pkgdesc="Header files and scripts for building modules for ${pkgbase} kernel"
provides=("kernel26${_kernelname}-headers=${pkgver}")
@@ -317,7 +351,7 @@
rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
}
-pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs")
+pkgname=("${pkgbase}" "${pkgbase}-debuginfo" "${pkgbase}-headers" "${pkgbase}-docs")
for _p in ${pkgname[@]}; do
eval "package_${_p}() {
_package${_p#${pkgbase}}
diff -ur linux.orig/config linux/config
--- linux.orig/config 2012-08-28 21:53:04.757568936 +0400
+++ linux/config 2012-08-28 22:04:59.507558470 +0400
@@ -5620,7 +5620,8 @@
# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_HIGHMEM is not set
CONFIG_DEBUG_BUGVERBOSE=y
-# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_REDUCED=n
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
diff -ur linux.orig/config.x86_64 linux/config.x86_64
--- linux.orig/config.x86_64 2012-08-28 21:53:04.760902270 +0400
+++ linux/config.x86_64 2012-08-28 22:05:06.900891696 +0400
@@ -5389,7 +5389,8 @@
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
-# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_REDUCED=n
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.