GNU bug report logs - #45742
[PATCH] gnu: Add x86emu.

Previous Next

Package: guix-patches;

Reported by: Vincent Legoll <vincent.legoll <at> gmail.com>

Date: Sat, 9 Jan 2021 14:31:01 UTC

Severity: normal

Tags: patch

Done: Vincent Legoll <vincent.legoll <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45742 in the body.
You can then email your comments to 45742 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 14:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Legoll <vincent.legoll <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 09 Jan 2021 14:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vincent Legoll <vincent.legoll <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Vincent Legoll <vincent.legoll <at> gmail.com>
Subject: [PATCH] gnu: Add x86emu.
Date: Sat,  9 Jan 2021 15:30:38 +0100
* gnu/packages/linux.scm (x86emu): New variable.
---
 gnu/packages/linux.scm | 45 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 8317723bbf..cb712dd8a4 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -74,6 +74,7 @@
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages assembly)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
@@ -98,6 +99,7 @@
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
@@ -5767,6 +5769,49 @@ not as a replacement for it.")
                    license:public-domain        ; nist/dfft.c
                    license:gpl3+))))            ; everything else
 
+(define-public x86emu
+  (let ((revision "0")
+        (commit "cbc65a99d0f7d291b7c72444b8afa71649d214c4"))
+    (package
+      (name "x86emu")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/shift-crops/x86emu")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "16q69m5zb71pgwsw5w0ilkd0vqh0hrmgq10fqba3x604chb90a87"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f         ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (invoke "make" "all")))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (outbin (string-append out "/bin")))
+               (mkdir-p outbin)
+               (copy-file "x86emu" (string-append outbin "/x86emu"))
+               (copy-recursively "include" (string-append out "/include"))
+               #t))))))
+    (native-inputs
+     `(("nasm" ,nasm)))
+    (inputs
+     `(("glfw" ,glfw)))
+    (home-page "https://github.com/shift-crops/x86emu")
+    (synopsis "simple x86 emulator")
+    (description "x86emu is an emulator of the x86 architecture.  It supports
+multiple CPU modes (16bit/32bit, Real/Protected), and some devices.  You can
+boot via FDD simulator (DMA not supported), and operate with mouse and keyboard.")
+    (license license:x11))))
+
 (define-public ecryptfs-utils
   (package
     (name "ecryptfs-utils")
-- 
2.30.0





Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 14:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 45742 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Legoll <vincent.legoll <at> gmail.com>
To: 45742 <at> debbugs.gnu.org
Subject: [PATCH] gnu: Add x86emu.
Date: Sat, 9 Jan 2021 15:40:19 +0100
The repo has no releases.
So I used the "0.0.0" version.

-- 
Vincent Legoll




Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 15:50:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Vincent Legoll <vincent.legoll <at> gmail.com>
Cc: 45742 <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 09 Jan 2021 16:49:24 +0100
[Message part 1 (text/plain, inline)]
Vincent,

Vincent Legoll 写道:
> * gnu/packages/linux.scm (x86emu): New variable.

I don't see the connection to Linux.  How about emulators.scm?

> +(define-public x86emu

There's at least one other x86emu (declared obsolete upstream[0]) 
and I wouldn't be surprised if there were twenty.  But if (this) 
upstream insists on such a generic name, so be it.

What's your use case for this package?  Is it a fun hack, or more?

> +         (replace 'build
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (invoke "make" "all")))

The ‘all’ is presumably to build the ‘os’ (bios + sample kernel) 
images, but they aren't installed below.  Is that intentional?

The emulator is useless without them:

 $ x86emu
 [WARN] run_emulator (main.cpp:141) cannot load image
 'sample/kernel.img'
 Segmentation fault

 $ x86emu .../sample/kernel.img
 [hangs]

 $ strace x86emu .../sample/kernel.img
 [...]
 openat(AT_FDCWD, "bios/bios.bin", O_RDONLY) = -1 ENOENT
 openat(AT_FDCWD, "bios/crt0.bin", O_RDONLY) = -1 ENOENT
 [hangs]

Put them in a separate :os output if you like[1].

> +         (replace 'install
> +           (lambda* (#:key inputs outputs #:allow-other-keys)

‘inputs’ is unused.

> +             (let* ((out (assoc-ref outputs "out"))
> +                    (outbin (string-append out "/bin")))

Subjective nitpick: please just call this ‘bin’ :-)

> +               (mkdir-p outbin)
> +               (copy-file "x86emu" (string-append outbin 
> "/x86emu"))

These two lines can be replaced with the simpler:

 (install-file "x86emu" bin)

> +               (copy-recursively "include" (string-append out 
> "/include"))
> +               #t))))))
> +    (native-inputs
> +     `(("nasm" ,nasm)))
> +    (inputs
> +     `(("glfw" ,glfw)))
> +    (home-page "https://github.com/shift-crops/x86emu")
> +    (synopsis "simple x86 emulator")

Running ‘guix lint x86emu’ will point out possible issues, like 
this lowercase s.

> +    (description "x86emu is an emulator of the x86 
> architecture.  It supports
> +multiple CPU modes (16bit/32bit, Real/Protected), and some 
> devices.  You can
> +boot via FDD simulator (DMA not supported), and operate with 
> mouse and keyboard.")
> +    (license license:x11))))

This should be ‘expat’.  The X11 variant is extremely rare.

I made these changes (and a few more) in the attached patch and 
the emulator starts, but hangs on a black screen with

 [WARN] hundle_interrupt (interrupt.cpp:40) exception interrupt 
 11 (!idt.P)

looped on stderr.  I didn't look into it.

Thanks!

T G-R

[0]: 
https://web.archive.org/web/20090218022239/http://www.scitechsoft.com/products/dev/x86_emulator.html
[1]: I'm not sure where they belong.  They're x86 but 
‘architecture independent’ from the host's point of view so I put 
them in /share nonetheless.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 15:50:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 15:52:02 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Vincent Legoll <vincent.legoll <at> gmail.com>
Cc: 45742 <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 09 Jan 2021 16:51:21 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice 写道:
> the attached patch

[0001-gnu-Add-x86emu.patch (text/x-patch, inline)]
From 6a74a2447e0e1f624903d468376542d785558986 Mon Sep 17 00:00:00 2001
From: Vincent Legoll <vincent.legoll <at> gmail.com>
Date: Sat, 9 Jan 2021 15:30:38 +0100
Subject: [PATCH] gnu: Add x86emu.

* gnu/packages/emulators.scm (x86emu): New variable.

Signed-off-by: Tobias Geerinckx-Rice <me <at> tobias.gr>
---
 gnu/packages/emulators.scm | 62 ++++++++++++++++++++++++++++++++++++++
 gnu/packages/linux.scm     |  2 ++
 2 files changed, 64 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 1d94090f48..785d464273 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2019 David Wilson <david <at> daviwil.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2020 Christopher Howard <christopher <at> librehacker.com>
+;;; Copyright © 2021 Vincent Legoll <vincent.legoll <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2236,3 +2237,64 @@ framework based on QEMU.")
      "PPSSPP is a ``high-level'' emulator simulating the PSP operating
 system.")
     (license license:gpl2+)))
+
+(define-public x86emu
+  (let ((revision "0")
+        (commit "cbc65a99d0f7d291b7c72444b8afa71649d214c4"))
+    (package
+      (name "x86emu")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/shift-crops/x86emu")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "16q69m5zb71pgwsw5w0ilkd0vqh0hrmgq10fqba3x604chb90a87"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'set-image-file-names
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (os  (string-append out "/share/x86emu")))
+               (substitute* "main.cpp"
+                 (("sample/kernel\\.img|bios/(bios|crt0)\\.bin" file)
+                  (string-append os "/" file)))
+               #t)))
+         (delete 'configure)            ; no configure script
+         (replace 'build
+           ;; Also build the ‘os’ target with kernel & BIOS images.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (invoke "make" "all")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (os  (string-append out "/share/x86emu")))
+               (invoke "find")
+               (install-file "x86emu" bin)
+               (copy-recursively "include" (string-append out "/include"))
+               (for-each (lambda (file)
+                           (install-file file (string-append os "/bios")))
+                         (find-files "bios" "\\.bin$"))
+               (for-each (lambda (file)
+                           (install-file file (string-append os "/sample")))
+                         (find-files "sample" "\\.img$"))
+               #t))))))
+    (native-inputs
+     `(("nasm" ,nasm)))
+    (inputs
+     `(("glfw" ,glfw)))
+    (home-page "https://github.com/shift-crops/x86emu")
+    (synopsis "Simple x86 emulator")
+    (description
+     "x86emu is an emulator of the x86 architecture.  It supports multiple CPU
+modes (16- and 32-bit, real/protected) and some devices.  You can boot from a
+simulated floppy disk drive without DMA support and operate it with the mouse
+and keyboard.  The package includes a light-weight BIOS and kernel image.")
+    (license license:expat))))
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 6c2556e91a..449258ad50 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -74,6 +74,7 @@
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages assembly)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
@@ -98,6 +99,7 @@
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
-- 
2.30.0

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 15:52:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 16:16:02 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Tobias Geerinckx-Rice via Guix-patches <guix-patches <at> gnu.org>
Cc: Vincent Legoll <vincent.legoll <at> gmail.com>, 45742 <at> debbugs.gnu.org
Subject: Re: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 9 Jan 2021 17:15:21 +0100
On Sat, Jan 09, 2021 at 04:49:24PM +0100, Tobias Geerinckx-Rice via Guix-patches via wrote:
> > +(define-public x86emu
> 
> There's at least one other x86emu (declared obsolete upstream[0]) and I
> wouldn't be surprised if there were twenty.  But if (this) upstream insists
> on such a generic name, so be it.

Another x86emu is part of xorg-server’s non-installed sources and used
by the v86d Guix package which is used by the uvesafb driver in the
Linux kernel.

Anyway, I suppose the name x86emu is fine for this package.

Regards,
Florian




Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 16:16:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 20:31:02 GMT) Full text and rfc822 format available.

Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: Vincent Legoll <vincent.legoll <at> gmail.com>, 45742 <at> debbugs.gnu.org,
 Tobias Geerinckx-Rice via Guix-patches <guix-patches <at> gnu.org>
Subject: Re: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 09 Jan 2021 21:30:37 +0100
[Message part 1 (text/plain, inline)]
pelzflorian (Florian Pelz) 写道:
> Another x86emu is part of xorg-server’s non-installed sources 
> and used
> by the v86d Guix package which is used by the uvesafb driver in 
> the
> Linux kernel.

Thanks, v86d's x86emu's the one I was thinking of.

At second glance my link above appears to be non-free.  Apologies. 
I got there through another GNU/Linux distribution's repository.

Or how running only FSDG ones can make you complacent :-)

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sat, 09 Jan 2021 20:31:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sun, 10 Jan 2021 10:33:02 GMT) Full text and rfc822 format available.

Message #35 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vincent Legoll <vincent.legoll <at> gmail.com>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>,
 Tobias Geerinckx-Rice via Guix-patches <guix-patches <at> gnu.org>,
 45742 <at> debbugs.gnu.org
Subject: Re: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sun, 10 Jan 2021 11:31:58 +0100
Hello,

I packaged this one by mistake, as another package needed
something x86emu as a dependency, and I only saw afterwards
that it was libx86emu instead of this.

But having done the packaging work, I just submitted it
anyways.

I'll try to finish the work properly for this one, but its
priority is lower (not that I have a real need for any of
those, just looking at repology as a source for missing
things in guix).

Yeah, I know it's not terribly useful, but...

-- 
Vincent Legoll




Information forwarded to guix-patches <at> gnu.org:
bug#45742; Package guix-patches. (Sun, 10 Jan 2021 10:33:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 45742 <at> debbugs.gnu.org and Vincent Legoll <vincent.legoll <at> gmail.com> Request was from Vincent Legoll <vincent.legoll <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 26 Jun 2023 18:42:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 25 Jul 2023 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 267 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.