[原创]在ubuntu7.10上搭建uClinux编译开发环境并用Skyeye进行仿真

内核编译和嵌入式产品的设计与开发
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

[原创]在ubuntu7.10上搭建uClinux编译开发环境并用Skyeye进行仿真

#1

帖子 wenwu » 2007-11-11 16:42

本文完全原创,转载请注明出处
--by wenwu
首先感谢http://hi.baidu.com/zkheartboy/blog/item/a73927ad3629c9094a36d6f1.html上提供的方法,我在写这篇文章的时候参考了作者的一些方法。
下面的所有操作,在 ubuntu7.10下全部调试通过。
但仅供参考!
我在写的时候,将shell命令完整部分都粘贴了下来,希望你能看清我在操作时的一些路径,这个很重要。
另外,我也是新手~
我写出来,一是希望能帮助其他像我一样的新手,二是希望自己能够从中学到更多的东西。也希望有更多的人能将自己的经历写下来,共同交流!
一、搭建开发环境
在www.uclinux.org上下载以下两个包:
交叉开发工具:arm-elf-tools-20040427.sh
uClinux的源码包:uClinux-dist-20040408.tar.gz
好像现在arm-elf-tools-20040427.sh不太好下,你也可以下载arm-elf-tools-20030314.sh
安装交叉开发工具:进入arm-elf-tools-20040427.sh所在的目录,执行以下命令进行安装:

代码: 全选

$sudo chmod +x arm-elf-tools-20040427.sh
$sudo ./arm-elf-tools-20040427.sh
这两条命令首先是加可执行权限,然后安装。
解压uClinux源码包:
用以下命令:

代码: 全选

$tar zxvf uClinux-dist-20040408.tar.gz
二、下载Skyeye 以便进行仿真:

SkyEye是开源软件的一个项目,SkyEye的目标是在Linux和Windows操作系统里提供一个完全的仿真环境。SkyEye仿真环境相当于一个嵌入式计算机系统,你可以在SkyEye里运行一些嵌入式Linux操作系统,如ARMLinux,uClinux,uc/OS-II(ucos-ii)等,并能分析和调试它们的源代码。
如果你想知道关于SkyEye和嵌入式系统更详细的信息,请访问下面的站点:
www.SkyEye.org
http://www.skyeye.org/index_cn.html

安装SkyEye
网上介绍了很多安装方法,其实在ubuntu里面安装最方便:

代码: 全选

wenwu@wenwu-desktop:~$ sudo apt-get install skyeye
这样,一个最新版的skyeye1.2.3就安装好了。
在shell 里面直接键入skyeye后看到如下说明:

代码: 全选

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

big_endian is false.
Failed to open skyeye config file skyeye.conf in the same directory
error: No such file or directory
------------------------- SkyEye -V1.2 ---------------------------
Usage: SkyEye [options] -e program [program args]
Default mode is STANDALONE mode
------------------------------------------------------------------
Options:
-e exec-file        the (ELF executable format)kernel file name.
-l load_address,load_address_mask
                    Load ELF file to another address, not its entry.
-b                  specify the data type is big endian when non "-e" option.
-d                  in GDB Server mode (can be connected by GDB).
-c config-file      the skyeye configure file name.
-h                  The SkyEye command options, and ARCHs and CPUs simulated.
------------------------------------------------------------------
----------- Architectures and CPUs simulated by SkyEye-------------
-------- ARM architectures ---------
at91 
lpc 
s3c4510b 
s3c44b0x 
s3c44b0 
s3c3410x 
ep7312 
lh79520 
ep9312 
cs89712 
sa1100 
pxa_lubbock 
pxa_mainstone 
at91rm92 
s3c2410x 
s3c2440 
sharp_lh7a400 
ns9750 
lpc2210 
ps7500 
integrator 
-------- BlackFin architectures ----
bf533 
表明你的skyeye 已经安装好了,可以随时使用了。
当然,如果你的源里面没有 skyeye,就尝试从下面的方法安装:
首先下载skyeye:
下载地址:http://gro.clinux.org/projects/skyeye/
在这个网址里面有如下两个版本,我建议用1.2.2版本的,1.2.3版本的在安装时往往存在一些问题
skyeye_1_2_2_Rel.tar.bz2
skyeye_1_2_3_Rel.tar.bz2


