Download MIPS32 Malta Linux - Open Virtual Platforms
Transcript
MIPS32 Malta Linux Platform 13.5.2 Building The tools available allow the driver to be built on a Linux host machine, in the same way that the Linux kernel is re-built only on a Linux host. Building the example kernel module using the Makefile, shown above, will provide output similar to that below: 13.6 Installing the Kernel Module The file created is a .ko file and this should be transferred into the MIPS Malta Linux platform in the same way as a user application is transferred, as described in section 11 “Transferring Files to Guest Linux”. The kernel module can only be installed from the root account. First we use mknod to make a directory entry and corresponding i-node for a special file. mknod /dev/led c 42 0 We provide the name of the device as /dev/led, c defines the device as a character device, the major device number 42 that helps the operating system find the device driver code and the minor device number 0 used to select the line number. The Major number 42 is reserved for examples and demos. ⇒ the Major number used when the entry is created corresponds to the value used in the driver source code during the initialization, as the argument to the function register_chrdev(), see 13.4.3.1 “Device Initialisation” There will now be an entry in /dev called led. We must make this file writable for all accounts chmod 666 /dev/led © 2010 Imperas Software Limited www.OVPworld.org . Page 77 of 115