[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] Adding new driver to kernel 2.6
Hi Raul,
Raul Camaras wrote:
I am trying to add a new driver to the kernel 2.6, so that it is
initialized at booting.
Steps I do are:
1) Create directory “~/drivers/misc/mydriver” with source code
mydriver.c and the following Makefile:
+obj-$(CONFIG_MICROBLAZE_MYDRIVER) := mydriver.o
2) Add next lines to file “~/drivers/misc/Kconfig” :
+CONFIG_MICROBLAZE_MYDRIVER
+ tristate “My driver”
+ depends on MICROBLAZE
3) Add next line to file “~/drivers/misc/Makefile” :
+obj-$(CONFIG_MICROBLAZE_MYDRIVER) += mydriver/
4) Add device file to ~/vendors/PetaLogix/common/common.mak:
+ifdef CONFIG_MICROBLAZE_MYDRIVER
+DEVICES += \
+ mydriver,c,14,0
+endif
5) Select “My driver” in make menuconfig, and do make dep all.
All looks good.
The new driver compiles together with the kernel, but it is not
initialized at booting.
Do you have
module_init(my_driver_init);
module_exit(my_driver_exit);
in the driver source code? These should be declared as
int __devinit my_driver_init(void);
and
void __devexit my_driver_exit(void);
respectively.
Check Linux Device Drivers edition 3 for the specifics - you've done the
right thing for PetaLinux build infrastructure, now it's just standard
kernel driver hacking.
Hope this helps,
John
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/