[Q] Compiling modules to existing stock kernel - Galaxy S III Q&A, Help & Troubleshooting

I'm currently at stock rom JB 4.1.2 with kernel 3.0.31-566833.
For my previous rom JB 4.1.1, I've used cifs module from:
http://forum.xda-developers.com/showthread.php?t=1697982&page=6
I want to compile cifs and nfs modules, so I've donwloaded: arm-eabi for linux 4.4.3 toolchain, kernel source from: opensouce.samsung.com (GT-I9300_JB_Opensource_Update6.zip).
Then I've configured CROSS_COMPILE, arch and extraversion -566833, configured kernel as written in README attached for kernel source.
After insmod I've got exec format error. It's compiled correctly, so either wrong modversion (modinfo shows correct version) or wrong source. But There's only info, its's 3.0.31 kernel, so I don't know how to check if I'm compiling from exact the same kernel tree, that stock JB 4.1.2 kernel.
What should I do to compile working modules?
http://forum.xda-developers.com/showthread.php?t=1697982&page=6
Code:
filename: /mnt/sdcard/Download/mod/../modules/md4.ko
description: MD4 Message Digest Algorithm
license: GPL
depends:
vermagic: 3.0.31-204919 SMP preempt mod_unload modversions ARMv7 p2v8
My module:
Code:
filename: /mnt/sdcard/Download/mod/md4.ko
description: MD4 Message Digest Algorithm
license: GPL
depends:
vermagic: 3.0.31-566833 SMP preempt mod_unload modversions ARMv7 p2v8
Version magic looks the same, but:
insmod: init_module 'md4.ko' failed (Exec format error)

I've got the same problem when trying to insmod my module. Did you find any solutions ? What does dmesg say after the insmod command ?
It show me an error about a wrong "module_layout" but even if I correct it , the problem stay

Related

Openvpn and tun.ko

I found a tun.ko here: http://forum.xda-developers.com/showthread.php?t=741182
I tried to apply, but:
Code:
D:\x10\ftool>adb shell
$ su
su
# insmod /system/lib/modules/tun.ko
insmod /system/lib/modules/tun.ko
insmod: init_module '/system/lib/modules/tun.ko' failed (Exec format error)
#
Then I did dmesg:
Code:
.
.
.
<3>[ 5883.527575] tun: version magic '2.6.29-rel preempt mod_unload ARMv7 ' should be '2.6.29 preempt mod_unload ARMv6 '
So, I ssume the attached tun.ko is compiled for X10 mini(or x10) and not for X10 mini pro which has ARMv7 proc instead of ARMv6.
tun.ko should be built for Mini Pro.
Can anybody help where I can find the source of tun.ko and all the necessary source which I need for the compiling?
Any suggestion where to find desp. how to compile?
Hi, try this ... I compiled it for the X10 mini from eDream_2.0.A.0.504 sources. It's work for me (# insmod /system/lib/modules/tun.ko ), but OpenVPN restart my phone after this:
Code:
Thu Dec 9 15:20:22 2010 us=583828 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:1: remote-gateway (2.1.1)
Thu Dec 9 15:20:22 2010 us=586573 OPTIONS IMPORT: timers and/or timeouts modified
Thu Dec 9 15:20:22 2010 us=587870 OPTIONS IMPORT: --ifconfig/up options modified
Thu Dec 9 15:20:22 2010 us=588996 OPTIONS IMPORT: route options modified
Maybe you have better luck
P.S. I use OpenVPN installer and OpenVPN settings from Market.
How did you manage to compile it?
If i try it with the 2.1 source and the toolchain of the Android-Git repo it seams to build for ARMv7 which should be ARMv6. How to change that?

[HOWTO] Compile modules for stock kernels

