aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-21 11:39:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-04 17:14:34 +0000
commite790aecfde4199cf9b658338900ad9a87cc1094f (patch)
tree8f0b0b78840eb798182e20fc8ddc84ea4044521b
parent61c449857f056d7c6c29530aa11bf8353b113638 (diff)
downloadopenembedded-core-e790aecfde4199cf9b658338900ad9a87cc1094f.zip
openembedded-core-e790aecfde4199cf9b658338900ad9a87cc1094f.tar.gz
openembedded-core-e790aecfde4199cf9b658338900ad9a87cc1094f.tar.bz2
qemuboot: Improve relative path handling
qemuconf files are currently written relative to TOPDIR. What makes more sense is to write paths relative to the location of the file. This makes moving them around and decoding the end paths in runqemu much easier. The effect of this should allow less use of bitbake to determine variables and allow us to simplify runqemu. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 55a0028a961c0ad3c2e5729a9e3919cbbf256fe1) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/classes/qemuboot.bbclass8
1 files changed, 5 insertions, 3 deletions
diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 7243cc5..15a9e63 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -85,7 +85,8 @@ python do_write_qemuboot_conf() {
qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME'))
qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
- topdir="%s/"%(d.getVar('TOPDIR')).replace("//","/")
+ finalpath = d.getVar("DEPLOY_DIR_IMAGE")
+ topdir = d.getVar('TOPDIR')
cf = configparser.ConfigParser()
cf.add_section('config_bsp')
for k in sorted(qemuboot_vars(d)):
@@ -98,7 +99,8 @@ python do_write_qemuboot_conf() {
val = d.getVar(k)
# we only want to write out relative paths so that we can relocate images
# and still run them
- val=val.replace(topdir,"")
+ if val.startswith(topdir):
+ val = os.path.relpath(val, finalpath)
cf.set('config_bsp', k, '%s' % val)
# QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink
@@ -108,7 +110,7 @@ python do_write_qemuboot_conf() {
kernel = os.path.realpath(kernel_link)
# we only want to write out relative paths so that we can relocate images
# and still run them
- kernel=kernel.replace(topdir,"")
+ kernel = os.path.relpath(kernel, finalpath)
cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
bb.utils.mkdirhier(os.path.dirname(qemuboot))