char device driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

char device driver

584 Views
garimella
Contributor I

I have the following questions

1. I am using custom board using MPC8309. I want to develop char device driver in LTIB environment. I have looked at watchdog timer example in drivers directory. Please explain the commands required to compile a device driver in LTIB?

Where to locate the source file , ie. driver and application program (within the source tree or outside)?

2. Assuming that the code is compiled (*.o) with the procedures as per step 1, how to transfer the compiled file to the target?( Uboot and kernel is ported to the board)

3. If step2 is successful, what is the procedure to auto load the application at start up without downloading to the target?

4. I get error running .ltib -c while configuring kernel as it expects the network connectivity for installing some files (eg hello world modules). I checked at several forums and I learnt that .librc need to be modified in order to correct network connectivity problem( my internet is OK). Please help me to locate the librc file?

0 Kudos
2 Replies

368 Views
Pavel
NXP Employee
NXP Employee

Linux supports kernel driver and kernel module. See the following page:

http://unix.stackexchange.com/questions/47208/what-is-the-difference-between-kernel-drivers-and-kern...

http://haifux.org/lectures/86-sil/kernel-modules-drivers/kernel-modules-drivers.html

http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html

There is a lot information for developing char device driver for Linux and adding this driver to LTIB. For example see the following pages:

http://www.tldp.org/LDP/lkmpg/2.6/html/x569.html

http://derekmolloy.ie/writing-a-linux-kernel-module-part-2-a-character-device/

http://blog-eforembedded.rhcloud.com/category/ltib/

http://ltib.org/pages/LTIB_generic_v1.4_-_version_6.4.1.pdf

Usually customers use LTIB for application code and device drivers.

For the cross compile is better to do using LTIB, you need to do the next steps to add in the LTIB menu

  1. 1.- Create your directory  for your driver or use a directory under linux/drivers/
  2. 2.- Modify/create the Kconfig to add your driver as configurable in ltib.
  3. 3.- Modify/reate Makefile to compile your driver with the same kernel as all the drivers.

In case that you create a new directory you need to change the Kconfig and Makefile under linux/drivers to add your configurations.

When you have all your files, under ltib/ enter the command ./ltib -c, select Configure Kernel and in the next window select Device Drivers and you could find your driver there, chose your driver to be compiled as M and finally you can use this file in you board.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

368 Views
garimella
Contributor I

I have been trying to build char drivers with the procedure given by you. Facing problems during build.

1. I want to first build loadable drivers instead of kernel modules (*.config file entry) and check, please give the commands to compile a custom driver from LTIB. I used the commands make -C (uname -r) PWD = modules but it noes not work. Please resolve

regards

Vishnu

0 Kudos