I couldn't figure out how to compile a module for stock kernel - I kept getting the following in dmesg:
Code:
<module>: disagrees about version of symbol module_layout
I sent a message to Samsung Open Source Release Center on Friday and received a very helpful response yesterday. Basically, c1_rev02_defconfig contains some debug options that are not set in the actual kernel. These are the options that should not be set in the config:
Code:
CONFIG_DEBUG_PREEMPT
CONFIG_DEBUG_RT_MUTEXES
CONFIG_DEBUG_SPINLOCK
CONFIG_DEBUG_MUTEXES
CONFIG_PROFILING
CONFIG_PERF_EVENTS
CONFIG_PERF_COUNTERS
CONFIG_LATENCYTOP
CONFIG_FTRACE
You can use the attached script to modify all these values (the script was also supplied by Samsung, although it was syntactically incorrect and a couple of modifications were necessary to make it work). I have included a copy of the c1_rev02_defconfig with these modifications.
Using this config, I was finally able to compile modules that can actually be loaded on the device
Kudos to Samsung for sending me this information.
Nice info I guess that will help out the people who had issues with kernel modules on stock ROMs...
jps1974 said:
Kudos to Samsung for sending me this information.
Click to expand...
Click to collapse
No, that is the stuff they should put on their server. Makes you wonder what else they haven't released. Every time they make modifications to the GPL open source code (eg. kernel) and release a new version, they must release the code, and the exact same files they used to build it.
Thanks
That was the info I missed. I have successfully compiled cifs for kf1.
Sent from my GT-I9100 using XDA App
You know guys if there is a basic tutorial available online?.
Thank you!
Hi, I am new to compile modules for android (new to compile kernel anyway)
thanks for your info and config, I am now able to compile modules.
I had a problem on the compiled modules tho, wonder can anyone please point me some direction?
when I insmod the ko, dmesg gives me:
xyz.ko : no symbol version for module_layout
Any hint?
more info, I am compiling like:
I am aiming on compiling to for stock ROM, uname -r > 2.6.35.7-I9100XWKDD-CL161513
- I read, and follow base on http://forum.xda-developers.com/showthread.php?t=1113191
- kernel source from: SHW-M250L kernel source from OSRC, https://opensource.samsung.com/
- .config file of this post, select my wanted modules using make menuconfig
- then make ARCH=arm CROSS_COMPILE=__MYPATH__/bin/arm-none-eabi- modules
Thanks!
Hi,
I'm using insecure kernel :
Code:
#uname -r
2.6.35.7-I9100XWKE2-CL187606
I cross compiled modules using your config file but each time I'm trying to insmod it, I have: failed (Exec format error)
and busybox insmod gives me a invalid module format error
I use the commands :
Code:
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- modules
So I don't really know where I'm wrong here
alx5962 said:
Hi,
I'm using insecure kernel :
Code:
#uname -r
2.6.35.7-I9100XWKE2-CL187606
I cross compiled modules using your config file but each time I'm trying to insmod it, I have: failed (Exec format error)
and busybox insmod gives me a invalid module format error
I use the commands :
Code:
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- modules
So I don't really know where I'm wrong here
Click to expand...
Click to collapse
can you do a dmesg here?
I "think" I am on a same boat as you are on the error tho.....
I didn't checked dmesg, shame on me !
so the error is :
joydev: no symbol version for module_layout
I used your config file, do I need to fix config each time I update with menuconfig ?
alx5962 said:
I didn't checked dmesg, shame on me !
so the error is :
joydev: no symbol version for module_layout
I used your config file, do I need to fix config each time I update with menuconfig ?
Click to expand...
Click to collapse
dmesg is good to read, we are both compiling the same module (joydev)
the config file is not from me, is from jps1974.
no I don't think you need to fix unless you uses the build_kernel.sh unmod, since it cp the defconfig everytime, still I face the same problem...
Instead of SHW-M250L kernel source from OSRC, I just did a quick change to GT-I9100_HK_Opensource.zip
A little bit different on the package, but still the same work flow and results...
.config file:
cp ~/sgs2/9100i_hk/arch/arm/configs/c1_rev02_defconfig ~/sgs2/9100i_hk/kernel/.config
./fix_config.sh
make ARCH=arm CROSS_COMPILE=[PATH_TO_G++LITE_BIN] modules
compile without problem, but no luck, insmod still report:
insmod: init_module '/lib/modules/joydev.ko' failed (Exec format error)
dmesg | grep joy report:
joydev: no symbol version for module_layout
Any help, any directions?
Thanks in advance!!!
I used the european I9100 source from the samsung site and the config file from the opening post when I successfully compiled my modules.
Sent from my GT-I9100 using XDA App
richyy74 said:
I used the european I9100 source from the samsung site and the config file from the opening post when I successfully compiled my modules.
Sent from my GT-I9100 using XDA App
Click to expand...
Click to collapse
YES SIR, will do try this src next!!!!!
richyy74 would u mind share with us which kernel are you at on your phone?
and which version of toolchain u are using on the compile?
Thanks.
A bit of update, just try with GT-I9100_Opensource.zip, nope, still no luck........
I start to think would that be problem of toolchain (which in the readme of the zip from Samsung, they are using 2009q3 while I am using the current 2011 build), or it is possible problem because my/our unsecure kernel (2.6.35.7-I9100XWKDD-CL161513)...
update: Roll back on 2009q3, nope, no luck.............
I can only thinks that it is due to the kernel I am using.............
I compiled for ke7 and kf1 cifs, slow-work and cpu governor modules.
I used the 2009 gnu/linux toolchain from codesourcery /it ends with 67 something/
I never succeded with the version mentioned in the readme.
Sent from my GT-I9100 using XDA App
richyy74 said:
I compiled for ke7 and kf1 cifs, slow-work and cpu governor modules.
I used the 2009 gnu/linux toolchain from codesourcery /it ends with 67 something/
I never succeded with the version mentioned in the readme.
Sent from my GT-I9100 using XDA App
Click to expand...
Click to collapse
Thanks for your direction, will do more test after my "should have slept" 5 hours session.... which end up in data center instead of bed...
utp said:
Thanks for your direction, will do more test after my "should have slept" 5 hours session.... which end up in data center instead of bed...
Click to expand...
Click to collapse
The "exec format error" means that you compiled it for the wrong architecture.
To see which arch the kernel module was compiled for, use the "file" command (found on any Linux computer but not present on the phone itself).
The file command is an extremely useful function for identifying files.
So, at a terminal, type:
Code:
file -k /user/home/output/example.ko
It should output information on the file, which will clarify whether it was statically built, which architecture, etc. Examples:
Dynamically linked executable:
Code:
"ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped"
Statically linked executable:
Code:
"ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped"
Object file:
Code:
"ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped"
Most importantly, if it doesn't say 32bit ARM, it will not work.
So the module I cross-compiled gives me :
joydev.ko: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped.
So it was correctly compiled, I may need to try another toolchain.
Using Sourcery G++ Lite 2009q3-68 for ARM EABI toolchain, still have the issue.
So as I use an insecure kernel, I may need to ask the author what compiler he used for it.

