红联Linux门户
Linux帮助

在CentOS3_linux上编译能在ML401上运行的uClinux内核

发布时间:2006-12-08 01:03:20来源:红联作者:pinkfirex
在此之前需要下载CentOS3_linux。

1、 从auto-config.in获得硬件系统信息

(1)把在EDK下生成的包含硬件系统信息的“auto-config.in”文件复制到CentOS3_linux的/home/devel/src\uClinux-2.4.x\arch\microblaze\platform\uclinux-auto路径下。编译器需要从auto-config.in文件里知道“the address map and the processor system”以及其它相关信息。

(2)转换auto-config.in文件为unix格式

这里,需要将auto-config.in文件转换成unix格式。用命令:dos2unix auto-config.in auto-config.in就可以完成转换。

2、 配置内核和应用程序

执行命令:

$ cd ~/uClinux-dist

$ make menuconfig

(1)初始设置

Choose ‘Vendor/Product Selection’ (Press Enter)

Move down to ‘Vendor’ selection, press Enter and choose Xilinx as the vendor from the list.

Move down to ‘Xilinx Products’, and choose the ‘uclinux-auto’ target, which will enable the tool to generate the library based on your hardware information in auto-config.in file.

Choose Exit and press Enter

Select ‘Kernel/Library/Defaults’ selection

Select ‘uClibc’ for Libc version

Select ‘Default all settings (lose changes)’ by pressing SPACE

Choose Exit and press Enter, this will return to the main menu

Choose Exit and press Enter again

Answer Yes to save your new kernel configuration

然后,会在文字界面下出现一些需要你选择的配置选项:

Menory model (RAM,ROM) [RAM] (NEM) 直接回车,默认选择RAM



FLASH size (AUTO,NONE,128K,1MB,2MB,4MB,6MB,8MB)[8MB](NEW) 直接回车,默认选择8MB

然后出现一系列形如[N/y/m?]的配置选项,都输入N,然后回车。



到此,我们已经设置好了初始设置。

(2)针对ML401配置内核

再一次执行:

$ cd ~/uClinux-dist

$ make menuconfig

然后按下面的提示配置:

elect ‘Kernel/Library/Defaults’ Selection and press Enter

Check both ‘Customize Kernel Settings’ and ‘Customize Vendor/User Settings’ by pressing SPACE

Choose Exit and press Enter

Choose Exit and press Enter again

Answer Yes to save your new kernel configuration

The tool will come back with Kernel configuration main menu

Select ‘Processor type and features’ and press Enter

Uncheck the ‘GPIO driver’, uncheck ‘Kernel cmdlind support’ and uncheck ‘Enable debug logging’ by pressing SPACE

Choose Exit and press Enter

Select ‘Memory Technology Devices (MTD)’ and press Enter

Select ‘Mapping drivers for chip access’ and press Enter

Uncheck ‘CFI Flash device mapped on Microblaze/mbvanilla (uClinux)’ by pressing SPACE

Choose Exit and press Enter

Choose Exit and press Enter again

Choose Exit and press Enter, and answer Yes to save your new kernel configuration

(3)配置软件

The tool will come back with application configuration main menu

Select ‘Network Applications’ and press Enter

Check ‘telnetd does not use openpty()’ by pressing SPACE

Choose Exit and press Enter

Select ‘Miscellanceous Application’ and press Enter

Check ‘dhrystone’ by pressing SPACE

Choose Exit and press Enter

Choose Exit and press Enter, and answer Yes to save your new kernel configuration

在这里,我们需要手工修改~/uClinux-dist/linux-2.4.x/.config文件。

执行命令:

$vi .config

然后找到CONFIG_MTD_UCLINUX,修改为:CONFIG_MTD_UCLINUX=y



3、 Making the image

执行:

$ cd ~/uClinux-dist 转到此路径

$ make dep 编译2。4内核的必须步骤

$ make clean 清楚旧的遗留文件

$ make 编译内核



这个过程会需要约15分钟,在此期间将完成下面的内容:

编译内核 Build kernel (uClinux-dist/linux-2.4.x)
编译uclinux的C库 Build C libraries (uClinux-dist/uClibc)
编译用户程序 Build user applications (uClinux-dist/user)
转换成二进制文件 Convert to flat binary format
编译内核文件系统 Build local image of the root file system (uClinux-dist/romfs)
合并内核和文件系统为一个二进制文件 Merge the kernel and file system to a single image (uClinux-dist/images)



整个编译完成后在image文件夹下面会有image.elf和image.bin两个文件。这个ELF文件包含有调试信息在里面所以它会比BIN文件大很多。在这里我们只需要下载BIN文件到ML401上即可。
文章评论

共有 1 条评论

  1. kobelai 于 2007-08-09 12:19:50发表:

    不好意思想??你最後有移植成功?...因?我?造出?的IMAGE.BIN...都一直不能用...在RS232上面都?反?...所以想??你有移植成功?

    方便加MSN一起??? KOBELAI15@HOTMAIL.COM