diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 22:31:25 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 19:43:26 +0300 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/classes/qemu.bbclass | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.xz |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/classes/qemu.bbclass')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/qemu.bbclass | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/classes/qemu.bbclass b/import-layers/yocto-poky/meta/classes/qemu.bbclass new file mode 100644 index 000000000..75739dbbf --- /dev/null +++ b/import-layers/yocto-poky/meta/classes/qemu.bbclass @@ -0,0 +1,59 @@ +# +# This class contains functions for recipes that need QEMU or test for its +# existence. +# + +def qemu_target_binary(data): + target_arch = data.getVar("TARGET_ARCH", True) + if target_arch in ("i486", "i586", "i686"): + target_arch = "i386" + elif target_arch == "powerpc": + target_arch = "ppc" + elif target_arch == "powerpc64": + target_arch = "ppc64" + + return "qemu-" + target_arch + +def qemu_wrapper_cmdline(data, rootfs_path, library_paths): + import string + + qemu_binary = qemu_target_binary(data) + if qemu_binary == "qemu-allarch": + qemu_binary = "qemuwrapper" + + qemu_options = data.getVar("QEMU_OPTIONS", True) + + return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\ + + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " " + +# Next function will return a string containing the command that is needed to +# to run a certain binary through qemu. For example, in order to make a certain +# postinstall scriptlet run at do_rootfs time and running the postinstall is +# architecture dependent, we can run it through qemu. For example, in the +# postinstall scriptlet, we could use the following: +# +# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments] +# +def qemu_run_binary(data, rootfs_path, binary): + libdir = rootfs_path + data.getVar("libdir", False) + base_libdir = rootfs_path + data.getVar("base_libdir", False) + + return qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir]) + rootfs_path + binary + +# QEMU_EXTRAOPTIONS is not meant to be directly used, the extensions are +# PACKAGE_ARCH, *NOT* overrides. +# In some cases (e.g. ppc) simply being arch specific (apparently) isn't good +# enough and a PACKAGE_ARCH specific -cpu option is needed (hence we have to do +# this dance). For others (e.g. arm) a -cpu option is not necessary, since the +# qemu-arm default CPU supports all required architecture levels. + +QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH', True), True) or ""}" +QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${PACKAGE_ARCH}" + +QEMU_EXTRAOPTIONS_ppce500v2 = " -cpu e500v2" +QEMU_EXTRAOPTIONS_ppce500mc = " -cpu e500mc" +QEMU_EXTRAOPTIONS_ppce5500 = " -cpu e500mc" +QEMU_EXTRAOPTIONS_ppc64e5500 = " -cpu e500mc" +QEMU_EXTRAOPTIONS_ppce6500 = " -cpu e500mc" +QEMU_EXTRAOPTIONS_ppc64e6500 = " -cpu e500mc" +QEMU_EXTRAOPTIONS_ppc7400 = " -cpu 7400" |