Treiberenwicklung in C HW 4 Flashcards

1
Q

What is the file format of compiled Kernel modules?

A

.ko files are now used instead of .o files. They contain an additional .modinfo section that holds additional information about the module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In the VM, load the module using either modprobe (requires previous depmod) or insmod

What is the difference between the two?

A

insmod is a simple program to insert a module into the kernel. It can not handle module dependencies and will report only the most general errors.

On the other hand modprobe is a more advanced tool that intelligently adds or removes modules. It automatically looks at the /lib/modules/uname -r directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does depmod do?

A

It generates a modules.dep file which handles the dependencies between modules easily. It checks the /lib/modules/uname -r directory for each module and handles their symbols.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Welche Tools muss Busybox bereitstellen um mit Modulen umzugehen?

A
modprobe
modinfo
rmmod
lsmod
insmod
dmesg: Das dmesg (display message) Kommando zeigt unter Linux den Inhalt des Kernel Ring Buffers. Die darin enthaltenen Meldungen werden typischerweise von Gerätetreibern erzeug
depmod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Welche Makros werden für die grundsätzliche Entwicklung von Modulen verwendet?

A

MODULE_LICENSE(“GPL”);
MODULE_AUTHOR(AUTHOR);
MODULE_DESCRIPTION(“Simple Hello World example”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Wie sehen die Bodys von ModInit und ModExit aus?

A

static int __init ModInit(void)

static void __exit ModExit(void)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Was ist die Major Number?

A

The major number identifies the driver associated with the device. For example, /dev/null and /dev/zero are both managed by driver 1, whereas virtual consoles and serial terminals are managed by driver 4; similarly, both vcs1 and vcsa1 devices are managed by driver 7. The kernel uses the major number at open time to dispatch execution to the appropriate driver.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Was ist die Minor Number?

A

The minor number is used only by the driver specified by the major number; other parts of the kernel don’t use it, and merely pass it along to the driver. It is common for a driver to control several devices (as shown in the listing); the minor number provides a way for the driver to differentiate among them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Wie initialisiert man einen Buffer in Modulen?

A

buffer = (char*)kmalloc(sizeof(char) * buffersize, GFP_KERNEL);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Was ist beim ModExit zusätzlich zu beachten?

A

Offene Ressourcen schließen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Was machen die Devices null & zero

A

/dev/zero bezeichnet eine virtuelle Gerätedatei auf Unix-artigen Betriebssystemen, die beim Lesezugriff die angeforderte Anzahl an Null-Bytes (Nullzeichen) zurückliefert.

Wird /dev/null bei der Ausgabe adressiert, wird ein auszugebener Datenstrom verworfen. Beim Lesezugriff darauf (Eingabe) wird ein einzelnes End-of-File-Zeichen (EOF) ausgegeben.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly