[PLUG] Compiling my driver into kernel statically.
sgr.m.pdy at gmail.com
Tue Mar 12 12:14:07 IST 2013
I have successfully created a dummy procfile with read/write calls. I know
this is old way of coding & I should use sysfs, but still I did it.
When I compile this thing as module it works fine - proc file is created,
read & write works.
Then I thought of playing around a bit - I kept my code in
linux-x.x.x/drivers/sagar dir. Added an entry -
> obj-y += sagar/
to makefile of drivers dir. Added following makefile to drivers/sagar dir ->
$ car /path/to/linux/src/drivers/sagar/Makefile
obj-y += procfs-2.o
compiled linux the usual way -> clean, mrproper, bzImage, modules,
modules_install, copy bzImage to /boot & update-grub (ubuntu) and rebooted
into new kernel.
It looks like, the /proc file I was expecting is not created, so I think
init_module is not called when we link the code statically to the kernel -
I thought this function would be called by the `init` process. But looks
like my assumption was wrong. I got none of my printk (INFO) logs in dmesg
just after startup.
When I do cat /proc/kallsyms , I can find my variables & functions in there
ffffffff81436800 T cleanup_module
ffffffff81436830 T init_module
ffffffff814368d0 T procfile_write
ffffffff81436910 T procfile_read
ffffffff819e22c0 b procfs_buffer_size
ffffffff819e22c8 b my_proc_file
ffffffff819e22e0 b procfs_buffer
Still the /proc file I was expecting is not there. Can somebody point me to
Kernel used - 22.214.171.124
Note : I have started reading 'http://lwn.net/Kernel/LDD3/' as pointed by
Prashant, but I am just dying to get this working. :P
More information about the Plug-mail