Linux
Making Simple Linux Kernel Module in C
Linux kernel modules enable you to extend the kernel dynamically with more functionality for example add file system drivers, …
[ad_2]
source
Linux kernel modules enable you to extend the kernel dynamically with more functionality for example add file system drivers, …
[ad_2]
source
Lorem ipsum dolor sit amet, consectetur.
How do I learn such stuff? Like the meaning of commands such as dmesg | tail -n l, like what does -n do or what is the meaning of tail? How or where do people learn this ?
A bit late but I have a question, why did you use insmod and not modprobe?
Surely modprobe is better as a default as it loads a kernel module and all it's dependencies.
Your example has no dependencies but that should not cause a problem or will it?
That transition from slow "vi cat…" to crazy fast speed in "#include ….." caught me off guard.
A keeper! Amazingly simple, exactly the right way to start.
Causes a "tainted kernel" warning in dmesg, I guess that's something to fix, but it's perfect.
Developing kernel modules in your machine is not sweet thing, and developing on an external machine from your device is also not that easy…
Could you explain how I could run a qemu image to start learning about Linux Device Drivers
Wtf speed typing bro
What type of compiler are you using?
great video, love the straight-to-the-point style. Slight problem: i followed exactly and get this output from the make command
make -C /lib/modules/`uname -r`/build M=$PWD
make: Entering directory '/usr/src/linux-headers-5.15.0-102-generic'
CC [M] /home/josh/source/linux/module/test/cats.o
MODPOST /home/josh/source/linux/module/test/Module.symvers
ERROR: modpost: missing MODULE_LICENSE() in /home/josh/source/linux/module/test/cats.o
make[1]: * [scripts/Makefile.modpost:133: /home/josh/source/linux/module/test/Module.symvers] Error 1
make[1]: * Deleting file '/home/josh/source/linux/module/test/Module.symvers'
make: * [Makefile:1830: modules] Error 2
make: Leaving directory '/usr/src/linux-headers-5.15.0-102-generic'
no cats.ko is produced, just cats.o and some other files like .mod, modules.order, and some .cmd files
Any ideas what's going on? thanks in advance to anyone who responds. also I can provide any extra info if necessary.
Awesome vid, thanks!
Wow, dude, that was amazing. We wanna see more and more Linux videos please. very easy explanation. Subscribed to your channel.
how do I do it with multiple files like add it to the make it says it can't find some file.c??
Wtf it was so smooth ❤
ty for video, how to test the module like from Python?
Nie simple video. Can you do one in Rust? Just curious to see it.
simple, point to point, no BS, keep doing man…
It's insane how much easier this is than writing a simple Windows driver.
Awesome! Could you make a tutorial for building an existing distribution like centos stream or Ubuntu with a custom module?
This is great! You should make a video similar to this on GPU/cuda processing in C++, it's an unknown area for many people and I'm sure a lot would benefit from a simplistic video showing where you can get started
Bro please make some long videos on C also.
I've already watched several of your videos and I'm very positively surprised by the quality.
did you run it in WSL? I'm having trouble with the WSL I'm using :"(
The M=$PWD environment variable is also explained here:
google: docs kernel org Building External Modules
( obj-m that you put in your own makefile is also explained there)
the -C /lib/modules/$(uname -r)/build makes the make program switch to the build directory where the kbuild build system is installed and then starts the makefile of kbuild that will source your makefile (finding it because you did set the M= variable) to make your kernel module
Hey I really like this simplistic, to-the-point approach. You’ve got yourself a new subscriber.
perfect. very fast so it can save time. Thanks
Hii Sir.
I just watched your video.
It is fantastic and so good. I like it so much.
Just like you did I also try to do that, but there is an error,
I type a command:
1) make -C /lib/modules/`uname -r`/build M=$PWD.
error : make: * /lib/modules/5.16.0-kali7-arm64/build: No such file or directory.
2) make -C /lib/modules/$(uname -r)/build M=$PWD.
Same error is coming.
-> when I go to this lib/modules/ directory. There is one another subdirectory called '5.16.0-kali7-arm64' in that one subdirectory called 'kernel'. and when I added this into that command.
3) make -C /lib/modules/5.16.0-kali7-arm64/`uname -r`/build M=$PWD.
Same error is coming.
4) make -C /lib/modules/5.16.0-kali7-arm64/kernel/`uname -r`/build M=$PWD.
Same error is coming.
Even though all the path is correct. So you plz help me. I want to build one mini project very small for my college.
You helped solve a problem, thank you. I'm studying Operating Systems in the university.
I don’t get it, but I’m fascinated by it. Looks like magic. Where’s Gandalf??? 🤓
Thank you for the video!
Thank you, that was all I needed.
love the fast video format, new sub
wait WHAT!? That was fast. So, this is all the configuration I need to destroy my kernel binaries??? Awesome! All this time I've been updating grub to destroy my bootloader, This is so much easier!
HOW DO YOU TYPE SO FAST??????
Great video. Cant wait for more Linux/Kernel level videos