Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Getting Working Wifi for Kernel builds

OP sleshepic

18th December 2012, 03:26 AM   |  #1  
sleshepic's Avatar
OP Recognized Themer
Flag PA
Thanks Meter: 6,779
 
3,791 posts
Join Date:Joined: Oct 2011
Donate to Me
More
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
Last edited by sleshepic; 20th December 2012 at 05:03 AM.
The Following 2 Users Say Thank You to sleshepic For This Useful Post: [ View ]
19th December 2012, 02:27 AM   |  #2  
garyd9's Avatar
Recognized Developer
Flag Pittsburgh, PA
Thanks Meter: 2,169
 
2,087 posts
Join Date:Joined: Sep 2006
It's only in the wrong section if you don't share what you did wrong, and how you fixed it.
The Following User Says Thank You to garyd9 For This Useful Post: [ View ]
24th December 2012, 07:30 AM   |  #3  
Droidzone's Avatar
Recognized Developer
Flag Kerala
Thanks Meter: 2,217
 
5,471 posts
Join Date:Joined: Sep 2010
Donate to Me
More
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.
Last edited by Droidzone; 24th December 2012 at 07:49 AM.
The Following User Says Thank You to Droidzone For This Useful Post: [ View ]
24th December 2012, 07:56 PM   |  #4  
AndreiLux's Avatar
Senior Member
Thanks Meter: 14,080
 
2,953 posts
Join Date:Joined: Jul 2011
Donate to Me
Quote:
Originally Posted by Droidzone

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.
Last edited by AndreiLux; 24th December 2012 at 07:59 PM.
The Following 7 Users Say Thank You to AndreiLux For This Useful Post: [ View ]
24th December 2012, 08:05 PM   |  #5  
Droidzone's Avatar
Recognized Developer
Flag Kerala
Thanks Meter: 2,217
 
5,471 posts
Join Date:Joined: Sep 2010
Donate to Me
More
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.
Last edited by Droidzone; 27th December 2012 at 05:23 PM.
6th February 2013, 08:33 PM   |  #6  
garwynn's Avatar
Forum Moderator / Recognized Developer
Flag Chi-town
Thanks Meter: 7,846
 
4,792 posts
Join Date:Joined: Jul 2011
Donate to Me
More
Quote:
Originally Posted by AndreiLux

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.
21st March 2013, 12:25 PM   |  #7  
Member
Flag China
Thanks Meter: 2
 
41 posts
Join Date:Joined: Feb 2013
Quote:
Originally Posted by Droidzone

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?
21st March 2013, 12:31 PM   |  #8  
Droidzone's Avatar
Recognized Developer
Flag Kerala
Thanks Meter: 2,217
 
5,471 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Quote:
Originally Posted by wctliu

How to Solved? Too detailed can you tell us a little bit?

Used another toolchain.
21st March 2013, 01:21 PM   |  #9  
Member
Flag China
Thanks Meter: 2
 
41 posts
Join Date:Joined: Feb 2013
Quote:
Originally Posted by Droidzone

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?
21st March 2013, 02:25 PM   |  #10  
sleshepic's Avatar
OP Recognized Themer
Flag PA
Thanks Meter: 6,779
 
3,791 posts
Join Date:Joined: Oct 2011
Donate to Me
More
Re: Getting Working Wifi for Kernel builds
Quote:
Originally Posted by wctliu

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
Last edited by sleshepic; 21st March 2013 at 02:27 PM.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes