Also use this example: http://www.faqs.org/docs/kernel/hello2.html with the 
proper module macroses

On Tuesday, 9 April 2013 06:20:51 UTC+3, Fazhang Liu wrote:
>
> my device is samsung n8000   
>
> android version : 4.0.4
>
> kernel version : 3.0.15-962322
>
>
>
> i want to make a "hello world " kernel module .   
>
> git clone https://android.googlesource.com/kernel/samsung.git   to get 
> source code . and make it .
>
>
> hello world code
>
> #include <linux/module.h>     /* Needed by all modules */
>> #include <linux/kernel.h>    /* Needed for KERN_INFO */
>>
>> int init_module(void)
>> {
>>      printk(KERN_INFO "Hello world 1.\n");
>>
>>      /* 
>>       * A non 0 return means init_module failed; module can't be loaded. 
>>       */
>>      return 0;
>> }
>>
>> void cleanup_module(void)
>> {
>>      printk(KERN_INFO "Goodbye world 1.\n");
>> }
>>
>>
>
> make
>
> obj-m += hello-1.o
>
> all:
>       make -C /opt/kernel/samsung M=$(PWD) modules
>
> clean:
>       make -C /opt/kernel/samsung M=$(PWD) clean
>
>
> ARCH=arm 
> CROSS_COMPILE=/opt/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- 
> make
>
> and make success   .  
>
> but when i push ko to device 
>
> su 
>
> insmod  hello.ko 
>
> insmod: init_module 'hello.ko ' failed (Exec format error)
>
>
> what's wrong with that ? 
>
>
>

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to