diff options
author | Riku Voipio <riku.voipio@linaro.org> | 2013-06-10 15:49:34 +0300 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2013-06-10 15:49:34 +0300 |
commit | fd855e4ef7cd06ee5ce021ca1d1503fce9baf245 (patch) | |
tree | 7a5c3875aae736b11c428f42d4d4c33eb52cd5c0 /meta-aarch64 | |
parent | 76d7fdad00683cc6e2dc45b1790845752fea8ccd (diff) |
add qemu for kvm loop
Diffstat (limited to 'meta-aarch64')
19 files changed, 1113 insertions, 0 deletions
diff --git a/meta-aarch64/recipes-devtools/qemu/files/3f08ffb4a4741d147634761dc053ed386243a0de.patch b/meta-aarch64/recipes-devtools/qemu/files/3f08ffb4a4741d147634761dc053ed386243a0de.patch new file mode 100644 index 00000000..4390b943 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/3f08ffb4a4741d147634761dc053ed386243a0de.patch @@ -0,0 +1,42 @@ +Upstream-Status: Backport + +[Appears to fix the random segfaults we were seeing in a variety of architectures: +https://bugzilla.yoctoproject.org/show_bug.cgi?id=4216 ] + + +From: Yeongkyoon Lee <yeongkyoon.lee@samsung.com> +Date: Fri, 22 Mar 2013 12:50:17 +0000 (+0900) +Subject: tcg: Fix occasional TCG broken problem when ldst optimization enabled +X-Git-Url: http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=52ae646d4a3ebdcdcc973492c6a56f2c49b6578f;hp=3f08ffb4a4741d147634761dc053ed386243a0de + +tcg: Fix occasional TCG broken problem when ldst optimization enabled + +is_tcg_gen_code() checks the upper limit of TCG generated code range wrong, so +that TCG could get broken occasionally only when CONFIG_QEMU_LDST_OPTIMIZATION +enabled. The reason is code_gen_buffer_max_size does not cover the upper range +up to (TCG_MAX_OP_SIZE * OPC_BUF_SIZE), thus code_gen_buffer_max_size should be +modified to code_gen_buffer_size. + +CC: qemu-stable@nongnu.org +Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com> +Reviewed-by: Peter Maydell <peter.maydell@linaro.org> +Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> +--- + +Index: qemu-1.4.0/translate-all.c +=================================================================== +--- qemu-1.4.0.orig/translate-all.c 2013-04-09 10:58:19.000000000 +0000 ++++ qemu-1.4.0/translate-all.c 2013-04-09 10:58:34.783203406 +0000 +@@ -1310,10 +1310,10 @@ + /* check whether the given addr is in TCG generated code buffer or not */ + bool is_tcg_gen_code(uintptr_t tc_ptr) + { +- /* This can be called during code generation, code_gen_buffer_max_size ++ /* This can be called during code generation, code_gen_buffer_size + is used instead of code_gen_ptr for upper boundary checking */ + return (tc_ptr >= (uintptr_t)code_gen_buffer && +- tc_ptr < (uintptr_t)(code_gen_buffer + code_gen_buffer_max_size)); ++ tc_ptr < (uintptr_t)(code_gen_buffer + code_gen_buffer_size)); + } + #endif + diff --git a/meta-aarch64/recipes-devtools/qemu/files/enable-i386-linux-user.patch b/meta-aarch64/recipes-devtools/qemu/files/enable-i386-linux-user.patch new file mode 100644 index 00000000..bb0d6a38 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/enable-i386-linux-user.patch @@ -0,0 +1,55 @@ +Enable i386-linux-user + +Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> + +Upstream-Status: Inappropriate [configuration] + +Index: qemu-0.14.0/Makefile.target +=================================================================== +--- qemu-0.14.0.orig/Makefile.target ++++ qemu-0.14.0/Makefile.target +@@ -78,8 +78,13 @@ ifeq ($(TARGET_BASE_ARCH), i386) + libobj-y += cpuid.o + endif + libobj-$(CONFIG_NEED_MMU) += mmu.o ++ifndef CONFIG_LINUX_USER + libobj-$(TARGET_I386) += helper_opengl.o opengl_exec.o + libobj-$(TARGET_X86_64) += helper_opengl.o opengl_exec.o ++else ++libobj-$(TARGET_I386) += dummygl.o ++libobj-$(TARGET_X86_64) += dummygl.o ++endif #CONFIG_LINUX_USER + libobj-$(TARGET_ARM) += dummygl.o + libobj-$(TARGET_MIPS) += dummygl.o + libobj-$(TARGET_PPC) += dummygl.o +Index: qemu-0.14.0/target-i386/dummygl.c +=================================================================== +--- /dev/null ++++ qemu-0.14.0/target-i386/dummygl.c +@@ -0,0 +1,26 @@ ++#include <string.h> ++#include <stdlib.h> ++#include <assert.h> ++#include <stdint.h> ++#include <X11/Xlib.h> ++#include <X11/Xutil.h> ++ ++void opengl_exec_set_parent_window(Display* _dpy, Window _parent_window) ++{ ++ ++} ++ ++void opengl_process_enable(void) ++{ ++ ++} ++ ++ ++void mem_opengl(uint64_t ptr) ++{ ++ ++} ++ ++void helper_opengl(void) ++{ ++} diff --git a/meta-aarch64/recipes-devtools/qemu/files/fdt_header.patch b/meta-aarch64/recipes-devtools/qemu/files/fdt_header.patch new file mode 100644 index 00000000..dccfe531 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/fdt_header.patch @@ -0,0 +1,39 @@ +Upstream-Status: Pending + +qemu: define fdt types in libfdt_env.h from qemu + + * fixes + In file included from /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/libfdt.h:55:0, + from /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/work/x86_64-linux/qemu-native/1.4.0-r0/qemu-1.4.0/hw/arm/../../device_tree.c:28: + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:58:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:59:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:60:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:61:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:62:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:63:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:64:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:67:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:70:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:73:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:77:2: error: unknown type name 'fdt64_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:78:2: error: unknown type name 'fdt64_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:82:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:87:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:88:2: error: unknown type name 'fdt32_t' + /home/oe/setup-scripts/build/tmp-angstrom_next-uclibc/sysroots/x86_64-linux/usr/include/fdt.h:89:2: error: unknown type name 'fdt32_t' + +Index: qemu-1.4.0/include/libfdt_env.h +=================================================================== +--- qemu-1.4.0.orig/include/libfdt_env.h 2013-02-15 23:05:35.000000000 +0000 ++++ qemu-1.4.0/include/libfdt_env.h 2013-04-13 14:17:27.918885225 +0000 +@@ -21,6 +21,10 @@ + + #include "qemu/bswap.h" + ++typedef uint16_t fdt16_t; ++typedef uint32_t fdt32_t; ++typedef uint64_t fdt64_t; ++ + #ifdef HOST_WORDS_BIGENDIAN + #define fdt32_to_cpu(x) (x) + #define cpu_to_fdt32(x) (x) diff --git a/meta-aarch64/recipes-devtools/qemu/files/fix-configure-checks.patch b/meta-aarch64/recipes-devtools/qemu/files/fix-configure-checks.patch new file mode 100644 index 00000000..294c2201 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/fix-configure-checks.patch @@ -0,0 +1,22 @@ +In native builds, qemu can fail to find zlib development files in the native +sysroot and the build machine might not have zlib-dev packages installed. + +Add CFLAGS to qemu's CFLAGS which in the native case means BUILD_CFLAGS are +added and files in the sysroot can be found. + +Patch from Paul Eggleton, Comments by RP 28/11/10 + +Upstream-Status: Inappropriate [embedded specific] + +Index: qemu-1.4.0/configure +=================================================================== +--- qemu-1.4.0.orig/configure 2013-02-15 15:05:35.000000000 -0800 ++++ qemu-1.4.0/configure 2013-02-25 13:44:17.915273181 -0800 +@@ -286,6 +286,7 @@ + QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" + QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" + QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include" ++QEMU_CFLAGS="$QEMU_CFLAGS $CFLAGS" + if test "$debug_info" = "yes"; then + CFLAGS="-g $CFLAGS" + LDFLAGS="-g $LDFLAGS" diff --git a/meta-aarch64/recipes-devtools/qemu/files/fix-libcap-header-issue-on-some-distro.patch b/meta-aarch64/recipes-devtools/qemu/files/fix-libcap-header-issue-on-some-distro.patch new file mode 100644 index 00000000..13a6ea23 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/fix-libcap-header-issue-on-some-distro.patch @@ -0,0 +1,84 @@ +fix libcap header issue on some distro + +1, When build qemu-native on SLED 11.2, there is an error: +... +| In file included from /usr/include/bits/sigcontext.h:28, +| from /usr/include/signal.h:339, +| from /buildarea2/tmp/work/i686-linux/qemu-native/1.4.0-r0/ +qemu-1.4.0/include/qemu-common.h:42, +| from fsdev/virtfs-proxy-helper.c:23: +| /usr/include/asm/sigcontext.h:28: error: expected specifier- +qualifier-list before '__u64' +| /usr/include/asm/sigcontext.h:191: error: expected specifier- +qualifier-list before '__u64' +... + +2, The virtfs-proxy-helper.c includes <sys/capability.h> and +qemu-common.h in sequence. The header include map is: +(`-->' presents `include') +... +"virtfs-proxy-helper.c" --> <sys/capability.h> +... +"virtfs-proxy-helper.c" --> "qemu-common.h" --> <signal.h> --> +<bits/sigcontext.h> --> <asm/sigcontext.h> --> <linux/types.h> --> +<asm/types.h> --> <asm-generic/types.h> --> <asm-generic/int-ll64.h> +... + +3, The bug is found on SLED 11.2 x86. In libcap header file +/usr/include/sys/capability.h, it does evil stuff like this: +... + 25 /* + 26 * Make sure we can be included from userland by preventing + 27 * capability.h from including other kernel headers + 28 */ + 29 #define _LINUX_TYPES_H + 30 #define _LINUX_FS_H + 31 #define __LINUX_COMPILER_H + 32 #define __user + 33 + 34 typedef unsigned int __u32; + 35 typedef __u32 __le32; +... +This completely prevents including /usr/include/linux/types.h. +The above `<asm/sigcontext.h> --> <linux/types.h>' is prevented, +and '__u64' is defined in <asm-generic/int-ll64.h>. + +4, Modify virtfs-proxy-helper.c to include <sys/capability.h> +last to workaround the issue. + +http://www.linuxtv.org/pipermail/vdr/2009-August/021194.html +http://patchwork.linuxtv.org/patch/12748/ + +Upstream-Status: Pending +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +--- + fsdev/virtfs-proxy-helper.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c +--- a/fsdev/virtfs-proxy-helper.c ++++ b/fsdev/virtfs-proxy-helper.c +@@ -12,7 +12,6 @@ + #include <sys/resource.h> + #include <getopt.h> + #include <syslog.h> +-#include <sys/capability.h> + #include <sys/fsuid.h> + #include <sys/vfs.h> + #include <sys/ioctl.h> +@@ -26,7 +25,11 @@ + #include "virtio-9p-marshal.h" + #include "hw/9pfs/virtio-9p-proxy.h" + #include "fsdev/virtio-9p-marshal.h" +- ++/* ++ * Include this one last due to some versions of it being buggy: ++ * http://www.linuxtv.org/pipermail/vdr/2009-August/021194.html ++ */ ++#include <sys/capability.h> + #define PROGNAME "virtfs-proxy-helper" + + #ifndef XFS_SUPER_MAGIC +-- +1.7.10.4 + diff --git a/meta-aarch64/recipes-devtools/qemu/files/init-info.patch b/meta-aarch64/recipes-devtools/qemu/files/init-info.patch new file mode 100644 index 00000000..2250444a --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/init-info.patch @@ -0,0 +1,18 @@ +# This is a workaround to the crashes seen on Ubuntu. Setting info to zero +# makes info.info.x11.display zero and avoids the calls to +# opengl_exec_set_parent_window, one of which is crashing. + +Upstream-Status: Pending + +Index: qemu-0.14.0/ui/sdl.c +=================================================================== +--- qemu-0.14.0.orig/ui/sdl.c ++++ qemu-0.14.0/ui/sdl.c +@@ -863,6 +863,7 @@ void sdl_display_init(DisplayState *ds, + vi = SDL_GetVideoInfo(); + host_format = *(vi->vfmt); + ++ bzero(&info, sizeof(info)); + SDL_GetWMInfo(&info); + if (info.subsystem == SDL_SYSWM_X11 && info.info.x11.display) + opengl_exec_set_parent_window(info.info.x11.display, diff --git a/meta-aarch64/recipes-devtools/qemu/files/larger_default_ram_size.patch b/meta-aarch64/recipes-devtools/qemu/files/larger_default_ram_size.patch new file mode 100644 index 00000000..711c3607 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/larger_default_ram_size.patch @@ -0,0 +1,22 @@ +This patch is taken from debian. 128M is too less sometimes if distro +with lot of packages is booted so this patch raises the default to 384M + +It has not been applied to upstream qemu + +Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Pending + +Index: qemu-0.14.0/vl.c +=================================================================== +--- qemu-0.14.0.orig/vl.c ++++ qemu-0.14.0/vl.c +@@ -168,7 +168,7 @@ int main(int argc, char **argv) + //#define DEBUG_NET + //#define DEBUG_SLIRP + +-#define DEFAULT_RAM_SIZE 128 ++#define DEFAULT_RAM_SIZE 384 + + #define MAX_VIRTIO_CONSOLES 1 + diff --git a/meta-aarch64/recipes-devtools/qemu/files/no-strip.patch b/meta-aarch64/recipes-devtools/qemu/files/no-strip.patch new file mode 100644 index 00000000..d6a4377c --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/no-strip.patch @@ -0,0 +1,15 @@ +Upstream-Status: Inappropriate [configuration] + +Index: qemu-0.14.0/Makefile +=================================================================== +--- qemu-0.14.0.orig/Makefile ++++ qemu-0.14.0/Makefile +@@ -235,7 +235,7 @@ install-sysconfig: + install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig + $(INSTALL_DIR) "$(DESTDIR)$(bindir)" + ifneq ($(TOOLS),) +- $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)" ++ $(INSTALL_PROG) $(TOOLS) "$(DESTDIR)$(bindir)" + endif + ifneq ($(BLOBS),) + $(INSTALL_DIR) "$(DESTDIR)$(datadir)" diff --git a/meta-aarch64/recipes-devtools/qemu/files/powerpc_rom.bin b/meta-aarch64/recipes-devtools/qemu/files/powerpc_rom.bin Binary files differnew file mode 100644 index 00000000..c4044296 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/powerpc_rom.bin diff --git a/meta-aarch64/recipes-devtools/qemu/files/relocatable_sdk.patch b/meta-aarch64/recipes-devtools/qemu/files/relocatable_sdk.patch new file mode 100644 index 00000000..774a49c7 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/files/relocatable_sdk.patch @@ -0,0 +1,34 @@ +Upstream-Status: Inappropriate [SDK specific] + +In order to be able to change the dynamic loader path when relocating +binaries, the interp section has to be made big enough to accomodate +the new path (4096 is the maximum path length in Linux). + +Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> + +Index: qemu-1.4.0/ldscripts/i386.ld +=================================================================== +--- qemu-1.4.0.orig/ldscripts/i386.ld 2013-02-15 15:05:35.000000000 -0800 ++++ qemu-1.4.0/ldscripts/i386.ld 2013-02-28 22:55:36.138816418 -0800 +@@ -8,7 +8,7 @@ + { + /* Read-only sections, merged into text segment: */ + . = 0x60000000 + SIZEOF_HEADERS; +- .interp : { *(.interp) } ++ .interp : { *(.interp); . = 0x1000; } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } +Index: qemu-1.4.0/ldscripts/x86_64.ld +=================================================================== +--- qemu-1.4.0.orig/ldscripts/x86_64.ld 2013-02-15 15:05:35.000000000 -0800 ++++ qemu-1.4.0/ldscripts/x86_64.ld 2013-02-28 22:55:36.138816418 -0800 +@@ -6,7 +6,7 @@ + { + /* Read-only sections, merged into text segment: */ + . = 0x60000000 + SIZEOF_HEADERS; +- .interp : { *(.interp) } ++ .interp : { *(.interp); . = 0x1000; } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } diff --git a/meta-aarch64/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb b/meta-aarch64/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb new file mode 100644 index 00000000..fbf9e771 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb @@ -0,0 +1,49 @@ +SUMMARY = "Qemu helper scripts" +DESCRIPTION = "Qemu helper scripts" +LICENSE = "GPLv2" +RDEPENDS_${PN} = "nativesdk-qemu" +PR = "r9" + +FILESPATH = "${FILE_DIRNAME}/qemu-helper" + +LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999 \ + file://${COREBASE}/scripts/runqemu;endline=18;md5=77fbe442a88b1bcdc29c3ba67733b21b" + + +SRC_URI = "file://${COREBASE}/scripts/runqemu \ + file://${COREBASE}/scripts/runqemu-internal \ + file://${COREBASE}/scripts/runqemu-addptable2image \ + file://${COREBASE}/scripts/runqemu-gen-tapdevs \ + file://${COREBASE}/scripts/runqemu-ifup \ + file://${COREBASE}/scripts/runqemu-ifdown \ + file://${COREBASE}/scripts/oe-find-native-sysroot \ + file://${COREBASE}/scripts/runqemu-extract-sdk \ + file://${COREBASE}/scripts/runqemu-export-rootfs \ + file://tunctl.c \ + file://raw2flash.c \ + " + +S = "${WORKDIR}" + +inherit nativesdk + +do_compile() { + ${CC} tunctl.c -o tunctl + ${CC} raw2flash.c -o raw2flash.spitz + ${CC} raw2flash.c -o flash2raw.spitz -Dflash2raw +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}${COREBASE}/scripts/oe-* ${D}${bindir}/ + install -m 0755 ${WORKDIR}${COREBASE}/scripts/runqemu* ${D}${bindir}/ + install tunctl ${D}${bindir}/ + install raw2flash.spitz ${D}${bindir}/ + install flash2raw.spitz ${D}${bindir}/ + ln -fs raw2flash.spitz ${D}${bindir}/raw2flash.akita + ln -fs raw2flash.spitz ${D}${bindir}/raw2flash.borzoi + ln -fs raw2flash.spitz ${D}${bindir}/raw2flash.terrier + ln -fs flash2raw.spitz ${D}${bindir}/flash2raw.akita + ln -fs flash2raw.spitz ${D}${bindir}/flash2raw.borzoi + ln -fs flash2raw.spitz ${D}${bindir}/flash2raw.terrier +} diff --git a/meta-aarch64/recipes-devtools/qemu/qemu-helper-native_1.0.bb b/meta-aarch64/recipes-devtools/qemu/qemu-helper-native_1.0.bb new file mode 100644 index 00000000..23771acf --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu-helper-native_1.0.bb @@ -0,0 +1,23 @@ +DESCRIPTION = "Qemu helper utilities from Poky" +LICENSE = "GPLv2" +RDEPENDS_${PN} = "qemu-native" +PR = "r1" + +LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999" + +FILESPATH = "${FILE_DIRNAME}/qemu-helper" + +SRC_URI = "file://tunctl.c" + +S = "${WORKDIR}" + +inherit native + +do_compile() { + ${CC} tunctl.c -o tunctl +} + +do_install() { + install -d ${D}${bindir} + install tunctl ${D}${bindir}/ +} diff --git a/meta-aarch64/recipes-devtools/qemu/qemu-helper/raw2flash.c b/meta-aarch64/recipes-devtools/qemu/qemu-helper/raw2flash.c new file mode 100644 index 00000000..19faf629 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu-helper/raw2flash.c @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2006 OpenedHand Ltd. + * + * This file is licensed under GNU GPL v2. + */ +#include <string.h> +#include <unistd.h> +#include <stdint.h> +#include <stdio.h> +#include <sys/types.h> +#include <stdlib.h> + +#define TFR(_) _ +#define VERBOSE +#define PBAR_LEN 40 + +#define PARTITION_START 0x00700000 + +static const int ecc_pos8[] = { + 0x0, 0x1, 0x2, +}; + +static const int ecc_pos16[] = { + 0x0, 0x1, 0x2, 0x3, 0x6, 0x7, +}; + +static const int ecc_pos64[] = { + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, +}; + +static const int ecc_akita[] = { + 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11, + 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23, + 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37, +}; + +struct jffs_marker_s { + int pos; + uint8_t value; +}; + +static const struct jffs_marker_s free_pos8[] = { + { 0x03, 0xff }, { 0x04, 0xff }, { 0x06, 0x85 }, { 0x07, 0x19 }, + { -1 }, +}; + +static const struct jffs_marker_s free_pos16[] = { + { 0x08, 0x85 }, { 0x09, 0x19 }, { 0x0a, 0x03 }, { 0x0b, 0x20 }, + { 0x0c, 0x08 }, { 0x0d, 0x00 }, { 0x0e, 0x00 }, { 0x0f, 0x00 }, + { -1 }, +}; + +static const struct jffs_marker_s free_pos64[] = { + { 0x02, 0xff }, { 0x03, 0xff }, { 0x04, 0xff }, { 0x05, 0xff }, + { 0x06, 0xff }, { 0x07, 0xff }, { 0x08, 0xff }, { 0x09, 0xff }, + { 0x0a, 0xff }, { 0x0b, 0xff }, { 0x0c, 0xff }, { 0x0d, 0xff }, + { 0x0e, 0xff }, { 0x0f, 0xff }, { 0x10, 0x85 }, { 0x11, 0x19 }, + { 0x12, 0x03 }, { 0x13, 0x20 }, { 0x14, 0x08 }, { 0x15, 0x00 }, + { 0x16, 0x00 }, { 0x17, 0x00 }, { 0x18, 0xff }, { 0x19, 0xff }, + { 0x1a, 0xff }, { 0x1b, 0xff }, { 0x1c, 0xff }, { 0x1d, 0xff }, + { 0x1e, 0xff }, { 0x1f, 0xff }, { 0x20, 0xff }, { 0x21, 0xff }, + { 0x22, 0xff }, { 0x23, 0xff }, { 0x24, 0xff }, { 0x25, 0xff }, + { 0x26, 0xff }, { 0x27, 0xff }, + { -1 }, +}; + +static const struct jffs_marker_s free_akita[] = { + { 0x08, 0x85 }, { 0x09, 0x19 }, { 0x0a, 0x03 }, { 0x0b, 0x20 }, + { 0x0c, 0x08 }, { 0x0d, 0x00 }, { 0x0e, 0x00 }, { 0x0f, 0x00 }, + { 0x10, 0xff }, + { -1 }, +}; + +#define LEN(array) (sizeof(array) / sizeof(*array)) + +static const struct ecc_style_s { + int page_size; + int oob_size; + int eccbytes; + int eccsize; + const int *eccpos; + int romsize; + const struct jffs_marker_s *freepos; +} spitz = { + 0x200, 0x10, 0x100, LEN(ecc_pos16), ecc_pos16, 0x01000000, free_pos16 +}, akita = { + 0x800, 0x40, 0x100, LEN(ecc_akita), ecc_akita, 0x08000000, free_akita +}, borzoi = { + 0x800, 0x40, 0x100, LEN(ecc_akita), ecc_akita, 0x08000000, free_akita +}, terrier = { + 0x800, 0x40, 0x100, LEN(ecc_akita), ecc_akita, 0x08000000, free_akita +}; + +struct ecc_state_s { + int count; + uint8_t cp; + uint8_t lp[2]; + const struct ecc_style_s *style; +}; + +#ifndef flash2raw +/* + * Pre-calculated 256-way 1 byte column parity. Table borrowed from Linux. + */ +static const uint8_t ecc_precalc_table[] = { + 0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, + 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00, + 0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, + 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65, + 0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, + 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66, + 0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, + 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03, + 0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, + 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69, + 0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, + 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c, + 0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, + 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f, + 0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, + 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a, + 0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, + 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a, + 0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, + 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f, + 0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, + 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c, + 0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, + 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69, + 0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, + 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03, + 0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, + 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66, + 0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, + 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65, + 0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, + 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00, +}; + +/* Update ECC parity count */ +static inline uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample) { + uint8_t idx = ecc_precalc_table[sample]; + + s->cp ^= idx & 0x3f; + if (idx & 0x40) { + s->lp[0] ^= ~(s->count & 0xff); + s->lp[1] ^= s->count & 0xff; + } + s->count ++; + + return sample; +} + +static void buffer_digest(struct ecc_state_s *ecc, + const uint8_t *buf, uint8_t *out) { + int i, lp_a[2]; + + ecc->lp[0] = 0x00; + ecc->lp[1] = 0x00; + ecc->cp = 0x00; + ecc->count = 0; + for (i = 0; i < ecc->style->eccbytes; i ++) + ecc_digest(ecc, buf[i]); + +# define BSHR(byte, from, to) ((ecc->lp[byte] >> (from - to)) & (1 << to)) + lp_a[0] = + BSHR(0, 4, 0) | BSHR(0, 5, 2) | + BSHR(0, 6, 4) | BSHR(0, 7, 6) | + BSHR(1, 4, 1) | BSHR(1, 5, 3) | + BSHR(1, 6, 5) | BSHR(1, 7, 7); + +# define BSHL(byte, from, to) ((ecc->lp[byte] << (to - from)) & (1 << to)) + lp_a[1] = + BSHL(0, 0, 0) | BSHL(0, 1, 2) | + BSHL(0, 2, 4) | BSHL(0, 3, 6) | + BSHL(1, 0, 1) | BSHL(1, 1, 3) | + BSHL(1, 2, 5) | BSHL(1, 3, 7); + + out[0] = ~lp_a[1]; + out[1] = ~lp_a[0]; + out[2] = (~ecc->cp << 2) | 0x03; +} + +static void jffs2_format(const struct ecc_state_s *ecc, uint8_t oob[]) { + const struct jffs_marker_s *byte; + for (byte = ecc->style->freepos; byte->pos >= 0; byte ++) + oob[byte->pos] = byte->value; +} + +static void buffer_fill(const struct ecc_state_s *ecc, uint8_t buffer[], + int *len, int *partition, int count, uint8_t jffs_buffer[]) { + int ret; + + switch (*partition) { + case 0: + if (count < PARTITION_START) { + memcpy(buffer, jffs_buffer + count, + ecc->style->eccbytes); + *len = ecc->style->eccbytes; + break; + } + *partition = 1; + case 1: + if (count - PARTITION_START < PARTITION_START) { + memcpy(buffer, jffs_buffer + count - PARTITION_START, + ecc->style->eccbytes); + *len = ecc->style->eccbytes; + break; + } + + while (*len < ecc->style->eccbytes) { + ret = TFR(read(0, buffer + *len, 0x800 - *len)); + if (ret <= 0) + break; + *len += ret; + } + + if (*len == 0) + *partition = 2; + else if (*len < ecc->style->eccbytes) { + fprintf(stderr, "\nWarning: %i stray bytes\n", *len); + memset(buffer + *len, 0xff, + ecc->style->eccbytes - *len); + *len = ecc->style->eccbytes; + break; + } else + break; + case 2: + memset(buffer, 0xff, ecc->style->eccbytes); + *len = ecc->style->eccbytes; + break; + } +} + +int main(int argc, char *argv[], char *envp[]) { + struct ecc_state_s ecc; + uint8_t buffer[0x1000], ecc_payload[0x40], regs[3], *jffs; + int ret, len, eccbyte, count, partition; + + /* Check if we're called by "raw2flash.spitz" or similar */ + len = strlen(argv[0]); + if (!strcasecmp(argv[0] + len - 5, "akita")) + ecc.style = &akita; + else if (!strcasecmp(argv[0] + len - 6, "borzoi")) + ecc.style = &borzoi; + else if (!strcasecmp(argv[0] + len - 7, "terrier")) + ecc.style = &terrier; + else + ecc.style = &spitz; + +# ifdef VERBOSE + fprintf(stderr, "["); +# endif + + /* Skip first 10 bytes */ + TFR(read(0, buffer, 0x10)); + + len = 0; + jffs = (uint8_t *) malloc(PARTITION_START); + while (len < PARTITION_START) { + ret = TFR(read(0, jffs + len, PARTITION_START - len)); + if (ret <= 0) + break; + len += ret; + } + + /* Convert data from stdin */ + partition = len = eccbyte = count = 0; + memset(ecc_payload, 0xff, ecc.style->oob_size); + jffs2_format(&ecc, ecc_payload); + while (count < ecc.style->romsize) { + buffer_fill(&ecc, buffer, &len, &partition, count, jffs); + buffer_digest(&ecc, buffer, regs); + + ecc_payload[ecc.style->eccpos[eccbyte ++]] = regs[0]; + ecc_payload[ecc.style->eccpos[eccbyte ++]] = regs[1]; + ecc_payload[ecc.style->eccpos[eccbyte ++]] = regs[2]; + + TFR(write(1, buffer, ecc.style->eccbytes)); + count += ecc.style->eccbytes; + len -= ecc.style->eccbytes; + memmove(buffer, buffer + ecc.style->eccbytes, len); + + if (eccbyte >= ecc.style->eccsize) { + TFR(write(1, ecc_payload, ecc.style->oob_size)); + eccbyte = 0; + memset(ecc_payload, 0xff, ecc.style->oob_size); + if (partition < 2) + jffs2_format(&ecc, ecc_payload); + } + +# ifdef VERBOSE + if (count * PBAR_LEN / ecc.style->romsize > + (count - ecc.style->eccbytes) * + PBAR_LEN / ecc.style->romsize) + fprintf(stderr, "#"); +# endif + } + +# ifdef VERBOSE + fprintf(stderr, "]\n"); +# endif + free(jffs); + return 0; +} +#else +int main(int argc, char *argv[], char *envp[]) { + struct ecc_state_s ecc; + uint8_t buffer[0x1000]; + int ret, len, count; + + /* Check if we're called by "flash2raw.spitz" or similar */ + len = strlen(argv[0]); + if (!strcasecmp(argv[0] + len - 5, "akita")) + ecc.style = &akita; + else if (!strcasecmp(argv[0] + len - 6, "borzoi")) + ecc.style = &borzoi; + else if (!strcasecmp(argv[0] + len - 7, "terrier")) + ecc.style = &terrier; + else + ecc.style = &spitz; + +# ifdef VERBOSE + fprintf(stderr, "["); +# endif + + /* Convert data from stdin */ + count = 0; + while (count < ecc.style->romsize) { + len = 0; + while (len < ecc.style->page_size) { + ret = TFR(read(0, buffer + len, + ecc.style->page_size - len)); + if (ret <= 0) + break; + len += ret; + } + if (len == 0) + break; + if (len < ecc.style->page_size) { + fprintf(stderr, "\nWarning: %i stray bytes\n", len); + } + + TFR(write(1, buffer, ecc.style->page_size)); + + count += len; + len = 0; + while (len < ecc.style->oob_size) { + ret = TFR(read(0, buffer, ecc.style->oob_size - len)); + if (ret <= 0) + break; + len += ret; + } + +# ifdef VERBOSE + if (count * PBAR_LEN / ecc.style->romsize > + (count - ecc.style->page_size) * + PBAR_LEN / ecc.style->romsize) + fprintf(stderr, "#"); +# endif + } + +# ifdef VERBOSE + fprintf(stderr, "]\n"); +# endif + return 0; +} +#endif diff --git a/meta-aarch64/recipes-devtools/qemu/qemu-helper/tunctl.c b/meta-aarch64/recipes-devtools/qemu/qemu-helper/tunctl.c new file mode 100644 index 00000000..16e24a2a --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu-helper/tunctl.c @@ -0,0 +1,156 @@ +/* Copyright 2002 Jeff Dike + * Licensed under the GPL + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> +#include <pwd.h> +#include <grp.h> +#include <net/if.h> +#include <sys/ioctl.h> +#include <linux/if_tun.h> + +/* TUNSETGROUP appeared in 2.6.23 */ +#ifndef TUNSETGROUP +#define TUNSETGROUP _IOW('T', 206, int) +#endif + +static void Usage(char *name) +{ + fprintf(stderr, "Create: %s [-b] [-u owner] [-g group] [-t device-name] " + "[-f tun-clone-device]\n", name); + fprintf(stderr, "Delete: %s -d device-name [-f tun-clone-device]\n\n", + name); + fprintf(stderr, "The default tun clone device is /dev/net/tun - some systems" + " use\n/dev/misc/net/tun instead\n\n"); + fprintf(stderr, "-b will result in brief output (just the device name)\n"); + exit(1); +} + +int main(int argc, char **argv) +{ + struct ifreq ifr; + struct passwd *pw; + struct group *gr; + uid_t owner = -1; + gid_t group = -1; + int tap_fd, opt, delete = 0, brief = 0; + char *tun = "", *file = "/dev/net/tun", *name = argv[0], *end; + + while((opt = getopt(argc, argv, "bd:f:t:u:g:")) > 0){ + switch(opt) { + case 'b': + brief = 1; + break; + case 'd': + delete = 1; + tun = optarg; + break; + case 'f': + file = optarg; + break; + case 'u': + pw = getpwnam(optarg); + if(pw != NULL){ + owner = pw->pw_uid; + break; + } + owner = strtol(optarg, &end, 0); + if(*end != '\0'){ + fprintf(stderr, "'%s' is neither a username nor a numeric uid.\n", + optarg); + Usage(name); + } + break; + case 'g': + gr = getgrnam(optarg); + if(gr != NULL){ + group = gr->gr_gid; + break; + } + group = strtol(optarg, &end, 0); + if(*end != '\0'){ + fprintf(stderr, "'%s' is neither a groupname nor a numeric group.\n", + optarg); + Usage(name); + } + break; + + case 't': + tun = optarg; + break; + case 'h': + default: + Usage(name); + } + } + + argv += optind; + argc -= optind; + + if(argc > 0) + Usage(name); + + if((tap_fd = open(file, O_RDWR)) < 0){ + fprintf(stderr, "Failed to open '%s' : ", file); + perror(""); + exit(1); + } + + memset(&ifr, 0, sizeof(ifr)); + + ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + strncpy(ifr.ifr_name, tun, sizeof(ifr.ifr_name) - 1); + if(ioctl(tap_fd, TUNSETIFF, (void *) &ifr) < 0){ + perror("TUNSETIFF"); + exit(1); + } + + if(delete){ + if(ioctl(tap_fd, TUNSETPERSIST, 0) < 0){ + perror("disabling TUNSETPERSIST"); + exit(1); + } + printf("Set '%s' nonpersistent\n", ifr.ifr_name); + } + else { + /* emulate behaviour prior to TUNSETGROUP */ + if(owner == -1 && group == -1) { + owner = geteuid(); + } + + if(owner != -1) { + if(ioctl(tap_fd, TUNSETOWNER, owner) < 0){ + perror("TUNSETOWNER"); + exit(1); + } + } + if(group != -1) { + if(ioctl(tap_fd, TUNSETGROUP, group) < 0){ + perror("TUNSETGROUP"); + exit(1); + } + } + + if(ioctl(tap_fd, TUNSETPERSIST, 1) < 0){ + perror("enabling TUNSETPERSIST"); + exit(1); + } + + if(brief) + printf("%s\n", ifr.ifr_name); + else { + printf("Set '%s' persistent and owned by", ifr.ifr_name); + if(owner != -1) + printf(" uid %d", owner); + if(group != -1) + printf(" gid %d", group); + printf("\n"); + } + } + return(0); +} diff --git a/meta-aarch64/recipes-devtools/qemu/qemu-targets.inc b/meta-aarch64/recipes-devtools/qemu/qemu-targets.inc new file mode 100644 index 00000000..5a60bfda --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu-targets.inc @@ -0,0 +1,18 @@ +# possible arch values are arm mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 +# ppcemb armeb alpha sparc32plus i386 x86_64 cris m68k microblaze sparc sparc32 +# sparc32plus + +def get_qemu_target_list(d): + import bb + archs = d.getVar('QEMU_TARGETS', True).split() + targets = "" + for arch in ['mips64', 'mips64el', 'ppcemb']: + if arch in archs: + targets += arch + "-softmmu," + archs.remove(arch) + for arch in ['armeb', 'alpha', 'ppc64abi32', 'sparc32plus']: + if arch in archs: + targets += arch + "-linux-user," + archs.remove(arch) + return targets + ''.join([arch + "-linux-user" + "," + arch + "-softmmu" + "," for arch in archs]).rstrip(',') + diff --git a/meta-aarch64/recipes-devtools/qemu/qemu.inc b/meta-aarch64/recipes-devtools/qemu/qemu.inc new file mode 100644 index 00000000..a68d5080 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu.inc @@ -0,0 +1,92 @@ +DESCRIPTION = "open source processor emulator" +HOMEPAGE = "http://qemu.org" +LICENSE = "GPLv2 & LGPLv2.1" +DEPENDS = "glib-2.0 zlib alsa-lib virtual/libx11 pixman dtc libsdl" +DEPENDS_class-native = "zlib-native alsa-lib-native glib-2.0-native pixman-native dtc-native" +DEPENDS_class-nativesdk = "nativesdk-zlib nativesdk-libsdl nativesdk-glib-2.0 nativesdk-pixman nativesdk-dtc" +RDEPENDS_${PN}_class-nativesdk = "nativesdk-libsdl" + +require qemu-targets.inc +inherit autotools +BBCLASSEXTEND = "native nativesdk" + +# QEMU_TARGETS is overridable variable +QEMU_TARGETS ?= "arm i386 mips mipsel mips64 mips64el ppc sh4 x86_64" + +SDL ?= "" +SDL_class-native ?= "" +SDL_class-nativesdk ?= "" + +SRC_URI = "\ + file://powerpc_rom.bin \ + file://no-strip.patch \ + file://fix-configure-checks.patch \ + file://larger_default_ram_size.patch \ + " + +SRC_URI_append_class-nativesdk = "\ + file://relocatable_sdk.patch \ + " + +SRC_URI_append_class-native = "\ + file://fix-libcap-header-issue-on-some-distro.patch \ + " + +EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror --disable-vnc-tls --audio-drv-list=oss,alsa --disable-curl --disable-vnc-jpeg --disable-bluez --with-system-pixman" + +EXTRA_OECONF_class-nativesdk = "--target-list=${@get_qemu_target_list(d)} --disable-werror --disable-vnc-tls \ + --disable-curl \ + " + +do_configure_prepend_class-native() { + # Undo the -lX11 added by linker-flags.patch, don't assume that host has libX11 installed + sed -i 's/-lX11//g' Makefile.target +} + +do_configure_prepend_class-nativesdk() { + if [ "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" = "" ] ; then + # Undo the -lX11 added by linker-flags.patch + sed -i 's/-lX11//g' Makefile.target + fi +} + +do_configure() { + # Handle distros such as CentOS 5 32-bit that do not have kvm support + KVMOPTS="--disable-kvm" + if [ "${PN}" != "qemu-native" -a "${PN}" != "nativesdk-qemu" ] \ + || [ -f /usr/include/linux/kvm.h ] ; then + KVMOPTS="--enable-kvm" + fi + + ${S}/configure --prefix=${prefix} --sysconfdir=${sysconfdir} --libexecdir=${libexecdir} --disable-strip ${EXTRA_OECONF} $KVMOPTS + test ! -e ${S}/target-i386/beginend_funcs.sh || chmod a+x ${S}/target-i386/beginend_funcs.sh +} + +do_install () { + export STRIP="true" + autotools_do_install + install -d ${D}${datadir}/qemu + install -m 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu||true +} + +# The following fragment will create a wrapper for qemu-mips user emulation +# binary in order to work around a segmentation fault issue. Basically, by +# default, the reserved virtual address space for 32-on-64 bit is set to 4GB. +# This will trigger a MMU access fault in the virtual CPU. With this change, +# the qemu-mips works fine. +# IMPORTANT: This piece needs to be removed once the root cause is fixed! +do_install_append() { + if [ -e "${D}/${bindir}/qemu-mips" ]; then + create_wrapper ${D}/${bindir}/qemu-mips \ + QEMU_RESERVED_VA=0x0 + fi +} +# END of qemu-mips workaround + +PACKAGECONFIG ??= "" + +# Qemu target will not build in world build for ARM or Mips +BROKEN_qemuarm = "1" +BROKEN_qemumips = "1" + +INSANE_SKIP_${PN} = "arch" diff --git a/meta-aarch64/recipes-devtools/qemu/qemu_1.5.0.bb b/meta-aarch64/recipes-devtools/qemu/qemu_1.5.0.bb new file mode 100644 index 00000000..2ea4f120 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu_1.5.0.bb @@ -0,0 +1,10 @@ +require qemu.inc + +LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ + file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913" + +SRC_URI += "file://fdt_header.patch" + +SRC_URI_prepend = "http://wiki.qemu.org/download/qemu-${PV}.tar.bz2" +SRC_URI[md5sum] = "b6f3265b8ed39d77e8f354f35cc26e16" +SRC_URI[sha256sum] = "b22b30ee9712568dfb4eedf76783f4a76546e1cbc41659b909646bcf0b4867bb" diff --git a/meta-aarch64/recipes-devtools/qemu/qemu_git.bb b/meta-aarch64/recipes-devtools/qemu/qemu_git.bb new file mode 100644 index 00000000..d29ef130 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemu_git.bb @@ -0,0 +1,16 @@ +require qemu.inc + +LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ + file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913" + +PV = "1.5.git${SRCPV}" +PR = "r0" + +QEMU_TARGETS_aarch64 = "" +EXTRA_OECONF_aarch64 += "--enable-tcg-interpreter --enable-kvm --enable-fdt --target-list=aarch64-softmmu" + +SRC_URI = "git://git.linaro.org/people/pmaydell/qemu-aarch64.git;branch=kvm-aarch64-wip" +S = "${WORKDIR}/git" + +SRCREV = "${AUTOREV}" + diff --git a/meta-aarch64/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta-aarch64/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb new file mode 100644 index 00000000..18f18928 --- /dev/null +++ b/meta-aarch64/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb @@ -0,0 +1,48 @@ +DESCRIPTION = "Qemu wrapper script" +LICENSE = "MIT" +PR = "r0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit qemu + +do_install () { + install -d ${D}${bindir_crossscripts}/ + + echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper + qemu_binary=${@qemu_target_binary(d)} + echo "$qemu_binary \"\$@\"" >> ${D}${bindir_crossscripts}/qemuwrapper + fallback_qemu_bin= + case $qemu_binary in + "qemu-i386") + fallback_qemu_bin=qemu-x86_64 + ;; + "qemu-x86_64") + fallback_qemu_bin=qemu-i386 + ;; + *) + ;; + esac + + if [ -n "$fallback_qemu_bin" ]; then + + cat >> ${D}${bindir_crossscripts}/qemuwrapper << EOF +rc=\$? +if [ \$rc = 255 ]; then + $fallback_qemu_bin "\$@" + rc=\$? +fi +exit \$rc +EOF + + fi + + chmod +x ${D}${bindir_crossscripts}/qemuwrapper +} + +SYSROOT_PREPROCESS_FUNCS += "qemuwrapper_sysroot_preprocess" + +qemuwrapper_sysroot_preprocess () { + sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts} +} + +INHIBIT_DEFAULT_DEPS = "1" |