Regarding makefiles
Hey everyone, I need your help.
After writeing a simple hello world kernel module named hello-world.c, I require to write a make file to compile it. Now, where to write this make file and what should be its extention. Kindly help, Thanks... |
For the simplest solution, write the makefile in the same directory as your source. There is no extension, name it "makefile" if you want make to find it automatically, or name it anything you want and tell make where to find it with the -f flag, eg:
Code:
make -f sally |
Quote:
http://tldp.org/LDP/lkmpg/2.6/html/ Did you try that? Maybe reading the part on 'Compiling Kernel Modules', that has EXAMPLES of the makefile needed for the hello world module??? Not meaning to sound nasty, but you posted questions about how to copy/move files, and now you're trying to do kernel programming? You need to learn the basics first. |
@TBOne Yes you are correct. Thanks. Actually the basics are the part of my syllabus in college, and i am pretty much acqauinted now to change directory, rename, move and other terminal tasks so i thought this would be a good time to start with kernel. I am referring linux kernel in nutshell book. Do you have any better to suggest? Thanks.
|
@suicidaleggroll Thanks. I dropped it since i am finding difficult to just download, configure and boot the kernel without making changes to it. I will have to try it after i understand the kernel. I am working on it. Thanks for your time.
|
Quote:
https://www.linuxquestions.org/quest...nation-931262/ Before you start kernel programming, you need to learn a LOT of basic concepts. Basics of programming would be first...learning shell scripting would be a good start. Going from "how do you move a file" to "I'm going to write kernel modules", takes more than two weeks. Quote:
|
@TBOne But i just want to see what it looks like. A very straight-forward process, download, configure, install and boot the kernel. That's what i was trying to do. Anyways, i will start with the basic terminal commands as you say. Thanks :-)
|
What are you trying to modify in the kernel? Building custom kernels and installing kernel modules are not things you do when you're a beginner, at all. Hell, I've been using Linux basically every day for the last 8 years and I still don't compile my own kernel or write kernel modules (except for some VERY rare instances). It's not something you need to be concerned with unless you're REALLY digging into the nitty gritty. There are much more important things to educate yourself on before you dive into the kernel.
If you don't know how to use makefiles, you're not ready to mess with the kernel. Give it a few months/years. |
For the hello.c program, the Makefile is :
Code:
obj-m := hello.o At worst, you will not be able to use your OS, if you install it. . |
@suicidaleggroll No no...I was trying to write a hello world module but i realized it was beyond my scope, so knowing a few terminal commands, bit of shell scripting and system programming using system calls, I just want to see how it looks like by just downloading the source and building it referring my books. "No modifications at all". Is it so difficult? Just boot from the downloaded source, that's
what i was trying to do. :-) |
Quote:
|
This topic has been re-posted in the kernel forum. Discussion follows there: https://www.linuxquestions.org/quest...efiles-933052/.
|
All times are GMT -5. The time now is 05:35 PM. |