- 论坛徽章:
- 0
|
Before
starting to compile kernel, please read the doc carefully[color="#000000"]。
[color="#000000"]http://www.arm.linux.org.uk/docs/kerncomp.php
1. Get kernel package
From
[color="#0000ff"]http://www.kernel.org
download source package and patch(option)
linux-2.6.21.tar.bz2
copy
lnux-2.6.21.tar.bz2 and path-2.6.21.bz2 into $HOME(from kerncomp.php
doc I know it is better putting kernel into $HOME).
After unpacking
linux-2.6.21.tar.bz2, Change into the newly created
directory(linux-2.6.21) and apply the patch files, eg:
bash$ cd linux-2.6.21
bash$ cp ~/patch-2.6.21.bz2
.
bash$ bzip2 -dc
patch-2.6.21.bz2 | patch -p1 --dry-run
bash$ bzip2 -dc
patch-2.6.21.bz2 | patch -p1
** For
this version kernel it's not necessary to path, since the kernel
source code contains the path context.
Normally, the
kernel build system will build the kernel for the native machine
architecture. This is not appropriate when cross compiling, so you
will need to change two lines in the top level kernel Makefile.
Examine the top level Makefile in an editor and find the
definitions for ARCH and CROSS_COMPILE.
on
2.6.x kernels:
ARCH ?= $(SUBARCH)
[color="#000000"]CROSS_COMPILE ?=
Edit these two lines to read:
ARCH ?= arm
[color="#000000"]CROSS_COMPILE ?= /usr/local/bin/arm-linux-
replacing
/usr/local/bin/arm-linux- with the path to your ARM Linux
toolchain. For me it's
/home/cknr34/develops/arm-linux-tools-20061213/bin/arm-linux-
This completes the
configuration of the top level kernel makefile. The next step is to
configure the kernel build to select the drivers that your platform
requires.
You may like to read
linux/README
and
linux/Documentation/arm/README
before proceeding. Both these files provide further useful
information which may be specific to your kernel version.
2. configure
kernel
There
are many default configure files in /usr/src/linux/arch/arm/configs .
It's a good way for us choosing a similar configure file to modify
for our develop board.
Tips:
lubbock_defconfig is for ARM/XScale PXA25X ; mainstone_defconfig is
for ARM/XScale PXA27X
Configuration
of 2.6 kernels
For
2.6 kernels, the process is similar. Use [color="#000000"]_defconfig
to select the machine, eg:
[color="#000000"] bash$ make netwinder_defconfig
In
this case, there is no need to run a separate [color="#000000"]oldconfig
step.
For
me, I compile PXA27X main board use the following command, eg:
[s3sdf@power
linux-2.6.21]$ make mainstone_defconfig
It
will create .config file in linux-2.6.21 directory.
3. Compile
kernel source
If
you are only installing the kernel source tree for other programs,
then you have finished. If you want to compile up a new kernel, type
the following commands:
bash$ make clean
bash$ make #full build
bash$ make zImage
[color="#000000"] bash$ make modules
The final two commands will
actually compile the kernel and the kernel modules.
I
am lucky that a file of zImage is created in
linux-2.6.21/arch/arm/boot directory. It's with 1179828 byte size.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/37775/showart_291536.html |
|