Difference between revisions of "Building a custom kernel"

From BubbaWiki
Jump to navigation Jump to search
(Created page with '= Introduction = This a very quick-and-dirty how-to to build (and customize) a kernel for your bubba 3 device. It also works for bubba 2 providing some small differences I will...')
 
m (→‎Introduction: What about compiling kernel modules?)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Introduction  =
= Introduction  =


This a very quick-and-dirty how-to to build (and customize) a kernel for your bubba 3 device. It also works for bubba 2 providing some small differences I will point out.  
This a very quick-and-dirty how-to to build (and customize) a kernel for your bubba 3 device. It also works for bubba 2 providing some small differences I will point out.


= Preparing an compilation host  =
OK, but what about compiling modules for this custom kernel?
How can one compile and install kernel modules for Bubba 2 or 3 device using this method ( by configuring, compiling on the guest operating system installed on VirtualBox )?


You could compile direclty on the B3 (resp. B2) itself, but it would take HOURS. That's why we will use a host which will be cross-compiling the kernel much quicker. Personnaly I use a virtual host in VirtualBox, but you use whatever machine/virtualization technology.  
The command 'make modules_install' does not install modules ob Bubba device, but want to install on that guest operating system on the VirtualBox.
 
= Preparing a compilation host  =
 
You could compile direclty on the B3 (resp. B2) itself, but it would take HOURS. That's why we will use a host which will be cross-compiling the kernel much quicker. Personnaly I use a virtual host in VirtualBox, but you can use whatever machine/virtualization technology.  


== OS install  ==
== OS install  ==
Line 15: Line 20:
After the install is completed, install the compiling tools :  
After the install is completed, install the compiling tools :  


*emdebian cross-compilation toolchain :
*emdebian cross-compilation toolchain:


  apt-get install emdebian-archive-keyring
  apt-get install emdebian-archive-keyring
Line 21: Line 26:
  apt-get update
  apt-get update


For the B3 :  
For the B3:  


  apt-get install gcc-4.4-arm-linux-gnueabi
  apt-get install gcc-4.4-arm-linux-gnueabi


For the B2 :  
For the B2:  


  apt-get install gcc-4.4-powerpc-linux-gnu
  apt-get install gcc-4.4-powerpc-linux-gnu


Note : you can install both toolchains if you have both platforms as I do :-)  
Note: you can install both toolchains if you have both platforms as I do :-)  


*native compiler and debian package utils :
*native compiler and debian package utils :
Line 43: Line 48:
  apt-get install libncurses5-dev
  apt-get install libncurses5-dev


= Download and prepare the excito kernel source  =
= Build a custom kernel  =
 
== Download and prepare the excito kernel source  ==


The next operations can be done as a regular user.  
The next operations can be done as a regular user.  


*Prepare the environment :  
*Prepare the environment :  
**For the B3 :
**For the B3:


  export ARCH=arm
  export ARCH=arm
  export CROSS_COMPILE=arm-linux-gnueabi-
  export CROSS_COMPILE=arm-linux-gnueabi-


**For the B2 :
**For the B2:


  export ARCH=powerpc
  export ARCH=powerpc
Line 62: Line 69:
  dget -xu http://b3.update.excito.org/pool/main/l/linux/linux_2.6.39.4-13.dsc
  dget -xu http://b3.update.excito.org/pool/main/l/linux/linux_2.6.39.4-13.dsc


Note : the above link will work as long as excito does not upgrade the kernel.  
Note: the above link will work as long as excito does not upgrade the kernel.  


= Customizing the kernel  =
== Customizing the kernel  ==


Now everything is in place, time to customize the kernel :  
Now everything is in place, time to customize the kernel:  


*Move into the source directory :
*Move into the source directory :
Line 72: Line 79:
  cd linux-2.6.39.4
  cd linux-2.6.39.4


*Run the curses-based configuration tool (if you wish to use xconfig, be my guest, there are a few more dependencies to install) :
*Run the curses-based configuration tool (if you wish to use xconfig, be my guest, there are a few more dependencies to install):


  make menuconfig
  make menuconfig


*Load the default excito configuration&nbsp;: From the menu, select <tt>Load an Alternate Configuration File</tt> and enter the following path&nbsp;:
*Load the default excito configuration: From the menu, select <tt>Load an Alternate Configuration File</tt> and enter the following path:


  arch/arm/configs/bubba3_defconfig
  arch/arm/configs/bubba3_defconfig


*From now on you can customize the configuration to suit your needs.  
For the B2:
*When you're satisfied, save the configuration&nbsp;: From the menu, select <tt>Save an Alternate Configuration File</tt>, the path entered above sould have been kept.
 
*You may exit the configuration, no need to save
arch/powerpc/configs/bubbatwo_defconfig
 
