在IXP435上移植嵌入式Linux内核和根文件系统


简要介绍如何在IXP435上移植嵌入式Linux内核和根文件系统

1.       安装交叉编译工具

为什么要先安装交叉编译工具?由于我们的Linux操作系统是安装在嵌入式处理器平台上的,需要在主机上编译出开发板需要的程序,比如编译和生成适合在开发板上运行的Linux内核的镜像文件zImage。所以要首先安装交叉编译工具。

最原始最基本的交叉编译工具的安装过程是很复杂的,在《构建嵌入式LINUX系统》这本书中有很详细的介绍。

我使用的是集成开发工具buildroot。在buildroot中定制和调整软件包十分的方便,而且buildroot提供类似 Linux kernel配置采用的图形化的配置菜单,非常容易使用,从而也简化了交叉编译工具的安装过程。

下面简单介绍一下利用buildroot建立交叉编译工具过程。

首先从网站http://buildroot.uclibc.org/downloads/snapshots/ 下载最新的buildrootbuildroot-snapshot.tar.bz2并执行以下指令

$ tar jxvf buildroot-snapshot.tar.bz2 --解压文件

$ cd buildroot --进入目录

$ make menuconfig --配置相关选项

Target Architecture (armeb) --->                           

Target Architecture Variant (xscale) --->                   

         Target ABI (EABI) --->      

        Toolchain --->

                 [*] Build/install a shared libgcc? (NEW)

                   [*] Build/install c++ compiler and libstdc++?

注:在这里要配置处理器的架构(比如armebIntel IXP435属于arm架构),安装C++编译器和标准C++库等内容,其余选项根据自己的需要配置,这里就不详细说明。

$ make all --编译

为了验证该交叉编译工具是否可以正常工作,执行

$ gedit ~/.bashrc

最后一行加入

export PATH=$PATH:/home/shuaigexin/ixp435/buildroot/output/staging/usr/bin

保存退出后,执行命令

$ source ~/.bashrc

完成之后执行命令:

$ armeb-linux-gcc –version

如果安装成功即可检测到当前的交叉编译工具版本。

我的测试结果是:

armeb-linux-gcc (Buildroot 2010.08-rc1) 4.3.5

Copyright (C) 2008 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2.      移植Linux内核

首先从http://www.kernel.org中下载比较新版本的内核,比如linux-2.6.30.tar.bz2然后执行下列指令

$ tar jxvf linux-2.6.30.tar.bz2 --解压内核

$ cd linux-2.6.30 --进入目录

$ gedit Makefile --修改Makefile文件

找到ARCHCROSS_COMPILE,修改为

ARCH := arm

注:Intel IXP435处理器架构为arm

CROSS_COMPILE := /home/shuaigexin/ixp435/buildroot/output/staging/usr/bin/armeb-linux-

注:前面利用buildroot安装的交叉编译工具的绝对地址。

$ make menuconfig --配置内核

系统类型配置:

System Type ---> ARM system type ---> IXP4xx-based

System Type ---> Intel IXP4xx Implementation Options ---> KIXRP435

内核特征配置:

Kernel Features --->
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTA)

设备驱动配置:

Device Drivers --->

         <*> Memory Technology Device (MTD) support --->

                [*]   Debugging       

                   [*] MTD partitioning support                                    

           <*>   RedBoot partition table parsing

                   [*]     Direct char device access to MTD devices

                   [*]     Caching block device acess to MTD devices

                   RAM/ROM/Flash chip drivers --->

                            [*] Flash chip driver advanced configuration options

                            <*> Support for Intel/Sharp flash chips

                   Mapping drivers for chip access --->

                            [*] Support non-linear mappings of flash chips                  

                                <*> Flash device in physical memory map

                            <*> CFI Flash device mapped on Intel IXP4xx based systems

Device Drivers ---> Graphics support --->Console display driver support --->[ ] VGA text console (该项N掉)                    

根文件系统类型配置:

File systems ---> Miscellaneous filesystems (NEW) --->

<*> Journalling Flash File System v2 (JFFS2) support

[*] JFFS2 write-buffering support

<*> Compressed ROM file system support(cramfs)

注:在内核特征(Kernel Features)配置中,由于我安装的交叉编译工具链版本为4.3.5为,而用4.X.X版本的交叉编译器使用EABI,但内核默认是不支持EABI编译的,所以编译出的系统会报错Kernel panic - not syncing: Attempted to kill init!,但用3.X.X版本的编译器就不会出现这个问题。解决办法是,配置内核支持EABI编译

其余配置按需要选择,这里就不详细述及。

$ make zImage   --制作内核镜像文件

至此,嵌入式linux内核镜像文件zImage已经制作完成,www.bkjia.com可通过windows的超级终端或者linuxminicom下载到开发平台上测试移植的linux内核是否能够运行。

注:在Linux下,我向目标板传送内核和根文件系统的工具是tftp,怎样安装和配置tftp请看本人另一篇博客:

  • 1
  • 2
  • 3
  • 下一页

相关内容