因为在安装skyeye 时会用到一些别的包,所以在新立得软件包管理器中找到下面的软件包:binutils-dev 标记并安装
下面是关于这个软件包的描述
The GNU binary utilities (BFD development files)
This package includes header files and static libraries necessary to build
programs which use the GNU BFD library, which is part of binutils. Note
that building Debian packages which depend on the shared libbfd is Not
Allowed.

最后使用make命令进行软件的安装,编译完毕后会在binary生成一个skyeye可执行文件,该文件就是skyeye模拟器了。
使用make命令的时候可以加入一些选项参数,例如:
不允许DBCT
$make NO_DBCT=1
不支持LCD
$make NO_LCD=1
不支持BFD库
$make NO_BFD=1
不支持网络设备
$make NO_NET=1
如果在binary目录下生成了skyeye文件,那么安装成功。

为了可以在shell 里面直接运用skyeye命令,将这个路径/source/skyeye_1_2_2_Rel/binary 加入到系统环境变量中

代码: 全选

$gedit /etc/environment
找到有PATH那一行,加入skyeye 路径,比如下面所示
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/slickedit/bin:/source/skyeye_1_2_2_Rel/binary"
重启系统后生效
但我一再提示你,如果你的ubuntu源里面有skyeye,就不要再进行上面那些繁琐的步骤,一条命令apt-get install skyeye就搞定!

三、测试arm-elf-tool 的工作情况
建立一个源文件键入以下代码:

代码: 全选

/*test.c*/
#include <stdio.h>

int main()
{
        int i;
        for(i=0;i<6;i++)
        {
                printf("i=%d\n",i);
                printf("Hello,embedded linux!\n");
        }
        return 0;
}
用以下命令进行编译:

代码: 全选

wenwu@wenwu-desktop:/source/work/test$ arm-elf-gcc -Wl,-elf2flt -o test test.c
wenwu@wenwu-desktop:/source/work/test$ ls
test  test.c  test.gdb
可以看到编译输出两个文件:test和test.gdb,表示编译成功
其中-elf2flt参数是将elf文件格式转为flat文件格式,这个工具是在你安装交叉编译器产生的.
也可以写一个makefile测试,下面是我写的一个,仅供参考:

代码: 全选

#begin
CC=arm-elf-gcc

LDFLAGS=-Wl,-elf2flt

LIBS=
OBJS=test.o

all:test

hello:$(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o hello $(OBJS)
	
clean:
	rm -rf *.o *.elf *.gdb test
	
#end
执行make 命令后编译成功,最后也生成了test文件,我们来看一下这个test文件

代码: 全选

wenwu@wenwu-desktop:/source/work/test$ file test
test: BFLT executable - version 4 ram
可以看到生成的文件格式为BFLT格式,这是目标平台所支持的格式,所以当你试图:./test时,系统会提示:

代码: 全选

wenwu@wenwu-desktop:/source/work/test$ ./test
bash: ./test:无法执行二进制文件
我们也可以用下面的命令进行编译生成汇编代码

代码: 全选

wenwu@wenwu-desktop:/source/work/test$ arm-elf-gcc -S -o test.S test.c
wenwu@wenwu-desktop:/source/work/test$ file test.S
test.S: ASCII assembler program text
用文本编辑器打开这个文件test.S,就可以看到熟悉的ARM 汇编代码了。

四、测试这个程序:

测试这个程序需要用到一个工具skyeye-testsuits,可以在下面的网址下载:
http://gro.clinux.org/projects/skyeye/
网址里面有testsuite2.1.tar.bz2 但是在这里我们直接下载1.2.0版的二进制的工具包,skyeye-binary-testutils-1.2.0.tar.bz2
下载后解压

代码: 全选

wenwu@wenwu-desktop:/source$ tar jxvf skyeye-binary-testutils-1.2.0.tar.bz2 
进入下面这个目录,这是我们主要用到的目录。

代码: 全选

wenwu@wenwu-desktop:/source$ ls skyeye-binary-testutils-1.2.0/at91x40/uclinux2
boot.rom  linux  readme  skyeye.conf
这个目录里面有四个文件,其中linux就是内核映像,boot.rom是要写到Flash里面去的。里面包含文件系统。skyeye.conf是配置文件。
可以在命令行里键入以下代码,

代码: 全选

skyeye -e linux
你看到了什么?没错,我没有骗你

代码: 全选

          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|
当你看到这幅图片的时候,是不是感觉很爽?呵呵,我也是。

刚才我们不是写了一个代码吗?下面我们就看看怎么运行我们的程序:
首先在skyeye-binary-testutils-1.2.0/at91x40/uclinux2这个目录里面建立一个文件夹:romfs
这个目录主要用来存放用户程序,就是最后你写的程序也要拷到这个目录里面。

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ mkdir romfs
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls
boot.rom  linux  readme  romfs  skyeye.conf
但是我们必须把系统已有的文件系统里面的程序也拷出来,也就是把boot.rom本身所有的程序也要拷到romfs这个文件夹里面,所以首先要进行一次挂载,所以进入/mnt目录,建立一个临时文件夹tmp,如下所示

代码: 全选

wenwu@wenwu-desktop:/mnt$ ls
wenwu@wenwu-desktop:/mnt$ sudo mkdir tmp
wenwu@wenwu-desktop:/mnt$ ls
tmp
用 mount -o loop src dst命令进行挂载,如下所示:

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo mount -o loop boot.rom /mnt/tmp/
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls /mnt/tmp/
bin  dev  etc  home  lib  mnt  proc  sbin  tmp  usr  var
然后把这里面的所有文件拷贝到我们刚才所建的那个我们自己的文件夹romfs里面

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo cp -r /mnt/tmp/* ./romfs/
这时,我们自己的文件夹里面有以下内容:

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls romfs/
bin  dev  etc  home  lib  mnt  proc  sbin  tmp  usr  var
将我们刚才生成的一个测试程序test也拷贝过来到romfs/bin目录时面:

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo cp /source/work/test/test romfs/bin/
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls romfs/bin/
boa      dhcpcd  ftp   gdbserver  inetd  login  ping    route  telnet   test
busybox  expand  ftpd  ifconfig   init   mount  reboot  sh     telnetd  umount
用genromfs这个工具重新制作文件系统

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo genromfs -f boot.rom -d ./romfs/
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls -l boot.rom 
-rw-r--r-- 1 wenwu wenwu 1561600 2007-11-11 14:03 boot.rom
好了,下面我们再运行skyeye进行仿真,键入:skyeye -e linux

代码: 全选

wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ skyeye -e linux 
big_endian is false.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0 
mach info: name at91, mach_init addr 0x8057550
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
can't find device module: (name:net, type:(null))
log_info: log is off.
log_info:log file is /tmp/test.log, fd is 0x80f9318
log_info: log start clock 3200000
log_info: log end clock 3330000
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM   ./boot.rom
start addr is set to 0x01000000 by exec file.
Linux version 2.4.20-uc0 (chy@localhost.localdomain) (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/)) #7 �� 8�� 1 19:43:07 CST 2003
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 12.97 BogoMIPS
Memory: 4MB = 4MB total
Memory: 2984KB available (833K code, 181K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 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: 1024 (order: 0, 4096 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
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 1400000-157D3FF [VIRTUAL 1400000-157D3FF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
SkyEye NE2k Ethernet driver version 0.2 (2003-04-27) 
sene2k dev name: eth0: <6>NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
sys_mount:dev_name /dev/root,dir_name /root, type ext2, flag 0x8001, data 0
 sys_mount:1 data_page 1122000, type_page 113bf74, dev_page 0, dir_page 8001
sys_mount:2 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:3 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:4 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:dev_name /dev/root,dir_name /root, type romfs, flag 0x8001, data 0
 sys_mount:1 data_page 0, type_page 117f000, dev_page 117d000, dir_page 8001
sys_mount:2 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:3 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
sys_mount:4 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000
VFS: Mounted root (romfs filesystem) readonly.
sys_mount:dev_name .,dir_name /, type <NULL>, flag 0x2000, data 0
 sys_mount:1 data_page 111c120, type_page 0, dev_page 10e5d00, dir_page 10e5174
sys_mount:2 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000
sys_mount:3 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000
sys_mount:4 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
sys_mount:dev_name /proc,dir_name /proc, type proc, flag 0xc0ed0000, data 11d0008
 sys_mount:1 data_page 1000, type_page 1002, dev_page 118a008, dir_page c0ed0000
sys_mount:2 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000
sys_mount:3 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000
sys_mount:4 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000
mount: /etc/mtab: Read-only file system
Command: mount -t ext2 /dev/ram0 /var
sys_mount:dev_name /dev/ram0,dir_name /var, type ext2, flag 0xc0ed0000, data 11d0008
 sys_mount:1 data_page 111c260, type_page 119fe40, dev_page 0, dir_page c0ed0000
sys_mount:2 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000
sys_mount:3 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000
sys_mount:4 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000
mount: /etc/mtab: Read-only file system
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
Welcome to
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/

Command: /bin/ifconfig eth0 up 10.0.0.2
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> 
在这里面进行以下操作:

代码: 全选

/> cd bin
/bin> ./test
i=0
Hello,embedded linux!
i=1
Hello,embedded linux!
i=2
Hello,embedded linux!
i=3
Hello,embedded linux!
i=4
Hello,embedded linux!
i=5
Hello,embedded linux!
/bin> 
看到程序在运行了吗?

五、编译我们的uClinux内核

首先解压

代码: 全选

tar zxvf uClinux-dist-20040408.tar.gz
这是在你解压的目录里面会生成一个 uClinux-dist目录
shell 中进 uClinux-dist目录,执行make menuconfig进行配置,我猜你遇到了和我一样的问题:

代码: 全选

wenwu@wenwu-desktop:/source/uClinux-dist$ make menuconfig
config/mkconfig > config.in
make -C /source/uClinux-dist/config/scripts/lxdialog all
make[1]: Entering directory `/source/uClinux-dist/config/scripts/lxdialog'
/usr/bin/ld: cannot find -lncurses
collect2: ld 返回 1
-e 
>> Unable to find the Ncurses libraries.
>>
>> You must have Ncurses installed in order
>> to use 'make menuconfig'

make[1]: *** [ncurses] 错误 1
make[1]: Leaving directory `/source/uClinux-dist/config/scripts/lxdialog'
make: *** [menuconfig] 错误 2
wenwu@wenwu-desktop:/source/uClinux-dist$ 
其实是没有安装ncurses开发包,安装就是了
在新立得软件管理器中找到libncurses5-dev,安装
用的朋友喜欢用make xconfig,直接运行会出现如下错误:

代码: 全选

wenwu@wenwu-desktop:/source/uClinux-dist$ sudo make xconfig
config/mkconfig > config.in
make -C /source/uClinux-dist/config/scripts tkparse
make[1]: Entering directory `/source/uClinux-dist/config/scripts'
make[1]: “tkparse”是最新的。
make[1]: Leaving directory `/source/uClinux-dist/config/scripts'
ARCH=dummy /source/uClinux-dist/config/scripts/tkparse < config.in > config.tmp
cat /source/uClinux-dist/config/scripts/header.tk >> ./config.tk
cat config.tmp >> config.tk
rm -f config.tmp
echo "set defaults \"/dev/null\"" >> config.tk
echo "set help_file \"config/Configure.help\"" >> config.tk
cat /source/uClinux-dist/config/scripts/tail.tk >> config.tk
chmod 755 config.tk
make: wish:命令未找到
make: *** [xconfig] 错误 127
解决办法是在新立得软件包管理器中找到以下几项并安装,然后再运行make xconfig就可以看到图形界面了。
tcl8.4
tcl8.4-dev
tk8.4
k8.4-dev

然后再进行配置:在下面这个选项里面选择GDB ARMulator,怎么选择应该不用再说了吧?

代码: 全选

  --- Select the Vendor you wish to target  
	(GDB) Vendor
 --- Select the Product you wish to target 
 	 (ARMulator) GDB Products   
Kernel选择2.4内核,Libc Version选择uC-libc

代码: 全选

(linux-2.4.x) Kernel Version  
  (uC-libc) Libc Version          
[ ] Default all settings (lose changes) 
[ ] Customize Kernel Settings         
[ ] Customize Vendor/User Settings 
[ ] Update Default Vendor Settings   
退出它会提示:

代码: 全选

   Do you wish to save your new kernel configuration? 
                   < Yes >      <  No  >                            
选择Yes
这个时候就可以进行编译了,编译首先用make dep
然后用make
很不幸,我们的错误总是不断存在!

代码: 全选

arm/clone.S: Assembler messages:
arm/clone.S:34: Error: undefined symbol `EINVAL' in operation
make[3]: *** [arm/clone.o] 错误 1
make[3]: Leaving directory `/source/uClinux-dist/lib/libc/sysdeps'
make[2]: *** [subdirs] 错误 1
make[2]: Leaving directory `/source/uClinux-dist/lib/libc'
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/source/uClinux-dist/lib'
make: *** [subdirs] 错误 1
但有时候,就是因为这些错误使我们不断前行。
其实很多人都遇到了这个错误 ,是上面的库文件选择错了,什么?错了你还写在上面?我是想让你有更深的记忆!
make clean把上次编译过程生成的中间文件删除
然后make menuconfig
这次,我们把Libc Version换成uClibc

代码: 全选

(uClibc) Libc Version

再重复上面的步骤:

代码: 全选

make dep
make
这个编译过程比较长,耐心等待。
编译成功后会在uClinux-dist目录里面生成一个images目录,这个目录里面有四个文件:
image.bin:这是包含内核映像和 romfs文件系统映像,可以写到Flash中的文件,
linux.data:包括内核所有的数据段
linux.text:包括内核所有的代码段
romfs.img:文件系统
另外在uClinux-dist/linux-2.4.x目录里面生成了两个文件:linux和system.map
linux:linux内核文件
system.map:内核符号表

然后在uClinux-dist目录里面建一个skyeye.conf文件,并键入以下配置文件

代码: 全选

#skyeye config file sample
cpu: arm7tdmi

mach: at91

mem_bank: map=M, type=RW, addr=0x00000000, size=0x00004000
mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000
mem_bank: map=M, type=R,  addr=0x01400000, size=0x00400000, file=./boot.rom
mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000
mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000
mem_bank: map=M, type=RW, addr=0x04000000, size=0x00400000
mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000
注意这个配置文件中需要boot.rom 文件系统,但是我们并没有生成boot.rom文件系统,怎么办?
ln -s images/romfs.img boot.rom

代码: 全选

wenwu@wenwu-desktop:/source/uClinux-dist$ ln -s images/romfs.img boot.rom
这是就可以在uClinux-dist 目录里面看到boot.rom这个文件
下面就可以用skyeye运行我们自己编译出来的内核了。

代码: 全选

wenwu@wenwu-desktop:/source/uClinux-dist$ skyeye -e linux-2.4.x/linux 
big_endian is false.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0 
mach info: name at91, mach_init addr 0x8057550
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM   ./boot.rom
start addr is set to 0x01000000 by exec file.
Linux version 2.4.24-uc0 (wenwu@wenwu-desktop) (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/)) #2 2007年 11月 11日 星期日 16:21:16 CST
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 15.82 BogoMIPS
Memory: 4MB = 4MB total
Memory: 2968KB available (850K code, 180K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 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: 1024 (order: 0, 4096 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
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 1400000-14AC3FF [VIRTUAL 1400000-14AC3FF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: cat /etc/motd
Welcome to
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/

Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> 
相信到这里整个uClinux 开发环境的拱建以及在skyeye上的运行方法都已经很清楚了。
上次由 wenwu 在 2007-11-11 20:24,总共编辑 2 次。
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

#2

帖子 wenwu » 2007-11-11 17:03

本人也是初学,如果存在问题,请多多指教。
头像
wyg1258
帖子: 654
注册时间: 2006-09-12 19:44
来自: whu

#3

帖子 wyg1258 » 2007-11-11 19:34

值得参考~~谢谢
linux 学习记录 你的 我的 大家的

http://wyg1258.cublog.cn
hulllo
帖子: 11
注册时间: 2007-05-20 14:07

#4

帖子 hulllo » 2007-11-12 2:54

我运行make menuconfig或者make xconfig的时候出现这个错误是什么原因啊?
望高手能替我解惑。谢谢

代码: 全选

pansqoo@pansqoo-desktop:~/uClinux-dist$ make xconfig
config/mkconfig > config.in
make -C /home/pansqoo/uClinux-dist/config/scripts tkparse
make[1]: Entering directory `/home/pansqoo/uClinux-dist/config/scripts'
unset GCC_EXEC_PREFIX; gcc -o tkparse tkparse.o tkcond.o tkgen.o
tkparse.o: file not recognized: File format not recognized
collect2: ld 返回 1
make[1]: *** [tkparse] 错误 1
make[1]: Leaving directory `/home/pansqoo/uClinux-dist/config/scripts'
make: *** [config.tk] 错误 2
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

#5

帖子 wenwu » 2007-11-12 8:52

用下面办法试试:
进入/home/pansqoo/uClinux-dist/config/scripts这个目录,
先make clean,如果不能清除这几个.o文件,就手动清除。
然后make tkparse
你必须保证你的系统里安装了
tcl8.4
tcl8.4-dev
tk8.4
k8.4-dev
这几项,从新立得软件包管理器中可以找到。

然后再在/home/pansqoo/uClinux-dist/这个目录里make xconfig试试。
我建议用make menuconfig
hulllo
帖子: 11
注册时间: 2007-05-20 14:07

#6

帖子 hulllo » 2007-11-12 11:11

感谢搂主的回答。
按照的你的方法在make tkparse时出现错误:

代码: 全选

pansqoo@pansqoo-desktop:~/uClinux-dist/config/scripts$ make tkparse
c -o tkparse.o tkparse.c
make: c:命令未找到
make: [tkparse.o] 错误 127 (忽略)
c -o tkcond.o tkcond.c
make: c:命令未找到
make: [tkcond.o] 错误 127 (忽略)
c -o tkgen.o tkgen.c
make: c:命令未找到
make: [tkgen.o] 错误 127 (忽略)
o tkparse tkparse.o tkcond.o tkgen.o
make: o:命令未找到
make: [tkparse] 错误 127 (忽略)
tcl8.4
tcl8.4-dev
tk8.4
k8.4-dev这些我已经装了。
运行make menuconfig 仍然出现同样的错误。怎么回事阿。麻烦楼主了
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

#7

帖子 wenwu » 2007-11-12 11:48

你的arm-elf-tool是怎么安装的?
是用了.sh的安装包安装的还是用的直接下载的二进制文件?
命令行下键入arm-elf-
然后按tab键是否出现下图所示?

如果不能出现,表明交叉编译工具安装有问题。
附件
uclinux2.jpg
hulllo
帖子: 11
注册时间: 2007-05-20 14:07

#8

帖子 hulllo » 2007-11-12 11:55

我是用实验书上的光盘上的arm-elf-tools。
那是个压缩包来的,我直接tar到了根目录下。
有出现哦。。。。

代码: 全选

pansqoo@pansqoo-desktop:~$ arm-elf-
arm-elf-addr2line   arm-elf-gasp        arm-elf-protoize
arm-elf-ar          arm-elf-gcc         arm-elf-ranlib
arm-elf-as          arm-elf-gdb         arm-elf-readelf
arm-elf-c++         arm-elf-ld          arm-elf-run
arm-elf-c++filt     arm-elf-ld.real     arm-elf-size
arm-elf-elf2flt     arm-elf-nm          arm-elf-strings
arm-elf-flthdr      arm-elf-objcopy     arm-elf-strip
arm-elf-g++         arm-elf-objdump     arm-elf-unprotoize
pansqoo@pansqoo-desktop:~$ arm-elf-
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

#9

帖子 wenwu » 2007-11-12 13:00

我觉得有可能就是这种安装方式存在的问题,直接解压需要设置环境变量等一系列操作。
我建议你用以下方法重新安装一下arm-elf-tools
从网上下载
arm-elf-tools-20040427.sh或arm-elf-tools-20030314.sh
然后把以前的暂时删除
然后sh arm-elf-tools-20040427.sh安装或./arm-elf-tools-20040427.sh安装。然后再试试行不行。
我没遇到过你这种问题
不过我在网上找了一下,你可以参照一下这篇文章。
http://sjtubme.bokee.com/1282894.html
hulllo
帖子: 11
注册时间: 2007-05-20 14:07

#10

帖子 hulllo » 2007-11-12 17:33

谢谢楼主,删除了旧版的arm-elf-tools。刚从官网下了arm-elf-tools-20030314.sh 安装后出现不同的问题

代码: 全选

root@pansqoo-desktop:/home/pansqoo/uClinux-dist# make menuconfig
config/mkconfig > config.in
make -C /home/pansqoo/uClinux-dist/config/scripts/lxdialog all
make[1]: Entering directory `/home/pansqoo/uClinux-dist/config/scripts/lxdialog'
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o checklist.o checklist.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o menubox.o menubox.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o textbox.o textbox.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o yesno.o yesno.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o inputbox.o inputbox.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o util.o util.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o lxdialog.o lxdialog.c
unset GCC_EXEC_PREFIX; gcc -DLOCALE  -DCURSES_LOC="<ncurses.h>" -c -o msgbox.o msgbox.c
unset GCC_EXEC_PREFIX; gcc -o lxdialog checklist.o menubox.o textbox.o yesno.o inputbox.o util.o lxdialog.o msgbox.o -lncurses
menubox.o: In function `dialog_menu':
menubox.c:(.text+0xbcc): undefined reference to `__ctype_b'
inputbox.o: In function `dialog_inputbox':
inputbox.c:(.text+0x731): undefined reference to `__ctype_b'
util.o: In function `first_alpha':
util.c:(.text+0xb1b): undefined reference to `__ctype_b'
collect2: ld 返回 1
make[1]: *** [lxdialog] 错误 1
make[1]: Leaving directory `/home/pansqoo/uClinux-dist/config/scripts/lxdialog'
make: *** [menuconfig] 错误 2
还有make tkparse时仍然出现相同的错误。。。。
哎,好多问题阿。
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

#11

帖子 wenwu » 2007-11-13 12:57

你这个问题看来不简单
不过很奇怪,如果用公司的板子,公司提供的开发套件应该是经过严格测试并可正常运行的。
头像
wth123456
帖子: 234
注册时间: 2006-12-07 17:32

#12

帖子 wth123456 » 2007-11-13 15:41

这个要留名学习了。
十年磨一剑,霜刃未曾试。今日把示君,谁有不平事?
xuwlhhui
帖子: 10
注册时间: 2007-10-04 12:43

我编译uclinux-disk-20070130不成功

#13

帖子 xuwlhhui » 2007-11-14 8:53

按照你的步骤编译的20070130里的2.4版没成功,出现一个错误,郁闷
头像
wenwu
帖子: 15
注册时间: 2006-12-20 14:52

Re: 我编译uclinux-disk-20070130不成功

#14

帖子 wenwu » 2007-11-14 12:14

xuwlhhui 写了:按照你的步骤编译的20070130里的2.4版没成功,出现一个错误,郁闷
我还没测试过20070130版的uClinux。
等你解决了把错误及解决办法发出来,一起分享~
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#15

帖子 eexpress » 2007-11-14 12:26

不错,鼓励。
:em52 :em50
● 鸣学
回复