28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

136<br />

3.8.4 <strong>Rump</strong> Component Init Routines<br />

In <strong>the</strong> previous section we discussed <strong>the</strong> attachment <strong>of</strong> drivers that followed <strong>the</strong><br />

kernel module framework. Now we discuss <strong>the</strong> runtime attachment <strong>of</strong> drivers that<br />

have not yet been converted to a kernel module, or code that applies to a only rump<br />

kernel environment.<br />

If a driver is modular, <strong>the</strong> module’s init routine should be preferred over any rump<br />

kernel specific routines since <strong>the</strong> module framework is more generic. However, a<br />

module’s init routine is not always enough for a rump kernel. Consider <strong>the</strong> following<br />

cases. On a regular system, parts <strong>of</strong> <strong>the</strong> kernel are configured by userspace<br />

utilities. For example, <strong>the</strong> Internet address <strong>of</strong> <strong>the</strong> loopback interface (127.0.0.1)<br />

is configured by <strong>the</strong> rc scripts instead <strong>of</strong> by <strong>the</strong> kernel. Ano<strong>the</strong>r example is <strong>the</strong><br />

creation <strong>of</strong> device nodes on <strong>the</strong> file system under <strong>the</strong> directory /dev. NetBSDdoes<br />

not have a dynamic device file system <strong>and</strong> device nodes are pre-created with <strong>the</strong><br />

MAKEDEV script. Since a rump kernel does not have an associated userl<strong>and</strong> or a<br />

persistent root file system, <strong>the</strong>se configuration actions must be performed by <strong>the</strong><br />

rump kernel itself. A rump component init routine may be created to augment <strong>the</strong><br />

module init routine.<br />

By convention, we place <strong>the</strong> rump component init routines in <strong>the</strong> component’s source<br />

directory in a file called component.c. To define an init routine, <strong>the</strong> component<br />

should use <strong>the</strong> RUMP_COMPONENT() macro. <strong>The</strong> use <strong>of</strong> this macro serves <strong>the</strong> same<br />

purpose as <strong>the</strong> MODULE() macro <strong>and</strong> ensures that <strong>the</strong> init routine is automatically<br />

called during rump kernel bootstrap. <strong>The</strong> implementation places a descriptor structure<br />

in a .rodata section called rump_components.<br />

<strong>The</strong> RUMP_COMPONENT() macro takes as arguments a single parameter indicating<br />

when <strong>the</strong> component should be initialized with respect to o<strong>the</strong>r components. This<br />

specifier is required because <strong>of</strong> interdependencies <strong>of</strong> components that <strong>the</strong> NetBSD

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!