Hi all I'm very new in working with FriendlyARM Board. I would like to write a hello world device driver and want to make it part of the kernel. So I've followed "Chapter 7.3 - Simple module for embedded Linux drivers.pdf" document which I got from internet. While progressing following the steps, first I encountered problem in the step "make menuconfig". There when the new screen comes there was no entry made for my new module even though I've changed my 'Kconfig' file as per the document.So instead of the suggested change I've edited my 'Kconfig' file in the following way. config MINI2440_HELLO_MODULE tristate "Mini2440 module sample" depends on y default m if MACH_MINI2440 help Mini2440 module sample. As per the document it should be like, config MINI2440_HELLO_MODULE tristate "Mini2440 module sample" depends on MACH_MINI2440 default m if MACH_MINI2440 help Mini2440 module sample. . After I changed my 'Kconfig' file we are able to see our module entry in the menuconfig menu. Then I continued with doing 'make modules' and got the ' .ko ' file . But when I try to do insmod it in my target machine - ie #insmod mini2440_hello_module.ko I'm getting the following error; #version magic '2.6.32.2 ARMv5' should be '2.6.29.4-FriendlyARM mod-unload-ARMv4 For me modprobe and rmmod is showing "No such file or directory" error. Kindly help me out. Any help is appreciated. Thanking you Athira
Writing a device driver for friendlyARM board
Which cross-compiler are you using? I don't know about .ko file but on applications that you cross-compile and do a : readelf -a <filename> or readelf -A <filename> you want to see a tag at the bottom of the output that says: armv4t
Just checked it: readelf -A <filename> will just give you the File Attributes: 2nd line Tag_CPU_arch: v4t or it won't work on the mini2440
Read the "Documentation/kbuild/kconfig-language.txt" for the correct file content syntax. > depends on y This is bogus. > depends on MACH_MINI2440 This one is correct. > default m if MACH_MINI2440 The trailing "if MACH_MINI2440" makes no sense here, because the menu entry is visible only when "MACH_MINI2440" is already enabled (due to the 'depends on" statement above). " #version magic '2.6.32.2 ARMv5' should be '2.6.29.4-FriendlyARM > mod-unload-ARMv4 Read what it says: you compiled your own module within a 2.6.32.2 Linux kernel but at runtime it seems you are using a 2.6.29 kernel. Compile your module within the source tree of your run-time kernel and it will work. Always keep the kernel and the external modules in sync. Happy hacking
Hi Juergen Beisert I've tried with, config MINI2440_HELLO_MODULE tristate "Mini2440 module sample" depends on MACH_MINI2440 default m if MACH_MINI2440 help Mini2440 module sample. in my Kconfig file. But this is not giving an entry for my "hello module" in the 'make menuconfig' menu. That's why I tried with 'depends on y' change. That worked for me. But my problem is my module is not getting inserted because of the version problem. I've googled for getting the kernel source tree for 2.6.29.4-FriendlyARM . But no where I could find it. :( I'm only getting linux-2.6.32.2 source tree. So I compiled using that.And I hope you've seen the pdf I've attached. Kindly help me out in getting kernel source tree for 2.6.29.4-FriendlyARM. Thanking you Athira M A
Hi Athira, AFAIK the sources for the 2.6.29 (which is the factory default) are not available publicly. However the 2.6.32.2 sources on this web site build correctly. This is also evident from the fact that your .ko file got built correctly. All you need to do is to flash your newly built kernel (the zImage file in the arch/arm/boot directory) onto your board. If you have the Supervivi bootloader running on your board, you may want to try running the kernel from RAM first (choose option 'z' to download and option 'g' to run from RAM) before burning it into NAND flash. After your kernel boots, run the command: #/> uname -r and check that you are running the 2.6.32.2 kernel before proceeding. I guess you should be able to load your kernel module thereafter. Good luck! Gautam