Questions on device drivers in Minix

178 views
Skip to first unread message

David Robinson

unread,
Mar 13, 2014, 2:06:22 AM3/13/14
to min...@googlegroups.com
Hello,

In Minix, when I run the ps -ef command, I can see device drivers running,

For example:

/usr/sbin/pci
/sbin/floppy
/sbin/at_wini
/sbin/at_wini instance=1

The parent process id's for all the device drivers is 4 (Reincarnation Server). I looked through the Reincarnation Server's source code for where it is forking child processes for the device drivers, but was unable to find it.

My questions are:

1. Where in the Reincarnation Server source code is it forking and executing the device drivers?

2. During system initialization, how does the Reincarnation Server know which device drivers to run? (I guessing that it parses the /etc/system.conf file, but I'm not sure).

3. Is the at_wini driver, hard coded to start running during system initialization or is there a way to prevent it from running? For example, If I boot from a CD, can I disable at_wini from running?



Thanks

Lionel Sambuc

unread,
Mar 13, 2014, 4:33:52 AM3/13/14
to min...@googlegroups.com
Hello David,

On 13 mars 2014, at 07:06, David Robinson <daverob...@gmail.com> wrote:

> Hello,
>
> In Minix, when I run the ps -ef command, I can see device drivers running,
>
> For example:
>
> /usr/sbin/pci
> /sbin/floppy
> /sbin/at_wini
> /sbin/at_wini instance=1
>
> The parent process id's for all the device drivers is 4 (Reincarnation Server). I looked through the Reincarnation Server's source code for where it is forking child processes for the device drivers, but was unable to find it.
>
> My questions are:
>
> 1. Where in the Reincarnation Server source code is it forking and executing the device drivers?

The logic to fork and execute a service is in servers/rs/exec.c.

> 2. During system initialization, how does the Reincarnation Server know which device drivers to run? (I guessing that it parses the /etc/system.conf file, but I'm not sure).

Server and driver startup is done through the RC scripts, first the one on the ramdisk (in the sources in drivers/ramdisk/rc) then the one in etc (/etc/rc).

/etc/system.conf is parsed, not to know what to start, but apply and check for the permission the service / driver has.

> 3. Is the at_wini driver, hard coded to start running during system initialization or is there a way to prevent it from running? For example, If I boot from a CD, can I disable at_wini from running?

No it is not hardcoded, you can edit drivers/ramdisk/rc to that end.

> Thanks


Regards

Lionel

Antoine LECA

unread,
Mar 13, 2014, 5:50:09 AM3/13/14
to min...@googlegroups.com
David Robinson wrote:
> If I boot from a CD, can I disable at_wini from running?

Did you try to add
disable=at_wini
at the boot command line?


Antoine

David Robinson

unread,
Mar 14, 2014, 12:44:08 AM3/14/14
to min...@googlegroups.com
Hi Antoine,

I tried running the command 'disable=at_wini' from the boot monitor prompt but the command was not recognized. Did I enter the command incorrectly?


Thanks

Antoine LECA

unread,
Mar 14, 2014, 4:55:24 AM3/14/14
to min...@googlegroups.com
David Robinson wrote:
> I tried running the command 'disable=at_wini' from the boot monitor prompt
> but the command was not recognized.

Sorry, I am not a native English-speaking person and it appears I was
not able to express myself correctly.

I just asked you if before writing here, did you try to add the option
disable=at_wini
at the end of the boot monitor command line; it was not my intent to ask
you to try some workaround.

Anyway it seems clear from your post that you did not try.

The question was because some driver (but not all) are started (in the
various rc scripts, as explained Lionel) through that "disable="
mechanism, which allows a limited control over started drivers.
However I was not sure if such mechanism should be expanded or not, or
if it should be more advertised or not. Seems it should not.


> Did I enter the command incorrectly?

Since it is an option and not a command (the command to bootstrap MINIX
is always multiboot), you should enter edit mode, select the normal
command, append the option, and then run the edited command.


Antoine

David Robinson

unread,
Mar 15, 2014, 4:50:50 AM3/15/14
to min...@googlegroups.com
On my Minix system, I noticed that there are two instances of the at_wini driver running. Why are there two instances of the driver running?

ps -ef | grep at_wini

/sbin/at_wini
/sbin/at_wini instance=1

From /usr/src/drivers/ramdisk/rc, I see the following:

/sbin/at_wini -dev /dev/c0d0 -label at_wini_0
/sbin/at_wini -dev /dev/c1d0 -label at_wini_1 instance=1

When I run df:

Filesystem            Mounted on
/dev/c0d6p0s0        /
none                     /proc
/dev/c0d6p0s2       /usr
/dev/c0d6p0s1       /home
none                     /sys

I'm confused because the device files passed to at_wini (/dev/c0d0 and /dev/c1d0) don't appear to have any mounted filesystems.



Thanks






--
You received this message because you are subscribed to the Google Groups "minix3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minix3+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antoine LECA

unread,
Mar 17, 2014, 4:38:58 AM3/17/14
to min...@googlegroups.com
David Robinson wrote:
> On my Minix system, I noticed that there are two instances of the at_wini
> driver running. Why are there two instances of the driver running?

Historically, the ATA driver only managed up to 8 drives or channels
which is the upper number chose by MS-DOS 5.0, and the maximum number of
normal PC-AT-class machines, that is, up to 4 ATA interfaces each with 2
channels, usually known as "master" and "slave". This upper number of 8
is even cast into the sub-device numbering scheme within the minor
device number, where only drive d0 to d7 are allowed.

Furthermore, for compatibility reasons (particularly with the BIOS
bootstrapping system), the first 4 channels are "compatibility" copies
of the ones as reported from the BIOS subsystem; as a result, c0d0 and
c0d4 usually behaves the same.

Of course, being able to address at most 2 ATA interfaces is not enough,
particularly with SATA disks (using the legacy "IDE" interface) where
only channel 0 serves usually. So to support quietly many machines,
MINIX chooses to start two instances of the at_disk driver, serving
controller c0 and controller c1; the latter is not subject to the
compatibility mapping, so serves really 4 interfaces. As a result, a
standard MINIX system is able to serve 6 different ATA interfaces, or 12
channels, which is enough to support any non-special needs.


> From /usr/src/drivers/ramdisk/rc, I see the following:
>
> /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
> /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 instance=1
>

I am not sure of the details, but I think that in '-dev /dev/c0d0', the
'd0' part does not matter, only the controller number does; the reason
is because there are no entries in the /dev file system, nor in the
numbering scheme for devices, to designate a controller as a whole,
without any reference to one of its attached drives. In MINIX a
controller is a major device, which is what is linked to a given driver;
but in the UNIX way, only devices, ie major+minor, can be named.

> I'm confused because the device files passed to at_wini (/dev/c0d0 and
> /dev/c1d0) don't appear to have any mounted filesystems.

Well I believe this is explained in
http://wiki.minix3.org/UsersGuide/DiskPartitions
In the PC architecture, file systems are not mounted on drives, rather
on independent partition of them.
The work to perform that mapping is in lib/libblockdriver/drvlib.c


Antoine
Reply all
Reply to author
Forward
0 new messages