Device Driver Tutorial

Building and Installing Quote Of The Day Version 3

Compile and link the driver. The following example shows compiling and linking for a 32-bit architecture:

% cc -D_KERNEL -c qotd_3.c
% ld -r -o qotd_3 qotd_3.o

Make sure you are user root when you install the driver.

Copy the driver binary to the /tmp directory as discussed in Building and Installing the Template Driver.

# cp qotd_3 /tmp
# ln -s /tmp/qotd_3 /usr/kernel/drv/qotd_3

Copy the configuration file to the kernel driver area of the system.

# cp qotd_3.conf /usr/kernel/drv

In a separate window, enter the following command:

% tail -f /var/adm/messages

Make sure you are user root when you load the driver. Use the add_drv(1M) command to load the driver:

# add_drv qotd_3

You should see the following messages in the window where you are viewing /var/adm/messages:

date time machine pseudo: [ID 129642] pseudo-device: qotd_30
date time machine genunix: [ID 936769] qotd_30 is /pseudo/qotd_3@0