summaryrefslogtreecommitdiffstats
path: root/meta/classes
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:24:00 +0000
commit1e4d4762b16f6d64f10e41c1af28409a1a5bf899 (patch)
tree8b6016ee00c6c2b9d641cc1c7c6cfe659263b9c8 /meta/classes
parent968145b24e3cef6fe047e89e5542d8c231eb7f52 (diff)
downloadpoky-1e4d4762b16f6d64f10e41c1af28409a1a5bf899.tar.gz
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. (From OE-Core rev: e790aecfde4199cf9b658338900ad9a87cc1094f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 55a0028a961c0ad3c2e5729a9e3919cbbf256fe1) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 7243cc5257..15a9e63f2b 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -85,7 +85,8 @@ python do_write_qemuboot_conf() {
85 85
86 qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME')) 86 qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME'))
87 qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME')) 87 qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
88 topdir="%s/"%(d.getVar('TOPDIR')).replace("//","/") 88 finalpath = d.getVar("DEPLOY_DIR_IMAGE")
89 topdir = d.getVar('TOPDIR')
89 cf = configparser.ConfigParser() 90 cf = configparser.ConfigParser()
90 cf.add_section('config_bsp') 91 cf.add_section('config_bsp')
91 for k in sorted(qemuboot_vars(d)): 92 for k in sorted(qemuboot_vars(d)):
@@ -98,7 +99,8 @@ python do_write_qemuboot_conf() {
98 val = d.getVar(k) 99 val = d.getVar(k)
99 # we only want to write out relative paths so that we can relocate images 100 # we only want to write out relative paths so that we can relocate images
100 # and still run them 101 # and still run them
101 val=val.replace(topdir,"") 102 if val.startswith(topdir):
103 val = os.path.relpath(val, finalpath)
102 cf.set('config_bsp', k, '%s' % val) 104 cf.set('config_bsp', k, '%s' % val)
103 105
104 # QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink 106 # QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink
@@ -108,7 +110,7 @@ python do_write_qemuboot_conf() {
108 kernel = os.path.realpath(kernel_link) 110 kernel = os.path.realpath(kernel_link)
109 # we only want to write out relative paths so that we can relocate images 111 # we only want to write out relative paths so that we can relocate images
110 # and still run them 112 # and still run them
111 kernel=kernel.replace(topdir,"") 113 kernel = os.path.relpath(kernel, finalpath)
112 cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel) 114 cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
113 115
114 bb.utils.mkdirhier(os.path.dirname(qemuboot)) 116 bb.utils.mkdirhier(os.path.dirname(qemuboot))