Stack Exchange
Cross compiling a kernel module issue in Makefile
I am working on intelX86_64 host machine and i am trying to cross compile a linux module for an ARM embedded board architecture.
I made a linux os for my board with yocto project and i build sdk cross compiler. 
This is what i get when i run SDK environment script :

arm-poky-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon
  -mfloat-abi=hard -mcpu=cortex-a5 --sysroot=/opt/poky-atmel/2.5.3/sysroots/cortexa5hf-neon-poky-linux-gnueabi

Basing on this, this is the Makefile i made :
MYY_KERNEL_DIR ?= /home/gaston/linux4sam/poky/build-microchip/tmp/work/sama5d27_som1_ek_sd-poky-linux-gnueabi/linux-at91/4.14+gitAUTOINC+b733e44da2-r0/image/lib/modules/4.14.73-linux4sam-6.0-dirty/

ARCH ?= armv7-a

CROSS_COMPILE ?= arm-poky-linux-gnueabi-gcc

obj-m += uleds.o

all:
        make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) -C $(MYY_KERNEL_DIR) modules

clean:
        make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) -C $(MYY_KERNEL_DIR) clean

And This is the error i get when i run MAKE command :

make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-
  M=/home/gaston/shit -C
  /home/gaston/linux4sam/poky/build-microchip/tmp/work/sama5d27_som1_ek_sd-poky-linux-gnueabi/linux-at91/4.14+gitAUTOINC+b733e44da2-r0/image/lib/modules/4.14.73-linux4sam-6.0-dirty/
  modules
make[1]: Entering directory
  '/home/gaston/linux4sam/poky/build-microchip/tmp/work/sama5d27_som1_ek_sd-poky-linux-gnueabi/linux-at91/4.14+gitAUTOINC+b733e44da2-r0/image/lib/modules/4.14.73-linux4sam-6.0-dirty'
  make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory
  '/home/gaston/linux4sam/poky/build-microchip/tmp/work/sama5d27_som1_ek_sd-poky-linux-gnueabi/linux-at91/4.14+gitAUTOINC+b733e44da2-r0/image/lib/modules/4.14.73-linux4sam-6.0-dirty'
  Makefile:10: recipe for target 'all' failed make: *** [all] Error 2

What error i'm making ? How can i fix this ? Thank you

Maybe your kernel is not compiled correctly (on the tmp directory of Yocto). Go to the kernel directory, source your environment, type  make, then retry to compile your module.

I solved the problem, my kernel path directory was wrong. Now it's working
