Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have my helloworld.c inside the /Desktop/Kernel/linux/driver/input/misc
from the website, to build my external driver I need to make
$ make -C <path_to_kernel_src> M=$PWD
I would write the following in the terminal: laptop:~/Desktop/Kernel/linux$ make -C Desktop/Kernel/linux-2.6.37/drivers/input/misc M=$PWD helloworld.c
make: *** Desktop/Kernel/linux-2.6.37/drivers/input/misc: No such file or directory. Stop.
You need to specify the path of your linux kernel source, not an arbitrary directory. You can try:
Code:
make -C /lib/modules/`uname -r`/build M=$PWD
Note that you don't give the name of the .c file as argument, since the M=$PWD argument takes care of compiling all the source code in the current working directory. Just be sure the kernel sources are installed on your system.
Indeed the "-m elf_i386" is an option to the linker ld. It should not appear in the gcc command line. Please, try to remove the helloworld (last) argument from your command line:
ok, I am pretty confuse now...
Since yesterday I want to make my helloworld.c into the makefile....
so that helloworld.o being create, before I can run compile.
this is what happened..
Here is the legend,
I have another kernel on desktop where my helloworld is.
The version on desktop is linux-2.6.37.
Currently the system running on 2.6.32.
xxx@xxx-laptop:~/Desktop/Kernel/linux$ make -C /lib/modules/`uname -r`/build M=$PWD
make: Entering directory `/usr/src/linux-headers-2.6.32-34-generic'
CC kernel/bounds.s
/home/xxx/Desktop/Kernel/linux/kernel/bounds.c:1: fatal error: can’t open kernel/bounds.s for writing: Permission denied
compilation terminated.
make[1]: *** [kernel/bounds.s] Error 1
make: *** [_module_/home/xxx/Desktop/Kernel/linux] Error 2
make: Leaving directory `/usr/src/linux-headers-2.6.32-34-generic'
xxx@xxx-laptop:~/Desktop/Kernel/linux$
also, in the tutorial, it didn't specify where should I be putting my helloworld.c.
for beginner where should I put this? can just put inside driver folder?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.