CS3 Operating Systems 2013-14, Practical Exercise. PHASE 2 ------- Compiling and loading kernel modules ------------------------------------ In your background reading, you should by now have found out about the principles of Linux kernel modules. Now you should compile and install one in your UML system, and make sure it loads. First, it would be a good idea to skim through the Modules-HOWTO (available at www.tldp.org, of course), and/or The Linux Kernel Module Programming Guide. The directory /group/teaching/cs3/os/Modules contains a "Hello World" module, together with a makefile for compiling it. Under 2.6, the kernel build procedure should be used for compiling standalone modules, and the kernel build procedure is a very complex beast. In this practical, you should be able to get away with trivial changes to the Makefile I've provided, and not need to understand the build procedure beyond this. Copy this directory to a directory in your "shared" VM directory. In the virtual machine, change to that directory, and type make and you should get a compiled module hello.ko Now (as root, if you weren't already), do insmod hello.ko You should see a message (two, in fact: you will see a warning that the licence "unspecified" "taints the kernel". This is because our hello module has not been declared to be a GPL module.) If you do lsmod then you will see that indeed the module is loaded. To unload the module, you do rmmod hello at which you should see another message. If you now do dmesg you should see the messages at the end, so showing that they were indeed kernel messages, rather than just things printed to the terminal. That's it: easy.