Difference between revisions of "Kernel build instructions"
Linux-SWAT (talk | contribs) (→Cloning and switching branches) |
Linux-SWAT (talk | contribs) |
||
Line 53: | Line 53: | ||
git checkout --track -b pandora-27-omap1 origin/pandora-27-omap1 | git checkout --track -b pandora-27-omap1 origin/pandora-27-omap1 | ||
</source> | </source> | ||
+ | |||
+ | ==Firmware Compatibility== | ||
+ | The firmware kernel is built using OE (openembedded), so the only sure way to get binary compatibility is to use that (see [[Firmware_build_instructions]]). | ||
+ | |||
+ | The manual procedure to do the same without using OE would be: | ||
+ | * Get [[Setting_up_a_cross-compiler#DJWillis.27s_Cross_Compiler|DJWillis' toolchain]] (it is the same as one built by OE). | ||
+ | * Apply the patches listed in [http://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=blob;f=recipes/linux/omap3-pandora-kernel_2.6.27-pandora.bb;hb=HEAD recipes/linux/omap-pandora-kernel_2.6.27-pandora.bb] from the git repository at [http://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=tree;f=recipes/linux/omap3-pandora-kernel git://git.openpandora.org/openpandora.oe.git] on the kernel tree. musb-rxtx.patch may not apply cleanly unless you remove the junk at the end and fix the context for musbhsdma.c | ||
+ | * Copy the defconfig file from above patches location to .config | ||
+ | * Set up environment as described in "Building" section and build (make/make uImage). | ||
== Building == | == Building == | ||
Line 82: | Line 91: | ||
</source> | </source> | ||
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. Last make command will build you kernel modules. | 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. Last make command will build you kernel modules. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:Kernel]] | [[Category:Kernel]] |
Revision as of 19:48, 28 October 2011
Kernel will not be binary compatible with one that comes with firmware, meaning you'll need to rebuild all modules too, unless exact same toolchain and source code is used. See "Firmware Compatibility" section. |
Contents
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, 2009q1-203 version is recommended (click "all versions" in above page), as 2007q3 doesn't work with kernels above 2.6.29, and 2008q1-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:
cd pandora-kernel/
Then:
git checkout --track -b pandora-27-omap1 origin/pandora-27-omap1
Firmware Compatibility
The firmware kernel is built using OE (openembedded), so the only sure way to get binary compatibility is to use that (see Firmware_build_instructions).
The manual procedure to do the same without using OE would be:
- Get DJWillis' toolchain (it is the same as one built by OE).
- Apply the patches listed in recipes/linux/omap-pandora-kernel_2.6.27-pandora.bb from the git repository at git://git.openpandora.org/openpandora.oe.git on the kernel tree. musb-rxtx.patch may not apply cleanly unless you remove the junk at the end and fix the context for musbhsdma.c
- Copy the defconfig file from above patches location to .config
- Set up environment as described in "Building" section and build (make/make uImage).
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-2009q1/bin
You also need to have CROSS_COMPILE set:
export CROSS_COMPILE=arm-none-linux-gnueabi-
Newer kernels (2.6.3x+) need ARCH set to arm:
export ARCH=arm
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
make
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. Last make command will build you kernel modules.