From ce5409f9bf4ebf1fd3509fb24d0e0299c25c2912 Mon Sep 17 00:00:00 2001 From: Ribbon Date: Wed, 15 Nov 2023 17:20:37 +0000 Subject: [PATCH] Improve the README --- README.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5221d94d63..eac9d4eab7 100644 --- a/README.md +++ b/README.md @@ -86,14 +86,30 @@ This section cover the interfaces used by Redox drivers. - `memory:physical@wc`: write-combining memory - `irq:` - allows getting events from interrupts. It is used primarily by listening for its file descriptors using the `event:` scheme. -## Contributing to Drivers +## Contributing -If you want to write drivers for Redox, datasheets are preferable, when they are freely available. Be aware that datasheets are often provided under a [Non-Disclosure Agreement](https://en.wikipedia.org/wiki/Non-disclosure_agreement) from hardware vendors, which can affect the ability to create an MIT-licensed driver. +### Driver Design -If you don't have datasheets, we recommend you to do reverse-engineering of available C code of BSD drivers. +A device driver on Redox is an user-space daemon that use system calls and schemes to work. -We recommend BSDs drivers because BSD license is compatible with MIT (permissive), that way we can reuse the code in other drivers. +For operating systems with monolithic kernels, drivers use internal kernel APIs instead of common program APIs. + +If you want to port a driver from a monolithic OS to Redox you will need to rewrite the driver with reverse enginnering of the code logic, because the logic is adapted to internal kernel APIs (it's a hard task if the device is complex, datasheets are more easy). + +### Write a Driver + +Datasheets are preferable, when they are freely available. Be aware that datasheets are often provided under a [Non-Disclosure Agreement](https://en.wikipedia.org/wiki/Non-disclosure_agreement) from hardware vendors, which can affect the ability to create an MIT-licensed driver. + +If you don't have datasheets, we recommend you to do reverse-engineering of available C code on BSD drivers. You can use the [example](https://gitlab.redox-os.org/redox-os/exampled) driver or read the code of other drivers with the same type of your device. Before testing your changes, be aware of [this](https://doc.redox-os.org/book/ch09-02-coding-and-building.html#a-note-about-drivers). + +### Driver References + +If you want to reverse enginner the existing drivers, you can access the BSD code using these links: + +- [FreeBSD drivers](https://github.com/freebsd/freebsd-src/tree/main/sys/dev) +- [NetBSD drivers](https://github.com/NetBSD/src/tree/trunk/sys/dev) +- [OpenBSD drivers](https://github.com/openbsd/src/tree/master/sys/dev)