This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
developersguide:driverprogramming [2015/10/26 12:39] dcvmoole [Example 2: /dev/hello] sync with actual source |
developersguide:driverprogramming [2016/02/04 14:29] lionelsambuc Corrected configuration file name |
||
---|---|---|---|
Line 10: | Line 10: | ||
The following sections contain step-by-step instructions to try out programming simple device drivers. | The following sections contain step-by-step instructions to try out programming simple device drivers. | ||
- | Please note that while this page may be slightly outdated, an up-to-date version of the hello driver is part of the MINIX3 source tree. You can find it in /usr/src/minix/drivers/examples/hello. The rest of this document will assume that the driver is not yet there, and will take you through the steps to create the driver yourself. Example 1 shows how to set up the infrastructure and create a very basic working driver process. Example 2 extends it into a simple character driver. The MINIX3 source tree's hello.c corresponds to the second example. | + | **Please note that while this page may be slightly outdated, an up-to-date version of the hello driver is part of the MINIX3 source tree.** You can find it in /usr/src/minix/drivers/examples/hello. The rest of this document will assume that the driver is not yet there, and will take you through the steps to create the driver yourself. Example 1 shows how to set up the infrastructure and create a very basic working driver process. Example 2 extends it into a simple character driver. The MINIX3 source tree's hello.c corresponds to the second example. |
==== Example 1: Hello, World ==== | ==== Example 1: Hello, World ==== | ||
Line 30: | Line 30: | ||
PROG= hello | PROG= hello | ||
SRCS= hello.c | SRCS= hello.c | ||
+ | |||
+ | FILES=${PROG}.conf | ||
+ | FILESNAME=${PROG} | ||
+ | FILESDIR= /etc/system.conf.d | ||
DPADD+= ${LIBCHARDRIVER} ${LIBSYS} | DPADD+= ${LIBCHARDRIVER} ${LIBSYS} | ||
Line 62: | Line 66: | ||
# make install | # make install | ||
</code> | </code> | ||
- | If you did not receive any errors, it is time to try and run the device driver. Before we do that, we must modify the ///etc/system.conf// file. It contains a list of all system services (servers and drivers) and their permissions. Each device driver typically only needs to access one real hardware device, and uses a few functions provided by Minix. To give our simple hello try-out driver enough permissions to experiment with, append the following to ///etc/system.conf//: | + | If you did not receive any errors, it is time to try and run the device driver. Before we do that, we must create the //hello.conf// file. It contains the permissions for the service. Each device driver typically only needs to access one real hardware device, and uses a few functions provided by Minix. To give our simple hello try-out driver enough permissions to experiment with, create //hello.conf// with: |
- | ///etc/system.conf//: | + | //hello.conf//: |
<code> | <code> |