Difference between revisions of "BeagleBoardLinuxKernel"

From eLinux.org
Jump to: navigation, search
(Add kernel handling section)
m (minor reformat)
(3 intermediate revisions by 2 users not shown)
Line 88: Line 88:
 
  git checkout 58cf2f1425abfd3a449f9fe985e48be2d2555022
 
  git checkout 58cf2f1425abfd3a449f9fe985e48be2d2555022
  
* Copy patches and defconfig go kernel sources. For this, in kernel main directory create a directory ''patches'' (this is used by quilt) and copy the patches from OE directory (e.g. recipes/linux/linux-omap-2.6.29/) to it. E.g.:
+
* Copy patches and defconfig to kernel sources. For this, in kernel main directory create a directory ''patches'' (this is used by quilt) and copy the patches from OE directory (e.g. recipes/linux/linux-omap-2.6.29/) to it. E.g.:
  
 
  cp <path_to>/openembedded/recipes/linux/linux-omap-2.6.29/* <path_to>/patches/
 
  cp <path_to>/openembedded/recipes/linux/linux-omap-2.6.29/* <path_to>/patches/
  
* Go into patches directory, there create a file ''series'' (used by quilt) and add the patch description from above recipe. This is done by removing leading ''file://'' and trailing '';patch=1 \'' from patch list and putting it into series file. With above example, series file should look like:
+
* Go into patches directory, there create a file ''series'' (used by quilt) and add the patch description from above recipe (from the ''SRC_URI_append'' and ''SRC_URI_append_beagleboard'' variables). This is done by removing leading ''file://'' and trailing '';patch=1 \'' from patch list and putting this list into series file. With above example, series file should look like:
  
 
  > cd patches
 
  > cd patches
Line 101: Line 101:
 
  ...
 
  ...
  
Result of this should be a ''patches'' directory with containing all patches described by ''series'' file:
+
Result of this should be a ''patches'' directory containing all patches described by ''series'' file:
  
  > ll patches
+
  > ls patches
 
  ...
 
  ...
 
  no-cortex-deadlock.patch
 
  no-cortex-deadlock.patch
Line 109: Line 109:
 
  ...
 
  ...
 
  series
 
  series
 +
...
  
 
* Now, go back into kernel main directory. There call
 
* Now, go back into kernel main directory. There call
Line 118: Line 119:
 
* Use ''defconfig'' from e.g. linux-omap-2.6.29/beagleboard/defconfig to configure your patched kernel. If you copied above all patches with sub directories, defconfig file should be in patches/beagleboard/defconfig now. E.g.:
 
* Use ''defconfig'' from e.g. linux-omap-2.6.29/beagleboard/defconfig to configure your patched kernel. If you copied above all patches with sub directories, defconfig file should be in patches/beagleboard/defconfig now. E.g.:
  
  cp patches/beagleboard/defconfig
+
  cp patches/beagleboard/defconfig .config
 
  make menuconfig
 
  make menuconfig
  
 
* Compile your kernel and modules as you are used to it. E.g.:
 
* Compile your kernel and modules as you are used to it. E.g.:
 
+
  make -j4 uImage
+
export PATH=$PATH:<path_to_gcc>
 +
  make -j4 uImage CROSS_COMPILE=arm-none-linux-gnueabi-
 +
...
  
 
Result should be an uImage which is the same as if it would be compiled with OE.
 
Result should be an uImage which is the same as if it would be compiled with OE.

Revision as of 06:36, 17 October 2009

This page is about compiling Linux Kernel for BeagleBoard manually. Manually here does mean it isn't done by any development environment (e.g. OpenEmbedded), instead you type "make uImage" at the command line and will get a recent BeagleBoard kernel.

  • Attention #1: If you just want a distribution for your BeagleBoard, i.e. something that just works, stop reading here. Have a look to development environments.
  • Attention #2: If you are already using OpenEmbedded (OE) and you are fine with the kernel generated by this, stop reading here.

This page is intended for people wanting to compile a recent Linux kernel for BeagleBoard manually. Maybe because they are real kernel hackers and don't want OE "overhead". Or they have issues with OE. Or ... . Again, if you are not such a person, stop reading here.

Still interested?

Most recent Linux kernel is available by OMAP Linux git repository, which then is heavily patched by OE. Most of these patches are grabbed from OMAP Linux mailing list, but still not applied to recent git. So OE creates a kernel by taking git kernel and then applies a lot of patches. For OE tools, this is described by OE "receipes". Looking at these recipes for BeagleBoard, grabbing the patches OE applies and then doing the stuff manually (usually done by OE automatically) gives you the same kernel OE generates.

So this page describes how to get all the pieces OE uses for kernel compilation and then patch and compile kernel manually. As this page is only for experts, some details might be missing.

Tools

Source

We need (OMAP) kernel sources and basic OpenEmbedded system (containing the patches and recipe). Both we get by git.

OE

Get basic OpenEmbedded system with steps described in OpenEmbedded and Bitbake install article (ignore the "export OE_HOME" part, we only want the OE source system). As of writing in June 2009 this downloads ~100MB.

After download finished, we are only interested in the recipe and patches for BeagleBoard kernel. This can be found in recipes/linux:

cd recipes/linux

There, identify the most recent (kernel) recipe. While writing this article, for BeagleBoard this was

linux-omap-2.6.29/
linux-omap_2.6.29.bb

Note: If you are unsure which might be the correct one, grep all files in recipes/linux for

DEFAULT_PREFERENCE_beagleboard

This should give you one .bb file.

This .bb file is the OE recipe used by OE to patch and build the kernel. Looking into it should give us something like:

...

COMPATIBLE_MACHINE = "...|beagleboard|..."

...
 
DEFAULT_PREFERENCE_beagleboard = "1"

...

SRCREV = "58cf2f1425abfd3a449f9fe985e48be2d2555022"

SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git;protocol=git \
	   file://defconfig"

SRC_URI_append = " \
          file://no-empty-flash-warnings.patch;patch=1 \
          file://no-cortex-deadlock.patch;patch=1 \
          file://read_die_ids.patch;patch=1 \
...

This recipes gives us 4 infos:

  • This recipe is the recent one for BeagleBoard :) (DEFAULT_PREFERENCE_*)
  • The git hash for OMAP kernel we have to check out (SRCREV)
  • Where we get the kernel from (SRC_URI) and which kernel config file to use
  • The patches which have to be applied (in which order) (SRC_URI_append)

Now, looking into the directory with the same name as the .bb recipe file (linux-omap-2.6.29/) we find

  • the kernel patches listed in the .bb recipe file
  • in beagleboard sub directory the kernel configuration (linux-omap-2.6.29/beagleboard/defconfig)

Kernel

  • First get recent OMAP Linux kernel. This is done by fetching recent OMAP Linux kernel using git. And make sure you are able to build it (e.g. cross compiler is in place etc.).
  • Check out version given by above recipe (SRCREV). E.g.
git checkout 58cf2f1425abfd3a449f9fe985e48be2d2555022
  • Copy patches and defconfig to kernel sources. For this, in kernel main directory create a directory patches (this is used by quilt) and copy the patches from OE directory (e.g. recipes/linux/linux-omap-2.6.29/) to it. E.g.:
cp <path_to>/openembedded/recipes/linux/linux-omap-2.6.29/* <path_to>/patches/
  • Go into patches directory, there create a file series (used by quilt) and add the patch description from above recipe (from the SRC_URI_append and SRC_URI_append_beagleboard variables). This is done by removing leading file:// and trailing ;patch=1 \ from patch list and putting this list into series file. With above example, series file should look like:
> cd patches
> cat series
no-empty-flash-warnings.patch
no-cortex-deadlock.patch
read_die_ids.patch
...

Result of this should be a patches directory containing all patches described by series file:

> ls patches
...
no-cortex-deadlock.patch
no-empty-flash-warnings.patch
...
series
...
  • Now, go back into kernel main directory. There call
quilt push -a

This should result in quilt applying all patches from patches directory in the order described by series file to OMAP Linux kernel.

  • Use defconfig from e.g. linux-omap-2.6.29/beagleboard/defconfig to configure your patched kernel. If you copied above all patches with sub directories, defconfig file should be in patches/beagleboard/defconfig now. E.g.:
cp patches/beagleboard/defconfig .config
make menuconfig
  • Compile your kernel and modules as you are used to it. E.g.:
export PATH=$PATH:<path_to_gcc>
make -j4 uImage CROSS_COMPILE=arm-none-linux-gnueabi-
...

Result should be an uImage which is the same as if it would be compiled with OE.