New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

B2 Building a Custom kernel - menuconfig issue

Got problems with your B2 or B3? Share and get helped!
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

Hi,

On my Bubba 2 I have installed Wheezy system, without Bubba packages except the kernel.
The kernel is:
Linux b2 3.2.62-1 #1 Mon Aug 25 04:22:40 UTC 2014 ppc GNU/Linux

I want to customize it so it support the rtl8192cu kernel module.

I downloaded the kernel source from here:
https://codeload.github.com/Excito/comm ... 253.2.62-1
and follow the steps described here:
http://wiki.mybubba.org/wiki/index.php? ... tom_kernel
from the header: Customizing the kernel.
When I'm trying to
Load an Alternate Configuration File and enter the following path:
arch/powerpc/configs/bubbatwo_defconfig
I just can't to alter in the textfield the default '.config' filename.
However, there is not any bubbatwo_defconfig file out there.
So how to go further to build my custom kernel?
Best, Pali
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: B2 Building a Custom kernel - menuconfig issue

Post by Gordon »

The source you got is a debian source package and is meant to be compiled using 'debuild'. To create a regular source from this you need to:
  • apply the patches in the debian/patches folder (in order)
  • edit the version info in Makefile to match your current installed kernel
  • load the b2-config (which gets created by running the patches)
  • enable the module(s) you require
  • run make - check link below
Here's a little readme that you could refer to for building just the one module you require rather than needing to build the complete kernel and its modules: http://askubuntu.com/questions/515407/h ... nel-module Saves a lot of time.
MouettE
Site admin
Posts: 345
Joined: 06 Oct 2011, 19:45

Re: B2 Building a Custom kernel - menuconfig issue

Post by MouettE »

Hi,

As Gordon said the package is meant to be built with debian tools. Besides the wiki page needs a serious refresh. Here are some detailed instructions for quickly rebuilding the kernel :

The instructions provided below applies only to this specific version (3.2.62-1). I will update the wiki page with more generic instructions once the excito kernel repository will be usable.

There are two ways to build a custom kernel from this source : the quick, ugly and efficient way - no debian package (which I will detail here) and the more proper way which generates a debian package (which will be refreshed in the wiki later).

To compile a kernel (quick-and-dirty) :
  • Install dependencies as described in part 'Installing the compilation tools' of the wiki (that part is true)
  • Fecth the source from the github tag and apply this patchset :

    Code: Select all

    patch -Np1 -i debian/patches/0002-Settings-for-marvell-88e1116.patch
    patch -Np1 -i debian/patches/0003-Marvell-reverse-led-fix.patch
    patch -Np1 -i debian/patches/0004-Excito-B3-board.patch
    patch -Np1 -i debian/patches/0005-Ath-regd-optional.patch
    patch -Np1 -i debian/patches/0006-vsc8601_and_clockskewfix.patch
    patch -Np1 -i debian/patches/0007-Excito-B2-board.patch
    patch -Np1 -i debian/patches/0008-Excito-B3-config.patch
    patch -Np1 -i debian/patches/0009-Excito-B2-config.patch
    
  • You want to compile a b2 kernel, so prepare the environnment :

    Code: Select all

    export ARCH=powerpc
    export CROSS_COMPILE=powerpc-linux-gnu-
    
  • Import the b2 configuration :

    Code: Select all

    make bubbatwo_defconfig
    
  • Personalize the config

    Code: Select all

    make menuconfig
    
  • Compile the kernel and the modules (add -jX flags to speed up the build if multiple cores available) :

    Code: Select all

    make uImage
    make modules
    
  • Create an output directory and install the files there :

    Code: Select all

    mkdir -p output/boot
    cp arch/powerpc/boot/uImage output/boot
    make INSTALL_MOD_PATH=$(pwd)/output modules_install
    
Voilà you now have a kernel with modules in output. To install it on your b3 just copy the contents of output inside the root of your b3. I strongly recommend to backup the original /boot/uImage file in case you need to go back. If everything is satisfactory, I suggest you remove the kernel package (switch the uImage files before or it will remove your new kernel ; after replace the new uImage file in /boot).
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

MouettE wrote: [*]Personalize the config

Code: Select all

make menuconfig
My problem still exist, namely, in the menuconfig at the step:
Load an Alternate Configuration File
I just can't to alter in the textfield the default '.config' filename and substitute the default '.config' filename with desired 'arch/powerpc/configs/bubbatwo_defconfig'.
Why?
Best, Pali
MouettE
Site admin
Posts: 345
Joined: 06 Oct 2011, 19:45

Re: B2 Building a Custom kernel - menuconfig issue

Post by MouettE »

You don't need to load an alternate config file ; just follow the steps in my post above and forget about the wiki page (except the part 'Installing the compilation tools' to install necessary tools).
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

MouettE wrote:You don't need to load an alternate config file ; just follow the steps in my post above and forget about the wiki page (except the part 'Installing the compilation tools' to install necessary tools).
OK I will do that today.
But I have Bubba 2.
And I do these steps on my Bubba 2.

Shall I install it as you adviced me, namely to just copy the contents of output inside the root of my Bubba 2? Is these last steps for Bubba 2 the same as for Bubba 3?
Best, Pali
MouettE
Site admin
Posts: 345
Joined: 06 Oct 2011, 19:45

Re: B2 Building a Custom kernel - menuconfig issue

Post by MouettE »

If you build directly on your b2 (or your b3) do not define the ARCH and CROSS_COMPILE environment variables. The steps are very similar between the b2 and the b3 ; the configuration file is obviously different and the uImage will be inside arch/arm/boot for the b3 and arch/powerpc/boot for the b2.

Again this is a quick-and-dirty howto so copying the contents of the output folder inside the root of you b2/b3 is not a by-the-book way to install things on a debian system but it will definitely work. As I said do not forget to backup the original /boot/uImage in case your version doesn't boot.
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

MouettE wrote: Voilà you now have a kernel with modules in output. To install it on your b3 just copy the contents of output inside the root of your b3. I strongly recommend to backup the original /boot/uImage file in case you need to go back. If everything is satisfactory, I suggest you remove the kernel package (switch the uImage files before or it will remove your new kernel ; after replace the new uImage file in /boot).
I did backup the original uImage from the /boot/ directory into a subdirectory in my $HOME/ directory on Bubba 2.
I have now the new kernel uImage in the output/boot/ directory and the new kernel modules in the output/lib/ directory.

I shall now copy these from output/ directory into root of my Bubba 2.
After that I shall reboot my Bubba 2.
What I don't understand here is the sentence 'I suggest you remove the kernel package'

After the

Code: Select all

make uImage
command I get an output:
Image Name: Linux-3.2.62
but I have installed the original kernel Linux-3.2.62-1 yet.

So you recommend me to remove the original Linux-3.2.62-1 kernel after reboot with the new kernel uImage?

Second, I don't understand the part '(switch the uImage files before or it will remove your new kernel ; after replace the new uImage file in /boot).'
Please explain it to me.
Best, Pali
MouettE
Site admin
Posts: 345
Joined: 06 Oct 2011, 19:45

Re: B2 Building a Custom kernel - menuconfig issue

Post by MouettE »

paulchany wrote:What I don't understand here is the sentence 'I suggest you remove the kernel package'
If your custom kernel works as expected you should remove the kernel package because it conflicts with your files (the /boot/uImage file). That's my advice but it's not necessary ; however it will prevent some package problems in the future.
paulchany wrote:Image Name: Linux-3.2.62
but I have installed the original kernel Linux-3.2.62-1 yet.
That's normal ; the appended '-1' indicated a debian build-and-packaged kernel whereas yours is manually build.
paulchany wrote:So you recommend me to remove the original Linux-3.2.62-1 kernel after reboot with the new kernel uImage?

Second, I don't understand the part '(switch the uImage files before or it will remove your new kernel ; after replace the new uImage file in /boot).'
Please explain it to me.
These are related ; once you have rebooted yout b2 with your kernel and verified it's working properly perform these steps to remove the original kernel package :
  • Backup your NEW /boot/uImage somewhere
  • Restore the PREVIOUS uImage in /boot
  • remove the bubba3-kernel package with apt-get
  • Restore the NEW uImage into /boot
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: B2 Building a Custom kernel - menuconfig issue

Post by Gordon »

Note of caution:

If you remove the 'bubba3-kernel' package, it will also remove the associated modules. The above therefore should only be done if you're creating an entirely new kernel and its modules. If you're building this on the B2 itself, be prepared that it will take several hours to complete. My suggestion is that you look at that previous link I posted and simply build the module you require.

I don't really know why you can't change what config file you want to use during 'make menuconfig' (are you root?), but you could simply copy bubba2-defconfig to .config prior to starting 'make'. Just do not forget to edit 'Makefile' and set the appropriate value for 'extraversion' (i.e. '-1') in the top of the file.
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

Gordon wrote:Note of caution:

If you remove the 'bubba3-kernel' package, it will also remove the associated modules. The above therefore should only be done if you're creating an entirely new kernel and its modules. If you're building this on the B2 itself, be prepared that it will take several hours to complete. My suggestion is that you look at that previous link I posted and simply build the module you require.

I don't really know why you can't change what config file you want to use during 'make menuconfig' (are you root?), but you could simply copy bubba2-defconfig to .config prior to starting 'make'. Just do not forget to edit 'Makefile' and set the appropriate value for 'extraversion' (i.e. '-1') in the top of the file.
It is completely independent of whether I'm root or not ( I tried booth ), in menuconfig I just can't to alter the '.config' filename. Is this the case only on my Bubba 2, or on all Bubba 2 ??
In Makefile I think the 'extraversion' should be '1', and not '-1'; I set it this way:

