[bug#34758,2/4] gnu: Add vhba.

Message ID 20190305172853.21358-1-mail@ambrevar.xyz
State Accepted
Headers show
Series [bug#34758,1/4] gnu: Add libmirage. | expand

Checks

Context Check Description
cbaines/comparison success View comparison
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

Pierre Neidhardt March 5, 2019, 5:28 p.m. UTC
* gnu/packages/cdrom.scm (vhba): New variable.
---
 gnu/packages/cdrom.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Ludovic Courtès March 22, 2019, 9:12 p.m. UTC | #1
Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> * gnu/packages/cdrom.scm (vhba): New variable.

[...]

> +       (modify-phases %standard-phases
> +         ;; TODO: Compress kernel modules?
> +         ;; TODO: Build does not work because it needs the Makefile in
> +         ;; /lib/modules/$(KERNELRELEASE)/build which we don't ship in Guix.
> +         (delete 'configure))))

So it doesn’t build, right?  In that case I’d rather not add it.  :-)

It’s true that /build is a dangling link:

--8<---------------cut here---------------start------------->8---
$ readlink $(guix build linux-libre)/lib/modules/5.0.2-gnu/build
/tmp/guix-build-linux-libre-5.0.2.drv-0/linux-5.0.2
--8<---------------cut here---------------end--------------->8---

Ludo’.
Pierre Neidhardt March 22, 2019, 9:24 p.m. UTC | #2
I should have explained a little bit more: the whole patchset makes no
sense (beside libmirage) without this kernel module.  CDEmu needs it or
it won't run.

This raises a general, important question: how do we build kernel
modules on guix?  At the moment, it seems that it's only possible by
re-building the kernel.

I suggest we add a "build" output to the kernel  that can be used as an
input to build kernel modules.  Maybe I should should an email to
guix-devel to ask for more opinions / advice.
Pierre Neidhardt March 22, 2019, 9:27 p.m. UTC | #3
Also see my other email from Tue, 05 Mar 2019 18:44:25 +0100 in this thread.
Ludovic Courtès March 23, 2019, 2:52 p.m. UTC | #4
Hello,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> I should have explained a little bit more: the whole patchset makes no
> sense (beside libmirage) without this kernel module.  CDEmu needs it or
> it won't run.

Oh I see, I didn’t know that.

> This raises a general, important question: how do we build kernel
> modules on guix?  At the moment, it seems that it's only possible by
> re-building the kernel.

… or maybe just unpacking the kernel source so you have the makefile
snippet around?  Perhaps that’s enough?

I’m generally dubious about out-of-tree modules.  Given the way kernel
development works, we’re often talking about modules of poor quality, or
proprietary modules.  Do you know the reason this one is not in the main
tree?

> I suggest we add a "build" output to the kernel  that can be used as an
> input to build kernel modules.  Maybe I should should an email to
> guix-devel to ask for more opinions / advice. 

Yes, sounds like a good idea.

Thanks,
Ludo’.
Pierre Neidhardt March 25, 2019, 8:35 a.m. UTC | #5
Ludovic Courtès <ludo@gnu.org> writes:

>> This raises a general, important question: how do we build kernel
>> modules on guix?  At the moment, it seems that it's only possible by
>> re-building the kernel.
>
> … or maybe just unpacking the kernel source so you have the makefile
> snippet around?  Perhaps that’s enough?

Nope, because we need the "build" folder which is only available after
building the kernel.  Re-building the kernel just to build a module
sounds like a waste of time :p

> I’m generally dubious about out-of-tree modules.  Given the way kernel
> development works, we’re often talking about modules of poor quality, or
> proprietary modules.  Do you know the reason this one is not in the main
> tree?

I don't.  I'll investigate a bit.

Anyways, I think it's nice as a _free software distribution_ to make it
accessible to the user to build custom modules.

>> I suggest we add a "build" output to the kernel  that can be used as an
>> input to build kernel modules.  Maybe I should should an email to
>> guix-devel to ask for more opinions / advice. 
>
> Yes, sounds like a good idea.

Will do!
Ludovic Courtès March 25, 2019, 9:10 p.m. UTC | #6
Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> This raises a general, important question: how do we build kernel
>>> modules on guix?  At the moment, it seems that it's only possible by
>>> re-building the kernel.
>>
>> … or maybe just unpacking the kernel source so you have the makefile
>> snippet around?  Perhaps that’s enough?
>
> Nope, because we need the "build" folder which is only available after
> building the kernel.  Re-building the kernel just to build a module
> sounds like a waste of time :p

I wasn’t suggesting a kernel rebuild.  I thought that perhaps it’s
enough to use the makefiles and build machinery directly from the kernel
source tree, without rebuilding the kernel itself.  Dunno if that’s possible.

>> I’m generally dubious about out-of-tree modules.  Given the way kernel
>> development works, we’re often talking about modules of poor quality, or
>> proprietary modules.  Do you know the reason this one is not in the main
>> tree?
>
> I don't.  I'll investigate a bit.
>
> Anyways, I think it's nice as a _free software distribution_ to make it
> accessible to the user to build custom modules.

I agree, no argument here.  :-)

Thanks,
Ludo’.

Patch

diff --git a/gnu/packages/cdrom.scm b/gnu/packages/cdrom.scm
index 846ce705b..67b234e47 100644
--- a/gnu/packages/cdrom.scm
+++ b/gnu/packages/cdrom.scm
@@ -888,3 +888,31 @@  CD data, and more.  It's mostly compatible with @code{cdrtools}.")
 in C and based on GLib.  Its aim is to provide uniform access to the data
 stored in various image formats.")
     (license gpl2+)))
+
+(define-public vhba-module
+  (package
+    (name "vhba-module")
+    (version "20170610")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://downloads.sourceforge.net/cdemu/vhba-module-"
+                    version ".tar.bz2"))
+              (sha256
+               (base32
+                "1v6r0bgx0a65vlh36b1l2965xybngbpga6rp54k4z74xk0zwjw3r"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; TODO: No tests?
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; TODO: Compress kernel modules?
+         ;; TODO: Build does not work because it needs the Makefile in
+         ;; /lib/modules/$(KERNELRELEASE)/build which we don't ship in Guix.
+         (delete 'configure))))
+    (home-page "https://cdemu.sourceforge.io/")
+    (synopsis "Kernel module that emulates SCSI devices")
+    (description "VHBA module provides a Virtual (SCSI) HBA, which is the link
+between the CDemu userspace daemon and linux kernel.")
+    (license gpl2+)))