This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Cross Compile Hello.c Module for TI Sitara device



I think I figured out the problem Don't worry about this for now.

I am trying to cross compile a simple Hello world program that I plan to upload as a module into an android ARM device. Below is the c code.

#include<linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("CW");
MODULE_DESCRIPTION("Demo Hello");
static int init_module(void)
{
      printk(KERN_ALERT "<1>Hello World\n");
      return 0;
}
static void cleanup_module(void)
{
       printk(KERN_ALERT "Good Bye World\n");
}
module_init(init_module);
module_exit(cleanup_module);

Below is the makefile.

VERSION = 3
PATCHLEVEL = 2
SUBLEVEL = 0
EXTRAVERSION = 00763-g4071679

obj-m :=hello.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
           $(MAKE) ARCH=arm CROSS_COMPILE=/home/userid/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
         $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean

Below is the intial section of the error log

make ARCH=arm CROSS_COMPILE=/home/mgunawardena/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C /lib/modules/3.5.0-23-generic/build SUBDIRS=/home/mgunawardena/myfiles modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-23-generic'
        CC [M] /home/mgunawardena/myfiles/hello.o
In file included from /usr/src/linux-headers-3.5.0-23-generic/arch/arm/include/asm/types.h:4,
        from include/linux/types.h:4,
        from include/linux/init.h:5,
        from /home/mgunawardena/myfiles/hello.c:1:
include/asm-generic/int-ll64.h:11:29: error: asm/bitsperlong.h: No such file or directory
In file included from /usr/src/linux-headers-3.5.0-23-generic/arch/arm/include/asm/posix_types.h:35,
       from include/linux/posix_types.h:35,
       from include/linux/types.h:17,
       from include/linux/init.h:5,
       from /home/mgunawardena/myfiles/hello.c:1:
include/asm-generic/posix_types.h:66:5: warning: "__BITS_PER_LONG" is not defined
In file included from include/linux/module.h:9,
       from /home/mgunawardena/myfiles/hello.c:2:


On the host machine uname -r => 3.5.0-23 generic => Ubuntu 12.04 LTS

Android TI Sitara device /proc/version => Linux version 3.2.0-00763-g407167a (gcc version 4.4.3(GCC)) ....

Thank you for the help in advance.