8 Replies Latest reply on Sep 9, 2016 5:08 AM by Radhika.k

    How can I write the Makefile for edison

    cer1991

      HI,

      I want to build the "hello world " driver module and lsmod helloworld driver module on the edison.But I don't know how to write the Makefile.

      Can anyone help me?

      The hello world driver module is like below:

      #include <linux/init.h>
       
      #include <linux/module.h>
       
      #include <linux/kernel.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,world\n");
       
      }
       
      
       
      module_init(hello_init);
       
      module_exit(hello_exit);
      
      

      I think the 'make' file should be like below:

      the makefile is run on ARM,but I don't know how to modify it.

      
      
      1. obj-m := hello_module.o

      2. KERNEL_DIR := /root/workspace/s3c-linux.jyx

      3. PWD := $(shell pwd)

      4. all:

      5.         make ARCH=arm CROSS_COMPILE=arm-linux- -C /root/workspace/s3c-linux.jyx/ M=$(PWD) modules

      6. clean:

      7.         rm *.o *.ko