* 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
The repo has no releases. So I used the "0.0.0" version. -- Vincent Legoll
[-- Attachment #1: Type: text/plain, Size: 2968 bytes --] 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. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --]
[-- Attachment #1.1: Type: text/plain, Size: 57 bytes --] Tobias Geerinckx-Rice 写道: > the attached patch [-- Attachment #1.2: 0001-gnu-Add-x86emu.patch --] [-- Type: text/x-patch, Size: 4631 bytes --] From 6a74a2447e0e1f624903d468376542d785558986 Mon Sep 17 00:00:00 2001 From: Vincent Legoll <vincent.legoll@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@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@daviwil.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com> +;;; Copyright © 2021 Vincent Legoll <vincent.legoll@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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --]
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
[-- Attachment #1: Type: text/plain, Size: 488 bytes --] 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --]
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