Drive module compilation and mount issues, simple Makefile writing

zhaozj2021-02-16  169

Drive module compile:

Add -i /usR/src/linux-2.4.22-1.2115/include/

Such as: gcc -wall -c-^ -i / usr / src / linux-2.4.22-1.2115 / include / a.c (Note: The space between -i and directories can be available)

To remove compilation warning information "no license", in INCLUDE

Next line plus Module_License ("GPL");

Drive module mount: You can see the unidentified level message of Printk in the non-virtual terminal. If you want to see the message in the virtual terminal, you need to add levels before the message, such as Printf ("<0> <= 7, such as Printk (? <0> Hello World! / N ");

Makefile Preparation Example: #this is my frist makefile cc = gcc cflags = -i / usr / src / linux-2.4.22-1.2115.nptl / include / unreal: AO Hello.o AO: AC $ (cc) -c -O2 -wall $ (cflags) ac Hello.o: Hello.c $ (cc) -c-^ -wall $ (cflags) Hello.c

转载请注明原文地址:https://www.9cbs.com/read-8539.html

New Post(0)