Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Help me, How to compile that one driver to the kernel?
PostPosted: Fri Feb 17, 2012 3:10 am 
Offline

Joined: Fri Sep 03, 2010 4:47 am
Posts: 9
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

8) 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");


Top
 Profile  
 
 Post subject: Re: Help me, How to compile that one driver to the kernel?
PostPosted: Fri Feb 17, 2012 8:43 am 
Offline

Joined: Mon Nov 08, 2010 11:42 am
Posts: 17
Is there any error message?


Top
 Profile  
 
 Post subject: Re: Help me, How to compile that one driver to the kernel?
PostPosted: Fri Feb 17, 2012 9:01 am 
Offline

Joined: Fri Sep 03, 2010 4:47 am
Posts: 9
simply warnings only occurs.

following logs was displayed during kernel compiling time

===============================================
root@devpc-laptop:/usr/src/linux# make ARCH=arm CROSS_COMPILE=/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
CHK include/linux/compile.h
CC drivers/char/dev_in_kernel.o
drivers/char/dev_in_kernel.c:49: warning: data definition has no type or storage class
drivers/char/dev_in_kernel.c:49: warning: type defaults to 'int' in declaration of '__initcal'
drivers/char/dev_in_kernel.c:49: warning: parameter names (without types) in function declaration
drivers/char/dev_in_kernel.c:36: warning: 'template_init' defined but not used
drivers/char/dev_in_kernel.c:44: warning: 'template_exit' defined but not
used
LD drivers/char/built-in.o
LD drivers/built-in.o
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
KSYM .tmp_kallsyms1.S
AS .tmp_kallsyms1.o
LD .tmp_vmlinux2
KSYM .tmp_kallsyms2.S
AS .tmp_kallsyms2.o
LD vmlinux
SYSMAP System.map
SYSMAP .tmp_System.map
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
GZIP arch/arm/boot/compressed/piggy.gz
AS arch/arm/boot/compressed/piggy.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 31 modules


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: