Help me, How to compile that one driver to the kernel?
Development Environment :
1) EK-Board : AT91SAM9M10G-45EK
2) Kernel Version: 2.6.30
I am trying to create a minimalistic Linux for an embedded device.
That means the necessity of compiling kernel and drivers.
my problem is how to compile that one special driver to the kernel?
All searching have not provided me with a solution - all are only about compiling as modules.
I tried the following development procedure.
1) Modify Kconfig : add my template driver at char device
============================================================
#
# Character device configuration
#
menu "Character devices"
config TEMPLATE_DRIVER tristate "A driver template which dose nothing help"
---help---
this driver will do nothing but to be compiled.
====================================================================
2) Makefile Modify : add my config setting for built-in driver to kernel
=================================================================
obj-$(CONFIG_TEMPLATE_DRIVER) += dev_in_kernel.o=================================================================
3) make ARCH=arm menuconfig : select my template driver at char driver
4) Make ARCH=arm CROSS_COMPILE="my arm-gcc compile prefix"
6) Make uImage : this is ok
7) download uImage file to my EK-Board

booting test : this is work well
9) make node
mknod /dev/template c 192 0
9) test driver made
-> my driver is not built-in to kernel, tested it's driver through my Applicatin
Thanks for any help.
following source is my template driver
===============================================================
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#define CALL_DEV_NAME "template"
#define CALL_DEV_MAJOR 192
#define CALL_DEV_SUB 0
/*
Note:
check device name and major device number before test.
usage: mknod /dev/template c 192 0
*/
int template_open (struct inode *inode, struct file *fp)
{
printk ("open function has been called -> minor: \n");
return 0;
}
int template_release (struct inode *inode, struct file *fp)
{
printk ("release function has been called\n");
return 0;
}
struct file_operations template_fops = {
.owner = THIS_MODULE,
.open = template_open,
.release = template_release,
};
static int template_init (void)
{
int res;
printk ("initializer has been called\n");
res = register_chrdev(CALL_DEV_MAJOR, CALL_DEV_NAME, &template_fops);
if (res < 0) return res;
return 0;
};
static void template_exit (void)
{
printk ("finalizer has been called\n");
unregister_chrdev (CALL_DEV_MAJOR, CALL_DEV_NAME);
};
__initcal(template_init);
MODULE_LICENSE("Dual BSD/GPL");