HI !
I am trying to make a simple "helloworld" driver for am-1808, the am-1808 (evm zoom kit) which i am having has kernel 2.6.33.rc-4, here are the steps which i performed:
1. download the DaVinci-PSP-SDK-03.20.00.13 from here: (which contains the kernel version 2.6.33.rc-4), [path of kernel is /home/user/Desktop/linux-03.20.00.13/]
2. Installed CodeSourcery, [installation path : /home/user/CodeSourcery]
3. Compiled the kernel by following commands:
export CROSS_COMPILE=/home/user/CodeSourcery/Sourcery_G++_Lite/bin/:$CROSS_COMPILE
make da850_omapl138_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make uImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
[Kernel compiles successfully , zimage + uimage are created as a result of compilation ]
4. Compile the driver, which results in error:
hello.c file contains :
/*
* $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
*/
#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);
Makefile contains this:
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /home/user/Desktop/linux-03.20.00.13/
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
Compiled the module using following command;
make -C /home/user/Desktop/linux-03.20.00.13/ M=`pwd` modules
After this i got these errors:
make: Entering directory `/home/user/Desktop/linux-03.20.00.13'
CC [M] /home/user/Desktop/drivers/hello.o
In file included from include/linux/prefetch.h:14,
from include/linux/list.h:6,
from include/linux/module.h:9,
from /home/user/Desktop/drivers/hello.c:5:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:117: error: 'CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:117: error: requested alignment is not a constant
In file included from include/linux/prefetch.h:14,
from include/linux/list.h:6,
from include/linux/module.h:9,
from /home/user/Desktop/drivers/hello.c:5:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:163:1: warning: "cache_line_size" redefined
In file included from /home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:28,
from include/linux/prefetch.h:14,
from include/linux/list.h:6,
from include/linux/module.h:9,
from /home/user/Desktop/drivers/hello.c:5:
include/linux/cache.h:64:1: warning: this is the location of the previous definition
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:243: error: requested alignment is not a constant
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:274: error: requested alignment is not a constant
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h: In function 'native_get_debugreg':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:504: error: invalid application of 'sizeof' to incomplete type 'struct bug_entry'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h: In function 'native_set_debugreg':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/processor.h:531: error: invalid application of 'sizeof' to incomplete type 'struct bug_entry'
In file included from /home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic.h:4,
from /home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/thread_info.h:24,
from include/linux/thread_info.h:56,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/stat.h:60,
from include/linux/module.h:10,
from /home/user/Desktop/drivers/hello.c:5:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:201: warning: type defaults to 'int' in declaration of 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:201: error: expected ';', ',' or ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:213: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:225: error: expected declaration specifiers or '...' before 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: In function 'atomic64_add':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:228: error: 'v' undeclared (first use in this function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:228: error: (Each undeclared identifier is reported only once
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:228: error: for each function it appears in.)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:227: error: invalid lvalue in asm output 0
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:227: error: memory input 2 is not directly addressable
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:239: error: expected declaration specifiers or '...' before 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: In function 'atomic64_sub':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:242: error: 'v' undeclared (first use in this function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:241: error: invalid lvalue in asm output 0
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:241: error: memory input 2 is not directly addressable
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:255: error: expected declaration specifiers or '...' before 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: In function 'atomic64_sub_and_test':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:260: error: 'v' undeclared (first use in this function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:259: error: invalid lvalue in asm output 0
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:259: error: memory input 3 is not directly addressable
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:271: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:284: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:299: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:317: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:336: error: expected declaration specifiers or '...' before 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: In function 'atomic64_add_negative':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:341: error: 'v' undeclared (first use in this function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:340: error: invalid lvalue in asm output 0
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:340: error: memory input 3 is not directly addressable
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:353: error: expected declaration specifiers or '...' before 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: In function 'atomic64_add_return':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:357: error: 'v' undeclared (first use in this function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:356: error: invalid lvalue in asm output 1
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:356: error: memory input 3 is not directly addressable
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:362: error: expected declaration specifiers or '...' before 'atomic64_t'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: In function 'atomic64_sub_return':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:364: error: 'v' undeclared (first use in this function)
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:364: error: too many arguments to function 'atomic64_add_return'
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h: At top level:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:370: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:375: error: expected ')' before '*' token
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/atomic_64.h:425: error: expected ')' before '*' token
In file included from include/linux/mmzone.h:16,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /home/user/Desktop/drivers/hello.c:5:
include/linux/nodemask.h: In function '__first_node':
include/linux/nodemask.h:239: error: implicit declaration of function 'find_first_bit'
include/linux/nodemask.h: In function '__next_node':
include/linux/nodemask.h:245: error: implicit declaration of function 'find_next_bit'
include/linux/nodemask.h: In function '__first_unset_node':
include/linux/nodemask.h:268: error: implicit declaration of function 'find_first_zero_bit'
In file included from include/linux/elf.h:7,
from include/linux/module.h:14,
from /home/user/Desktop/drivers/hello.c:5:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/elf.h: In function 'elf_common_init':
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/elf.h:167: error: 'struct thread_struct' has no member named 'fs'
In file included from include/linux/module.h:21,
from /home/user/Desktop/drivers/hello.c:5:
/home/user/Desktop/linux-03.20.00.13/arch/x86/include/asm/module.h:59:2: error: #error unknown processor family
make[1]: *** [/home/user/Desktop/drivers/hello.o] Error 1
make: *** [_module_/home/user/Desktop/drivers] Error 2
make: Leaving directory `/home/user/Desktop/linux-03.20.00.13'
Can anyone tell, how to resolve these errors:
regards
usama