You are not logged in.

#1 2011-12-28 21:23:21

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

[Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Hi all,

I want to compile my own optimized ck-kernel with localmodcfg="y" which works mostly.
However there is a small problem.
The module 'brcmsmac' for the WLAN card is never included although it is listed in my modprobed.db.
Does someone have any clue what could be the cause?

Thanks
Radioactiveman

Last edited by Radioactiveman (2012-01-13 16:36:15)

Offline

#2 2011-12-28 21:33:15

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

First let's make sure reload_database is working.  Run it manually, then post the output of

$ lsmod | grep brcms

If it's there, locate the option for this module within the nconfig and see if it's enabled by Steven Rostedt's script.  If not, I think the problem lies that that code.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2011-12-29 12:50:51

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

'reload_database' is working fine.

Output of 'lsmod':

$ lsmod | grep brcmsmac
brcmsmac              569832  0
mac80211              222059  1 brcmsmac
brcmutil                6912  1 brcmsmac
cfg80211              165796  2 brcmsmac,mac80211

The kernel option is 'CONFIG_BRCMSMAC=m' like in the default config.x86_64 from linux-ck.
However my config (/proc/config.gz) contains '# CONFIG_BRCMSMAC is not set' which leads to the missing module.

Another important information is, I don't use '_makenconfig="Y"' (at least for now).
Graysky, could you try to compile the kernel with brcmsmac to see if it's working for you?
If you want my modprobed.db, tell it.

EDIT: there is a typo at 'Intel C++' https://wiki.archlinux.org/index.php/User:Graysky

Thanks
Radioactiveman

Last edited by Radioactiveman (2011-12-29 13:00:06)

Offline

#4 2011-12-29 23:38:13

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Today I found out this problem is not related to the ck-kernel because compiling linux-mainline doesn't work properly either.
It would be nice if someone (graysky wink) compiles a kernel with localmodcfg while having brcmsmac loaded.

Offline

#5 2011-12-30 07:46:43

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Radioactiveman wrote:

Today I found out this problem is not related to the ck-kernel because compiling linux-mainline doesn't work properly either.

Always glad to hear bugs are NOT due to my stuff smile  You'll need to email upstream (Steven Rostedt) to let me know about a bug in his code.

Radioactiveman wrote:

It would be nice if someone (graysky wink) compiles a kernel with localmodcfg while having brcmsmac loaded.

To verify the bug?  I'm confused.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2011-12-30 12:59:01

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

I just want to make sure that someone is able to reproduce it. Then I know the bug is not caused by a mistake and I'll contact Steven Rostedt.

Offline

#7 2011-12-30 13:08:58

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

I'd say go ahead and email him now; you have verified the behavior under two different kernels.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2012-01-12 16:58:32

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Today he answered finally: smile

Steven Rostedt wrote:

Hi,

Sorry for the late reply. I was on break and this got lost in my pile of
emails during it.

Ug this is nasty. The make localmodconfig does a parsing of the
Makefile's looking for the "obj-$(CONFIG_FOO) += foo.o" names. But in
this case we have in drivers/net/wireless/brcm80211/brcmsmac/Makefile:

MODULEPFX := brcmsmac

obj-$(CONFIG_BRCMSMAC)    += $(MODULEPFX).o


I have no idea why they did this. But this fools the parsing, because
the localmodconfig script doesn't convert the $(MODULEPFX) into
anything. I could try to come up with a patch to do so.

Thanks for the report!

-- Steve

Will report again.

Last edited by Radioactiveman (2012-01-12 16:58:50)

Offline

#9 2012-01-12 17:12:26

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

You have to disable bcma to get brcmsmac, see this: https://bugs.archlinux.org/task/27844


ᶘ ᵒᴥᵒᶅ

Offline

#10 2012-01-12 17:26:53

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Who wrote the first comment there? wink
And it's the same with 3.1.x.

Anyway, I responded to his email and report hopefully soon. smile

[EDIT]: He sent me a patch, trying it now.

Last edited by Radioactiveman (2012-01-12 17:32:49)

Offline

#11 2012-01-12 18:35:27

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Radioactiveman wrote:

Who wrote the first comment there? wink
And it's the same with 3.1.x.

Anyway, I responded to his email and report hopefully soon. smile

[EDIT]: He sent me a patch, trying it now.

Ahh lol, sorry about that. tongue


ᶘ ᵒᴥᵒᶅ

Offline

#12 2012-01-13 16:35:29

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

A minor fix for the patch by Steven Rostedt solved my issue.
I have compiled linux-ck 3.2.1-2 with localmodconfig today and brcmsmac is now included.

Marking the thread as solved, thanks to Steve.

Patch file:

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index ec7afce..bccf07d 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -250,33 +250,61 @@ if ($kconfig) {
     read_kconfig($kconfig);
 }
 
+sub convert_vars {
+    my ($line, %vars) = @_;
+
+    my $process = "";
+
+    while ($line =~ s/^(.*?)(\$\((.*?)\))//) {
+	my $start = $1;
+	my $variable = $2;
+	my $var = $3;
+
+	if (defined($vars{$var})) {
+	    $process .= $start . $vars{$var};
+	} else {
+	    $process .= $start . $variable;
+	}
+    }
+
+    $process .= $line;
+
+    return $process;
+}
+
 # Read all Makefiles to map the configs to the objects
 foreach my $makefile (@makefiles) {
 
-    my $cont = 0;
+    my $line = "";
+    my %make_vars;
 
     open(MIN,$makefile) || die "Can't open $makefile";
     while (<MIN>) {
+	# if this line ends with a backslash, continue
+	chomp;
+	if (/^(.*)\\$/) {
+	    $line .= $1;
+	    next;
+	}
+
+	$line .= $_;
+	$_ = $line;
+	$line = "";
+
 	my $objs;
 
-	# is this a line after a line with a backslash?
-	if ($cont && /(\S.*)$/) {
-	    $objs = $1;
-	}
-	$cont = 0;
+	$_ = convert_vars($_, %make_vars);
 
 	# collect objects after obj-$(CONFIG_FOO_BAR)
 	if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
 	    $var = $1;
 	    $objs = $2;
+
+	# check if variables are set
+	} elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) {
+	    $make_vars{$1} = $2;
 	}
 	if (defined($objs)) {
-	    # test if the line ends with a backslash
-	    if ($objs =~ m,(.*)\\$,) {
-		$objs = $1;
-		$cont = 1;
-	    }
-
 	    foreach my $obj (split /\s+/,$objs) {
 		$obj =~ s/-/_/g;
 		if ($obj =~ /(.*)\.o$/) {

Last edited by Radioactiveman (2012-01-13 16:37:06)

Offline

#13 2012-01-26 15:22:19

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling kernel with 'localmodcfg' - 'brcmsmac' missing

Patch was merged into 3.0-stable, 3.2-stable and linux-git.
And 3.2.2 was released today with the patch. smile

Offline

Board footer

Powered by FluxBB