GNU bug report logs - #40084
[PATCH] gnu: Add v86d.

Previous Next

Package: guix-patches;

Reported by: Florian Pelz <pelzflorian <at> pelzflorian.de>

Date: Sun, 15 Mar 2020 21:49:01 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <m.othacehe <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 40084 in the body.
You can then email your comments to 40084 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#40084; Package guix-patches. (Sun, 15 Mar 2020 21:49:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Florian Pelz <pelzflorian <at> pelzflorian.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 15 Mar 2020 21:49:01 GMT) Full text and rfc822 format available.

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

From: Florian Pelz <pelzflorian <at> pelzflorian.de>
To: guix-patches <at> gnu.org
Cc: Florian Pelz <pelzflorian <at> pelzflorian.de>
Subject: [PATCH] gnu: Add v86d.
Date: Sun, 15 Mar 2020 22:48:51 +0100
* gnu/packages/xorg.scm (v86d): New variable.
---
 gnu/packages/xorg.scm | 109 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index f951e565ff..be381adc43 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -21,6 +21,7 @@
 ;;; Copyright © 2019 nee <nee <at> cock.li>
 ;;; Copyright © 2019 Yoshinori Arai <kumagusu08 <at> gmail.com>
 ;;; Copyright © 2020 Leo Prikler <leo.prikler <at> student.tugraz.at>
+;;; Copyright © 2020 Florian Pelz <pelzflorian <at> pelzflorian.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3446,6 +3447,114 @@ X server.")
 X server.")
     (license license:x11)))
 
