Difference between revisions of "Kernel build instructions"

From Pandora Wiki
Jump to: navigation, search
(Building: cat)
(formating)
Line 1: Line 1:
Note: while this will build functional kernel, it will not be binary compatible with one that comes with firmware, meaning you'll need to rebuild all modules too. The firmware kernel is built using OE ([http://www.openembedded.org OpenEmbeded]) with some OE patches and using OE-built toolchain (all handled by it's build system).
+
{{hint|Kernel it will not be binary compatible with one that comes with firmware, meaning you'll need to rebuild all modules too. The firmware kernel is built using OE ([http://www.openembedded.org OpenEmbeded]) with some OE patches and using OE-built toolchain (all handled by it's build system).
 +
}}
  
 
== Preparation ==
 
== Preparation ==
Line 16: Line 17:
  
 
===CodeSourcery G++===
 
===CodeSourcery G++===
Usually [http://www.codesourcery.com/gnu_toolchains/arm/portal/subscription?@template=lite CodeSourcery's ARM GNU/Linux tool chain] is used to build OMAP3 kernels, but other variations can be used as well. For CodeSourcery, 2007q3 version is recommended (click "all versions" in above page, as 2008q1 and 2008q3 produce bad code in some situations. See [http://elinux.org/BeagleBoard#Compiler BeagleBoard page] for more information.  
+
Usually [http://www.codesourcery.com/gnu_toolchains/arm/portal/subscription?@template=lite CodeSourcery's ARM GNU/Linux tool chain] is used to build OMAP3 kernels, but other variations can be used as well. For [[CodeSourcery]], 2007q3 version is recommended (click "all versions" in above page, as 2008q1 and 2008q3 produce bad code in some situations. See [http://elinux.org/BeagleBoard#Compiler BeagleBoard page] for more information.  
  
 
'''Windows Users:'''
 
'''Windows Users:'''
Line 52: Line 53:
 
== Building ==
 
== Building ==
 
To build you need to have several environment variables set. If you don't have your toolchain in PATH, you need to add it there:
 
To build you need to have several environment variables set. If you don't have your toolchain in PATH, you need to add it there:
<source lang="text">
+
<source lang="bash">
 
export PATH=$PATH:/path/to/arm-2007q3/bin
 
export PATH=$PATH:/path/to/arm-2007q3/bin
 
</source>
 
</source>
 
You also need to have CROSS_COMPILE set:
 
You also need to have CROSS_COMPILE set:
<source lang="text">
+
<source lang="bash">
 
export CROSS_COMPILE=arm-none-linux-gnueabi-
 
export CROSS_COMPILE=arm-none-linux-gnueabi-
 
</source>
 
</source>
  
 
Now set up the default .config file:
 
Now set up the default .config file:
<source lang="text">
+
<source lang="bash">
 
make omap3_pandora_defconfig
 
make omap3_pandora_defconfig
 
</source>
 
</source>
 
If you want to customize kernel features, run
 
If you want to customize kernel features, run
<source lang="text">
+
<source lang="bash">
 
make menuconfig
 
make menuconfig
 
</source>
 
</source>
 
When finished, just run
 
When finished, just run
<source lang="text">
+
<source lang="bash">
 
make uImage
 
make uImage
 
</source>
 
</source>
and it should build you uImage and place it in arch/arm/boot/ . You can now use it to boot from SD (recommended) or replace the one in your flash.
+
and it should build you uImage and place it in arch/arm/boot/ . You can now use it to boot from [[SD card]] (recommended) or replace the one in your flash.
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Kernel]]
 
[[Category:Kernel]]

Revision as of 07:03, 22 April 2011


Preparation

First you need a toolchain and several other tools.

Cygwin (Windows Users)

Cygwin is a Linux-like environment for Windows; download and install here. You will need additional packages installed to build the kernel:

  • diffutils
  • gcc4
  • make
  • ncurses
  • libncurses-devel
  • git (see below)


CodeSourcery G++

Usually CodeSourcery's ARM GNU/Linux tool chain is used to build OMAP3 kernels, but other variations can be used as well. For CodeSourcery, 2007q3 version is recommended (click "all versions" in above page, as 2008q1 and 2008q3 produce bad code in some situations. See BeagleBoard page for more information.

Windows Users: When installing on Windows, do not use the default install path, as it contains spaces and will cause problems when building (when the build system uses -print-file-name=include). Install to

C:\SourceryG++\

or similar. As mentioned here, create an environment variable called CYGPATH with the value 'cygpath' (minus the quotes). Patching your install using the SourceryG++ guide to kernel building as a reference is necessary to get your cygwin/windows builds off the ground.


Git

For source control access, you need to have git installed. Use your packet manager or build it from source. On Windows, install via cygwin.

A guide for basic git usage.


mkimage

Finally you need to have 'mkimage' tool in PATH, which can be built as part of u-boot build process, or download below:


Cloning and switching branches

Now you need to 'clone' kernel source using git tools from previous step. Make a directory you want to keep source in and cd into it. Then run:

git clone git://openpandora.org/pandora-kernel.git

This will now download the source from openpandora.org. Note that it will take a while, so be patient. When done, you will have default 'master' branch checked out, but it doesn't have the latest files, so you need to checkout the current 'pandora-27-omap1' branch:

git checkout --track -b pandora-27-omap1 origin/pandora-27-omap1

Building

To build you need to have several environment variables set. If you don't have your toolchain in PATH, you need to add it there:

export PATH=$PATH:/path/to/arm-2007q3/bin

You also need to have CROSS_COMPILE set:

export CROSS_COMPILE=arm-none-linux-gnueabi-

Now set up the default .config file:

make omap3_pandora_defconfig

If you want to customize kernel features, run

make menuconfig

When finished, just run

make uImage

and it should build you uImage and place it in arch/arm/boot/ . You can now use it to boot from SD card (recommended) or replace the one in your flash.