summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/package.bbclass24
-rw-r--r--meta/conf/bitbake.conf3
2 files changed, 21 insertions, 6 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 5a84255666..bdbe96d4cb 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -300,6 +300,15 @@ def get_conffiles(pkg, d):
300 os.chdir(cwd) 300 os.chdir(cwd)
301 return conf_list 301 return conf_list
302 302
303def checkbuildpath(file, d):
304 tmpdir = d.getVar('TMPDIR', True)
305 with open(file) as f:
306 file_content = f.read()
307 if tmpdir in file_content:
308 return True
309
310 return False
311
303def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d): 312def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
304 # Function to split a single file into two components, one is the stripped 313 # Function to split a single file into two components, one is the stripped
305 # target system binary, the other contains any debugging information. The 314 # target system binary, the other contains any debugging information. The
@@ -312,8 +321,6 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
312 dvar = d.getVar('PKGD', True) 321 dvar = d.getVar('PKGD', True)
313 objcopy = d.getVar("OBJCOPY", True) 322 objcopy = d.getVar("OBJCOPY", True)
314 debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit") 323 debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit")
315 workdir = d.getVar("WORKDIR", True)
316 workparentdir = d.getVar("DEBUGSRC_OVERRIDE_PATH", True) or os.path.dirname(os.path.dirname(workdir))
317 324
318 # We ignore kernel modules, we don't generate debug info files. 325 # We ignore kernel modules, we don't generate debug info files.
319 if file.find("/lib/modules/") != -1 and file.endswith(".ko"): 326 if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
@@ -327,7 +334,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
327 334
328 # We need to extract the debug src information here... 335 # We need to extract the debug src information here...
329 if debugsrcdir: 336 if debugsrcdir:
330 cmd = "'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file) 337 cmd = "'%s' -i -l '%s' '%s'" % (debugedit, sourcefile, file)
331 (retval, output) = oe.utils.getstatusoutput(cmd) 338 (retval, output) = oe.utils.getstatusoutput(cmd)
332 if retval: 339 if retval:
333 bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "")) 340 bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
@@ -366,6 +373,13 @@ def copydebugsources(debugsrcdir, d):
366 workparentdir = os.path.dirname(os.path.dirname(workdir)) 373 workparentdir = os.path.dirname(os.path.dirname(workdir))
367 workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir) 374 workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
368 375
376 # If build path exists in sourcefile, it means toolchain did not use
377 # -fdebug-prefix-map to compile
378 if checkbuildpath(sourcefile, d):
379 localsrc_prefix = workparentdir + "/"
380 else:
381 localsrc_prefix = "/usr/src/debug/"
382
369 nosuchdir = [] 383 nosuchdir = []
370 basepath = dvar 384 basepath = dvar
371 for p in debugsrcdir.split("/"): 385 for p in debugsrcdir.split("/"):
@@ -379,9 +393,11 @@ def copydebugsources(debugsrcdir, d):
379 # We need to ignore files that are not actually ours 393 # We need to ignore files that are not actually ours
380 # we do this by only paying attention to items from this package 394 # we do this by only paying attention to items from this package
381 processdebugsrc += "fgrep -zw '%s' | " 395 processdebugsrc += "fgrep -zw '%s' | "
396 # Remove prefix in the source paths
397 processdebugsrc += "sed 's#%s##g' | "
382 processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" 398 processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
383 399
384 cmd = processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir) 400 cmd = processdebugsrc % (sourcefile, workbasedir, localsrc_prefix, workparentdir, dvar, debugsrcdir)
385 (retval, output) = oe.utils.getstatusoutput(cmd) 401 (retval, output) = oe.utils.getstatusoutput(cmd)
386 # Can "fail" if internal headers/transient sources are attempted 402 # Can "fail" if internal headers/transient sources are attempted
387 #if retval: 403 #if retval:
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index d4fb5f3571..b873b4150d 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -550,8 +550,7 @@ EXTRA_OEMAKE_prepend_task-install = "${PARALLEL_MAKEINST} "
550# Optimization flags. 550# Optimization flags.
551################################################################## 551##################################################################
552DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types \ 552DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types \
553 -fdebug-prefix-map=${B}=/usr/src/${BPN} \ 553 -fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
554 -fdebug-prefix-map=${S}=/usr/src/${BPN} \
555 -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ 554 -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
556 -fdebug-prefix-map=${STAGING_DIR_HOST}= \ 555 -fdebug-prefix-map=${STAGING_DIR_HOST}= \
557" 556"