|
一直对嵌入式操作系统感兴趣,几个月前移植了uc/os-II,感觉不过瘾,去海淀中发二楼买了块44b0的开发板,板子不错,核心板4层,先赞一个^_^
板子带有bootloader,但是感觉u-boot功能强大,所以决心移植,下面说一下u-boot-1.1.4的注意事项:
1、我的nor flash是sst39vf1601,为了擦写方便,配置成32个sector,每个sector大小为64k,共2M大小,网上有的移植笔记配置成512个sector,但是每个sector还是64k,汗!!!执行显示flash命令flinfo(fl)的时候会导致系统崩溃。
2、移植网卡的时候,大多的44bx板都是rtl8019 我的是cs8900,注意地址偏移量,和baseaddr,我的8900接在ngcs3上,所以地址是0x06000000,至于是6000000还是6000300,其实都一样(个人感觉,因为都能ping通),但是执行ping以后,用md命令看网卡的id号是在6000000,所以我用的是6000000,还有,要用16bit。
3、环境变量要设置在flash(默认是eeprom)
4、cpu/s3c44b0/start.s中断向量表修改,网上有现成的,拿来就用没有问题
5、最重要的,也是我费时最长的就是入口地址的修改,lowlevel_int.S,配置bank,我网上的都不能发现我的cs8900,只能根据开发板光盘例程里的改了,才好的,这里不列出我的了,免的误导大家,只要看厂家给的例程就行了。
以上就是uboot的移植,网上资料不少,但没有没错的,我就算做个补充吧。
(原文件名:uboot.JPG)
接下来是uClinux的移植,网上文章一大片,但仔细一看其实都是差不多的,真正原创的很少,2.6以上要自己编写串口控制台的驱动,比较麻烦,所以先从2.4开始。我用的uClinux-dist-20040408.tar.gz和uClinux-20040408-ARMSYS.patch
一开始解压源码、打补丁什么的就不说了,太多了。我说一下关键的地方:
1、按照http://blog.21ic.com/user1/738/archives/2006/18153.html来基本没问题,但是找不到网卡。
2、网卡问题,我的8900要自己添加驱动cs8900a。c放到driver/net文件夹,修改ne.c中ne2000的基址为自己的0x6000000 。make menuconfig的时候选网络设备的时候要选三项 cs8900 ne2000 16bit
修改后,cs8900正常工作
(原文件名:cs8900.JPG)
(原文件名:ping.JPG)
3、Sash command shell 功能太弱,换busybox,Busybox中集成进去的Shell有以下几个。
①Lash:很小,加起来有10k,非常适合执行命令,支持管道和重定向,但不支持Bourne Shell语法,无法解释脚本。
②Hush:也非常小, 18k左右,支持Bourne Shell语法,能够很好地处理if/then/else/fi结构语句,但是处理不了像for/do/done或者case/esac等循环语 句。
③Msh:加起来有30k左右,能够处理for/do/done、case/esac等循环语句。只要是Bourne shell能够做的,Msh一般都能做到,它的语法与Bourne Shell语法可能不完全相同,但大多数Bourne Shell语法都能被Msh解释。Msh是用vfork来创建新进程的,所以适于uClinux操作系统。
④Ash:在默认配置下大约有60k左右,是Busybox里最完整的Shell,但无法在uClinux 上编译通过。
综上所述,Busybox里的Msh是目前uClinux下最好的Shell。
(原文件名:uClinux(busybox).jpg)
最后的运行过程
Welcome To XW World!
U-Boot 1.1.4 (Apr 24 2008 - 17:54:43)
U-Boot code: 0C700000 -> 0C71A1E8 BSS: -> 0C71E33C
RAM Configuration:
Bank #0: 0c000000 8 MB
NOR Flash: 2 MB
In: serial
Out: serial
Err: serial
CS8900 Ethernet chip ID:630E
Hit any key to stop autoboot: 0
## Booting image at 00040000 ...
Image Name: XW-uClinux-2.4.24-uc0
Created: 2008-04-27 14:18:38 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1063372 Bytes = 1 MB
Load Address: 0c300000
Entry Point: 0c300040
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux........................................................................ done, booting the kernel.
Linux version 2.4.24-uc0 (root@localhost) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #33 日 4月 27 22:15:28 CST 2008
Processor: Samsung S3C44B0X revision 0
Architecture: S3C44B0X
On node 0 totalpages: 2048
zone(0): 0 pages.
zone(1): 2048 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/ram0 console=ttyS0,115200
Console: colour dummy device 80x30
Calibrating delay loop... 23.85 BogoMIPS
Memory: 8MB = 8MB total
Memory: 5700KB available (2049K code, 243K data, 60K init)
Dentry cache hash table entries: 1024 (order: 1, 8192 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 2048 (order: 1, 8192 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
NTFS driver v1.1.22 [Flags: R/O]
LCD buffer : 0c2d0000
fbcon_setup: No support for fontwidth 8
fbcon_setup: type 0 (aux 0, depth 0) not supported
Console: switching to colour frame buffer device 80x30
pty: 256 Unix98 ptys configured
Samsung S3C44B0X UART driver version 0.1 <thomas.eschenbacher@sympat.de>
ttyS0 (irq = 3) is a builtin Samsung S3C44B0X UART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: C12F958-C217557 [VIRTUAL C12F958-C217557] (RO)
RAMDISK driver initialized: 16 RAM disks of 1024K size 1024 blocksize
eth0: cs8900 rev K(3.3 Volts) found at 0x6000000
cs89x0 media RJ-45, IRQ 23
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 60K
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
For further information check:
http://www.uclinux.org/
XW_powered <genuinetata@163.com>
BusyBox v0.60.5 (2008.04.27-14:13+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
# ls -F
bin/ dev/ etc/ home/ lib/ mnt/ proc/ sbin@ tmp@ usr/ var/
#
以上是本人最近学习linux的心得,希望老鸟多加指点,给咱们想学嵌入式的人一些帮助 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。
|