Init and Exit functions.
[cascardo/kernel/old_slides/.git] / 01.hello / 01.hello.xml
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE slides SYSTEM "/usr/share/xml/docbook/custom/slides/3.3.1/schema/dtd/slides-full.dtd">
3
4 <slides>
5
6 <slidesinfo>
7 <title>Hello World Module</title>
8 <author><firstname>Thadeu</firstname><surname>Cascardo</surname></author>
9 </slidesinfo>
10
11 <foil>
12 <title>Introduction</title>
13 <para>
14 Let's take a look at how linux modules work.
15 </para>
16 </foil>
17
18 <foil>
19 <title>Requirements</title>
20 <para>
21 We need the tools to build a module and a building linux tree. Running the built
22 linux kernel is highly recommended so we can test our modules.
23 </para>
24 <para>
25 The tools include GNU make, GCC and GNU binutils. Linux build is highly
26 dependent on the GNU toolchain, since the beginning.
27 </para>
28 </foil>
29
30 <foil>
31 <title>Hands-on</title>
32 <para>
33 We have prepared sample code to build in the samples/ directory. Try them.
34 </para>
35 </foil>
36
37 <foil>
38 <title>Building</title>
39 <para>
40 Building an out-of-tree linux module is very simple:
41 </para>
42 <screen>
43 $ make -C /lib/modules/`uname -r`/build M=$PWD modules
44 </screen>
45 </foil>
46
47 <foil>
48 <title>Init and Exit Functions</title>
49 <para>
50 We use <emphasis>module_init</emphasis> and <emphasis>module_exit</emphasis> to
51 declare our init and exit functions.
52 </para>
53 </foil>
54
55 <foil>
56 <title>Init and Exit Functions</title>
57 <para>
58 The <emphasis>__init</emphasis> and <emphasis>__exit</emphasis> marks allow the
59 kernel to remove them when they are not needed, reducing memory consumption.
60 </para>
61 </foil>
62
63 <foil>
64 <title>Module Tools</title>
65 <itemizedlist>
66 <listitem>
67 insmod
68 </listitem>
69 <listitem>
70 rmmod
71 </listitem>
72 <listitem>
73 modprobe
74 </listitem>
75 <listitem>
76 modinfo
77 </listitem>
78 <listitem>
79 depmod
80 </listitem>
81 </itemizedlist>
82 </foil>
83
84 <foil>
85 <title>Module Description Definitions</title>
86 <itemizedlist>
87 <listitem>
88 MODULE\_AUTHOR
89 </listitem>
90 <listitem>
91 MODULE\_DESCRIPTION
92 </listitem>
93 <listitem>
94 MODULE\_VERSION
95 </listitem>
96 <listitem>
97 MODULE\_LICENSE
98 </listitem>
99 <listitem>
100 MODULE\_ALIAS
101 </listitem>
102 </itemizedlist>
103 </foil>
104
105 </slides>