Cifs.ko - Error mounting Network Folder

Ola!
This is my first post on this forum and I would like to thanks the moderators for the quality and organization of the information posted on this Forum.
My Phone:
Galaxy S3
Android 4.0.4
Kernel: 3.0.15
Base: I9300UBLF2
Problem:
When I try to mount a network path I receive one message saying that device does not exist, after reading some posts and googleing on this subject, I find out that I would need to load cifs.ko module. I tried a some versions that I foung on Internet but everyone that I tried replied this erros:
[email protected]:/sdcard/Bluetooth # insmod cifs.ko
insmod: init_module 'cifs.ko' failed (Exec format error)
I believe that this is because I would need one compilation for my kernel, am I right? Does anyone can help me to find the correct compilation for my phone or even more, help me with instructions to compile it on the phone?
Thanks and I appreciate your help!
Sidney
Not allowed to post
Unfortunately, because I am a new member on the forum I can't post to developers as the agreed terms and conditions.
On this forum, http://forum.xda-developers.com/showthread.php?t=1697982&page=3 viuliam user is receiveing kernel information to make cifs.ko compatible with new kernels.
He is asking to run this 2 commands and post in that forum, than he will work on that.
Code:
cat /proc/kallsyms | grep -A 1 check_version
Code:
uname -a
Here are my information:
My Phone:
Galaxy S3
Android 4.0.4
Kernel: 3.0.15
Base: I9300UBLF2
Code
Code:
[email protected]:/data/local # cat /proc/kallsyms | grep -A 1 check_version
c00b5248 t check_version
c00b5318 t get_modinfo
--
c03cd574 t picolcd_check_version
c03cd64c t picolcd_probe
[email protected]:/data/local # uname -a
Linux localhost 3.0.15-679767-user #1 SMP PREEMPT Wed Jun 6 15:43:48 KST 2012 armv7l GNU/Linux
[email protected]:/data/local #
I appreciate if some administrator may send this info to viulian
viulian, congratulations about your work!
Regards

[Q] FTDI USB-RS232 for Trekstore Surftab breeze 7.0

Hello,
I'm trying to connect the Trekstore Surftab breeze 7.0 with a FTDI USB-RS232 Converter.
So, this are the facts:
The tablet is rooted by default, has an Allwinner A13 CPU (sun5i), comes with android 4.0.4 and kernel 3.0.8+.
I thought about downloading the kernel sources, build the single modules usbserial.ko + ftdi_sio.ko and load them manually.
But something seems to be wrong in my solution. Because insmod tells me:
Code:
init_module 'usbserial.ko' failed (Exec format error)
.
I got the same error message loading the ftdi_sio.ko module.
I've done these steps:
First, I downloaded the sources from github (amery/linux-allwinner/tree/wip/lichee3-sunxi/import-sun5i).
Maybe this is the first mistake (wrong kernel sources? repository kernel source is 3.0.8)
Secondly, I downloaded CodeSourcery to compile the kernel for the sun5i architecture. I set the following system variables:
The PATH variable to the compiler binaries and the ARCH variable to "arm".
Via menuconfig I selected the system type: AllWinner SUN5I Platform. Hopefully this are all steps I need for preparation to build the module.
Last but not least I compiled and linked the usb serial sources by executing:
Code:
make M=drivers/usb/serial
from the kernel directory. This builds all modules in the directory, including usbserial.ko and ftdi_sio.ko.
Modinfo shows me:
Code:
filename: drivers/usb/serial/usbserial.ko
license: GPL
description: USB Serial Driver core
author: Greg Kroah-Hartman
srcversion: F0784B79C15C3FAAAF12C46
depends:
vermagic: 3.0.8 mod_unload modversions ARMv7
parm: vendor:User specified USB idVendor (ushort)
parm: product:User specified USB idProduct (ushort)
parm: debug:Debug enabled or not (bool)
Code:
filename: drivers/usb/serial/ftdi_sio.ko
license: GPL
description: USB FTDI Serial Converters Driver
author: Greg Kroah-Hartman <>, Bill Ryder <>, Kuba Ober <>, Andreas Mohr, Johan Hovold <>
srcversion: A3E1F08290F6997001373D4
alias: usb:v0483p3747d*dc*dsc*dp*ic*isc*ip*
alias: usb:v20B7p0713d*dc*dsc*dp*ic*isc*ip*
alias: usb:v0403p9868d*dc*dsc*dp*ic*isc*ip*
.....
alias: usb:v0403pF60Bd*dc*dsc*dp*ic*isc*ip*
alias: usb:v0403pF608d*dc*dsc*dp*ic*isc*ip*
depends: usbserial
vermagic: 3.0.8 mod_unload modversions ARMv7
parm: debug:Debug enabled or not (bool)
parm: vendor:User specified vendor ID (default=0x0403) (ushort)
parm: product:User specified product ID (ushort)
parm: ndi_latency_timer:NDI device latency timer override (int)
I copied both modules using adb push command and tried to insert the modules by using adb shell -> insmod...
But then I get the error described above:
Code:
init_module 'usbserial.ko' failed (Exec format error)
Same for the ftdi module driver.
With the help of dmesg I got:
Code:
usbserial: no symbol version for module_layout
Am I completly wrong in the way of building the drivers? Do I need other kernel sources? Or do I have to set a special symbol anywhere?
I would be pleased if anybody can give an advice.
Thanks in advance,
ssw
Were you able to resolve this?
Can you attach the usbserial.ko?
It's possible that the problem lies with the linux source version.

[Q] module_layout error? help

Been trying for a few days to compile my own module for Geniatech ATV120 (same kernel as ATV1200), I've gotten as far as compile the modules and first I got Exec Error, but after making the changes to get the exact kernel version I now get “disagrees about version of symbol module_layout” so I wanted to know how the hid-sony.ko made by @fma965 (on this thread http://forum.xda-developers.com/showthread.php?t=2262421) since it works perfectly on my atv120, so I did this:
modinfo hid-sony.ko and I got this
filename: hid-sony.ko
license: GPL
alias: hid:b0003v0000054Cp0000024B
alias: hid:b0005v0000054Cp00000268
alias: hid:b0003v0000054Cp0000042F
alias: hid:b0003v0000054Cp00000268
depends:
vermagic: 3.0.8-g525c782 SMP preempt mod_unload modversions ARMv7
I did the same for my module
filename: joydev.ko
license: GPL
description: Joystick device interfaces
author: Vojtech Pavlik <[email protected]>
alias: input:b*v*p*e*-e*1,*k*2C0,*r*a*m*l*s*f*w*
alias: input:b*v*p*e*-e*1,*k*130,*r*a*m*l*s*f*w*
alias: input:b*v*p*e*-e*1,*k*120,*r*a*m*l*s*f*w*
alias: input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*
alias: input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*
alias: input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*
depends:
vermagic: 3.0.8-g525c782 SMP preempt mod_unload modversions ARMv7
so everything seem correct, when to load it with insmod on my ATV120 and I got the “disagrees about version of symbol module_layout” error
ok, back to ubuntu. ran this:
modprobe --dump-modversions hid-sony.ko
0x4e362f07 module_layout
I noticed the module layout so I ran the same on my module
modprobe --dump-modversions joydev.ko
0x82bedd05 module_layout
that seems to be my problem, I know nothing about module layouts, but doing some google research I found I need the same Module.symvers but for the life of me I just cannot get the same one, seeing as @fma965 you are the only one that has been able to compile a module with this kernel, do you still have thie Module.symvers? or can you tell me what kernel you used? or anybody else have any info I could use?
Thanks!
hi i haven't had time to read all this but wanted to reply asap, i no longer have the kernel source nor any associated files, i can't even remember how i did it, sorry for the lack of help as i was hoping to give helpful information.
fma965 said:
hi i haven't had time to read all this but wanted to reply asap, i no longer have the kernel source nor any associated files, i can't even remember how i did it, sorry for the lack of help as i was hoping to give helpful information.
Click to expand...
Click to collapse
hey, no problem Thanks for the reply!
happy holidays

Categories

Resources