Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Raspberry Pi 4 target #1253

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add Raspberry Pi 4 target #1253

wants to merge 1 commit into from

Conversation

dinosaure
Copy link
Member

This draft is the integration of Gilbraltar, a bare-metal operating system for MirageOS & Raspberry Pi 4.
It requires mirage-dev#rpi4 which contains several packages to be able to craft a MirageOS for RPi4.

An example is available here as an usual MirageOS project. You can test it with:

$ cd unikernel
$ mirage configure -t rpi4
$ make depends
$ mirage build

Then, you are able to test it with qemu and a special patch which virtualize a RPi4 system. This is the full way to build & run the unikernel:

$ opam switch create 4.13.1
$ eval $(opam env)
$ opam remote add git+https://github.com/dinosaure/mirage-dev#rpi4
$ opam install mirage.4.0.0
$ git clone https://github.com/dinosaure/gilbraltar
$ cd gilbraltar/unikernel
$ mirage configure -t rpi4
$ make depends
$ mirage build
$ qemu-system-aarch64 -M raspi4 -nographic -no-reboot -serial null -serial mon:stdio -kernel dist/hello.elf
 _____ _ _ _           _ _           
|   __|_| | |_ ___ ___| | |_ ___ ___ 
|  |  | | | . |  _| .'| |  _| .'|  _|
|_____|_|_|___|_| |__,|_|_| |__,|_|  
RPi4: Memory map: 768 MB addressable:
RPi4:   reserved @ (0x0 - 0xffffffffffffffff)
RPi4:       text @ (0x0 - 0xd3fff)
RPi4:     rodata @ (0xd4000 - 0xdbfff)
RPi4:       data @ (0xdc000 - 0x181fff)
RPi4:       heap >= 0x182000 < stack < 0x30000000
Hello World from MirageOS!
Ctrl - a + x
QEMU: Terminated

TODO

  • bootvar and argv are missing
  • gilbraltar is a baby step to make an OS (it does not implement MMU or GPIO)
  • some devices bring by default the freestanding implementation (we need to check match_impl)
  • mclock and pclock are missing
  • netif and TCP/IP stack?

@TheLortex
Copy link
Member

netif and TCP/IP: there are two network interface that could be implemented:

@asymmetric
Copy link

Is this going to be merged at some point? Has the state of the art changed in the meantime, in regards to running MirageOS applications on the RPi 4?

@hannesm
Copy link
Member

hannesm commented Oct 11, 2022

This PR has some conflicts with the main branch of mirage -- nevertheless, I'd be in favour to merge it once rebased (it doesn't need to have network interfaces etc. before being merged, I can see value in having the (experimental) target easy to use for developers). Especially in resepct to recent improvements thereof in Mirleft concerning audio driver etc. WDYT?

@dinosaure
Copy link
Member Author

Yes, let me prepare a release for gilbraltar first and I will clean up/merge this PR 👍

@dejanr
Copy link

dejanr commented Sep 12, 2023

Is this meant as a draft showcase only? It's pity that it is still not finalized. Given the current state of MirageOS what's needed to finalize this?

@dinosaure
Copy link
Member Author

At the moment, it's possible to build a simple operating system in OCaml without using MirageOS. MirageOS is simply a tool for choosing the right implementations depending on the target. So you can start experimenting. However, apart from serial communication via pins, Gilbraltar doesn't offer much more. What's really missing is a series of drivers, such as ethernet, to be able to experiment more.

Unfortunately, implementing these requires a lot of resources (reading the Linux code or the firmware documentation) and we don't really have the time to go any further. However, if someone is interested in helping us, we'll offer them all the documentation they need to go further 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants