ports: Add qemu port

This commit is contained in:
Bananymous 2025-08-21 03:08:18 +03:00
parent 214e7a5672
commit 0ff365c7f0
6 changed files with 150 additions and 0 deletions

17
ports/qemu/build.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash ../install.sh
NAME='qemu'
VERSION='10.0.2'
DOWNLOAD_URL="https://download.qemu.org/qemu-$VERSION.tar.xz#ef786f2398cb5184600f69aef4d5d691efd44576a3cff4126d38d4c6fec87759"
DEPENDENCIES=('glib' 'SDL2')
MAKE_BUILD_TARGETS=('qemu-system-x86_64')
CONFIGURE_OPTIONS=(
'--cross-prefix='
'--target-list=x86_64-softmmu'
'--disable-tpm'
'--disable-docs'
)
pre_configure() {
echo '' > tests/meson.build
}

View File

@ -0,0 +1,12 @@
diff -ruN qemu-10.0.2/configure qemu-10.0.2-banan_os/configure
--- qemu-10.0.2/configure 2025-05-29 01:05:46.000000000 +0300
+++ qemu-10.0.2-banan_os/configure 2025-05-31 00:03:10.361102831 +0300
@@ -360,6 +360,8 @@
host_os=netbsd
elif check_define __APPLE__; then
host_os=darwin
+elif check_define __banan_os__; then
+ host_os=banan_os
else
# This is a fatal error, but don't report it yet, because we
# might be going to just print the --help text, or it might

View File

@ -0,0 +1,43 @@
diff -ru qemu-10.0.2/util/oslib-posix.c qemu-10.0.2-x86_64/util/oslib-posix.c
--- qemu-10.0.2/util/oslib-posix.c 2025-05-29 01:05:47.000000000 +0300
+++ qemu-10.0.2-x86_64/util/oslib-posix.c 2025-08-18 02:38:04.839116456 +0300
@@ -128,7 +128,39 @@
int qemu_daemon(int nochdir, int noclose)
{
+#if defined(__banan_os__)
+ const pid_t pid = fork();
+ if (pid == -1) {
+ return -1;
+ }
+ if (pid > 0) {
+ exit(0);
+ }
+
+ if (setsid() == -1) {
+ return -1;
+ }
+
+ if (nochdir == 0) {
+ if (chdir("/") == -1) {
+ return -1;
+ }
+ }
+
+ if (noclose == 0) {
+ int fd = open("/dev/null", O_RDWR);
+ if (fd == -1) {
+ return -1;
+ }
+ dup2(fd, STDIN_FILENO);
+ dup2(fd, STDOUT_FILENO);
+ dup2(fd, STDERR_FILENO);
+ }
+
+ return 0;
+#else
return daemon(nochdir, noclose);
+#endif
}
bool qemu_write_pidfile(const char *path, Error **errp)

View File

@ -0,0 +1,24 @@
diff -ru qemu-10.0.2/util/main-loop.c qemu-10.0.2-x86_64/util/main-loop.c
--- qemu-10.0.2/util/main-loop.c 2025-05-29 01:05:47.000000000 +0300
+++ qemu-10.0.2-x86_64/util/main-loop.c 2025-08-09 18:35:25.670990547 +0300
@@ -95,8 +95,10 @@
* not catch it reliably.
*/
sigemptyset(&set);
+#if !defined(__banan_os__)
sigaddset(&set, SIG_IPI);
sigaddset(&set, SIGIO);
+#endif
sigaddset(&set, SIGALRM);
sigaddset(&set, SIGBUS);
/* SIGINT cannot be handled via signalfd, so that ^C can be used
@@ -106,7 +108,9 @@
*/
pthread_sigmask(SIG_BLOCK, &set, NULL);
+#if !defined(__banan_os__)
sigdelset(&set, SIG_IPI);
+#endif
sigfd = qemu_signalfd(&set);
if (sigfd == -1) {
error_setg_errno(errp, errno, "failed to create signalfd");

View File

@ -0,0 +1,22 @@
diff -ru qemu-10.0.2/net/colo.c qemu-10.0.2-x86_64/net/colo.c
--- qemu-10.0.2/net/colo.c 2025-05-29 01:05:46.000000000 +0300
+++ qemu-10.0.2-x86_64/net/colo.c 2025-08-09 19:24:57.624758915 +0300
@@ -123,14 +123,18 @@
case IPPROTO_TCP:
case IPPROTO_UDP:
case IPPROTO_DCCP:
+#if !defined(__banan_os__)
case IPPROTO_ESP:
+#endif
case IPPROTO_SCTP:
case IPPROTO_UDPLITE:
tmp_ports = *(uint32_t *)(pkt->transport_header);
break;
+#if !defined(__banan_os__)
case IPPROTO_AH:
tmp_ports = *(uint32_t *)(pkt->transport_header + 4);
break;
+#endif
default:
break;
}

View File

@ -0,0 +1,32 @@
diff -ru qemu-10.0.2/block/file-posix.c qemu-10.0.2-x86_64/block/file-posix.c
--- qemu-10.0.2/block/file-posix.c 2025-05-29 01:05:46.000000000 +0300
+++ qemu-10.0.2-x86_64/block/file-posix.c 2025-08-09 19:00:18.062695074 +0300
@@ -110,6 +110,10 @@
#include <sys/diskslice.h>
#endif
+#ifdef __banan_os__
+#include <sys/ioctl.h>
+#endif
+
/* OS X does not have O_DSYNC */
#ifndef O_DSYNC
#ifdef O_SYNC
Only in qemu-10.0.2-x86_64: build
Only in qemu-10.0.2-x86_64: .cache
diff -ru qemu-10.0.2/chardev/char-pty.c qemu-10.0.2-x86_64/chardev/char-pty.c
--- qemu-10.0.2/chardev/char-pty.c 2025-05-29 01:05:46.000000000 +0300
+++ qemu-10.0.2-x86_64/chardev/char-pty.c 2025-08-09 19:03:07.909515897 +0300
@@ -236,7 +236,11 @@
# include <termios.h>
#endif
-#ifdef __sun__
+#if defined(__banan_os__)
+# include <sys/ioctl.h>
+#endif
+
+#if defined(__sun__) || defined(__banan_os__)
#if !defined(HAVE_OPENPTY)
/* Once illumos has openpty(), this is going to be removed. */