+(define-public v86d
+  (package
+    (name "v86d")
+    (version "0.1.10")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mjanusz/v86d.git")
+             (commit (string-append name "-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1c4iiggb5r9i2hxhk8c6q1m2vpfva39l1w33fsfkrz6fav6x34pp"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; remove bundled x86emu
+           (for-each delete-file
+                     (filter (lambda (name) ;keep customized Makefile
+                               (not (string-suffix? "Makefile" name)))
+                             (find-files "libs/x86emu")))
+           ;; remove non-working vbetest utility program (it is unnecessary)
+           (delete-file "libs/lrmi-0.10/vbe.h")
+           (delete-file "libs/lrmi-0.10/vbetest.c")
+           #t))))
+
+    ;; We keep the bundled copy of the Linux Real Mode Interface lrmi-0.10,
+    ;; because it includes fixes missing from upstream lrmi.  We do not use
+    ;; libx86, because we already use x86emu with the more current lrmi.
+
+    (inputs `(("xorg-server-sources" ,(package-source xorg-server)) ;for x86emu
+              ("xorgproto" ,xorgproto))) ;upstream x86emu uses X11/Xfuncproto.h
+    (outputs '("out" ;main v86d helper
+               "testvbe")) ;test program for listing video modes
+    (supported-systems '("i686-linux" "x86_64-linux"))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;there are no tests
+       #:modules ((guix build utils)
+                  (guix build gnu-build-system)
+                  (ice-9 popen))
+       #:phases
+       (modify-phases %standard-phases
+         ;; Replace the bundled x86emu with its upstream copy from Xorg-server:
+         (add-after 'unpack 'unpack-x86emu-sources
+           (lambda* (#:key inputs #:allow-other-keys)
+             (begin
+               (format #t "decompressing x86emu source code~%")
+               (with-directory-excursion "libs"
+                 (call-with-output-file "xorg-server.tar"
+                   (lambda (out)
+                     (let* ((xz (assoc-ref inputs "xz"))
+                            (srcs (assoc-ref inputs "xorg-server-sources"))
+                            (pipe (open-pipe* OPEN_READ
+                                              (string-append xz "/bin/xz")
+                                              "-cd" srcs)))
+                       (dump-port pipe out)
+                       (unless (= (status:exit-val (close-pipe pipe)) 0)
+                         (error "xz decompress failed")))))
+                 (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
+                         "xvf" "xorg-server.tar" "--strip-components=3"
+                         "--wildcards" "*/hw/xfree86/x86emu/")
+                 ;; extract license:
+                 (with-directory-excursion "x86emu"
+                   (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
+                           "xvf" "../xorg-server.tar" "--strip-components=1"
+                           "--wildcards" "*/COPYING"))
+                 (delete-file "xorg-server.tar")
+                 #t))))
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "CC" (which "gcc"))
+               (setenv "DESTDIR" out)
+               (invoke "./configure" "--with-x86emu"))))
+         (add-after 'build 'build-testvbe
+           (lambda _
+             (invoke "make" "testvbe")))
+         (add-after 'install 'install-testvbe
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((testvbe (assoc-ref outputs "testvbe"))
+                   (olddest (getenv "DESTDIR")))
+               (setenv "DESTDIR" testvbe)
+               (invoke "make" "install_testvbe")
+               (setenv "DESTDIR" olddest))))
+         (add-after 'install 'install-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc-dir (string-append out "/share/doc/v86d")))
+               (mkdir-p doc-dir)
+               (copy-file "README"
+                          (string-append doc-dir "/README"))
+               (copy-file "libs/lrmi-0.10/README"
+                          (string-append doc-dir "/README.lrmi"))
+               (copy-file "libs/x86emu/COPYING"
+                          (string-append doc-dir "/COPYING.xorg-server.x86emu"))
+               #t))))))
+    (home-page "https://github.com/mjanusz/v86d")
+    (synopsis "Userspace helper for uvesafb")
+    (description
+     "v86d provides a backend for kernel drivers that need to execute x86 BIOS
+code.  The code is executed in a controlled environment and the results are
+passed back to the kernel via the netlink interface.  v86d is required by the
+uvesafb Linux kernel module that provides an fbdev framebuffer when Kernel
+Mode Setting is unavailable.  It can be a last resort when no other Xorg X
+server driver works.")
+    (license (list license:gpl2
+                   license:x11)))) ;for bundled lrmi and x86emu
 
 (define-public xf86-video-vmware
   (package
-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#40084; Package guix-patches. (Thu, 19 Mar 2020 14:50:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Florian Pelz <pelzflorian <at> pelzflorian.de>
Cc: guix-patches <at> gnu.org
Subject: Re: [PATCH] gnu: Add v86d.
Date: Thu, 19 Mar 2020 15:49:08 +0100
[Message part 1 (text/plain, inline)]
On Sun, Mar 15, 2020 at 10:48:51PM +0100, Florian Pelz wrote:
> +         ;; Replace the bundled x86emu with its upstream copy from Xorg-server:
> +         (add-after 'unpack 'unpack-x86emu-sources
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (begin
> +               (format #t "decompressing x86emu source code~%")
> +               (with-directory-excursion "libs"
> +                 (call-with-output-file "xorg-server.tar"
> +                   (lambda (out)
> +                     (let* ((xz (assoc-ref inputs "xz"))
> +                            (srcs (assoc-ref inputs "xorg-server-sources"))
> +                            (pipe (open-pipe* OPEN_READ
> +                                              (string-append xz "/bin/xz")
> +                                              "-cd" srcs)))
> +                       (dump-port pipe out)
> +                       (unless (= (status:exit-val (close-pipe pipe)) 0)
> +                         (error "xz decompress failed")))))
> +                 (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
> +                         "xvf" "xorg-server.tar" "--strip-components=3"
> +                         "--wildcards" "*/hw/xfree86/x86emu/")
> +                 ;; extract license:
> +                 (with-directory-excursion "x86emu"
> +                   (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
> +                           "xvf" "../xorg-server.tar" "--strip-components=1"
> +                           "--wildcards" "*/COPYING"))
> +                 (delete-file "xorg-server.tar")
> +                 #t))))

I don't see why you're decompressing the tarball manually, this seems to
work just as well:

 (add-after 'unpack 'unpack-x86emu-sources
   (lambda* (#:key inputs #:allow-other-keys)
     (begin
       (format #t "decompressing x86emu source code~%")
       (with-directory-excursion "libs"
         (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
                 "xvf" (assoc-ref inputs "xorg-server-sources")
                 "--strip-components=3"
                 "--wildcards" "*/hw/xfree86/x86emu/")
         ;; extract license:
         (with-directory-excursion "x86emu"
           (invoke (string-append (assoc-ref inputs "tar") "/bin/tar")
                   "xvf" (assoc-ref inputs "xorg-server-sources")
                   "--strip-components=1"
                   "--wildcards" "*/COPYING"))
         #t))))

If it's about efficiency or robustness in some way, I'd suggest leaving
a comment detailing the reason. Either way, I'd bind the path to tar in
a `let', as well as the path to "xorg-server-sources" if we decide to
not decompress separately.

> +         (replace 'configure
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let ((out (assoc-ref outputs "out")))
> +               (setenv "CC" (which "gcc"))
> +               (setenv "DESTDIR" out)
> +               (invoke "./configure" "--with-x86emu"))))
> +         (add-after 'build 'build-testvbe
> +           (lambda _
> +             (invoke "make" "testvbe")))
> +         (add-after 'install 'install-testvbe
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let ((testvbe (assoc-ref outputs "testvbe"))
> +                   (olddest (getenv "DESTDIR")))
> +               (setenv "DESTDIR" testvbe)
> +               (invoke "make" "install_testvbe")
> +               (setenv "DESTDIR" olddest))))

These phases are missing the trailing #t.

I don't know how to test the package, but it passes lint & build,
including --rounds=2 to check for reproducibility.

Regards,
Jakub Kądziołka
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#40084; Package guix-patches. (Fri, 20 Mar 2020 08:41:01 GMT) Full text and rfc822 format available.

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

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: guix-patches <at> gnu.org
Subject: Re: [PATCH] gnu: Add v86d.
Date: Fri, 20 Mar 2020 09:40:00 +0100
On Thu, Mar 19, 2020 at 03:49:08PM +0100, Jakub Kądziołka wrote:
> I don't see why you're decompressing the tarball manually, this seems to
> work just as well:
> […]
> If it's about efficiency or robustness in some way, I'd suggest leaving
> a comment detailing the reason. Either way, I'd bind the path to tar in
> a `let', as well as the path to "xorg-server-sources" if we decide to
> not decompress separately.
> 

Your review is much appreciated.  Having tar do the decompression is
much better.  Before I had copied the decompression without checking
from my earlier patch for nginx-accept-language-module.  I think at
the time tar for some reason did not do auto-decompression when
building.  Or maybe manual decompression already was unnecessary back
then.

I have tested on multiple computers, sufficiently I believe, so I
pushed with your changes as e2303e8e375ed2e07c1fd760c86a204eb51fbc6e.
I also pushed similar changes to the decompression in
nginx-accept-language-module as e84490346d8dac3720a57a331f533ce67ff0da1c.


> > +         (replace 'configure
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let ((out (assoc-ref outputs "out")))
> > +               (setenv "CC" (which "gcc"))
> > +               (setenv "DESTDIR" out)
> > +               (invoke "./configure" "--with-x86emu"))))
> > +         (add-after 'build 'build-testvbe
> > +           (lambda _
> > +             (invoke "make" "testvbe")))
> > +         (add-after 'install 'install-testvbe
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let ((testvbe (assoc-ref outputs "testvbe"))
> > +                   (olddest (getenv "DESTDIR")))
> > +               (setenv "DESTDIR" testvbe)
> > +               (invoke "make" "install_testvbe")
> > +               (setenv "DESTDIR" olddest))))
> 
> These phases are missing the trailing #t.
>

I missed the #t for the install-testvbe phase.  Thank you!  According
to the docstring of

(define (invoke program . args)
  "Invoke PROGRAM with the given ARGS.  Raise an exception
if the exit code is non-zero; otherwise return #t."

in guix/build/utils.scm, invoke always returns #t, so I did not change
the phases ending in invoke.


> I don't know how to test the package, but it passes lint & build,
> including --rounds=2 to check for reproducibility.
> 
> Regards,
> Jakub Kądziołka

The important user of v86d is uvesafb.  uvesafb allows me to make Xorg
work on multiple computers of mine with

#!/bin/sh
modprobe uvesafb mode_option=1280x800-32 \
         v86d=/run/current-system/profile/sbin/v86d
chmod o+rw /dev/fb0
sleep 1
herd restart xorg-server


On many computers, the behavior can be tested when having a service

(set-xorg-configuration
 (xorg-configuration
  (modules
   (list xf86-video-fbdev
         xf86-input-libinput))))


and passing the kernel parameter 'nomodeset' e.g. in GRUB, because
then the framebuffer /dev/fb0 is only present when using uvesafb.

But I believe I have tested sufficiently.

Thank you!

Florian




bug closed, send any further explanations to 40084 <at> debbugs.gnu.org and Florian Pelz <pelzflorian <at> pelzflorian.de> Request was from Mathieu Othacehe <m.othacehe <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 21 Mar 2020 14:34:01 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. (Sun, 19 Apr 2020 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years ago.

Previous Next


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