diff options
author | Richard Purdie <richard@openedhand.com> | 2006-07-24 08:35:37 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-07-24 08:35:37 +0000 |
commit | 2ca73b57dc7df958ce80bfa3c2e3dc3fc18950b5 (patch) | |
tree | 3e901319353dfdc6d8175b9d65a021943ae91a2c /meta | |
parent | 23b93ceb820de17f28c2bf2bf114c0fca70cf159 (diff) | |
download | poky-2ca73b57dc7df958ce80bfa3c2e3dc3fc18950b5.tar.gz |
Add automatic generation of -dbg packages. These contain the debug symbols that are stripped from binaries and the symbols are linked to the original binaries via the gnu-debuglink section. If the -dbg packages are installed, oprofile and gdb will use them for symbol lookup.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@546 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/package.bbclass | 26 | ||||
-rw-r--r-- | meta/conf/bitbake.conf | 5 |
2 files changed, 21 insertions, 10 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 9edcc1e5ed..6365748956 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -177,8 +177,10 @@ runstrip() { | |||
177 | ro=1 | 177 | ro=1 |
178 | chmod +w "$1" | 178 | chmod +w "$1" |
179 | } | 179 | } |
180 | '${OBJCOPY}' --only-keep-debug "$1" "$1.dbg" | ||
180 | '${STRIP}' "$1" | 181 | '${STRIP}' "$1" |
181 | st=$? | 182 | st=$? |
183 | '${OBJCOPY}' --add-gnu-debuglink="$1.dbg" "$1" | ||
182 | test -n "$ro" && chmod -w "$1" | 184 | test -n "$ro" && chmod -w "$1" |
183 | if test $st -ne 0 | 185 | if test $st -ne 0 |
184 | then | 186 | then |
@@ -249,6 +251,21 @@ python populate_packages () { | |||
249 | bb.error("%s is listed in PACKAGES mutliple times. Undefined behaviour will result." % pkg) | 251 | bb.error("%s is listed in PACKAGES mutliple times. Undefined behaviour will result." % pkg) |
250 | pkgs += pkg | 252 | pkgs += pkg |
251 | 253 | ||
254 | if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): | ||
255 | stripfunc = "" | ||
256 | for root, dirs, files in os.walk(dvar): | ||
257 | for f in files: | ||
258 | file = os.path.join(root, f) | ||
259 | if not os.path.islink(file) and isexec(file): | ||
260 | stripfunc += "\trunstrip %s || st=1\n" % (file) | ||
261 | if not stripfunc == "": | ||
262 | from bb import build | ||
263 | localdata = bb.data.createCopy(d) | ||
264 | # strip | ||
265 | bb.data.setVar('RUNSTRIP', '\tlocal st\n\tst=0\n%s\treturn $st' % stripfunc, localdata) | ||
266 | bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) | ||
267 | bb.build.exec_func('RUNSTRIP', localdata) | ||
268 | |||
252 | for pkg in packages.split(): | 269 | for pkg in packages.split(): |
253 | localdata = bb.data.createCopy(d) | 270 | localdata = bb.data.createCopy(d) |
254 | root = os.path.join(workdir, "install", pkg) | 271 | root = os.path.join(workdir, "install", pkg) |
@@ -273,7 +290,6 @@ python populate_packages () { | |||
273 | bb.mkdirhier(root) | 290 | bb.mkdirhier(root) |
274 | filesvar = bb.data.getVar('FILES', localdata, 1) or "" | 291 | filesvar = bb.data.getVar('FILES', localdata, 1) or "" |
275 | files = filesvar.split() | 292 | files = filesvar.split() |
276 | stripfunc = "" | ||
277 | for file in files: | 293 | for file in files: |
278 | if os.path.isabs(file): | 294 | if os.path.isabs(file): |
279 | file = '.' + file | 295 | file = '.' + file |
@@ -293,17 +309,9 @@ python populate_packages () { | |||
293 | fpath = os.path.join(root,file) | 309 | fpath = os.path.join(root,file) |
294 | dpath = os.path.dirname(fpath) | 310 | dpath = os.path.dirname(fpath) |
295 | bb.mkdirhier(dpath) | 311 | bb.mkdirhier(dpath) |
296 | if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1') and not os.path.islink(file) and isexec(file): | ||
297 | stripfunc += "\trunstrip %s || st=1\n" % fpath | ||
298 | ret = bb.movefile(file,fpath) | 312 | ret = bb.movefile(file,fpath) |
299 | if ret is None or ret == 0: | 313 | if ret is None or ret == 0: |
300 | raise bb.build.FuncFailed("File population failed") | 314 | raise bb.build.FuncFailed("File population failed") |
301 | if not stripfunc == "": | ||
302 | from bb import build | ||
303 | # strip | ||
304 | bb.data.setVar('RUNSTRIP', '\tlocal st\n\tst=0\n%s\treturn $st' % stripfunc, localdata) | ||
305 | bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) | ||
306 | bb.build.exec_func('RUNSTRIP', localdata) | ||
307 | del localdata | 315 | del localdata |
308 | os.chdir(workdir) | 316 | os.chdir(workdir) |
309 | 317 | ||
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 529405a3eb..6c15ef71b4 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf | |||
@@ -102,7 +102,7 @@ PROVIDES = "" | |||
102 | PROVIDES_prepend = "${P} ${PF} ${PN} " | 102 | PROVIDES_prepend = "${P} ${PF} ${PN} " |
103 | RPROVIDES = "" | 103 | RPROVIDES = "" |
104 | 104 | ||
105 | PACKAGES = "${PN} ${PN}-doc ${PN}-dev ${PN}-locale" | 105 | PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-dev ${PN}-locale" |
106 | FILES = "" | 106 | FILES = "" |
107 | FILES_${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir}/lib*.so.* \ | 107 | FILES_${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir}/lib*.so.* \ |
108 | ${sysconfdir} ${sharedstatedir} ${localstatedir} \ | 108 | ${sysconfdir} ${sharedstatedir} ${localstatedir} \ |
@@ -118,6 +118,8 @@ FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la \ | |||
118 | ${libdir}/*.a ${libdir}/*.o ${libdir}/pkgconfig \ | 118 | ${libdir}/*.a ${libdir}/*.o ${libdir}/pkgconfig \ |
119 | /lib/*.a /lib/*.o ${datadir}/aclocal" | 119 | /lib/*.a /lib/*.o ${datadir}/aclocal" |
120 | FILES_${PN}-locale = "${datadir}/locale" | 120 | FILES_${PN}-locale = "${datadir}/locale" |
121 | FILES_${PN}-dbg = "${bindir}/*.dbg ${sbindir}/*.dbg ${libexecdir}/*.dbg ${libdir}/lib*.so.*.dbg \ | ||
122 | /bin/*.dbg /sbin/*.dbg /lib/*.so*.dbg ${libdir}/${PN}/*.dbg" | ||
121 | 123 | ||
122 | # File manifest | 124 | # File manifest |
123 | 125 | ||
@@ -222,6 +224,7 @@ export AR = "${HOST_PREFIX}ar" | |||
222 | export AS = "${HOST_PREFIX}as" | 224 | export AS = "${HOST_PREFIX}as" |
223 | export RANLIB = "${HOST_PREFIX}ranlib" | 225 | export RANLIB = "${HOST_PREFIX}ranlib" |
224 | export STRIP = "${HOST_PREFIX}strip" | 226 | export STRIP = "${HOST_PREFIX}strip" |
227 | export OBJCOPY = "${HOST_PREFIX}objcopy" | ||
225 | 228 | ||
226 | export BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc ${BUILD_CC_ARCH}" | 229 | export BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc ${BUILD_CC_ARCH}" |
227 | export BUILD_CXX = "${CCACHE}${BUILD_PREFIX}g++ ${BUILD_CC_ARCH}" | 230 | export BUILD_CXX = "${CCACHE}${BUILD_PREFIX}g++ ${BUILD_CC_ARCH}" |