*From now on you can customize the configuration to suit your needs (even patch the source if you're in the mood ...).
 
*When you're satisfied, you may exit and save the configuration (it will be written in the path loaded above).
 
Note: whenever you customize the kernel, the resulting configuration must be placed in <tt>arch/arm/configs/bubba3_defconfig</tt> (<tt>arch/powerpc/configs/bubbatwo_defconfig</tt> for the B2); only this file will be used during the compilation phase to configure the kernel.
 
<h2> Compiling and packaging  </h2>
<p>From the same directory, build the debian package:
</p>
<pre class="_fck_mw_lspace">dpkg-buildpackage -us -uc -b -aarmel
</pre>
<p>Note: If anyone knows the distinction between <tt>arm</tt> and <tt>armel</tt>, and why it's used here and not there, I'm very much interested&nbsp;!
</p><p>For the B2&nbsp;:
</p>
<pre class="_fck_mw_lspace">dpkg-buildpackage -us -uc -b -apowerpc
</pre>
<p>The resulting package will be found in the parent directory, <tt>bubba3-kernel_2.6.39.4-13_armel.deb</tt> or <tt>bubba3-kernel_2.6.39.4-13_powerpc.deb</tt>
</p>
<p> But how can one compiling and packaging kernel modules? </p>


Note&nbsp;: whenever you customize the kernel, the resulting configuration must be placed in <tt>arch/arm/configs/bubba3_defconfig</tt>&nbsp;; only this file will be used during the compilation phase.
= Installing the new kernel on the device  =


= Compiling and building the debian package =
Now you can send the debian package to your device, using scp or whatever you're confortable with. Then install it with a plain:


From the same directory, build the debian package&nbsp;:
dpkg -i bubba3-kernel_2.6.39.4-13_armel.deb


dpkg-buildpackage -us -uc -b
(or the obvious adapt for the b2)


= Installing the new kernel on the device =
You can now reboot your device. If your kernel panics during the boot, use your rescue key to reinstall the original excito kernel from http://b3.update.excito.org/pool/main/l/linux/

Latest revision as of 13:58, 17 February 2014

Introduction

This a very quick-and-dirty how-to to build (and customize) a kernel for your bubba 3 device. It also works for bubba 2 providing some small differences I will point out.

OK, but what about compiling modules for this custom kernel? How can one compile and install kernel modules for Bubba 2 or 3 device using this method ( by configuring, compiling on the guest operating system installed on VirtualBox )?

The command 'make modules_install' does not install modules ob Bubba device, but want to install on that guest operating system on the VirtualBox.

Preparing a compilation host

You could compile direclty on the B3 (resp. B2) itself, but it would take HOURS. That's why we will use a host which will be cross-compiling the kernel much quicker. Personnaly I use a virtual host in VirtualBox, but you can use whatever machine/virtualization technology.

OS install

The host must run debian squeeze, either i386 or amd64. I will not detail the OS install phase, if you want a custom kernel, you probably know how to do that. Nothing fancy here just a plain debian install. The desktop environment is obviously not needed ;-) .

Installing the compilation tools

After the install is completed, install the compiling tools :

  • emdebian cross-compilation toolchain:
apt-get install emdebian-archive-keyring
echo "deb http://www.emdebian.org/debian/ squeeze main" > /etc/apt/sources.list.d/emdebian.list
apt-get update

For the B3:

apt-get install gcc-4.4-arm-linux-gnueabi

For the B2:

apt-get install gcc-4.4-powerpc-linux-gnu

Note: you can install both toolchains if you have both platforms as I do :-)

  • native compiler and debian package utils :
apt-get install build-essential devscripts
  • platform specific tools :
apt-get install device-tree-compiler uboot-mkimage
  • development files for ncurses :
apt-get install libncurses5-dev

Build a custom kernel

Download and prepare the excito kernel source

The next operations can be done as a regular user.

  • Prepare the environment :
    • For the B3:
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
    • For the B2:
export ARCH=powerpc
export CROSS_COMPILE=powerpc-linux-gnu-
  • Download the source files
dget -xu http://b3.update.excito.org/pool/main/l/linux/linux_2.6.39.4-13.dsc

Note: the above link will work as long as excito does not upgrade the kernel.

Customizing the kernel

Now everything is in place, time to customize the kernel:

  • Move into the source directory :
cd linux-2.6.39.4
  • Run the curses-based configuration tool (if you wish to use xconfig, be my guest, there are a few more dependencies to install):
make menuconfig
  • Load the default excito configuration: From the menu, select Load an Alternate Configuration File and enter the following path:
arch/arm/configs/bubba3_defconfig

For the B2:

arch/powerpc/configs/bubbatwo_defconfig
  • From now on you can customize the configuration to suit your needs (even patch the source if you're in the mood ...).
  • When you're satisfied, you may exit and save the configuration (it will be written in the path loaded above).

Note: whenever you customize the kernel, the resulting configuration must be placed in arch/arm/configs/bubba3_defconfig (arch/powerpc/configs/bubbatwo_defconfig for the B2); only this file will be used during the compilation phase to configure the kernel.

Compiling and packaging

From the same directory, build the debian package:

dpkg-buildpackage -us -uc -b -aarmel

Note: If anyone knows the distinction between arm and armel, and why it's used here and not there, I'm very much interested !

For the B2 :

dpkg-buildpackage -us -uc -b -apowerpc

The resulting package will be found in the parent directory, bubba3-kernel_2.6.39.4-13_armel.deb or bubba3-kernel_2.6.39.4-13_powerpc.deb

But how can one compiling and packaging kernel modules?

Installing the new kernel on the device

Now you can send the debian package to your device, using scp or whatever you're confortable with. Then install it with a plain:

dpkg -i bubba3-kernel_2.6.39.4-13_armel.deb

(or the obvious adapt for the b2)

You can now reboot your device. If your kernel panics during the boot, use your rescue key to reinstall the original excito kernel from http://b3.update.excito.org/pool/main/l/linux/