I need to write a device driver for a piece of hardware my company manufactures. This board has 8 serial ports that sit on an ISA bus. There are 4 ISA slots on the mother board.
I downloaded the 2.6.29.1 kernel source code and placed it on my hard drive. I ran make headers_install in the source directory.
I also made a Makefile in the directory where my test code resides it has one line and it looks like this:
obj-m := first.o
I've been having trouble compiling the simplest device driver example from the linux device driver how to's I've found.
The code is in a file called first.c and looks like this:
#define __KERNEL__
#define MODULE
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT, "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT, "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
I compile with the line:
make -C pathtosource M=`pwd` modules
I get ther error:
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /mnt/hda3/MyKernel/linux-2.6.29.1/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /mnt/hda3/DriverTest/first.o
/mnt/hda3/DriverTest/first.c:1: error: code model 'kernel' not supported in the 32 bit mode
/mnt/hda3/DriverTest/first.c:1: sorry, unimplemented: 64-bit mode not compiled in
make[1]: *** [/mnt/hda3/DriverTest/first.o] Error 1
make: *** [_module_/mnt/hda3/DriverTest] Error 2
make: Leaving directory `/mnt/hda3/MyKernel/linux-2.6.29.1'
Are there any device driver experts about that can give some advice? Do I need to compile a custom kernel?
This is the location of the howto I'm using:
http://www.freesoftwaremagazine.com/articles/drivers_linux?page=0%2C1I notice that the author says,
"First, you need to have a complete, compiled kernel source-code-tree."
Is there a list of kernel options for tinycore anyplace? On my machine uname -a shows:
Linux box 2.6.29.1-tinycore #1337 SMP Fri Apr 10 19:12:39 EEST 2009 i686 GNU/Linux