commit: 171fc7752185f5a24293d995966999f06d23448b
parent 7061b93e655fe28ceeaef7836614af65b37b0d1f
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 17 Oct 2018 16:55:23 -0700
Add tinyemu 2018-09-23
Diffstat:
8 files changed, 96 insertions(+), 0 deletions(-)
diff --git a/pkg/gen.lua b/pkg/gen.lua
@@ -87,6 +87,7 @@ subgen 'syslinux'
subgen 'terminus-font'
subgen 'texi2mdoc'
subgen 'the_silver_searcher'
+subgen 'tinyemu'
subgen 'transmission'
subgen 'tz'
subgen 'ubase'
diff --git a/pkg/tinyemu/.gitignore b/pkg/tinyemu/.gitignore
@@ -0,0 +1,2 @@
+/src
+/tinyemu-2018-09-23.tar.gz
+\ No newline at end of file
diff --git a/pkg/tinyemu/gen.lua b/pkg/tinyemu/gen.lua
@@ -0,0 +1,25 @@
+cflags{
+ '-D _GNU_SOURCE',
+ '-D CONFIG_RISCV_MAX_XLEN=64',
+ '-D CONFIG_SLIRP',
+ [[-D 'CONFIG_VERSION="2018-09-23"']],
+}
+
+build('cc', '$outdir/riscv_cpu32.o', '$srcdir/riscv_cpu.c', {cflags='$cflags -DMAX_XLEN=32'})
+build('cc', '$outdir/riscv_cpu64.o', '$srcdir/riscv_cpu.c', {cflags='$cflags -DMAX_XLEN=64'})
+
+exe('temu', [[
+ virtio.c pci.c fs.c cutils.c iomem.c simplefb.c
+ json.c machine.c temu.c
+ slirp/(
+ bootp.c ip_icmp.c mbuf.c slirp.c tcp_output.c cksum.c ip_input.c
+ misc.c socket.c tcp_subr.c udp.c if.c ip_output.c sbuf.c
+ tcp_input.c tcp_timer.c
+ )
+ fs_disk.c
+ riscv_machine.c softfp.c riscv_cpu32.o riscv_cpu64.o
+ x86_cpu.c x86_machine.c ide.c ps2.c vmmouse.c pckbd.c vga.c
+]])
+file('bin/temu', '755', '$outdir/temu')
+
+fetch 'curl'
diff --git a/pkg/tinyemu/patch/0001-Include-sys-select.h-from-virtio.h-for-fd_set.patch b/pkg/tinyemu/patch/0001-Include-sys-select.h-from-virtio.h-for-fd_set.patch
@@ -0,0 +1,25 @@
+From 262d679517a8867f38e15369414a6cabe897ccb1 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Wed, 17 Oct 2018 16:48:16 -0700
+Subject: [PATCH] Include sys/select.h from virtio.h for fd_set
+
+---
+ virtio.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/virtio.h b/virtio.h
+index 92b1070..d53c8c4 100644
+--- a/virtio.h
++++ b/virtio.h
+@@ -24,6 +24,8 @@
+ #ifndef VIRTIO_H
+ #define VIRTIO_H
+
++#include <sys/select.h>
++
+ #include "iomem.h"
+ #include "pci.h"
+
+--
+2.19.0
+
diff --git a/pkg/tinyemu/patch/0002-Fix-ram-size-2048-MiB.patch b/pkg/tinyemu/patch/0002-Fix-ram-size-2048-MiB.patch
@@ -0,0 +1,39 @@
+From 2554a4ba54ce78fd3c568bb74bdaa626935dc152 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Wed, 17 Oct 2018 16:49:06 -0700
+Subject: [PATCH] Fix ram size >= 2048 MiB
+
+---
+ machine.c | 2 +-
+ temu.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/machine.c b/machine.c
+index eab92b4..bc8edac 100644
+--- a/machine.c
++++ b/machine.c
+@@ -260,7 +260,7 @@ static int virt_machine_parse_config(VirtMachineParams *p,
+ tag_name = "memory_size";
+ if (vm_get_int(cfg, tag_name, &val) < 0)
+ goto tag_fail;
+- p->ram_size = val << 20;
++ p->ram_size = (uint64_t)val << 20;
+
+ tag_name = "bios";
+ if (vm_get_str_opt(cfg, tag_name, &str) < 0)
+diff --git a/temu.c b/temu.c
+index e8886ff..a5eba31 100644
+--- a/temu.c
++++ b/temu.c
+@@ -719,7 +719,7 @@ int main(int argc, char **argv)
+ /* override some config parameters */
+
+ if (ram_size > 0) {
+- p->ram_size = ram_size << 20;
++ p->ram_size = (uint64_t)ram_size << 20;
+ }
+ if (accel_enable != -1)
+ p->accel_enable = accel_enable;
+--
+2.19.0
+
diff --git a/pkg/tinyemu/rev b/pkg/tinyemu/rev
@@ -0,0 +1 @@
+1
diff --git a/pkg/tinyemu/sha256 b/pkg/tinyemu/sha256
@@ -0,0 +1 @@
+9b58d5521df8356c3be09a520387d3e4adcb510cf8d2fd6bdd971287bd57d734 tinyemu-2018-09-23.tar.gz
diff --git a/pkg/tinyemu/url b/pkg/tinyemu/url
@@ -0,0 +1 @@
+url = "https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz"