[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] Need help adding a custom module (for GPIO) to Solo5 & MirageOS

  • To: mirageos-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hugues Fafard <fafardh@xxxxxxxxx>
  • Date: Tue, 8 Oct 2019 00:01:27 +0200
  • Autocrypt: addr=fafardh@xxxxxxxxx; prefer-encrypt=mutual; keydata= mDMEWBnFJhYJKwYBBAHaRw8BAQdAFlAEi/OSkzV/bKw5k8oVz9MV1gLBC7p+c652Xk1nWgu0 IUh1Z3VlcyBGYWZhcmQgPGZhZmFyZGhAcG9zdGVvLmRlPoiYBBMWCABAAhsDAh4BAheAAhkB BAsJCAcFFQoJCAsFFgIDAQAWIQSO/uRavtv0DUpdPkyJ0wfIiccs0AUCXDYi0QUJBfMFKwAK CRCJ0wfIiccs0P/gAP9c6HEavry5KPF4RXxCg3k+1mRuMX845o3GmWdko+JxQgEAgZcYxDFX 2xDJuB4nhPprUl6F7DMVPslZUfKo5vMIygi4OARYH0dvEgorBgEEAZdVAQUBAQdAEAamaSQR FOLnYeTQCHEbd/LmxHMI2WI/+zWuj0ueRxEDAQgHiH4EGBYIACYCGwwWIQSO/uRavtv0DUpd PkyJ0wfIiccs0AUCXDYi0QUJBe2C4gAKCRCJ0wfIiccs0DsGAQCBt8a5eWKuQddaSruy8spk LVZglclfGmIR0upiBg31zAEAn1ZIB1iXngVoHAVASQkW7Iu5Koot4hH3XCvR7+lL4go=
  • Delivery-date: Mon, 07 Oct 2019 22:01:48 +0000
  • List-id: Developer list for MirageOS <mirageos-devel.lists.xenproject.org>
  • Openpgp: preference=signencrypt

Hello all,

I'm currently attempting to add a custom module to Solo5 & MirageOS to
make it possible to access the host's GPIO interface from the unikernel.
However, I am currently stuck. I believe, the only thing that's missing
is some more "glue" to connect everything together, but I can't figure
out what exactly, so I'm reaching out to you all in the hope that
someone can help me.

Before starting on what I've done so far, I'd like to mention that I
forked the code from the latest stable tag when I started with this,
which was v0.4.1 at the time. I've seen a lot of changes on the v0.6.*
tags since then, but I want to get this working before figuring out what
I'd have to change to port this to v0.6.

What I've done in the 'solo5' repository:
* Added 'tenders/hvt/hvt_module_gpio.c' with code to access GPIO
* Added hypercalls & their structs to 'include/solo5/hvt_abi.h'
* Added references to the new module to `tenders/hvt/hvt_core.c`,
'tenders/hvt/hvt.h', and 'tneders/hvt/GNUmakefile'
* Added 'bindings/hvt/gpio.c' with stubs calling the hypercalls & added
that file to 'bindings/GNUmakefile'
* Added functions headers to 'include/solo5/solo5.h'

What I've done in the 'mirage-solo5' repository:
* Added 'lib/bindings/solo5_gpio_stubs.c' with the C-side of ocaml
bindings to the stubs from 'solo5/bindings/hvt/gpio.c'
* Added a reference to those new bindings in

What I've done in the 'mirage-gpio' repository:
* Tried adding a module signature for GPIO devices, modelled after a
stripped down version of 'mirage-block'

What I've done in the 'mirage-gpio-solo5' repository:
* Tried adding an implementation of 'mirage-gpio' using the new bindings
from 'mirage-solo5'. This modelled after a stripped down version of

I've thrown all of the code together into a monorepo for the time being,
which is available at
so you can have a look for yourselves.

I'm fairly certain that it's correct up to and including the changes to
the 'mirage-solo5' repository. I think the issue is probably in the
'mirage-gpio' or 'mirage-gpio-solo5' repos. Or maybe I have to tweak the
'mirage' repo too? This is where it gets fuzzy, escpecially since I
can't OCAML. (Best approximation is Haskell, which is the only other
function language I've worked with so far)

I really hope someone can help me out here or at least point me in the
right direction. In any case thanks for reading this far and after that
wall of text, have a nice evening everyone.


MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.