From 43fb11170b1b841ea38f66fa529069bc42d6d488 Mon Sep 17 00:00:00 2001 From: q66 Date: Thu, 11 Mar 2021 21:19:51 +0100 Subject: [PATCH] qemu: add support for ppcle in linux-user --- srcpkgs/qemu/patches/xxx-ppcle.patch | 126 +++++++++++++++++++++++++++ srcpkgs/qemu/template | 2 +- 2 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch new file mode 100644 index 00000000000..99396bff9dd --- /dev/null +++ b/srcpkgs/qemu/patches/xxx-ppcle.patch @@ -0,0 +1,126 @@ +From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001 +From: Daniel Kolesa +Date: Sun, 7 Mar 2021 01:47:42 +0100 +Subject: [PATCH] support ppcle architecture + +--- + configure | 14 ++++++++++++-- + default-configs/targets/ppcle-linux-user.mak | 4 ++++ + linux-user/ppc/target_syscall.h | 4 ++++ + scripts/qemu-binfmt-conf.sh | 6 +++++- + tests/tcg/configure.sh | 2 ++ + 5 files changed, 27 insertions(+), 3 deletions(-) + create mode 100644 default-configs/targets/ppcle-linux-user.mak + +diff --git configure configure +index 18c26e0..03d3e18 100755 +--- configure ++++ configure +@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then + cpu="ppc64" + fi + else +- cpu="ppc" ++ if check_define _LITTLE_ENDIAN ; then ++ cpu="ppcle" ++ else ++ cpu="ppc" ++ fi + fi + elif check_define __mips__ ; then + cpu="mips" +@@ -683,6 +687,9 @@ ARCH= + case "$cpu" in + ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) + ;; ++ ppcle) ++ ARCH="ppc" ++ ;; + ppc64le) + ARCH="ppc64" + ;; +@@ -6783,7 +6790,7 @@ if test "$linux" = "yes" ; then + i386|x86_64|x32) + linux_arch=x86 + ;; +- ppc|ppc64|ppc64le) ++ ppc|ppcle|ppc64|ppc64le) + linux_arch=powerpc + ;; + s390x) +@@ -6960,6 +6967,9 @@ if test -n "$cross_prefix"; then + i386|x86_64) + echo "cpu_family = 'x86'" >> $cross + ;; ++ ppcle) ++ echo "cpu_family = 'ppc'" >> $cross ++ ;; + ppc64le) + echo "cpu_family = 'ppc64'" >> $cross + ;; +diff --git default-configs/targets/ppcle-linux-user.mak default-configs/targets/ppcle-linux-user.mak +new file mode 100644 +index 0000000..2259243 +--- /dev/null ++++ default-configs/targets/ppcle-linux-user.mak +@@ -0,0 +1,4 @@ ++TARGET_ARCH=ppc ++TARGET_SYSTBL_ABI=common,nospu,32 ++TARGET_SYSTBL=syscall.tbl ++TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml +diff --git linux-user/ppc/target_syscall.h linux-user/ppc/target_syscall.h +index b9c4b81..cf26497 100644 +--- linux-user/ppc/target_syscall.h ++++ linux-user/ppc/target_syscall.h +@@ -65,7 +65,11 @@ struct target_revectored_struct { + #define UNAME_MACHINE "ppc64le" + #endif + #else ++#ifdef TARGET_WORDS_BIGENDIAN + #define UNAME_MACHINE "ppc" ++#else ++#define UNAME_MACHINE "ppcle" ++#endif + #endif + #define UNAME_MINIMUM_RELEASE "2.6.32" + +diff --git scripts/qemu-binfmt-conf.sh scripts/qemu-binfmt-conf.sh +index 9f1580a..393943f 100755 +--- scripts/qemu-binfmt-conf.sh ++++ scripts/qemu-binfmt-conf.sh +@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x + ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + ppc_family=ppc + ++ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00' ++ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00' ++ppc_family=ppcle ++ + ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15' + ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' + ppc64_family=ppc +@@ -148,7 +152,7 @@ qemu_get_family() { + "Power Macintosh"|ppc64|powerpc|ppc) + echo "ppc" + ;; +- ppc64el|ppc64le) ++ ppc64el|ppc64le|ppcel|ppcle) + echo "ppcle" + ;; + arm|armel|armhf|arm64|armv[4-9]*l|aarch64) +diff --git tests/tcg/configure.sh tests/tcg/configure.sh +index e1b70e2..e07f5fe 100755 +--- tests/tcg/configure.sh ++++ tests/tcg/configure.sh +@@ -59,6 +59,8 @@ fi + : $(cross_cc_mips="mips-linux-gnu-gcc") + : ${cross_cc_ppc="powerpc-linux-gnu-gcc"} + : ${cross_cc_cflags_ppc="-m32"} ++: ${cross_cc_ppcle="powerpcle-linux-gnu-gcc"} ++: ${cross_cc_cflags_ppcle="-m32"} + : ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"} + : ${cross_cc_ppc64le="powerpc64le-linux-gnu-gcc"} + : $(cross_cc_riscv64="riscv64-linux-gnu-gcc") +-- +2.30.1 + diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template index ae18a557078..83e43ff5cba 100644 --- a/srcpkgs/qemu/template +++ b/srcpkgs/qemu/template @@ -2,7 +2,7 @@ # This package should be updated together with qemu-user-static pkgname=qemu version=5.2.0 -revision=1 +revision=2 build_style=configure hostmakedepends="gettext pkg-config perl python3 automake libtool flex python3-Sphinx texinfo ninja"