Author Topic: How to develop and load custom modules  (Read 2467 times)

Offline bossmansnake

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
How to develop and load custom modules
« on: August 13, 2015, 01:17:56 pm »
I really need this code http://we.easyelectronics.ru/electro-and-pc/upravlenie-servomashinkoy-iz-cubieboard2.html  to work but the translation from google is not good enough to me. I need servos to work and this looks like the best code to use for now. But I need to be sure and from what I gather, I need to create a kernel module, something I don't have experience in.

Following tutorials, I've copied kernel headers into /usr/src/ and tried to run make.
If I use /lib/modules/(uname -r)/build i get 'No such file or directory'
If u use the path to the header files, I get 

Code: [Select]
make -C /usr/src/linux-headers-3.4.79-sun7i M=home/linaro/gpio/servo modules
make[1]: Entering directory `/usr/src/linux-headers-3.4.79-sun7i'
  CC [M]    /home/linaro/gpio/servo/servo.o
/bin/sh:    1: scripts/basic/fixdep: not found
make[2]: *** [/home/linaro/gpio/servo/servo.o] Error 127
make[1]: ***[_module_/home/linaro/gpio/servo] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.4.79-sun7i'
make: *** [default] Error 2

and no .ko file is produced and from what I understand it's what I need. Then I plan to use the insmod command.

my Makefile:
Code: [Select]
obj-m := servo.o

default:
    make -C /usr/src/linux-headers-3.4.79-sun7i M=$(PWD) modules