building a out-of-tree module on Beagle Bone Black

Machine Details :

Linux beaglebone 3.8.13-bone47 armv7l GNU/Linux

Problem Details:

In a attempt to write out-of-tree modules on beagle bone black(as intree modules require me to compile/flash them again and again ), i have logged in to beagle bone black revc through ssh client, which gives me a command line interface via putty, as in general out-of-tree module development, i have tried to compile module with the following make file

ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
        obj-m  := module.o

        #module-objs := module.o
else
# normal makefile
        KDIR ?= /lib/modules/$(shell uname -r)/build
        PWD  := $(shell pwd)
default:
        $(MAKE) -C $(KDIR) M=$(PWD) modules

endif

resulting an error

root@beaglebone:~/lddgeek# make
make -C /lib/modules/3.8.13-bone47/build M=/root/lddgeek modules
make: *** /lib/modules/3.8.13-bone47/build: No such file or directory.  Stop.
make: *** [default] Error 2

but when i parse to the path of KDIR i did not find build folder as we find it in an normal ubuntu installed on x86

if i have to develop drivers/modules out-of-tree on a Beagle how could i do that?

Thank you
Shyam

You need to install the kernel headers, then run “make scripts” in the headers directory:

root@beaglebone:/# apt-get install linux-headers-uname -r
root@beaglebone:/# cd /lib/modules/uname -r/build
root@beaglebone:/# make scripts

Once competed, your make of the out of source kernel module should get past that initial error.

frank

when you say initial error :slight_smile: will i get any build errors further, like during insmod, rmmod , can you please tell me what i should make ready for out-of-tree kernel module development

I said “get past that initial error” because I have no idea what code you are compiling. There could be a multitude of other reasons why your kernel module could not compile once the header issue is resolved. I can only comment on the errors you list, not the infinite number of unknowable potential problems. Please try what I suggested and then post your progress.

frank

I was not able to do that why so ???

Sorry, bone47 is way ‘before’ the repo was enabled. Start with the latest image.

you meant to say flash a latest image on beagle bone black

dont know whether i can go with this bone47 distro , but i have done below things and my module got inserted and i am happy :stuck_out_tongue:

No, the first time it succedded but dont know why the second time it started saying

i simply decided to update my eMMC with latest flash will update after it, by the way i am facing some issues while flashing the on board eMMC , help me in the tread named:Unable to Flash the internal eMMC of BBB Rev C

You should look more closely at the results. Your module built successfully and should be usable. The messages regarding “clock skew detected” are warnings only. They are usually caused when during separate compilation attempts (usually across system boots) the system clock has changed. You can usually eliminate those type of warnings by first running “make clean” then your normal make.

frank

Thank you very much for the repeated support, but any ways i have tried to flash my eMMC with latest image via SD (in middle i failed )after which i was not able to login to, may be my eMMC is corrupted now , i am trying to flash a new latest image on to my board in which i am facing many problems please answer some of my quires at thread named Unable to Flash the internal eMMC of BBB Rev C