5,593,401 Members 36,262 Now Online
XDA Developers Android and Mobile Development Forum

Getting Working Wifi for Kernel builds

Tip us?
 
sleshepic
Old
(Last edited by sleshepic; 20th December 2012 at 04:03 AM.)
#1  
sleshepic's Avatar
Recognized Themer - OP
Thanks Meter 5726
Posts: 3,414
Join Date: Oct 2011
Location: PA

 
DONATE TO ME
Default Getting Working Wifi for Kernel builds

I have been buliding some kernels recently, but have been unable to get the wifi working.

I have tried it having the modules included in initramfs/lib/modules when ramdisk is created and i do mkbootimg, and have also tried just putting all the modules in the flash zip in /system/lib/modules, and excluded it from build process. Both result in no Wifi [Edit, putting the newly built correct modules in my working folders /lib/modules fixed wifi, must not have done it correctly before)

basic overview of what I've done (after zImage compile)

I use "./unpack-bootimg.pl boot.img" to pull the "ramdisk-contents" from the stock kernel, I renamed that folder "initramfs" and threw it in a folder along with my mkbootimg binary, and my zImage I just compiled.

I put the newly created modules from zImage build in my initramfs/libs/modules with

find -name '*.ko' -exec cp -av {} [path to desired folder] \;

I navigate to the initramfs folder and

find .|cpio -o -H newc > ../ramdisk
cd ..
gzip ramdisk

./mkbootimg --kernel ./zImage --ramdisk ./ramdisk.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o boot.img

the resultant boot.img boots fine and shows all other changes, just cant seem to get the wifi working. Anyone have idea for getting wifi working on our Note 2 kernel builds?


Edit: I re-tried and this time it worked. Not sure what was different. Copied the newly created modules into my ramdisk folder (for me was /initramfs/lib/modules) and created my ramdisk.gz etc. made the boot.img and it's all good. The difference must've been having the correct modules in place prior to creating the ramdisk.cpio(then .cpio.gz).
Mods please move if you feel this is in wrong section now etc. Found the answer, thank you
The Following 2 Users Say Thank You to sleshepic For This Useful Post: [ Click to Expand ]
 
garyd9
Old
#2  
garyd9's Avatar
Recognized Developer
Thanks Meter 1871
Posts: 1,836
Join Date: Sep 2006
Location: Pittsburgh, PA
It's only in the wrong section if you don't share what you did wrong, and how you fixed it.

Donations: I don't accept donations, but if you are feeling charitable, help a child by going to http://www.shrinershospitalsforchildren.org/
and click the "Donate Now" link at the top.
The Following User Says Thank You to garyd9 For This Useful Post: [ Click to Expand ]
 
Droidzone
Old
(Last edited by Droidzone; 24th December 2012 at 06:49 AM.)
#3  
Droidzone's Avatar
Recognized Developer
Thanks Meter 2163
Posts: 5,466
Join Date: Sep 2010
Location: Kerala

 
DONATE TO ME
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.

Using the sbin's insmod gives me this:
Code:
[droidzone@supernova android]$adb shell
shell@android:/ $ su
shell@android:/ # insmod /system/lib/modules/dhd.ko                                                
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|shell@android:/ # busybox insmod /system/lib/modules/dhd.ko                
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|shell@android:/ #
I've turned off module versioning, and am not sure why there's a symbol error.

The Following User Says Thank You to Droidzone For This Useful Post: [ Click to Expand ]
 
AndreiLux
Old
(Last edited by AndreiLux; 24th December 2012 at 06:59 PM.)
#4  
AndreiLux's Avatar
Senior Member
Thanks Meter 13326
Posts: 2,646
Join Date: Jul 2011

 
DONATE TO ME
Quote:
Originally Posted by Droidzone View Post
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.

Using the sbin's insmod gives me this:
Code:
[droidzone@supernova android]$adb shell
shell@android:/ $ su
shell@android:/ # insmod /system/lib/modules/dhd.ko                                                
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|shell@android:/ # busybox insmod /system/lib/modules/dhd.ko                
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|shell@android:/ #
I've turned off module versioning, and am not sure why there's a symbol error.
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
The Following 6 Users Say Thank You to AndreiLux For This Useful Post: [ Click to Expand ]
 
Droidzone
Old
(Last edited by Droidzone; 27th December 2012 at 04:23 PM.)
#5  
Droidzone's Avatar
Recognized Developer
Thanks Meter 2163
Posts: 5,466
Join Date: Sep 2010
Location: Kerala

 
DONATE TO ME
I fixed that issue..

The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.

However the inability to load the module persists.

My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".

This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.

dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '

EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.

Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory

Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.

I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.

EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:

Code:
[droidzone@supernova kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42:    addis   r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43:    lwz     r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39:    seth    r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40:    or3     r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149:                     "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104:                    "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565:      if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
	/* ignore __this_module, it will be resolved shortly */
	if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
		return 1;
	/* ignore global offset table */
	if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
		return 1;
Edit3: Solved.

 
garwynn
Old
#6  
garwynn's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6663
Posts: 4,332
Join Date: Jul 2011
Location: Chi-town

 
DONATE TO ME
Quote:
Originally Posted by AndreiLux View Post
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
I'd like to thank you for this information - this cut my dhd.ko from 4.6 MB to around 550 kB - and my resulting kernel as a result. Fully expect this will now get my kernel working as it should.
Contact: Twitter || Google+/Hangouts (Non-Moderator issues only please)
Useful Links: Forum Moderator List || Forum Rules

Please continue to thank and support those who bring these great things to our devices!
(That includes RTs, RCs, RDs/SRDs, FMs/SFMs and the people who maintain the site.)
 
wctliu
Old
#7  
Member
Thanks Meter 2
Posts: 41
Join Date: Feb 2013
Location: China
Quote:
Originally Posted by Droidzone View Post
I fixed that issue..

The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.

However the inability to load the module persists.

My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".

This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.

dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '

EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.

Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory

Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.

I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.

EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:

Code:
[droidzone@supernova kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42:    addis   r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43:    lwz     r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39:    seth    r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40:    or3     r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149:                     "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104:                    "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565:      if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
	/* ignore __this_module, it will be resolved shortly */
	if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
		return 1;
	/* ignore global offset table */
	if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
		return 1;
Edit3: Solved.

How to Solved? Too detailed can you tell us a little bit?
 
Droidzone
Old
#8  
Droidzone's Avatar
Recognized Developer
Thanks Meter 2163
Posts: 5,466
Join Date: Sep 2010
Location: Kerala

 
DONATE TO ME
Quote:
Originally Posted by wctliu View Post
How to Solved? Too detailed can you tell us a little bit?
Used another toolchain.

 
wctliu
Old
#9  
Member
Thanks Meter 2
Posts: 41
Join Date: Feb 2013
Location: China
Quote:
Originally Posted by Droidzone View Post
Used another toolchain.

another toolchain????

Which version?

I uesd these:

/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-

/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-

Which will cause the problem to occur?
 
sleshepic
Old
(Last edited by sleshepic; 21st March 2013 at 01:27 PM.)
#10  
sleshepic's Avatar
Recognized Themer - OP
Thanks Meter 5726
Posts: 3,414
Join Date: Oct 2011
Location: PA

 
DONATE TO ME
Default Re: Getting Working Wifi for Kernel builds

Quote:
Originally Posted by wctliu View Post
another toolchain????

Which version?

I uesd these:

/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-

/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-

Which will cause the problem to occur?
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi

Sent from my SPH-L900 using xda premium

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes