1、Mini2440(128M )环境下面的操作环境见下表:目 录 说 明OS Redhat 企业版 5交叉编译工具 arm-linux-gcc 4.3.2Uboot获取 u-boot.tgz,将其拷贝至虚拟机的工作目录下。编译步骤如下:rootlocalhost jj# tar xzvf u-boot.tgzrootlocalhost jj# cd u-boot-2010.03/rootlocalhost u-boot-2010.03# make distcleanrootlocalhost u-boot-2010.03# make smdk2440a_configConfiguring for
2、 smdk2440a board.rootlocalhost u-boot-2010.03# make烧写首先,安装开发板的 USB 驱动,并将 USB 接口线与主机相连。同时,使用串口线连接开发板与主机。将开发板的启动模式选择为 nor,开发板上电后输出信息如下:# FriendlyARM BIOS 2.0 for 2440 #x format NAND FLASH for Linuxv Download vivi k Download linux kernel y Download root_yaffs image a Absolute User Applicationn Download
3、 Nboot for WinCE l Download WinCE boot-logow Download WinCE NK.bin d Download our IP address is 192.168.1.226Filename uImage.Load address: 0x30008000Loading: T #doneBytes transferred = 2517112 (266878 hex)最终烧写到 nand flash:u-bootSMDK2440A# nand erase 60000 500000NAND erase: device 0 offset 0x60000, s
4、ize 0x500000Erasing at 0x54000002800000 - 0% complete.OKu-bootSMDK2440A# nand write 0x30008000 60000 500000NAND write: device 0 offset 0x60000, size 0x500000Writing at 0x54000000020000 - 100% is complete. 5242880 bytes written: OK测试见根文件系统的测试一节。到此,内核成功烧写!根文件系统制作Busybox准备解压 busybox。rootlocalhost busyb
5、ox-1.2.0# tar xjvf busybox-1.2.0.tar.tar配置rootlocalhost busybox-1.2.0# make menuconfig(1) 编译 busybox 为静态链接库Busybox Settings - Build Options - *Build BusyBox as a static binary (no shared fibs)这一项将 BusyBox 编译为静态链接,可以减少启动时查找动态链接库的时间。* Do you want fo build BusyBox with:Cross Compiler?(arm-linux-) Cross
6、 Compiler prefix 指定交叉编译器(2)安装Busybox Settings - Installation Options -* Dont use /usr Applets links (as soft-links) (/home/alex/project/boot/mini2440/minifs)BusyBox installation prefix指定安装路径(3)选择 initInit Utilities -* init (5)选择 shellShells - Choose your default shell (ash) - (4)添加 tabShells - * msh
7、 * Command line editing * Tab completion (5)选择 ttyCoreutils - * tty(6)Login/Password Management Utilities -* getty 其他命令选项可选。编译rootlocalhost busybox-1.2.0# makerootlocalhost busybox-1.2.0# make install执行 make install 后,将编译生成安装在 /home/alex/jj/minifs 路径下。系统目录rootlocalhost minifs# mkdir dev etc home lib
8、 mnt proc sys tmp varinittab 文件rootlocalhost minifs# mkdir etc/init.d1)创建 inittab 文件rootlocalhost minifs# touch etc/inittab2)编辑 inittabvi etc/inittab编辑如下:# System initialization.:sysinit:/etc/init.d/rcS:sysinit:/bin/sh :ctrlaltdel:/sbin/reboot:shutdown:/bin/umount -a -r3)添加执行权限rootlocalhost etc# chm
9、od +x inittabrcS 文件1) 创建 rcS 文件rootlocalhost minifs# touch etc/init.d/rcS2)编辑 rcSvi etc/init.d/rcS编辑如下:#!/bin/shmount a3)添加执行权限rootlocalhost etc# chmod +x rcSfstab 文件1) 创建 fstab 文件rootlocalhost minifs# touch etc/fstab2) 编辑 fstab 文件vi etc/fstab编辑如下:none /proc proc defaults 0 0tmpfs /tmp tmpfs default
10、s 0 0设备文件创建设备文件节点。rootlocalhost minifs# cd dev/rootlocalhost dev# mknod ttySAC0 c 204 64rootlocalhost dev# ln s ttySAC0 consolerootlocalhost dev# mknod null c 1 3rootlocalhost dev# mknod mtdblock0 b 31 0rootlocalhost dev# mknod mtdblock1 b 31 1rootlocalhost dev# mknod mtdblock2 b 31 2库文件拷贝库文件,包括加载器、
11、动态库文件和静态库文件。rootlocalhost lib# cp /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/* ./ -arpYaffs 镜像最终,利用 mkyaffs2image-128M 工具完成 yaffs 镜像的制作:mkyaffs2image-128M minifs minifs.img烧写首先,在主机下开启 tftp 服务器,并将 yaffs 镜像文件拷贝到 tftp 工作目录下。然后,用网线将开发板与主机连接起来,将连接的主机网卡,ip 地址配置为:192.168.1.172启动开发板,配置其网路环境
12、参数如下:u-bootSMDK2440A# set serverip 192.168.1.172u-bootSMDK2440A# set ipaddr 192.168.1.226u-bootSMDK2440A# saveenv重新复位开发板,下载 uImage 镜像文件至内存:u-bootSMDK2440A# tftp 0x30008000 minifs.imgdm9000 i/o: 0x20000300, id: 0x90000a46 DM9000: running in 16 bit modeMAC: 08:08:11:18:12:27operating at 100M full dupl
13、ex modeUsing dm9000 deviceTFTP from server 192.168.1.172; our IP address is 192.168.1.226Filename minifs.img.Load address: 0x30008000Loading: T #T #doneBytes transferred = 5187072 (4f2600 hex)最终烧写到 nand flash:u-bootSMDK2440A# nand erase 0x560000 $filesizeNAND erase: device 0 offset 0x60000, size 0x5
14、00000Erasing at 0x54000002800000 - 0% complete.OKu-bootSMDK2440A# nand write.yaffs 0x30008000 0x560000 $filesizeNAND write: device 0 offset 0x560000, size 0x4f2600Skip the first good block 56000000020000Writing at 0xa4000000020000 - 100% is complete. 5029888 bytes written: OK测试开发板复位,正常启动串口输出如下:yaffs
15、_read_super: isCheckpointed 0VFS: Mounted root (yaffs filesystem) on device 31:3.Freeing init memory: 160Kinit started: BusyBox v1.2.0 (2010.09.16-15:52+0000) multi-call binaryStarting pid 671, console /dev/console: /etc/init.d/rcSStarting pid 675, console /dev/console: /bin/shBusyBox v1.2.0 (2010.09.16-15:52+0000) Built-in shell (ash)Enter help for a list of built-in commands.#