LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-23-2013, 05:24 PM   #1
georgewhr
Member
 
Registered: Nov 2012
Location: SF Bay Area
Posts: 46

Rep: Reputation: Disabled
Question how to write the compiler command or in Makefile to ARMv6


I was trying to compile a kernel module for my raspberry pi which runs 3.6.11+ Linux kerne. The kernel source on my development host is as same as the one running on rpi. When I do "modinfo spidev.ko" which is compiled on my host machine,
it shows "vermagic: 3.6.11+ preempt mod_unload modversions ARMv5".

However when I do "modinfo spidev.ko"(this module which comes with the image I downloaded from internet is under /lib/modules/kernel/drivers/spidev.ko in my raspberry pi), it shows "3.6.11+ preempt mod_unload modversions ARMv6".

Becasue the first one is ARMv5 so that it cannot be insmod to raspberry.

So does anybody know how to specify ARMv6 when I cross-compile the module on my host?
 
Old 10-24-2013, 12:49 PM   #2
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,443
Blog Entries: 8

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
You should review the documentation for how configure tools to build the RPi kernel, here's one option:

http://elinux.org/RPi_Kernel_Compilation
 
Old 10-25-2013, 01:31 PM   #3
georgewhr
Member
 
Registered: Nov 2012
Location: SF Bay Area
Posts: 46

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
You should review the documentation for how configure tools to build the RPi kernel, here's one option:

http://elinux.org/RPi_Kernel_Compilation
Hi rtmistler, thanks for your help. I did add the extra flag in my Makefile as the website said. My Makefile is like below

**********************************************************
obj-m += hello.o
HOSTCFLAGS=-march=armv6zk -mtune=arm1176jzf-s
all:
make -C /home/gwang/raspi_tool/kernel M=$(PWD) modules
clean:
make -C /home/gwang/raspi_tool/kernel M=$(PWD) clean
**********************************************************

But however I did "modinfo hello.ko" after I compiled it. It still shows the arch is ARMv5.

Here below is compile message it gives:

****************************************************************
gwang@george-dell:~/Dropbox/modules$ make ARCH=arm CROSS_COMPILE=arm-bcm2708-linux-gnueabi-
make -C /home/gwang/raspi_tool/kernel M=/home/gwang/Dropbox/modules modules
make[1]: Entering directory `/home/gwang/raspi_tool/kernel'
CC [M] /home/gwang/Dropbox/modules/hello.o
/home/gwang/Dropbox/modules/hello.c:1:0: warning: "MODULE" redefined [enabled by default]
this is the location of the previous definition
/home/gwang/Dropbox/modules/hello.c:3:0: warning: "__KERNEL__" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
Building modules, stage 2.
MODPOST 1 modules
WARNING: "__gnu_mcount_nc" [/home/gwang/Dropbox/modules/hello.ko] undefined!
CC /home/gwang/Dropbox/modules/hello.mod.o
LD [M] /home/gwang/Dropbox/modules/hello.ko
make[1]: Leaving directory `/home/gwang/raspi_tool/kernel

gwang@george-dell:~/Dropbox/modules$ modinfo hello.ko
filename: hello.ko
license: GPL
srcversion: 81534A67BAB6D41BF92CCE5
depends:
vermagic: 3.6.11+ mod_unload modversions ARMv5 p2v8

***********************************************************************************
 
Old 10-25-2013, 03:05 PM   #4
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,443
Blog Entries: 8

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
I think the proper term is "CFLAGS" not "HOSTCFLAGS", but those are the correct terms to use.

Another option which I didn't think of before is to build the module "on" the raspberry pi. That will clearly use the on system libraries an produce a result which will work on that machine.
 
Old 10-25-2013, 05:12 PM   #5
georgewhr
Member
 
Registered: Nov 2012
Location: SF Bay Area
Posts: 46

Original Poster
Rep: Reputation: Disabled
I changed to CFLAGS but I still get the ARMv5 version module.
Did you mean build the module directly on ras pi? I guess that's possible gonna work but I still want to try out on host machine...

Quote:
Originally Posted by rtmistler View Post
I think the proper term is "CFLAGS" not "HOSTCFLAGS", but those are the correct terms to use.

Another option which I didn't think of before is to build the module "on" the raspberry pi. That will clearly use the on system libraries an produce a result which will work on that machine.
 
Old 10-26-2013, 05:14 AM   #6
georgewhr
Member
 
Registered: Nov 2012
Location: SF Bay Area
Posts: 46

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by rtmistler View Post
I think the proper term is "CFLAGS" not "HOSTCFLAGS", but those are the correct terms to use.

Another option which I didn't think of before is to build the module "on" the raspberry pi. That will clearly use the on system libraries an produce a result which will work on that machine.
Hey man, I got it works, just change CONFIG_CPU_32v5 to CONFIG_CPU_32v6 in ./include/config/auto.conf and it will become armv6, but I still have to figure out how to add "preempt" option.
 
Old 10-28-2013, 09:37 AM   #7
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: Angstrom, Debian, Ubuntu, MINT
Posts: 1,443
Blog Entries: 8

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
Congrats! I've not mucked with the kernel preempt option if that's what you're referring too. Pretty sure there's info on that available via some general web searching.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compiler flags in Makefile..!!!?? jaiChara Suse/Novell 4 05-26-2011 01:15 PM
help: makefile how to let it locate c compiler in a relative path? lxpwj Programming 4 09-25-2009 04:38 AM
Compiler/Makefile help doxy Linux - Newbie 3 03-14-2008 03:10 PM
Linux shell command for makefile.in to create a text file and write to it alix123 Programming 8 01-07-2005 09:18 AM
How must I edit a Makefile for another compiler??? Schmurff Fedora 3 09-28-2004 04:16 AM


All times are GMT -5. The time now is 11:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration