summaryrefslogtreecommitdiffstats
path: root/meta/classes/qemu.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/qemu.bbclass')
-rw-r--r--meta/classes/qemu.bbclass48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/classes/qemu.bbclass b/meta/classes/qemu.bbclass
new file mode 100644
index 0000000000..b2cf85d628
--- /dev/null
+++ b/meta/classes/qemu.bbclass
@@ -0,0 +1,48 @@
1#
2# This class contains functions for recipes that need QEMU or test for its
3# existence.
4#
5
6def qemu_target_binary(data):
7 target_arch = data.getVar("TARGET_ARCH", True)
8 if target_arch in ("i486", "i586", "i686"):
9 target_arch = "i386"
10 elif target_arch == "powerpc":
11 target_arch = "ppc"
12 elif target_arch == "powerpc64":
13 target_arch = "ppc64"
14
15 return "qemu-" + target_arch
16#
17# Next function will return a string containing the command that is needed to
18# to run a certain binary through qemu. For example, in order to make a certain
19# postinstall scriptlet run at do_rootfs time and running the postinstall is
20# architecture dependent, we can run it through qemu. For example, in the
21# postinstall scriptlet, we could use the following:
22#
23# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments]
24#
25def qemu_run_binary(data, rootfs_path, binary):
26 qemu_binary = qemu_target_binary(data)
27 if qemu_binary == "qemu-allarch":
28 qemu_binary = "qemuwrapper"
29
30 libdir = rootfs_path + data.getVar("libdir", False)
31 base_libdir = rootfs_path + data.getVar("base_libdir", False)
32 oldest_kernel = data.getVar("OLDEST_KERNEL", True)
33
34 return "PSEUDO_UNLOAD=1 " + qemu_binary + " -r " + oldest_kernel + " -L " + rootfs_path\
35 + " -E LD_LIBRARY_PATH=" + libdir + ":" + base_libdir + " "\
36 + rootfs_path + binary
37
38QEMU_OPTIONS = "-r ${OLDEST_KERNEL}"
39QEMU_OPTIONS_append_iwmmxt = " -cpu pxa270-c5"
40QEMU_OPTIONS_append_armv6 = " -cpu arm1136"
41QEMU_OPTIONS_append_armv7a = " -cpu cortex-a8"
42QEMU_OPTIONS_append_e500v2 = " -cpu e500v2"
43QEMU_OPTIONS_append_e500mc = " -cpu e500mc"
44QEMU_OPTIONS_append_e5500 = " -cpu e5500"
45QEMU_OPTIONS_append_e5500-64b = " -cpu e5500"
46QEMU_OPTIONS_append_e6500 = " -cpu e6500"
47QEMU_OPTIONS_append_e6500-64b = " -cpu e6500"
48QEMU_OPTIONS_append_ppc7400 = " -cpu 7400"