problem with creating a kernel module program for angstrom os

491 views
Skip to first unread message

siva kumar

unread,
Mar 7, 2014, 1:30:41 AM3/7/14
to beagl...@googlegroups.com
hello,

i recently purchased beagle bone black . my bbb come with pre compiled angstrom os( Angstrom v2012.12 - Kernel 3.8.13) still i didn't  updated my os 
i try to test my board with simple hello module program . but when i insert a module i got the error message 
root@beaglebone:~# insmod hello.ko
Error: could not insert module hello.ko: Invalid module format
root@beaglebone:~# 

i compiled the module program from my host pc against arm-angstrom-linux-gcc compiler..and i transferred the hello.ko file via scp protocol.

  

my question is 
[1] Is it possible to add  a module  program with my available angstrom os..if yes what should i do to insert  modules????
[2] what are all the basic things needed to insert a module??


help me to better understand the beagle bone black!!!!
 

Brandon I

unread,
Mar 7, 2014, 4:12:31 PM3/7/14
to beagl...@googlegroups.com
dmesg will give you more details.

This usually means you compiled the kernel modules against a different build of the kernel. So, the kernel source you used didn't match what was on the beaglebone.

You can install the kernel-headers and kernel-dev packages and build directly on the beaglebone. For some time, these packages weren't in sync with the actual kernel installed...as always, good luck with Angstrom.
Message has been deleted

siva kumar

unread,
Mar 8, 2014, 1:57:54 AM3/8/14
to beagl...@googlegroups.com
thanks for your reply 

yes , u r right  i compiled the module against arm-angstrom-linux-gnueabi-gcc but my angstrom os comes with Linaro gcc 
root@beaglebone:~# opkg list_installed | grep gcc
gcc - linaro-4.7-r9.2
gcc-symlinks - linaro-4.7-r9.2
libgcc-s-dev - linaro-4.7-r9.0
libgcc1 - linaro-4.7-r9.0
perl-module-extutils-cbuilder-platform-windows-gcc - 5.14.2-r13.1

root@beaglebone:~# dmesg | head
[ 0.000000] Booting Linux on physical CPU 0×0
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.8.13 (koen@rrMBP) (gcc version 4.7.3 20130205 (prerelease) (Linaro GCC 4.7-2013.02-01) ) #1 SMP Tue Jun 18 02:11:09 EDT 2013
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=50c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine: Generic AM33XX (Flattened Device Tree), model: TI AM335x BeagleBone
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] On node 0 totalpages: 130816
[ 0.000000] free_area_init_node: node 0, pgdat c0688d80, node_mem_map c06e4000
[ 0.000000] Normal zone: 1024 pages used for memmap

i done the following steps to update my modules for my board .but it says  my kernel headers are up to date.
root@beaglebone:~#  opkg install kernel-headers
Package kernel-headers (3.8.13-r23a.22) installed in root is up to date.

[1] what should i do to get my modules to work with??

Brandon I

unread,
Mar 8, 2014, 4:21:34 AM3/8/14
to beagleboard
Just a regular kernel type makefile. For examlpe, here's mine for a file phyaccess.c

BEAGLEBONE_PROJ=/systems/Projects/beaglebone/workspace/Beaglebone
MDIO_ROOT=$(BEAGLEBONE_PROJ)/local/MDIODriver

# for kernel module make uses kbuild. Paths have to be absolute, not relative.
EXTRA_CFLAGS+=-I$(MDIO_ROOT)/include -I$(MDIO_ROOT) -I$(BEAGLEBONE_PROJ)/include -I$(BEAGLEBONE_PROJ)/Interface/local/include -Werror

obj-m += phyaccess.o

all:
make -C $(KERNELDIR) M=$(PWD) modules

clean:
make -C $(KERNELDIR) M=$(PWD) clean



--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/fIJ5YE_fJpg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brandon I

unread,
Mar 8, 2014, 4:22:49 AM3/8/14
to beagleboard
Missed first line on that copy paste. Should be

KERNELDIR := /usr/src/kernel

siva kumar

unread,
Mar 8, 2014, 9:20:13 AM3/8/14
to beagl...@googlegroups.com
hai,
 thank u!!
but  my  folder structure from my board looks like

root@beaglebone:/usr/src# ls
backfire  linux-3.8.13
root@beaglebone:/usr/src# cd linux-3.8.13/
root@beaglebone:/usr/src/linux-3.8.13# ls
include
root@beaglebone:/usr/src/linux-3.8.13/include# ls

asm  asm-generic  drm  linux  mtd  rdma  scsi  sound  uapi  video  xen

root@beaglebone:/usr/src/linux-3.8.13/include/linux# ls

byteorder  dvb isdn    netfilter_arp     netfilter_ipv6  spi     tc_ematch
caif   hdlc  mmc    netfilter_bridge  nfsd      sunrpc  usb
can   hsi netfilter  netfilter_ipv4    raid      tc_act  wimax

root@beaglebone:/usr/src/linux-3.8.13/include/linux# 

this info shows that my board shipped with no module support by default ..!!!

now question is 
[1] still i didn't update or upgraded my angstrom os ..shall i need to do or is there any other way to insert my hello_world.ko module into my board??
i found 1 more link for installing  the module libs sturcture and soure into the running os . here the link
will this link  help me to insert also to create  a modules without fail ..

can you suggest your opinion..pls..



 
regards
siva

Brandon I

unread,
Mar 8, 2014, 2:31:36 PM3/8/14
to beagl...@googlegroups.com
Did you install the kernel-dev package?

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/fIJ5YE_fJpg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages