Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
curioct
Old
#1  
Senior Member - OP
Thanks Meter 24
Posts: 173
Join Date: Jan 2011
Default [Q] Can any kernel developer help me?

I am trying to compile and insert the CFG80211.ko module

I have built an Ubuntu VM and installed the correct codesourcery cross compiler.

I have been able to build several modules which successfully insert. (ntfs, lib80211, all three lib80211_crypt modules, all three wusb modules, uwb, veth etc etc)

however the cfg80211.ko module always fails with invalid argument.

dmesg reports :-
Code:
[140146.246732] cfg80211: disagrees about version of symbol wireless_send_event
[140146.246751] cfg80211: Unknown symbol wireless_send_event (err -22)
cfg80211 depends on rfkill which is, as far as I cant tell, precompiled into the phone kernel.

the relevant section of the config file is as follows:-

Code:
#
# Bluetooth device drivers
#
# CONFIG_BT_HCIBTUSB is not set
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_BCSP is not set
# CONFIG_BT_HCIUART_LL is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
# CONFIG_BT_MRVL is not set
CONFIG_BT_HID=m
# CONFIG_AF_RXRPC is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_WIRELESS_COMPAT=m
CONFIG_CFG80211=m
# CONFIG_NL80211_TESTMODE is not set
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_REG_DEBUG is not set
# CONFIG_CFG80211_DEFAULT_PS is not set
# CONFIG_CFG80211_DEBUGFS is not set
# CONFIG_CFG80211_INTERNAL_REGDB is not set
CONFIG_CFG80211_WEXT=y
# CONFIG_WIRELESS_EXT_SYSFS is not set
CONFIG_LIB80211=m
CONFIG_LIB80211_CRYPT_WEP=m
CONFIG_LIB80211_CRYPT_CCMP=m
CONFIG_LIB80211_CRYPT_TKIP=m
# CONFIG_LIB80211_DEBUG is not set
CONFIG_MAC80211=m
CONFIG_MAC80211_HAS_RC=y
# CONFIG_MAC80211_RC_PID is not set
CONFIG_MAC80211_RC_MINSTREL=y
# CONFIG_MAC80211_RC_DEFAULT_PID is not set
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel"
# CONFIG_MAC80211_MESH is not set
# CONFIG_MAC80211_LEDS is not set
# CONFIG_MAC80211_DEBUGFS is not set
# CONFIG_MAC80211_DEBUG_MENU is not set
# CONFIG_WIMAX is not set
CONFIG_RFKILL=y
CONFIG_RFKILL_PM=y
# CONFIG_RFKILL_INPUT is not set
# CONFIG_NET_9P is not set
# CONFIG_CAIF is not set

#
# Device Drivers
#
Full .config file attached below.

I have tried converting RFKILL to a module, in order to enable CONFIG_RFKILL_INPUT to yes but the compile completely fails when this is set.

I have added WIRELESS_COMPAT details in the Kconfig file but this did not help and I am now lost as to how to troubleshoot this?

Anyone have any idea on what might be missing?
Attached Files
File Type: rar config.rar - [Click for QR Code] (15.2 KB, 15 views)
 
Entropy512
Old
#2  
Elite Recognized Developer
Thanks Meter 20794
Posts: 11,493
Join Date: Aug 2007
Location: Owego, NY

 
DONATE TO ME
If you're able to compile the modules, you should be able to compile the kernel - do the modules insmod against the compiled kernel?
*so much sig updating needed*

My Github profile - Some Android stuff, some AVR stuff

An excellent post on "noobs vs. developers"

A few opinions on kernel development "good practices"

Note: I have chosen not to use XDA's "friends" feature - I will reject all incoming "friend" requests.

Code:
<MikeyMike01> Smali is a spawn of hell
<shoman94> ^^^ +!
Code:
<Entropy512> gotta be careful not to step on each other's work.  :)
<Bumble-Bee> thats true
<jerdog> compeete for donations
 
curioct
Old
#3  
Senior Member - OP
Thanks Meter 24
Posts: 173
Join Date: Jan 2011
Quote:
Originally Posted by Entropy512 View Post
If you're able to compile the modules, you should be able to compile the kernel - do the modules insmod against the compiled kernel?
Yes all the other modules I mentioned all insert fine the ones that I have compiled that dont insert have dependancies that all stem back to the cfg80211.ko that is giving me the messages in the first post.

from the documentation cfg80211 is dependant on RFKILL which is precompiled into the kernel.
 
curioct
Old
#4  
Senior Member - OP
Thanks Meter 24
Posts: 173
Join Date: Jan 2011
Quote:
Originally Posted by Entropy512 View Post
If you're able to compile the modules, you should be able to compile the kernel - do the modules insmod against the compiled kernel?
Ahhh rereading your post, I see what you mean, I haven't installed the built kernel (though I did do the full build) on the phone, not entirely sure how to package it and I haven't tried to look because I really dont want to install a full kernel on the phone.

In any case I have used the default samsung config to build from fro the correct kernel.
 
s0be
Old
#5  
s0be's Avatar
Recognized Developer
Thanks Meter 390
Posts: 602
Join Date: Dec 2007
Location: Pentwater

 
DONATE TO ME
Quote:
Originally Posted by curioct View Post
I am trying to compile and insert the CFG80211.ko module

I have built an Ubuntu VM and installed the correct codesourcery cross compiler.

I have been able to build several modules which successfully insert. (ntfs, lib80211, all three lib80211_crypt modules, all three wusb modules, uwb, veth etc etc)

however the cfg80211.ko module always fails with invalid argument.

dmesg reports :-
Code:
[140146.246732] cfg80211: disagrees about version of symbol wireless_send_event
[140146.246751] cfg80211: Unknown symbol wireless_send_event (err -22)
cfg80211 depends on rfkill which is, as far as I cant tell, precompiled into the phone kernel.

the relevant section of the config file is as follows:-

Code:
#
# Bluetooth device drivers
#
# CONFIG_BT_HCIBTUSB is not set
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_BCSP is not set
# CONFIG_BT_HCIUART_LL is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
# CONFIG_BT_MRVL is not set
CONFIG_BT_HID=m
# CONFIG_AF_RXRPC is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_WIRELESS_COMPAT=m
CONFIG_CFG80211=m
# CONFIG_NL80211_TESTMODE is not set
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_REG_DEBUG is not set
# CONFIG_CFG80211_DEFAULT_PS is not set
# CONFIG_CFG80211_DEBUGFS is not set
# CONFIG_CFG80211_INTERNAL_REGDB is not set
CONFIG_CFG80211_WEXT=y
# CONFIG_WIRELESS_EXT_SYSFS is not set
CONFIG_LIB80211=m
CONFIG_LIB80211_CRYPT_WEP=m
CONFIG_LIB80211_CRYPT_CCMP=m
CONFIG_LIB80211_CRYPT_TKIP=m
# CONFIG_LIB80211_DEBUG is not set
CONFIG_MAC80211=m
CONFIG_MAC80211_HAS_RC=y
# CONFIG_MAC80211_RC_PID is not set
CONFIG_MAC80211_RC_MINSTREL=y
# CONFIG_MAC80211_RC_DEFAULT_PID is not set
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel"
# CONFIG_MAC80211_MESH is not set
# CONFIG_MAC80211_LEDS is not set
# CONFIG_MAC80211_DEBUGFS is not set
# CONFIG_MAC80211_DEBUG_MENU is not set
# CONFIG_WIMAX is not set
CONFIG_RFKILL=y
CONFIG_RFKILL_PM=y
# CONFIG_RFKILL_INPUT is not set
# CONFIG_NET_9P is not set
# CONFIG_CAIF is not set

#
# Device Drivers
#
Full .config file attached below.

I have tried converting RFKILL to a module, in order to enable CONFIG_RFKILL_INPUT to yes but the compile completely fails when this is set.

I have added WIRELESS_COMPAT details in the Kconfig file but this did not help and I am now lost as to how to troubleshoot this?

Anyone have any idea on what might be missing?
Are you installing the kernel and modules, or just the modules? If you are just installing the modules, are you using an IDENTICAL version of gcc, with nothing changed between N<=>M<=>Y except for your rt2x00 module in the .config?

useful information would be:

Your kernel version string from the phone: uname -a
A diff of the base .config and the new .config: diff -ubw orig.config new.config
A diff of the phone's working .config and your .config.

You can generally get the .config your running kernel was compiled with from /proc/config.gz on the device. You would then need to gunzip that and compare it to your .config with the diff command above.
There is no need to pm me, I probably won't answer. Just ask whatever you have to ask in a public thread.
My Github
 
curioct
Old
(Last edited by curioct; 16th November 2011 at 11:29 PM.)
#6  
Senior Member - OP
Thanks Meter 24
Posts: 173
Join Date: Jan 2011
Quote:
Originally Posted by s0be View Post
Are you installing the kernel and modules, or just the modules? If you are just installing the modules, are you using an IDENTICAL version of gcc, with nothing changed between N<=>M<=>Y except for your rt2x00 module in the .config?

useful information would be:

Your kernel version string from the phone: uname -a
A diff of the base .config and the new .config: diff -ubw orig.config new.config
A diff of the phone's working .config and your .config.

You can generally get the .config your running kernel was compiled with from /proc/config.gz on the device. You would then need to gunzip that and compare it to your .config with the diff command above.
Unfortunately /proc/config.gz support is not configured in the samsung kernel by default therefore the file is not present. uname gives 2.6.35.7-I9100XXKH3-CL479037

And I have tried the recommended codesourcery cross compiler and one other variant of this and the results are the same.

it's a stock rom with an insecure kernel (basically a repack of the stock kernel) to allow rooting from what I can gather.

I have tried many configuration of build from the default .config and just building the top dependancy module from the default config

In this case the top of the tree is CFG80211
(rt2x00usb depends on rt2x00lib, depends upon mac80211, mac8211 depends upon cfg80211 and cfg80211 depends upon rfkill. There are also some dependencies on kernel crypto libraries which I am unclear about but should be in the kernel build)

I have found it makes no difference at all if I build lots of modules at once or just the very bare CFG80211.ko with as few options as possible. The failures are the same trying to insert cfg80211.ko. as it is whether I use busybox insmod, standard insmod or insmod from within a chroot. (in the searches I read modules can behave differently with busybox)

the only changes I made from the samsung default config is switching some debugging options off as per this thread http://forum.xda-developers.com/show....php?t=1123643

other than that it is a stock samsung default config for a 2.6.25.7 kernel build, as distributed in the samsung source code.

I haven't had the nerve to install the fully built kernel because the phone is a key tool for me reflashing a kernel is kind of a last resort

The attached rar file includes the default config (c1_rev02_premium_defconfig) the config used (.config) the output of diff -uwb between the two (differences.txt) and the two modules built ntfs.ko and cfg80211.ko.

file reveal ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped on both modules. (done chroot)

I use ntfs.ko as a control since it's a small module and in this build it inserts just fine. cfg80211.ko fails with the same message and dmesg info mentioned in the first post.

As I previously mentioned I did try modifying the RFKILL sections to be built as a module but when this is attempt the kernel build fails completely with the error:-

Code:
ERROR: "s3c_gpio_slp_cfgpin" [arch/arm/mach-s5pv310/c1-rfkill.ko] undefined!
ERROR: "s3c_gpio_slp_setpull_updown" [arch/arm/mach-s5pv310/c1-rfkill.ko] undefined!
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
Thanks for looking at this for me
Attached Files
File Type: rar modules.rar - [Click for QR Code] (1.25 MB, 5 views)
 
s0be
Old
#7  
s0be's Avatar
Recognized Developer
Thanks Meter 390
Posts: 602
Join Date: Dec 2007
Location: Pentwater

 
DONATE TO ME
Do you have a link to your kernel tree? I'd suspect that CFG80211_WEXT being enabled makes some changes in the WEXT functions that get compiled in kernel. With CONFIG_WEXT_* being =Y, your enableing CFG80211_WEXT probably made things not agree. Also, I believe the rt2x00 driver is a mac80211 one, so you'll likely need that too.

In summary, you'll very likely have to use your own kernel to get this going. At least loading the ntfs.ko answers that it's not a toolchain/source tree issue.
There is no need to pm me, I probably won't answer. Just ask whatever you have to ask in a public thread.
My Github
 
s0be
Old
#8  
s0be's Avatar
Recognized Developer
Thanks Meter 390
Posts: 602
Join Date: Dec 2007
Location: Pentwater

 
DONATE TO ME
Quote:
Originally Posted by curioct View Post
I use ntfs.ko as a control since it's a small module and in this build it inserts just fine. cfg80211.ko fails with the same message and dmesg info mentioned in the first post.

As I previously mentioned I did try modifying the RFKILL sections to be built as a module but when this is attempt the kernel build fails completely with the error:-

Code:
ERROR: "s3c_gpio_slp_cfgpin" [arch/arm/mach-s5pv310/c1-rfkill.ko] undefined!
ERROR: "s3c_gpio_slp_setpull_updown" [arch/arm/mach-s5pv310/c1-rfkill.ko] undefined!
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
This error is due to another missing dependency (and the lack of proper dependency definitions in KCONFIG). You need to do:

egrep "s3c_gpio_slp_" -rsn

to find where those functions are defined, and find out why they're not being compiled. It's quite likely something like enabling rfkill for your arch/tree pulled in that c1-rfkill file (is your board a c1?) which is either not for your actual device, or dependent on something else being enabled. This is wholly based on previous experience with HTC kernel trees, where files from other Boards seemed to tag along.

I have no samsung hardware (although the GSII is on the list of what I'm considering ;) )
There is no need to pm me, I probably won't answer. Just ask whatever you have to ask in a public thread.
My Github
 
curioct
Old
#9  
Senior Member - OP
Thanks Meter 24
Posts: 173
Join Date: Jan 2011
Quote:
Originally Posted by s0be View Post
Do you have a link to your kernel tree? I'd suspect that CFG80211_WEXT being enabled makes some changes in the WEXT functions that get compiled in kernel. With CONFIG_WEXT_* being =Y, your enableing CFG80211_WEXT probably made things not agree. Also, I believe the rt2x00 driver is a mac80211 one, so you'll likely need that too.

In summary, you'll very likely have to use your own kernel to get this going. At least loading the ntfs.ko answers that it's not a toolchain/source tree issue.
I am aware I'll need other modules but they all come back to dependancy on CFG80211 so I am concentrating my efforts around that.

The link to the kernel tree is
git://opensource.samsung.com/p_497

but I have also used :-
https://github.com/GalaxySII/samsung-kernel-galaxysii

with the exact same results.

The config_wext elements are listed under the bluetooth elements, but I am firstly concerned that disabling these elements with adversely effect the standard wifi comms. which would not be acceptable even if I could package and install a fully kernel build. (which I can probably do enough research, on this site, to work out eventually, although I admit to some trepidation about this).
 
s0be
Old
#10  
s0be's Avatar
Recognized Developer
Thanks Meter 390
Posts: 602
Join Date: Dec 2007
Location: Pentwater

 
DONATE TO ME
Quote:
Originally Posted by curioct View Post
I am aware I'll need other modules but they all come back to dependancy on CFG80211 so I am concentrating my efforts around that.

The link to the kernel tree is
git://opensource.samsung.com/p_497

but I have also used :-
https://github.com/GalaxySII/samsung-kernel-galaxysii

with the exact same results.

The config_wext elements are listed under the bluetooth elements, but I am firstly concerned that disabling these elements with adversely effect the standard wifi comms. which would not be acceptable even if I could package and install a fully kernel build. (which I can probably do enough research, on this site, to work out eventually, although I admit to some trepidation about this).
Ok, per:

https://github.com/GalaxySII/samsung...ss/wext-core.c

Lines: 434, 548, and 613, 653

Your kernel will have to be replaced to have cfg80211, mac80211, and rt2x00 working. There is no way around this, as that code is compiled into the kernel, and cfg80211 and mac80211 depend on those function doing more than your kernel does. There's no way around it. That's only analyzing the wext-core... there may be other differences.
There is no need to pm me, I probably won't answer. Just ask whatever you have to ask in a public thread.
My Github

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Flash Custom ROM and Recovery to Samsung Galaxy S 4

After reading about Dan Rosenberg’s bootloader exploit for the Samsung Galaxy S 4,I … more

Windows-Based Multi-Tool for the Sony Xperia U

If you are a flashaholic and an owner of the Sony Xperia U, you may be interested in the … more

XDA University: Crafting Recovery-Flashable Packages

Those of us who use Linux on a day to day basis don’t think twice about sinking … more