Chinaunix首页 | 论坛 | 博客
  • 博客访问: 238410
  • 博文数量: 97
  • 博客积分: 1440
  • 博客等级: 上尉
  • 技术积分: 821
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-28 13:45
文章分类

全部博文(97)

文章存档

2011年(3)

2010年(4)

2009年(7)

2008年(2)

2007年(8)

2006年(73)

我的朋友

分类: LINUX

2006-12-25 22:04:27

some tips:

1. Under the ARM kernel tree, you will find a suffix to the kernel version number: -rmkN, or -vrsN where 'N' is the patch release number.  

2. Other maintainers, such as Nicolas Pitre, may produce additional patches, and these will add an additional suffix to denote their version. Nicolas Pitre's patches add a -np suffix, eg 2.4.21-rmk2-np1.

3. Some files may be named (eg) pre-patch-x.y.z-rmkN.gz. These are alpha or beta patches, which are probably unstable.

4. Some kernels are based on the Alan Cox series of kernels. These have names similar to patch-x.y.z-acm-rmkN.gz where x.y.z is Linus' version number and m is Alan's version number. In this case, you will need to obtain Alan Cox's corresponding patch from the kernel.org servers, in the directory /pub/linux/kernel/people/alan/linux-2.4/.

5. after unzip linux kernel, you need to patch the arm kernel:
bash$ cd linux-2.4.26
bash$ zcat ../patch-2.4.26-vrs1.gz | patch -p1

6. kernels later than 2.6.0-test2 do not require a -rmk or -vrs patch to be applied since ARM architecture support is already merged.

7. Configuration of the kernel build environment
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.4.x kernels, they will look like this:

ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)

[...]

CROSS_COMPILE   =

and on 2.6.x kernels:

ARCH            ?= $(SUBARCH)
CROSS_COMPILE   ?=

Edit these two lines to read:

ARCH		?= arm
CROSS_COMPILE	?= /usr/local/bin/arm-linux-

replacing /usr/local/bin/arm-linux- with the path to your ARM Linux toolchain.

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 and linux/Documentation/arm/README before proceeding. Both these files provide further useful information which may be specific to your kernel version.

8. Configuration of the kernel sources
Configuration of 2.4 kernels
For 2.4 kernels use _config format, for example:

  • a5k_config
  • ebsa110_config
  • netwinder_config
  • rpc_config
  • assabet_config

You should select one of these as the "basic" configuration as follows, and run make oldconfig immediately afterwards:

	bash$ make netwinder_config
	bash$ make oldconfig

The oldconfig step will prompt you for any new configuration options which may have been added since the default machine configuration file was submitted. It is normally safe to say 'N' to these new options.

Note: If you want to change the configuration via make xxx_config, please remove the file linux/.config immediately prior to executing this command.

Configuration of 2.6 kernels
For 2.6 kernels, the process is similar. Use _defconfig to select the machine, eg:

	bash$ make netwinder_defconfig

In this case, there is no need to run a separate oldconfig step.

9. Compiling the 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 dep
	bash$ make zImage
	bash$ make modules

The final two commands will actually compile the kernel and the kernel modules.

Note: With 2.6 kernels, the make dep stage is not necessary.

10. Installing the kernel
After the kernel has successfully compiled, you should have the kernel image, arch/arm/boot/zImage. What you do next depends if you are cross compiling or not.

11. Installing a native kernel
back the current kernel and modules
bash# cd /lib/modules
bash# mv 2.4.3-rmk1 2.4.3-rmk1.old
bash# cd /boot
bash# mv vmlinuz vmlinuz.bak
bash# mv System.map System.map.bak
bash#
install the new modules
bash# cd $HOME/linux
bash# make modules_install
bash#
install the new kernel
bash# cd /boot
bash# cat $HOME/linux/arch/arm/boot/zImage >vmlinuz
bash# cp $HOME/linux/System.map .
bash#
    Note that the command to copy the new kernel image is cat and is not the usual cp. Unix traditionally will not allocate space on the filesystem to sections of files containing zero data, but instead creates "holes" in the file. Some kernel loaders do not understand files with holes in, and therefore using cat in this way ensures that this does not happen.

12. running loadmap
bash# loadmap -v
bash#
to update the maps.

You have finished, and are now ready to reboot your machine and try out your new kernel!

13. installing a cross compiled kernel
Kernel modules are installed into the /lib/modules/x.y.z directory on the target system, though this will normally be a different directory on the host system. Where this directory is depends on your setup, but we will call it $TARGETDIR.

Install the modules into $TARGETDIR as follows:

	bash$ make modules_install INSTALL_MOD_PATH=$TARGETDIR
	bash$

This will place the modules into the $TARGETDIR/lib/modules/x.y.z directory on the host, which can then be placed into an suitable filesystem, or transferred to the target machine. Please also note that you must not install these kernel modules into the hosts root filesystem (eg by omitting INSTALL_MOD_PATH or giving $TARGETDIR as "/"), since they are incompatible with your host kernel and therefore may leave you with an unbootable host system.

The kernel will be available in $HOME/linux/arch/arm/boot/zImage and the kernel symbol information in $HOME/linux/System.map. Exactly how do install this is outside the scope of this document.

It is important that you keep the System.map file safe - it contains the symbolic information for this kernel, which will be required if you need to debug or report a problem.

 
阅读(1757) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~