Code: Select all

EXTRAVERSION = 1
I did see the link you posted but to me it is complicated.
I stuck at step:
Each edit

Code: Select all

$ cd ~/linux-3.13.0/drivers/scsi/mvsas
$ nano mv_sas.h
$ nano mv_sas.c
These are for the edits.
So, what should I edit in these files? ( Naturally, I must to edit some other files because my module is different. )
Best, Pali
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: B2 Building a Custom kernel - menuconfig issue

Post by Gordon »

'-1' is the correct value. This is because extravalue can be anything, from '.1' to ' -1' to '+abc'.

As for editing source code, that doesn't apply to you. The interesting part is this:

Code: Select all

make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install
In which 'build' is supposed to be a symlink to the kernel source code, but does not exist in the Debian binary release (because it is a binary release, meaning there is no source code to point to).

In your case you could simplify this to:

Code: Select all

make menuconfig
make prepare
make M=$(pwd)/drivers/net/wireless/rtlwifi modules
make M=$(pwd)/drivers/net/wireless/rtlwifi modules_install
This should create and install the module files rtl8192c-common.ko, rtl8192cu.ko, rtl_usb.ko and rtlwifi.ko. Don't know the speed of a B2, but this will probably take about 5 minutes to compile.
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

Gordon wrote:'-1' is the correct value. This is because extravalue can be anything, from '.1' to ' -1' to '+abc'.

As for editing source code, that doesn't apply to you. The interesting part is this:

Code: Select all

make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install
In which 'build' is supposed to be a symlink to the kernel source code, but does not exist in the Debian binary release (because it is a binary release, meaning there is no source code to point to).

In your case you could simplify this to:

Code: Select all

make menuconfig
make prepare
make M=$(pwd)/drivers/net/wireless/rtlwifi modules
make M=$(pwd)/drivers/net/wireless/rtlwifi modules_install
This should create and install the module files rtl8192c-common.ko, rtl8192cu.ko, rtl_usb.ko and rtlwifi.ko. Don't know the speed of a B2, but this will probably take about 5 minutes to compile.
OK
I edited Makefile this way:

Code: Select all

EXTRAVERSION = -1
And I did followings in the 'community-b3-kernel-debian-1-3.2.62-1' directory:

Code: Select all

make oldconfig
make prepare
make scripts
make menuconfig
make prepare
make M=$(pwd)/drivers/net/wireless/rtlwifi modules
but I get an error:
LD [M] /home/csanyipal/BubbaKernelek/LeforditottKernelek/CsakEgyelenKernelModulLeforditasa/community-b3-kernel-debian-1-3.2.62-1/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
ld: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory
make[1]: *** [/home/csanyipal/BubbaKernelek/LeforditottKernelek/CsakEgyelenKernelModulLeforditasa/community-b3-kernel-debian-1-3.2.62-1/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko] Error 1
make: *** [modules] Error 2
And yes, it takes about 5 minutes to compile.
What did I wrong?
I think, I must patch the kernel source and 'make bubbatwo_defconfig' first, right?
Best, Pali
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: B2 Building a Custom kernel - menuconfig issue

Post by Gordon »

Probably yes. The error is from a missing dependency, so you'll have to run make on that as well. Seems to be some kind of platform special support file and I don't know if that one has other dependencies of its own, but it definitely beats compiling the whole kernel and each and every module that is already on your system.
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: B2 Building a Custom kernel - menuconfig issue

Post by paulchany »

OK, I move one step further, but stuck again.
Sofar I did these steps:

Code: Select all

tar xvf community-b3-kernel-debian-1-3.2.62-1.tar.gz
cd community-b3-kernel-debian-1-3.2.62-1/
patch -Np1 -i debian/patches/0002-Settings-for-marvell-88e1116.patch
patch -Np1 -i debian/patches/0003-Marvell-reverse-led-fix.patch
patch -Np1 -i debian/patches/0004-Excito-B3-board.patch
patch -Np1 -i debian/patches/0005-Ath-regd-optional.patch
patch -Np1 -i debian/patches/0006-vsc8601_and_clockskewfix.patch
patch -Np1 -i debian/patches/0007-Excito-B2-board.patch
patch -Np1 -i debian/patches/0008-Excito-B3-config.patch
patch -Np1 -i debian/patches/0009-Excito-B2-config.patch
make oldconfig
make bubbatwo_defconfig
make menuconfig
make prepare
make scripts
make M=drivers/net/wireless/rtlwifi modules
The output of the last command is:
Building modules, stage 2.
MODPOST 3 modules
CC drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.mod.o
LD [M] drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
ld: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory
make[1]: *** [drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko] Error 1
make: *** [modules] Error 2
How can I run 'make' on crtsavres?
Can be the 'make oldconfig' omitted and run just the 'make bubbatwo_defconfig'?
Best, Pali
Post Reply