Difference between revisions of "Building a custom kernel"
(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...') |
|||
Line 15: | Line 15: | ||
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 21: | ||
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 | 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 43: | ||
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 64: | ||
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 | 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 74: | ||
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 | *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 | |||
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. | |||
== Compiling and packaging == | |||
From the same directory, build the debian package: | |||
dpkg-buildpackage -us -uc -b -aarmel | |||
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 ! | |||
For the B2 : | |||
dpkg-buildpackage -us -uc -b -apowerpc | |||
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> | |||
= 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/ |
Revision as of 20:06, 2 August 2013
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.
Preparing an 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 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
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/