Difference between revisions of "EBC Exercise 23 Configuring the Kernel"

From eLinux.org
Jump to: navigation, search
m (Doing it yourself: Adding note on using 2.6.32)
Line 2: Line 2:
 
[[Category:BeagleBoard]]
 
[[Category:BeagleBoard]]
  
There are several ways to get and configure the kernel. You could go to the [http://www.kernel.org The Linux Kernel Archives], find the ---arm--- branch, download a kernel and patch it for the omap. You could use [http://git-scm.com/ git] to get a kernel.  Or you could just use [http://bitbake.berlios.de/manual/ bitbake] like we did before. 
+
This is unfinished....
  
Let's first learn how to do it the bitbake way.
+
There are several ways to get and configure the kernel. In [[http://elinux.org/ECE497_Lab02_Installing_The_Angstrom_Distribution#Compile_via_make]] you learned how to get and compile the kernel.  Here we'll look at configuring it.
  
== bitbake ==
+
Let's first learn how to do it the bitbake way.  First set up the environment and go to the kernel directory
  
When you did [[ECE497 Lab02 Installing The Angstrom Distribution]] you used bitbake to build '''console-image'''.  During that build the kernel was downloaded and compiled.  If you used the default configure, the source code was removed once it was done.  Check and see:
 
 
<pre>
 
<pre>
cd ${OETREE}/angstrom-dev/work/beagleboard-angstrom-linux-gnueabi
+
$ source ~/BeagleBoard/oe/crossCompileEnv.sh
ls
+
$ cd ~/BeagleBoard/oe/build/tmp-angstrom_2008_1/work/beagleboard-angstrom-linux-gnueabi/linux-omap-psp-2.6.32-r88+gitra6bad4464f985fdd3bed72e1b82dcbfc004d7869/git
 
</pre>
 
</pre>
You should see a directory starting with <code>linux-omap-</code>.  The rest of the name tells what version you have.  Change to that directory and see what's there:
 
<pre>
 
cd linux-omap-2.6.29-r46
 
ls
 
</pre>
 
If you see a '''git''' directory, you are in luck. If you see just a '''temp''' directory you need to do the following to reload the sources:
 
<pre>
 
cd ${OETREE}/build/conf
 
gedit local.conf
 
</pre>
 
Find the line near the top that says <code>INHERIT += " rm_work "</code> and comment it out.
 
<pre>
 
# INHERIT += " rm_work "
 
</pre>
 
Save the file and then do the following (don't forget to source the source-me.txt file.)
 
<pre>
 
cd ${OETREE}/openembedded
 
$ bitbake -c clean linux-omap-2.6.29
 
$ bitbake -f -c compile linux-omap-2.6.29
 
</pre>
 
''Note:  These instructions are based on
 
[http://wh1t3s.com/2009/05/11/oe-bitake-kernel-mods/ this] which is a good reference on finding and modifying the kernel in the oe distribution. In fact, [http://wh1t3s.com/ wh1t3s] seems to have several nice tips.''
 
 
* The first bitbake command tells bitbake to remove the previously made binary file for that package (think "make clean"), which will force it to re-do what it previously did with the console-image build.
 
 
* The second bitbake line forces bitbake to rebuild the linux-omap package, which will require re-extracting the previously deleted source code, and apply the relevant OE related patches.
 
 
 
This took some 15 minutes on my machine.  Your mileage may vary.  Once done go back to
 
<pre>
 
cd ${OETREE}/angstrom-dev/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.29-r46
 
ls
 
</pre>
 
You should now see the '''git''' directory.  cd to it and look around.
 
 
You can now configure the kernel.
 
<pre>
 
sudo apt-get install libqt3-mt-dev
 
make xconfig
 
</pre>
 
After saving the configuration changes to update the .config file, it is a simple matter of rerunning the forced compile step from above to rebuild the kernel:
 
<pre>
 
$ bitbake -f -c compile linux-omap-2.6.29
 
$ bitbake -f -c deploy linux-omap-2.6.29
 
</pre>
 
If your kernel configuration modifications happen to result in the generation of any loadable modules, then you will wind up with another file in the deployment images folder:
 
 
*What does the bitbake deploy command do?  See if you can find out
 
  
 +
One there try some of the make commands.  Help is a good place to start.
 
<pre>
 
<pre>
$ cd ${OETREE}/angstrom-dev/deploy/glibc/images/beagleboard
+
$ make help | LESS
$ ls
 
 
</pre>
 
</pre>
  
== Doing it yourself ==
 
If you would prefer to maintain your own kernel source tree outside of OE, see these directions:
 
[[BeagleBoardLinuxKernel]]
 
 
Alternatively it is possible to run the official omap branch of the linux kernel.  Take a peek at this page.
 
[[BeagleBoard#Linux_kernel]] (Please continue reading for the modifications I needed)
 
 
*Since we are using OE, our paths are set up slightly different, I have made the relevant changes below that I needed to do it manually.  Take note on the second path command is arch specific (if you get an error about mkimage not being found, make sure you have the second path right)
 
<pre>
 
PATH=~/oe/angstrom-dev/cross/armv7a/bin:~/oe/angstrom-dev/staging/i686-linux/usr/bin:$PATH  # add cross tools to your path
 
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- distclean
 
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- omap3_beagle_defconfig
 
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- menuconfig  # only needed if you want to change the default configuration
 
make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
 
</pre>
 
  
* It is important to note that the kernel in the official branch will be newer then the ones that OE provides (2.6.33 at the time of this writing), and as such there are no OE related patches to apply. 
+
$ make xconfig
  
* There is no reason why you can't steal the OE kernel config, and apply it to the newer kernel.  See if you can figure out how to do this.  (Hint: You will need to combine both above links directions)
 
  
* Alternatively if you've previously built the kernel, take a peek in your ${OETREE}/downloads.  This is where the old kernel source (pre-patches) was downloaded, and see if you can manually apply the OE patches.
 
  
 
== Trying another branch ==
 
== Trying another branch ==

Revision as of 06:42, 31 March 2011


This is unfinished....

There are several ways to get and configure the kernel. In [[1]] you learned how to get and compile the kernel. Here we'll look at configuring it.

Let's first learn how to do it the bitbake way. First set up the environment and go to the kernel directory

$ source ~/BeagleBoard/oe/crossCompileEnv.sh
$ cd ~/BeagleBoard/oe/build/tmp-angstrom_2008_1/work/beagleboard-angstrom-linux-gnueabi/linux-omap-psp-2.6.32-r88+gitra6bad4464f985fdd3bed72e1b82dcbfc004d7869/git

One there try some of the make commands. Help is a good place to start.

$ make help | LESS


$ make xconfig


Trying another branch

Here's some notes on trying to get bitbake to compile the 2.6.32 version of the kernel.

$ cd BeagleBoard/oe
$ . source-me.txt
$ cd ${OETREE}
$ git checkout -b 2011.03-maintenance origin/2011.03-maintenance
$ bitbake